@camstack/addon-auth 1.2.131 → 1.2.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{hub-browser-origin-BRU-HVqq.mjs → dist-DbaYwR-N.mjs} +1781 -66
- package/dist/{hub-browser-origin-CCWSbHYb.js → dist-DjCeMP9o.js} +1780 -71
- package/dist/hub-browser-origin-DohQUFPz.js +16 -0
- package/dist/hub-browser-origin-LBBO5r05.mjs +11 -0
- package/dist/magic-link/auth-magic-link.addon.js +13 -12
- package/dist/magic-link/auth-magic-link.addon.mjs +3 -2
- package/dist/oidc/auth-oidc.addon.js +158 -19
- package/dist/oidc/auth-oidc.addon.mjs +149 -10
- package/dist/webauthn/_stub.js +1 -1
- package/dist/webauthn/{_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-DjJfFQA5.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-Cy2WCjhX.mjs} +2 -2
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DBsbNmPW.mjs +26 -0
- package/dist/webauthn/auth-webauthn.addon.js +13 -12
- package/dist/webauthn/auth-webauthn.addon.mjs +2 -1
- package/dist/webauthn/{hostInit-BCMxziLA.mjs → hostInit-3W0iPRJ_.mjs} +2 -2
- package/dist/webauthn/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CMFCCqdv.mjs +0 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -77,6 +77,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
77
77
|
*/
|
|
78
78
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
79
79
|
/**
|
|
80
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
81
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
82
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
83
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
84
|
+
*/
|
|
85
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
86
|
+
/**
|
|
80
87
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
81
88
|
* transitions from `failed` back to `healthy` (typically via the
|
|
82
89
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5369,7 +5376,7 @@ var ZodIssueCode = {
|
|
|
5369
5376
|
var ZodFirstPartyTypeKind;
|
|
5370
5377
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5371
5378
|
//#endregion
|
|
5372
|
-
//#region ../types/dist/sleep-
|
|
5379
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5373
5380
|
/**
|
|
5374
5381
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5375
5382
|
* window to float samples (D455).
|
|
@@ -5448,6 +5455,97 @@ function buildAlawTable() {
|
|
|
5448
5455
|
}
|
|
5449
5456
|
buildUlawTable();
|
|
5450
5457
|
buildAlawTable();
|
|
5458
|
+
/** Is this field's stored value a credential? */
|
|
5459
|
+
function isSecretConfigField(field) {
|
|
5460
|
+
if (field.type === "password") return true;
|
|
5461
|
+
return "secret" in field && field.secret === true;
|
|
5462
|
+
}
|
|
5463
|
+
/**
|
|
5464
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5465
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5466
|
+
*/
|
|
5467
|
+
function isKeychainStoredField(field) {
|
|
5468
|
+
if (!isSecretConfigField(field)) return false;
|
|
5469
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5470
|
+
return !("storage" in field && field.storage === "inline");
|
|
5471
|
+
}
|
|
5472
|
+
/**
|
|
5473
|
+
* What a settings blob holds where a secret used to be.
|
|
5474
|
+
*
|
|
5475
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5476
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5477
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5478
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5479
|
+
*
|
|
5480
|
+
* The same shapes travel to and from the admin UI:
|
|
5481
|
+
*
|
|
5482
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5483
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5484
|
+
* value is set, never the value.
|
|
5485
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5486
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5487
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5488
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5489
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5490
|
+
*
|
|
5491
|
+
* Pure and browser-safe.
|
|
5492
|
+
*/
|
|
5493
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5494
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5495
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5496
|
+
function isRecord$1(value) {
|
|
5497
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5498
|
+
}
|
|
5499
|
+
function makeSecretMarker(ref) {
|
|
5500
|
+
return {
|
|
5501
|
+
$secret: ref,
|
|
5502
|
+
v: 1
|
|
5503
|
+
};
|
|
5504
|
+
}
|
|
5505
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5506
|
+
function isSecretMarker(value) {
|
|
5507
|
+
if (!isRecord$1(value)) return false;
|
|
5508
|
+
const ref = value["$secret"];
|
|
5509
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5510
|
+
}
|
|
5511
|
+
function isSecretClear(value) {
|
|
5512
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5513
|
+
}
|
|
5514
|
+
/**
|
|
5515
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5516
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5517
|
+
* survives this function.
|
|
5518
|
+
*/
|
|
5519
|
+
function toSecretFieldView(stored) {
|
|
5520
|
+
if (isSecretMarker(stored)) return {
|
|
5521
|
+
$secret: stored.$secret,
|
|
5522
|
+
v: 1,
|
|
5523
|
+
set: true
|
|
5524
|
+
};
|
|
5525
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5526
|
+
$secret: null,
|
|
5527
|
+
v: 1,
|
|
5528
|
+
set: true,
|
|
5529
|
+
inline: true
|
|
5530
|
+
};
|
|
5531
|
+
return null;
|
|
5532
|
+
}
|
|
5533
|
+
/**
|
|
5534
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5535
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5536
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5537
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5538
|
+
*/
|
|
5539
|
+
function classifySecretWrite(incoming) {
|
|
5540
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5541
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5542
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5543
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5544
|
+
return {
|
|
5545
|
+
kind: "set",
|
|
5546
|
+
value: incoming
|
|
5547
|
+
};
|
|
5548
|
+
}
|
|
5451
5549
|
Object.fromEntries([
|
|
5452
5550
|
{
|
|
5453
5551
|
id: "overview",
|
|
@@ -5619,33 +5717,19 @@ Object.fromEntries([
|
|
|
5619
5717
|
function isValuelessField(field) {
|
|
5620
5718
|
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";
|
|
5621
5719
|
}
|
|
5622
|
-
|
|
5623
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5624
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5625
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5626
|
-
*
|
|
5627
|
-
* For each leaf field:
|
|
5628
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5629
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5630
|
-
*
|
|
5631
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5632
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5633
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5634
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5635
|
-
*/
|
|
5636
|
-
function hydrateSchema(schema, values) {
|
|
5720
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5637
5721
|
return {
|
|
5638
5722
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5639
5723
|
sections: schema.sections.map((section) => ({
|
|
5640
5724
|
...section,
|
|
5641
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5725
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5642
5726
|
}))
|
|
5643
5727
|
};
|
|
5644
5728
|
}
|
|
5645
|
-
function hydrateField(field, values) {
|
|
5729
|
+
function hydrateField(field, values, options) {
|
|
5646
5730
|
if (isValuelessField(field)) return field;
|
|
5647
5731
|
if (field.type === "group") {
|
|
5648
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5732
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5649
5733
|
return {
|
|
5650
5734
|
...field,
|
|
5651
5735
|
fields: hydratedChildren
|
|
@@ -5654,7 +5738,7 @@ function hydrateField(field, values) {
|
|
|
5654
5738
|
if (field.type === "sub-tabs") {
|
|
5655
5739
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5656
5740
|
...tab,
|
|
5657
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5741
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5658
5742
|
}));
|
|
5659
5743
|
return {
|
|
5660
5744
|
...field,
|
|
@@ -5664,6 +5748,33 @@ function hydrateField(field, values) {
|
|
|
5664
5748
|
const key = field.key;
|
|
5665
5749
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5666
5750
|
const defaultValue = field.default;
|
|
5751
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5752
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5753
|
+
...field,
|
|
5754
|
+
value: toSecretFieldView(storedValue)
|
|
5755
|
+
};
|
|
5756
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5757
|
+
...field,
|
|
5758
|
+
value: null
|
|
5759
|
+
};
|
|
5760
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5761
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5762
|
+
if (secretItemKeys.length > 0) {
|
|
5763
|
+
const rows = storedValue.map((row) => {
|
|
5764
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5765
|
+
const out = { ...row };
|
|
5766
|
+
for (const k of secretItemKeys) {
|
|
5767
|
+
const v = Reflect.get(row, k);
|
|
5768
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5769
|
+
}
|
|
5770
|
+
return out;
|
|
5771
|
+
});
|
|
5772
|
+
return {
|
|
5773
|
+
...field,
|
|
5774
|
+
value: rows
|
|
5775
|
+
};
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5667
5778
|
if (field.multiple) {
|
|
5668
5779
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5669
5780
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5906,6 +6017,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5906
6017
|
}
|
|
5907
6018
|
return out;
|
|
5908
6019
|
}
|
|
6020
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6021
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6022
|
+
function globalSecretScope() {
|
|
6023
|
+
return GLOBAL_SCOPE;
|
|
6024
|
+
}
|
|
6025
|
+
function encodeSegment(value) {
|
|
6026
|
+
return encodeURIComponent(value);
|
|
6027
|
+
}
|
|
6028
|
+
/**
|
|
6029
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6030
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6031
|
+
* `providers[authentik].clientSecret`.
|
|
6032
|
+
*/
|
|
6033
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6034
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6035
|
+
}
|
|
6036
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6037
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6038
|
+
fieldPath;
|
|
6039
|
+
constructor(fieldPath, cause) {
|
|
6040
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6041
|
+
this.fieldPath = fieldPath;
|
|
6042
|
+
this.name = "KeychainWriteRefusedError";
|
|
6043
|
+
}
|
|
6044
|
+
};
|
|
6045
|
+
var KEEP = { kind: "keep" };
|
|
6046
|
+
function isRecord(value) {
|
|
6047
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6048
|
+
}
|
|
6049
|
+
function defaultMintId() {
|
|
6050
|
+
return globalThis.crypto.randomUUID();
|
|
6051
|
+
}
|
|
6052
|
+
/** Every marker ref anywhere under `value`. */
|
|
6053
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6054
|
+
if (isSecretMarker(value)) {
|
|
6055
|
+
out.push(value.$secret);
|
|
6056
|
+
return out;
|
|
6057
|
+
}
|
|
6058
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6059
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6060
|
+
return out;
|
|
6061
|
+
}
|
|
6062
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6063
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6064
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6065
|
+
}
|
|
6066
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6067
|
+
const intent = classifySecretWrite(incoming);
|
|
6068
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6069
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6070
|
+
if (intent.kind === "keep") return KEEP;
|
|
6071
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6072
|
+
if (intent.kind === "clear") {
|
|
6073
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6074
|
+
return {
|
|
6075
|
+
kind: "value",
|
|
6076
|
+
value: null
|
|
6077
|
+
};
|
|
6078
|
+
}
|
|
6079
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6080
|
+
kind: "value",
|
|
6081
|
+
value: stored
|
|
6082
|
+
};
|
|
6083
|
+
try {
|
|
6084
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6085
|
+
} catch (err) {
|
|
6086
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6087
|
+
}
|
|
6088
|
+
return {
|
|
6089
|
+
kind: "value",
|
|
6090
|
+
value: makeSecretMarker(ref)
|
|
6091
|
+
};
|
|
6092
|
+
}
|
|
6093
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6094
|
+
function applyMember(out, key, result, storedParent) {
|
|
6095
|
+
if (result.kind === "value") {
|
|
6096
|
+
out[key] = result.value;
|
|
6097
|
+
return;
|
|
6098
|
+
}
|
|
6099
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6100
|
+
else delete out[key];
|
|
6101
|
+
}
|
|
6102
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6103
|
+
const out = { ...incoming };
|
|
6104
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6105
|
+
return out;
|
|
6106
|
+
}
|
|
6107
|
+
function rowId(row, idKey) {
|
|
6108
|
+
const raw = row[idKey];
|
|
6109
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6110
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6111
|
+
return null;
|
|
6112
|
+
}
|
|
6113
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6114
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6115
|
+
if (!Array.isArray(incoming)) {
|
|
6116
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6117
|
+
return {
|
|
6118
|
+
kind: "value",
|
|
6119
|
+
value: incoming
|
|
6120
|
+
};
|
|
6121
|
+
}
|
|
6122
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6123
|
+
for (const row of storedRows) {
|
|
6124
|
+
const id = rowId(row, node.idKey);
|
|
6125
|
+
if (id !== null) storedById.set(id, row);
|
|
6126
|
+
}
|
|
6127
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6128
|
+
const rows = [];
|
|
6129
|
+
for (const row of incoming) {
|
|
6130
|
+
if (!isRecord(row)) {
|
|
6131
|
+
rows.push(row);
|
|
6132
|
+
continue;
|
|
6133
|
+
}
|
|
6134
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6135
|
+
kept.add(id);
|
|
6136
|
+
const withId = {
|
|
6137
|
+
...row,
|
|
6138
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6139
|
+
};
|
|
6140
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6141
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6142
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6143
|
+
}
|
|
6144
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6145
|
+
return {
|
|
6146
|
+
kind: "value",
|
|
6147
|
+
value: rows
|
|
6148
|
+
};
|
|
6149
|
+
}
|
|
6150
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6151
|
+
switch (node.kind) {
|
|
6152
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6153
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6154
|
+
case "object": {
|
|
6155
|
+
if (!isRecord(incoming)) {
|
|
6156
|
+
if (incoming === void 0) return KEEP;
|
|
6157
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6158
|
+
return {
|
|
6159
|
+
kind: "value",
|
|
6160
|
+
value: incoming
|
|
6161
|
+
};
|
|
6162
|
+
}
|
|
6163
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6164
|
+
return {
|
|
6165
|
+
kind: "value",
|
|
6166
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6167
|
+
};
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6172
|
+
function splitNodeKey(key) {
|
|
6173
|
+
const at = key.indexOf("@");
|
|
6174
|
+
return at <= 0 ? {
|
|
6175
|
+
base: key,
|
|
6176
|
+
nodeId: null
|
|
6177
|
+
} : {
|
|
6178
|
+
base: key.slice(0, at),
|
|
6179
|
+
nodeId: key.slice(at + 1)
|
|
6180
|
+
};
|
|
6181
|
+
}
|
|
6182
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6183
|
+
async function transformSecretWrite(input) {
|
|
6184
|
+
const deletes = [];
|
|
6185
|
+
const base = {
|
|
6186
|
+
secrets: input.secrets,
|
|
6187
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6188
|
+
deletes,
|
|
6189
|
+
operatorWrite: input.operatorWrite === true
|
|
6190
|
+
};
|
|
6191
|
+
const out = {};
|
|
6192
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6193
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6194
|
+
const node = input.tree.get(baseKey);
|
|
6195
|
+
if (node === void 0) {
|
|
6196
|
+
out[key] = incoming;
|
|
6197
|
+
continue;
|
|
6198
|
+
}
|
|
6199
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6200
|
+
kind: "node",
|
|
6201
|
+
nodeId
|
|
6202
|
+
} : input.scope ?? globalSecretScope();
|
|
6203
|
+
const result = await writeNode({
|
|
6204
|
+
...base,
|
|
6205
|
+
scope
|
|
6206
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6207
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6208
|
+
}
|
|
6209
|
+
return {
|
|
6210
|
+
patch: out,
|
|
6211
|
+
afterWrite: async () => {
|
|
6212
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6213
|
+
try {
|
|
6214
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6215
|
+
return { orphaned: [] };
|
|
6216
|
+
} catch {
|
|
6217
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6218
|
+
}
|
|
6219
|
+
}
|
|
6220
|
+
};
|
|
6221
|
+
}
|
|
6222
|
+
/**
|
|
6223
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6224
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6225
|
+
*/
|
|
6226
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6227
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6228
|
+
if (refs.length === 0) return {
|
|
6229
|
+
value,
|
|
6230
|
+
unresolved: []
|
|
6231
|
+
};
|
|
6232
|
+
const answers = await secrets.resolve(refs);
|
|
6233
|
+
const unresolved = [];
|
|
6234
|
+
for (const ref of new Set(refs)) {
|
|
6235
|
+
const answer = answers[ref];
|
|
6236
|
+
if (answer === void 0) unresolved.push({
|
|
6237
|
+
ref,
|
|
6238
|
+
reason: "not-initialized"
|
|
6239
|
+
});
|
|
6240
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6241
|
+
ref,
|
|
6242
|
+
reason: answer.reason
|
|
6243
|
+
});
|
|
6244
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6245
|
+
ref,
|
|
6246
|
+
reason: answer.kind
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6249
|
+
const substitute = (v) => {
|
|
6250
|
+
if (isSecretMarker(v)) {
|
|
6251
|
+
const answer = answers[v.$secret];
|
|
6252
|
+
return answer?.kind === "value" ? {
|
|
6253
|
+
keep: true,
|
|
6254
|
+
value: answer.value
|
|
6255
|
+
} : {
|
|
6256
|
+
keep: false,
|
|
6257
|
+
value: void 0
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6260
|
+
if (Array.isArray(v)) {
|
|
6261
|
+
const items = [];
|
|
6262
|
+
for (const item of v) {
|
|
6263
|
+
const s = substitute(item);
|
|
6264
|
+
if (s.keep) items.push(s.value);
|
|
6265
|
+
}
|
|
6266
|
+
return {
|
|
6267
|
+
keep: true,
|
|
6268
|
+
value: items
|
|
6269
|
+
};
|
|
6270
|
+
}
|
|
6271
|
+
if (isRecord(v)) {
|
|
6272
|
+
const out = {};
|
|
6273
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6274
|
+
const s = substitute(child);
|
|
6275
|
+
if (s.keep) out[k] = s.value;
|
|
6276
|
+
}
|
|
6277
|
+
return {
|
|
6278
|
+
keep: true,
|
|
6279
|
+
value: out
|
|
6280
|
+
};
|
|
6281
|
+
}
|
|
6282
|
+
return {
|
|
6283
|
+
keep: true,
|
|
6284
|
+
value: v
|
|
6285
|
+
};
|
|
6286
|
+
};
|
|
6287
|
+
return {
|
|
6288
|
+
value: substitute(value).value,
|
|
6289
|
+
unresolved
|
|
6290
|
+
};
|
|
6291
|
+
}
|
|
6292
|
+
function touchesTree(tree, patch) {
|
|
6293
|
+
if (tree.size === 0) return false;
|
|
6294
|
+
for (const key of Object.keys(patch)) {
|
|
6295
|
+
const at = key.indexOf("@");
|
|
6296
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6297
|
+
}
|
|
6298
|
+
return false;
|
|
6299
|
+
}
|
|
6300
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6301
|
+
async function readStoredAddonBlob(raw) {
|
|
6302
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6303
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6304
|
+
const result = await threeWay.call(raw);
|
|
6305
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6306
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6307
|
+
}
|
|
6308
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6309
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6310
|
+
const serialize = (key, fn) => {
|
|
6311
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6312
|
+
const tail = next.catch(() => void 0);
|
|
6313
|
+
chains.set(key, tail);
|
|
6314
|
+
tail.then(() => {
|
|
6315
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6316
|
+
});
|
|
6317
|
+
return next;
|
|
6318
|
+
};
|
|
6319
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6320
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6321
|
+
return serialize(chainKey, async () => {
|
|
6322
|
+
const stored = await readStored();
|
|
6323
|
+
const result = await transformSecretWrite({
|
|
6324
|
+
tree,
|
|
6325
|
+
secrets: opts.secrets,
|
|
6326
|
+
patch,
|
|
6327
|
+
stored,
|
|
6328
|
+
...scope !== void 0 ? { scope } : {},
|
|
6329
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6330
|
+
});
|
|
6331
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6332
|
+
const { orphaned } = await result.afterWrite();
|
|
6333
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6334
|
+
});
|
|
6335
|
+
};
|
|
6336
|
+
const wrapped = {
|
|
6337
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6338
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6339
|
+
kind: "device",
|
|
6340
|
+
deviceId
|
|
6341
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6342
|
+
};
|
|
6343
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6344
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6345
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6346
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6347
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6348
|
+
} });
|
|
6349
|
+
}
|
|
6350
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6351
|
+
function withSecretAwareSettings(context, opts) {
|
|
6352
|
+
const raw = context.settings;
|
|
6353
|
+
if (raw === void 0) return context;
|
|
6354
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6355
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6356
|
+
if (prop === "settings") return settings;
|
|
6357
|
+
return Reflect.get(target, prop, receiver);
|
|
6358
|
+
} });
|
|
6359
|
+
}
|
|
6360
|
+
var LEAF = { kind: "leaf" };
|
|
6361
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6362
|
+
function collectFields(fields, out) {
|
|
6363
|
+
for (const field of fields) {
|
|
6364
|
+
if (field.type === "group") {
|
|
6365
|
+
collectFields(field.fields, out);
|
|
6366
|
+
continue;
|
|
6367
|
+
}
|
|
6368
|
+
if (field.type === "sub-tabs") {
|
|
6369
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6370
|
+
continue;
|
|
6371
|
+
}
|
|
6372
|
+
if (field.type === "editable-array") {
|
|
6373
|
+
const item = /* @__PURE__ */ new Map();
|
|
6374
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6375
|
+
if (item.size > 0) out.set(field.key, {
|
|
6376
|
+
kind: "array",
|
|
6377
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6378
|
+
item
|
|
6379
|
+
});
|
|
6380
|
+
continue;
|
|
6381
|
+
}
|
|
6382
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6383
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6386
|
+
/** The secret tree a settings schema declares. */
|
|
6387
|
+
function secretTreeFromSchema(schema) {
|
|
6388
|
+
const out = /* @__PURE__ */ new Map();
|
|
6389
|
+
if (schema === null) return out;
|
|
6390
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6391
|
+
return out;
|
|
6392
|
+
}
|
|
6393
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6394
|
+
function parseSecretStatePath(path) {
|
|
6395
|
+
const segments = [];
|
|
6396
|
+
for (const raw of path.split(".")) {
|
|
6397
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6398
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6399
|
+
segments.push(m[2] !== void 0 ? {
|
|
6400
|
+
key: m[1],
|
|
6401
|
+
idKey: m[2]
|
|
6402
|
+
} : { key: m[1] });
|
|
6403
|
+
}
|
|
6404
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6405
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6406
|
+
return segments;
|
|
6407
|
+
}
|
|
6408
|
+
function insert(into, segments) {
|
|
6409
|
+
const [head, ...rest] = segments;
|
|
6410
|
+
if (head === void 0) return;
|
|
6411
|
+
if (rest.length === 0) {
|
|
6412
|
+
into.set(head.key, LEAF);
|
|
6413
|
+
return;
|
|
6414
|
+
}
|
|
6415
|
+
const existing = into.get(head.key);
|
|
6416
|
+
if (head.idKey !== void 0) {
|
|
6417
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6418
|
+
insert(item, rest);
|
|
6419
|
+
into.set(head.key, {
|
|
6420
|
+
kind: "array",
|
|
6421
|
+
idKey: head.idKey,
|
|
6422
|
+
item
|
|
6423
|
+
});
|
|
6424
|
+
return;
|
|
6425
|
+
}
|
|
6426
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6427
|
+
insert(children, rest);
|
|
6428
|
+
into.set(head.key, {
|
|
6429
|
+
kind: "object",
|
|
6430
|
+
children
|
|
6431
|
+
});
|
|
6432
|
+
}
|
|
6433
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6434
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6435
|
+
if (paths.length === 0) return tree;
|
|
6436
|
+
const out = new Map(tree);
|
|
6437
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6438
|
+
return out;
|
|
6439
|
+
}
|
|
6440
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6441
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6442
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6443
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6444
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5909
6445
|
/**
|
|
5910
6446
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5911
6447
|
*
|
|
@@ -5975,6 +6511,25 @@ var BaseAddon = class {
|
|
|
5975
6511
|
settingsStoreReady = false;
|
|
5976
6512
|
/** Default config values. Provided via constructor. */
|
|
5977
6513
|
defaults;
|
|
6514
|
+
/**
|
|
6515
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6516
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6517
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6518
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6519
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6520
|
+
*/
|
|
6521
|
+
secretStatePaths = [];
|
|
6522
|
+
_addonSecretTree = null;
|
|
6523
|
+
_deviceSecretTree = null;
|
|
6524
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6525
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6526
|
+
_unresolvedSecrets = [];
|
|
6527
|
+
_secretRetryTimer = null;
|
|
6528
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6529
|
+
_secretChangeTimer = null;
|
|
6530
|
+
_secretChangeUnsub = null;
|
|
6531
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6532
|
+
_operatorWriteDepth = 0;
|
|
5978
6533
|
constructor(defaults) {
|
|
5979
6534
|
this.defaults = defaults;
|
|
5980
6535
|
this._config = { ...defaults };
|
|
@@ -6010,8 +6565,18 @@ var BaseAddon = class {
|
|
|
6010
6565
|
return this._config;
|
|
6011
6566
|
}
|
|
6012
6567
|
async initialize(context) {
|
|
6013
|
-
|
|
6568
|
+
const secrets = context.secrets;
|
|
6569
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6570
|
+
secrets,
|
|
6571
|
+
addonTree: () => this.addonSecretTree(),
|
|
6572
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6573
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6574
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6575
|
+
}) : context;
|
|
6014
6576
|
await this.resolveConfig();
|
|
6577
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6578
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6579
|
+
});
|
|
6015
6580
|
const result = await this.onInitialize();
|
|
6016
6581
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6017
6582
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6044,6 +6609,12 @@ var BaseAddon = class {
|
|
|
6044
6609
|
*/
|
|
6045
6610
|
async onHubReachable() {}
|
|
6046
6611
|
async shutdown() {
|
|
6612
|
+
this._secretChangeUnsub?.();
|
|
6613
|
+
this._secretChangeUnsub = null;
|
|
6614
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6615
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6616
|
+
this._secretRetryTimer = null;
|
|
6617
|
+
this._secretChangeTimer = null;
|
|
6047
6618
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6048
6619
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6049
6620
|
await this.onShutdown();
|
|
@@ -6122,7 +6693,7 @@ var BaseAddon = class {
|
|
|
6122
6693
|
return hydrateSchema(schema, overlay ? {
|
|
6123
6694
|
...projected,
|
|
6124
6695
|
...overlay
|
|
6125
|
-
} : projected);
|
|
6696
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6126
6697
|
}
|
|
6127
6698
|
/**
|
|
6128
6699
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6171,7 +6742,7 @@ var BaseAddon = class {
|
|
|
6171
6742
|
return hydrateSchema({
|
|
6172
6743
|
...schema,
|
|
6173
6744
|
sections
|
|
6174
|
-
}, projected);
|
|
6745
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6175
6746
|
}
|
|
6176
6747
|
/**
|
|
6177
6748
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6225,18 +6796,50 @@ var BaseAddon = class {
|
|
|
6225
6796
|
value: result.value[key]
|
|
6226
6797
|
};
|
|
6227
6798
|
}
|
|
6799
|
+
/**
|
|
6800
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6801
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6802
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6803
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6804
|
+
* writing back what it read is not (D787).
|
|
6805
|
+
*/
|
|
6806
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6807
|
+
this._operatorWriteDepth++;
|
|
6808
|
+
try {
|
|
6809
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6810
|
+
} finally {
|
|
6811
|
+
this._operatorWriteDepth--;
|
|
6812
|
+
}
|
|
6813
|
+
}
|
|
6228
6814
|
async updateGlobalSettings(patch, nodeId) {
|
|
6815
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6816
|
+
}
|
|
6817
|
+
/**
|
|
6818
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6819
|
+
*
|
|
6820
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6821
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6822
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6823
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6824
|
+
*/
|
|
6825
|
+
async clearSecrets(keys, nodeId) {
|
|
6826
|
+
const tree = this.addonSecretTree();
|
|
6827
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6828
|
+
const patch = {};
|
|
6829
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6830
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6831
|
+
}
|
|
6832
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6229
6833
|
const keys = this.perNodeKeys();
|
|
6230
6834
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6231
6835
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6232
|
-
const barePatch = patch;
|
|
6233
6836
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6234
6837
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6235
6838
|
if (target !== localNode) return;
|
|
6236
6839
|
await this.resolveConfig();
|
|
6237
6840
|
await this.onConfigChanged();
|
|
6238
6841
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6239
|
-
this.maybeAutoRestart(
|
|
6842
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6240
6843
|
}
|
|
6241
6844
|
/**
|
|
6242
6845
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6261,7 +6864,7 @@ var BaseAddon = class {
|
|
|
6261
6864
|
* time to return its response before the addon is torn down and
|
|
6262
6865
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6263
6866
|
*/
|
|
6264
|
-
maybeAutoRestart(
|
|
6867
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6265
6868
|
if (!schema) return;
|
|
6266
6869
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6267
6870
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6269,13 +6872,13 @@ var BaseAddon = class {
|
|
|
6269
6872
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6270
6873
|
}
|
|
6271
6874
|
if (restartKeys.size === 0) return;
|
|
6272
|
-
if (!
|
|
6875
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6273
6876
|
const ctx = this._ctx;
|
|
6274
6877
|
if (!ctx) return;
|
|
6275
6878
|
const addonId = ctx.id;
|
|
6276
6879
|
setImmediate(() => {
|
|
6277
6880
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6278
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6881
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6279
6882
|
}).catch((err) => {
|
|
6280
6883
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6281
6884
|
});
|
|
@@ -6284,7 +6887,7 @@ var BaseAddon = class {
|
|
|
6284
6887
|
async getDeviceSettings(deviceId) {
|
|
6285
6888
|
const schema = this.deviceSettingsSchema();
|
|
6286
6889
|
if (!schema) return { sections: [] };
|
|
6287
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6890
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6288
6891
|
}
|
|
6289
6892
|
async updateDeviceSettings(deviceId, patch) {
|
|
6290
6893
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6414,7 +7017,7 @@ var BaseAddon = class {
|
|
|
6414
7017
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6415
7018
|
*/
|
|
6416
7019
|
async resolveConfig() {
|
|
6417
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7020
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6418
7021
|
const perNode = this.perNodeKeys();
|
|
6419
7022
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6420
7023
|
const resolved = { ...this.defaults };
|
|
@@ -6439,7 +7042,7 @@ var BaseAddon = class {
|
|
|
6439
7042
|
key,
|
|
6440
7043
|
schema,
|
|
6441
7044
|
fallback,
|
|
6442
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7045
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6443
7046
|
write: async (patch) => {
|
|
6444
7047
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6445
7048
|
},
|
|
@@ -6456,7 +7059,7 @@ var BaseAddon = class {
|
|
|
6456
7059
|
key,
|
|
6457
7060
|
schema,
|
|
6458
7061
|
fallback,
|
|
6459
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7062
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6460
7063
|
write: async (patch) => {
|
|
6461
7064
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6462
7065
|
},
|
|
@@ -6468,6 +7071,70 @@ var BaseAddon = class {
|
|
|
6468
7071
|
} })
|
|
6469
7072
|
});
|
|
6470
7073
|
}
|
|
7074
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7075
|
+
addonSecretTree() {
|
|
7076
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7077
|
+
return this._addonSecretTree;
|
|
7078
|
+
}
|
|
7079
|
+
deviceSecretTree() {
|
|
7080
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7081
|
+
return this._deviceSecretTree;
|
|
7082
|
+
}
|
|
7083
|
+
/**
|
|
7084
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7085
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7086
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7087
|
+
* than start on an empty credential.
|
|
7088
|
+
*/
|
|
7089
|
+
get unresolvedSecrets() {
|
|
7090
|
+
return this._unresolvedSecrets;
|
|
7091
|
+
}
|
|
7092
|
+
/**
|
|
7093
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7094
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7095
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7096
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7097
|
+
* ever written back from here.
|
|
7098
|
+
*/
|
|
7099
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7100
|
+
const secrets = this._ctx?.secrets;
|
|
7101
|
+
if (secrets === void 0) return blob;
|
|
7102
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7103
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7104
|
+
if (refs.length === 0) {
|
|
7105
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7106
|
+
return blob;
|
|
7107
|
+
}
|
|
7108
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7109
|
+
if (trackForConfig) {
|
|
7110
|
+
this._unresolvedSecrets = unresolved;
|
|
7111
|
+
if (unresolved.length > 0) {
|
|
7112
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7113
|
+
ref: u.ref,
|
|
7114
|
+
reason: u.reason
|
|
7115
|
+
})) } });
|
|
7116
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7117
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7118
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7119
|
+
}
|
|
7120
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7121
|
+
}
|
|
7122
|
+
return value;
|
|
7123
|
+
}
|
|
7124
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7125
|
+
scheduleSecretReresolve(delayMs) {
|
|
7126
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7127
|
+
if (this[timerOf] !== null) return;
|
|
7128
|
+
const timer = setTimeout(() => {
|
|
7129
|
+
this[timerOf] = null;
|
|
7130
|
+
if (this._ctx === null) return;
|
|
7131
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7132
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7133
|
+
});
|
|
7134
|
+
}, delayMs);
|
|
7135
|
+
timer.unref?.();
|
|
7136
|
+
this[timerOf] = timer;
|
|
7137
|
+
}
|
|
6471
7138
|
/**
|
|
6472
7139
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6473
7140
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -14135,6 +14802,196 @@ id: union([string(), number()]) }), {
|
|
|
14135
14802
|
kind: "mutation",
|
|
14136
14803
|
auth: "admin"
|
|
14137
14804
|
});
|
|
14805
|
+
/**
|
|
14806
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14807
|
+
*
|
|
14808
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14809
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14810
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14811
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14812
|
+
* against the CALLER, never against anything the caller claims.
|
|
14813
|
+
*
|
|
14814
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14815
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14816
|
+
* connection, the agent from its child's connection carried in
|
|
14817
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14818
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14819
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14820
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14821
|
+
* runner is the same OS user): see the threat model in
|
|
14822
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14823
|
+
*
|
|
14824
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14825
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14826
|
+
* floors every method to admin anyway (D240).
|
|
14827
|
+
*
|
|
14828
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14829
|
+
*/
|
|
14830
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14831
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14832
|
+
"key-missing",
|
|
14833
|
+
"wrong-key",
|
|
14834
|
+
"key-file-unreadable",
|
|
14835
|
+
"store-unavailable",
|
|
14836
|
+
"not-initialized",
|
|
14837
|
+
"decrypt-failed"
|
|
14838
|
+
]);
|
|
14839
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14840
|
+
state: literal("locked"),
|
|
14841
|
+
reason: KeychainUnavailableReasonSchema
|
|
14842
|
+
})]);
|
|
14843
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14844
|
+
object({
|
|
14845
|
+
kind: literal("value"),
|
|
14846
|
+
value: string(),
|
|
14847
|
+
version: number().int()
|
|
14848
|
+
}),
|
|
14849
|
+
object({ kind: literal("missing") }),
|
|
14850
|
+
object({
|
|
14851
|
+
kind: literal("unavailable"),
|
|
14852
|
+
reason: KeychainUnavailableReasonSchema
|
|
14853
|
+
}),
|
|
14854
|
+
object({ kind: literal("forbidden") })
|
|
14855
|
+
]);
|
|
14856
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14857
|
+
/** Metadata of one stored value — never the value. */
|
|
14858
|
+
var KeychainSecretMetaSchema = object({
|
|
14859
|
+
ref: string(),
|
|
14860
|
+
owner: string(),
|
|
14861
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14862
|
+
scope: string(),
|
|
14863
|
+
fieldPath: string(),
|
|
14864
|
+
version: number().int(),
|
|
14865
|
+
createdAt: number(),
|
|
14866
|
+
updatedAt: number(),
|
|
14867
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14868
|
+
updatedBy: string(),
|
|
14869
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14870
|
+
lastReadAt: number().nullable()
|
|
14871
|
+
});
|
|
14872
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14873
|
+
method(object({
|
|
14874
|
+
ref: string().min(1),
|
|
14875
|
+
value: string().min(1)
|
|
14876
|
+
}), object({
|
|
14877
|
+
ref: string(),
|
|
14878
|
+
version: number().int()
|
|
14879
|
+
}), {
|
|
14880
|
+
kind: "mutation",
|
|
14881
|
+
auth: "admin"
|
|
14882
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14883
|
+
kind: "mutation",
|
|
14884
|
+
auth: "admin"
|
|
14885
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14886
|
+
var KeychainKeySourceSchema = object({
|
|
14887
|
+
kind: _enum([
|
|
14888
|
+
"config-file",
|
|
14889
|
+
"previous-config-file",
|
|
14890
|
+
"platform",
|
|
14891
|
+
"default-file"
|
|
14892
|
+
]),
|
|
14893
|
+
/** File sources only — a path is not a secret. */
|
|
14894
|
+
path: string().optional(),
|
|
14895
|
+
/**
|
|
14896
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14897
|
+
* next to the database it protects (the default file). The page warns.
|
|
14898
|
+
*/
|
|
14899
|
+
sharesBackupWithDatabase: boolean()
|
|
14900
|
+
});
|
|
14901
|
+
var KeychainStatusSchema = object({
|
|
14902
|
+
keychain: KeychainStateSchema,
|
|
14903
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14904
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14905
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14906
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14907
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14908
|
+
fingerprint: string().nullable(),
|
|
14909
|
+
activeKeyId: string().nullable(),
|
|
14910
|
+
/**
|
|
14911
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14912
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14913
|
+
*/
|
|
14914
|
+
rotationPending: boolean(),
|
|
14915
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14916
|
+
retiredWraps: number().int(),
|
|
14917
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14918
|
+
secretCount: number().int()
|
|
14919
|
+
});
|
|
14920
|
+
/**
|
|
14921
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14922
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14923
|
+
* never reported as an orphan (and never deleted as one).
|
|
14924
|
+
*/
|
|
14925
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14926
|
+
"in-use",
|
|
14927
|
+
"orphan",
|
|
14928
|
+
"unknown"
|
|
14929
|
+
]);
|
|
14930
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14931
|
+
var KeychainAuditActionSchema = _enum([
|
|
14932
|
+
"put",
|
|
14933
|
+
"delete",
|
|
14934
|
+
"reveal",
|
|
14935
|
+
"rotate-master-key",
|
|
14936
|
+
"purge-retired-keys",
|
|
14937
|
+
"download-recovery-key",
|
|
14938
|
+
"delete-orphans",
|
|
14939
|
+
"reset",
|
|
14940
|
+
"initialize"
|
|
14941
|
+
]);
|
|
14942
|
+
var KeychainAuditEntrySchema = object({
|
|
14943
|
+
id: string(),
|
|
14944
|
+
at: number(),
|
|
14945
|
+
action: KeychainAuditActionSchema,
|
|
14946
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14947
|
+
actor: string(),
|
|
14948
|
+
ref: string().nullable(),
|
|
14949
|
+
detail: string().nullable()
|
|
14950
|
+
});
|
|
14951
|
+
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({
|
|
14952
|
+
value: string(),
|
|
14953
|
+
version: number().int()
|
|
14954
|
+
}), {
|
|
14955
|
+
kind: "mutation",
|
|
14956
|
+
auth: "admin",
|
|
14957
|
+
caller: "required"
|
|
14958
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14959
|
+
deleted: array(string()).readonly(),
|
|
14960
|
+
kept: array(object({
|
|
14961
|
+
ref: string(),
|
|
14962
|
+
usage: KeychainSecretUsageSchema
|
|
14963
|
+
})).readonly()
|
|
14964
|
+
}), {
|
|
14965
|
+
kind: "mutation",
|
|
14966
|
+
auth: "admin",
|
|
14967
|
+
caller: "required"
|
|
14968
|
+
}), method(object({}), object({
|
|
14969
|
+
fingerprint: string(),
|
|
14970
|
+
keySource: KeychainKeySourceSchema
|
|
14971
|
+
}), {
|
|
14972
|
+
kind: "mutation",
|
|
14973
|
+
auth: "admin",
|
|
14974
|
+
caller: "required"
|
|
14975
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
14976
|
+
kind: "mutation",
|
|
14977
|
+
auth: "admin",
|
|
14978
|
+
caller: "required"
|
|
14979
|
+
}), method(object({}), object({
|
|
14980
|
+
key: string(),
|
|
14981
|
+
fingerprint: string(),
|
|
14982
|
+
keySource: KeychainKeySourceSchema
|
|
14983
|
+
}), {
|
|
14984
|
+
kind: "mutation",
|
|
14985
|
+
auth: "admin",
|
|
14986
|
+
caller: "required"
|
|
14987
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
14988
|
+
archivedCollection: string().nullable(),
|
|
14989
|
+
archived: number().int()
|
|
14990
|
+
}), {
|
|
14991
|
+
kind: "mutation",
|
|
14992
|
+
auth: "admin",
|
|
14993
|
+
caller: "required"
|
|
14994
|
+
});
|
|
14138
14995
|
method(_void(), object({
|
|
14139
14996
|
id: string(),
|
|
14140
14997
|
name: string(),
|
|
@@ -15172,7 +16029,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15172
16029
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15173
16030
|
var DevicePersistConfigPayloadSchema = object({
|
|
15174
16031
|
deviceId: number(),
|
|
15175
|
-
data: record(string(), unknown())
|
|
16032
|
+
data: record(string(), unknown()),
|
|
16033
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16034
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16035
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16036
|
+
secretConfigPaths: array(string()).optional()
|
|
15176
16037
|
});
|
|
15177
16038
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15178
16039
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -22159,8 +23020,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22159
23020
|
]);
|
|
22160
23021
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22161
23022
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22162
|
-
/**
|
|
22163
|
-
|
|
23023
|
+
/**
|
|
23024
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23025
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23026
|
+
*
|
|
23027
|
+
* - `operator` — drawn by hand.
|
|
23028
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23029
|
+
* model, or a larger teacher model).
|
|
23030
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23031
|
+
* back from the track store (never a re-run).
|
|
23032
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23033
|
+
*/
|
|
23034
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23035
|
+
"operator",
|
|
23036
|
+
"assist",
|
|
23037
|
+
"pipeline",
|
|
23038
|
+
"llm"
|
|
23039
|
+
]);
|
|
22164
23040
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22165
23041
|
var RetrainBboxSchema = object({
|
|
22166
23042
|
x: number(),
|
|
@@ -22178,7 +23054,8 @@ var RetrainBboxSchema = object({
|
|
|
22178
23054
|
*/
|
|
22179
23055
|
var RetrainAnnotationSchema = object({
|
|
22180
23056
|
id: string(),
|
|
22181
|
-
|
|
23057
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23058
|
+
trackId: string().optional(),
|
|
22182
23059
|
deviceId: number(),
|
|
22183
23060
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22184
23061
|
mediaKey: string(),
|
|
@@ -22227,13 +23104,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22227
23104
|
* fail, whatever became of the original. */
|
|
22228
23105
|
copied: boolean()
|
|
22229
23106
|
});
|
|
23107
|
+
/**
|
|
23108
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23109
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23110
|
+
* box recorded on the source media row when there is one, else the track
|
|
23111
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23112
|
+
* until the operator confirms it.
|
|
23113
|
+
*/
|
|
23114
|
+
var RetrainPipelineBoxSchema = object({
|
|
23115
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23116
|
+
bbox: RetrainBboxSchema,
|
|
23117
|
+
macroClass: RetrainMacroClassSchema,
|
|
23118
|
+
label: string().optional(),
|
|
23119
|
+
subLabel: string().optional(),
|
|
23120
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23121
|
+
score: number().optional(),
|
|
23122
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23123
|
+
modelId: string().optional(),
|
|
23124
|
+
trackId: string(),
|
|
23125
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23126
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23127
|
+
basis: _enum(["subject-box", "position"]),
|
|
23128
|
+
deltaMs: number()
|
|
23129
|
+
});
|
|
23130
|
+
/**
|
|
23131
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23132
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23133
|
+
* track at all.
|
|
23134
|
+
*/
|
|
23135
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22230
23136
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22231
23137
|
var RetrainFrameSchema = object({
|
|
22232
23138
|
frameId: string(),
|
|
22233
23139
|
deviceId: number(),
|
|
22234
|
-
|
|
22235
|
-
/**
|
|
22236
|
-
|
|
23140
|
+
origin: RetrainFrameOriginSchema,
|
|
23141
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23142
|
+
trackId: string().optional(),
|
|
23143
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23144
|
+
* Absent on a recording still. */
|
|
23145
|
+
sourceMediaId: number().int().optional(),
|
|
23146
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23147
|
+
epochMs: number().optional(),
|
|
22237
23148
|
sourceKind: MediaFileKindEnum,
|
|
22238
23149
|
sizeBytes: number().int(),
|
|
22239
23150
|
width: number().int(),
|
|
@@ -22244,7 +23155,12 @@ var RetrainFrameSchema = object({
|
|
|
22244
23155
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22245
23156
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22246
23157
|
* a false positive. */
|
|
22247
|
-
complete: boolean()
|
|
23158
|
+
complete: boolean(),
|
|
23159
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23160
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23161
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23162
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23163
|
+
collectionIds: array(string()).readonly().optional()
|
|
22248
23164
|
});
|
|
22249
23165
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22250
23166
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22275,6 +23191,8 @@ var RetrainFrameListSchema = object({
|
|
|
22275
23191
|
var RetrainExportFilterSchema = object({
|
|
22276
23192
|
deviceIds: array(number()).optional(),
|
|
22277
23193
|
frameIds: array(string()).max(2e4).optional(),
|
|
23194
|
+
/** Only frames in at least one of these named collections. */
|
|
23195
|
+
collectionIds: array(string()).max(200).optional(),
|
|
22278
23196
|
batchId: string().optional(),
|
|
22279
23197
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22280
23198
|
completeOnly: boolean().optional()
|
|
@@ -22339,6 +23257,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22339
23257
|
reason: string(),
|
|
22340
23258
|
detail: string().optional()
|
|
22341
23259
|
})]);
|
|
23260
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23261
|
+
var RetrainCollectionSchema = object({
|
|
23262
|
+
id: string(),
|
|
23263
|
+
name: string(),
|
|
23264
|
+
createdAt: number(),
|
|
23265
|
+
frameCount: number().int()
|
|
23266
|
+
});
|
|
23267
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23268
|
+
kind: literal("created"),
|
|
23269
|
+
collection: RetrainCollectionSchema
|
|
23270
|
+
}), object({
|
|
23271
|
+
kind: literal("refused"),
|
|
23272
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23273
|
+
})]);
|
|
23274
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23275
|
+
kind: literal("renamed"),
|
|
23276
|
+
collection: RetrainCollectionSchema
|
|
23277
|
+
}), object({
|
|
23278
|
+
kind: literal("refused"),
|
|
23279
|
+
reason: _enum([
|
|
23280
|
+
"empty-name",
|
|
23281
|
+
"duplicate-name",
|
|
23282
|
+
"unknown-collection"
|
|
23283
|
+
])
|
|
23284
|
+
})]);
|
|
23285
|
+
/**
|
|
23286
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23287
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23288
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23289
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23290
|
+
*/
|
|
23291
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23292
|
+
kind: literal("added"),
|
|
23293
|
+
collectionId: string(),
|
|
23294
|
+
frame: RetrainFrameSchema,
|
|
23295
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23296
|
+
reused: boolean()
|
|
23297
|
+
}), object({
|
|
23298
|
+
kind: literal("refused"),
|
|
23299
|
+
reason: _enum([
|
|
23300
|
+
"unknown-collection",
|
|
23301
|
+
"still-unavailable",
|
|
23302
|
+
"still-busy",
|
|
23303
|
+
"unreadable-image",
|
|
23304
|
+
"write-failed"
|
|
23305
|
+
]),
|
|
23306
|
+
detail: string().optional()
|
|
23307
|
+
})]);
|
|
23308
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23309
|
+
var RetrainAssistProfileSchema = object({
|
|
23310
|
+
id: string(),
|
|
23311
|
+
name: string(),
|
|
23312
|
+
model: string(),
|
|
23313
|
+
kind: string(),
|
|
23314
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23315
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23316
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23317
|
+
leavesHouse: boolean()
|
|
23318
|
+
});
|
|
23319
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23320
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23321
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23322
|
+
var RetrainLlmReviewSchema = object({
|
|
23323
|
+
/** The `ref` the page sent the box under. */
|
|
23324
|
+
ref: string(),
|
|
23325
|
+
verdict: _enum([
|
|
23326
|
+
"confirmed",
|
|
23327
|
+
"wrong-class",
|
|
23328
|
+
"not-an-object",
|
|
23329
|
+
"uncertain"
|
|
23330
|
+
]),
|
|
23331
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23332
|
+
reason: string()
|
|
23333
|
+
});
|
|
23334
|
+
/**
|
|
23335
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23336
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23337
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23338
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23339
|
+
*/
|
|
23340
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23341
|
+
kind: literal("proposed"),
|
|
23342
|
+
profileId: string(),
|
|
23343
|
+
model: string(),
|
|
23344
|
+
/** The frame was sent outside the house for this answer. */
|
|
23345
|
+
leftHouse: boolean(),
|
|
23346
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23347
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23348
|
+
rejected: number().int()
|
|
23349
|
+
}), object({
|
|
23350
|
+
kind: literal("refused"),
|
|
23351
|
+
reason: _enum([
|
|
23352
|
+
"unknown-frame",
|
|
23353
|
+
"unreadable-frame",
|
|
23354
|
+
"unknown-profile",
|
|
23355
|
+
"profile-disabled",
|
|
23356
|
+
"no-vision",
|
|
23357
|
+
"cloud-not-confirmed",
|
|
23358
|
+
"llm-error",
|
|
23359
|
+
"malformed-answer"
|
|
23360
|
+
]),
|
|
23361
|
+
detail: string().optional()
|
|
23362
|
+
})]);
|
|
22342
23363
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22343
23364
|
var RetrainTransitionResultSchema = object({
|
|
22344
23365
|
trackId: string(),
|
|
@@ -23056,7 +24077,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23056
24077
|
auth: "admin"
|
|
23057
24078
|
}), method(object({
|
|
23058
24079
|
deviceId: number(),
|
|
23059
|
-
trackId: string(),
|
|
24080
|
+
trackId: string().optional(),
|
|
23060
24081
|
frameId: string()
|
|
23061
24082
|
}), object({
|
|
23062
24083
|
removed: boolean(),
|
|
@@ -23073,7 +24094,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23073
24094
|
auth: "admin"
|
|
23074
24095
|
}), method(object({
|
|
23075
24096
|
deviceId: number(),
|
|
23076
|
-
|
|
24097
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24098
|
+
trackId: string().optional(),
|
|
23077
24099
|
frameId: string(),
|
|
23078
24100
|
subject: RetrainAssistSubjectSchema,
|
|
23079
24101
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23081,12 +24103,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23081
24103
|
}), RetrainAssistResultSchema, {
|
|
23082
24104
|
kind: "mutation",
|
|
23083
24105
|
auth: "admin"
|
|
23084
|
-
}), method(object({
|
|
24106
|
+
}), method(object({
|
|
24107
|
+
trackId: string().optional(),
|
|
24108
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24109
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23085
24110
|
kind: "query",
|
|
23086
24111
|
auth: "admin"
|
|
23087
24112
|
}), method(object({
|
|
23088
24113
|
deviceId: number(),
|
|
23089
|
-
|
|
24114
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24115
|
+
trackId: string().optional(),
|
|
23090
24116
|
frameId: string(),
|
|
23091
24117
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23092
24118
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23109,7 +24135,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23109
24135
|
auth: "admin"
|
|
23110
24136
|
}), method(object({
|
|
23111
24137
|
deviceId: number(),
|
|
23112
|
-
trackId: string(),
|
|
24138
|
+
trackId: string().optional(),
|
|
23113
24139
|
frameId: string(),
|
|
23114
24140
|
complete: boolean()
|
|
23115
24141
|
}), RetrainFrameSchema, {
|
|
@@ -23123,6 +24149,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23123
24149
|
kind: "mutation",
|
|
23124
24150
|
auth: "admin",
|
|
23125
24151
|
timeoutMs: 60 * 6e4
|
|
24152
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24153
|
+
kind: "query",
|
|
24154
|
+
auth: "admin"
|
|
24155
|
+
}), method(object({
|
|
24156
|
+
deviceId: number(),
|
|
24157
|
+
trackId: string().optional(),
|
|
24158
|
+
frameId: string(),
|
|
24159
|
+
profileId: string(),
|
|
24160
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24161
|
+
boxes: array(object({
|
|
24162
|
+
ref: string(),
|
|
24163
|
+
bbox: RetrainBboxSchema,
|
|
24164
|
+
macroClass: RetrainMacroClassSchema,
|
|
24165
|
+
label: string().optional()
|
|
24166
|
+
})).max(50),
|
|
24167
|
+
allowCloud: boolean()
|
|
24168
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24169
|
+
kind: "mutation",
|
|
24170
|
+
auth: "admin",
|
|
24171
|
+
timeoutMs: 18e4
|
|
24172
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24173
|
+
kind: "mutation",
|
|
24174
|
+
auth: "admin"
|
|
24175
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24176
|
+
kind: "query",
|
|
24177
|
+
auth: "admin"
|
|
24178
|
+
}), method(object({
|
|
24179
|
+
id: string(),
|
|
24180
|
+
name: string().max(120)
|
|
24181
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24182
|
+
kind: "mutation",
|
|
24183
|
+
auth: "admin"
|
|
24184
|
+
}), method(object({ id: string() }), object({
|
|
24185
|
+
deleted: boolean(),
|
|
24186
|
+
removedFrames: number().int()
|
|
24187
|
+
}), {
|
|
24188
|
+
kind: "mutation",
|
|
24189
|
+
auth: "admin"
|
|
24190
|
+
}), method(object({
|
|
24191
|
+
collectionId: string(),
|
|
24192
|
+
deviceId: number(),
|
|
24193
|
+
epochMs: number()
|
|
24194
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24195
|
+
kind: "mutation",
|
|
24196
|
+
auth: "admin",
|
|
24197
|
+
timeoutMs: 6e4
|
|
24198
|
+
}), method(object({
|
|
24199
|
+
collectionId: string(),
|
|
24200
|
+
frameIds: array(string()).min(1).max(500)
|
|
24201
|
+
}), object({
|
|
24202
|
+
added: number().int(),
|
|
24203
|
+
alreadyMember: number().int(),
|
|
24204
|
+
unknownFrameIds: array(string()).readonly()
|
|
24205
|
+
}), {
|
|
24206
|
+
kind: "mutation",
|
|
24207
|
+
auth: "admin"
|
|
24208
|
+
}), method(object({
|
|
24209
|
+
collectionId: string(),
|
|
24210
|
+
frameId: string()
|
|
24211
|
+
}), object({
|
|
24212
|
+
removed: boolean(),
|
|
24213
|
+
deletedFrame: boolean()
|
|
24214
|
+
}), {
|
|
24215
|
+
kind: "mutation",
|
|
24216
|
+
auth: "admin"
|
|
24217
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
24218
|
+
kind: "query",
|
|
24219
|
+
auth: "admin"
|
|
23126
24220
|
}), method(object({
|
|
23127
24221
|
/** Which of the three event tables owns the row. */
|
|
23128
24222
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23746,13 +24840,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23746
24840
|
object({
|
|
23747
24841
|
kind: literal("no-family-build"),
|
|
23748
24842
|
format: ModelFormatSchema$1
|
|
24843
|
+
}),
|
|
24844
|
+
object({
|
|
24845
|
+
kind: literal("kept-custom-pin"),
|
|
24846
|
+
modelId: string(),
|
|
24847
|
+
deviceKey: string()
|
|
23749
24848
|
})
|
|
23750
24849
|
]);
|
|
24850
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
24851
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
24852
|
+
/**
|
|
24853
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
24854
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
24855
|
+
*/
|
|
24856
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
24857
|
+
kind: literal("node-benchmark"),
|
|
24858
|
+
resultId: string(),
|
|
24859
|
+
measuredAtMs: number()
|
|
24860
|
+
})]);
|
|
23751
24861
|
var DeviceModelChoiceSchema = object({
|
|
23752
24862
|
modelId: string(),
|
|
23753
24863
|
p50Ms: number(),
|
|
23754
24864
|
fps: number(),
|
|
23755
24865
|
measured: boolean(),
|
|
24866
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
24867
|
+
source: LatencySourceSchema.optional(),
|
|
23756
24868
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23757
24869
|
capacitySessions: number(),
|
|
23758
24870
|
personRecall: number()
|
|
@@ -23763,6 +24875,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23763
24875
|
enabled: boolean(),
|
|
23764
24876
|
available: boolean(),
|
|
23765
24877
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
24878
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
24879
|
+
kept: KeptReasonSchema.optional(),
|
|
23766
24880
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23767
24881
|
});
|
|
23768
24882
|
var NodeRecommendationSchema = object({
|
|
@@ -23816,6 +24930,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
23816
24930
|
kind: literal("coral-enabled"),
|
|
23817
24931
|
nodeId: string(),
|
|
23818
24932
|
deviceKey: string()
|
|
24933
|
+
}),
|
|
24934
|
+
object({
|
|
24935
|
+
kind: literal("custom-pin-kept"),
|
|
24936
|
+
nodeId: string(),
|
|
24937
|
+
deviceKey: string().nullable(),
|
|
24938
|
+
deviceId: number().nullable(),
|
|
24939
|
+
modelId: string()
|
|
24940
|
+
}),
|
|
24941
|
+
object({
|
|
24942
|
+
kind: literal("custom-registry-unreadable"),
|
|
24943
|
+
error: string()
|
|
23819
24944
|
})
|
|
23820
24945
|
]);
|
|
23821
24946
|
var AutoTuneOptionsSchema = object({
|
|
@@ -23994,13 +25119,14 @@ var SuggestSharesResultSchema = object({
|
|
|
23994
25119
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
23995
25120
|
});
|
|
23996
25121
|
/**
|
|
23997
|
-
* Where the node and device shares come from (D750, D755).
|
|
23998
|
-
* - `
|
|
23999
|
-
*
|
|
24000
|
-
*
|
|
24001
|
-
*
|
|
24002
|
-
*
|
|
24003
|
-
*
|
|
25122
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25123
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25124
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25125
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25126
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25127
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25128
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25129
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24004
25130
|
* - `manual` — the operator's stored sliders.
|
|
24005
25131
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24006
25132
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24049,6 +25175,362 @@ var EffectiveSharesSchema = object({
|
|
|
24049
25175
|
nodeWeights: record(string(), number()),
|
|
24050
25176
|
deviceWeights: record(string(), record(string(), number()))
|
|
24051
25177
|
});
|
|
25178
|
+
/**
|
|
25179
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25180
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25181
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25182
|
+
* shares read.
|
|
25183
|
+
*
|
|
25184
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25185
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25186
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25187
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25188
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25189
|
+
*
|
|
25190
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25191
|
+
* cross a process at frame rate, D9):
|
|
25192
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25193
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25194
|
+
* interval;
|
|
25195
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25196
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25197
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25198
|
+
* CPU, RAM or the event loop give out.
|
|
25199
|
+
*/
|
|
25200
|
+
/** Defaults and bounds, one place. */
|
|
25201
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25202
|
+
fpsPerStream: 10,
|
|
25203
|
+
budgetMinutes: 45,
|
|
25204
|
+
minBudgetMinutes: 10,
|
|
25205
|
+
maxBudgetMinutes: 120,
|
|
25206
|
+
/** A result older than this no longer beats the table. */
|
|
25207
|
+
staleAfterDays: 30,
|
|
25208
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25209
|
+
settleSec: 5,
|
|
25210
|
+
/** Accounted window per ramp step. */
|
|
25211
|
+
measureSec: 20,
|
|
25212
|
+
/** Longest the drain may take before the run is refused. */
|
|
25213
|
+
drainTimeoutSec: 120,
|
|
25214
|
+
/** Candidate models per device in one run. */
|
|
25215
|
+
maxModelsPerDevice: 6
|
|
25216
|
+
};
|
|
25217
|
+
/** The two measurements a run can make. */
|
|
25218
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25219
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25220
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25221
|
+
deviceKey: string().min(1),
|
|
25222
|
+
/**
|
|
25223
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25224
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25225
|
+
*/
|
|
25226
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25227
|
+
});
|
|
25228
|
+
/** What the operator confirmed. */
|
|
25229
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25230
|
+
nodeId: string().min(1),
|
|
25231
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25232
|
+
/** Which measurements run. At least one. */
|
|
25233
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25234
|
+
/**
|
|
25235
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25236
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25237
|
+
* detector always runs.
|
|
25238
|
+
*/
|
|
25239
|
+
steps: array(string().min(1)).default([]),
|
|
25240
|
+
/** Offered rate of one stream / session. */
|
|
25241
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25242
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25243
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25244
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25245
|
+
keepDownloadedModels: boolean().default(false),
|
|
25246
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25247
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25248
|
+
});
|
|
25249
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25250
|
+
kind: _enum([
|
|
25251
|
+
"benchmark-active",
|
|
25252
|
+
"node-offline",
|
|
25253
|
+
"unknown-device",
|
|
25254
|
+
"no-phase",
|
|
25255
|
+
"insufficient-headroom"
|
|
25256
|
+
]),
|
|
25257
|
+
detail: string(),
|
|
25258
|
+
overridable: boolean()
|
|
25259
|
+
});
|
|
25260
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25261
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25262
|
+
deviceId: number(),
|
|
25263
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25264
|
+
placedOnNode: boolean(),
|
|
25265
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25266
|
+
pinnedToNode: boolean()
|
|
25267
|
+
});
|
|
25268
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25269
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25270
|
+
deviceId: number(),
|
|
25271
|
+
reason: literal("only-frame-source")
|
|
25272
|
+
});
|
|
25273
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25274
|
+
nodeId: string(),
|
|
25275
|
+
online: boolean(),
|
|
25276
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25277
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25278
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25279
|
+
estimatedDurationMs: number(),
|
|
25280
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25281
|
+
budgetMs: number(),
|
|
25282
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25283
|
+
steps: array(string()).readonly(),
|
|
25284
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25285
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25286
|
+
headroom: object({
|
|
25287
|
+
sessionsNow: number(),
|
|
25288
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25289
|
+
}),
|
|
25290
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25291
|
+
canStart: boolean()
|
|
25292
|
+
});
|
|
25293
|
+
/** Where the measuring runner is. */
|
|
25294
|
+
var NodeBenchProgressSchema = object({
|
|
25295
|
+
phase: _enum([
|
|
25296
|
+
"preparing",
|
|
25297
|
+
"device",
|
|
25298
|
+
"pipeline",
|
|
25299
|
+
"cleanup"
|
|
25300
|
+
]),
|
|
25301
|
+
deviceKey: string().nullable(),
|
|
25302
|
+
modelId: string().nullable(),
|
|
25303
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25304
|
+
load: number().nullable(),
|
|
25305
|
+
cellsDone: number(),
|
|
25306
|
+
cellsTotal: number(),
|
|
25307
|
+
message: string()
|
|
25308
|
+
});
|
|
25309
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25310
|
+
var NodeBenchLimitSchema = _enum([
|
|
25311
|
+
"p95",
|
|
25312
|
+
"drops",
|
|
25313
|
+
"errors",
|
|
25314
|
+
"stall",
|
|
25315
|
+
"cpu",
|
|
25316
|
+
"ram",
|
|
25317
|
+
"none"
|
|
25318
|
+
]);
|
|
25319
|
+
var NodeBenchRampStepSchema = object({
|
|
25320
|
+
load: number(),
|
|
25321
|
+
pass: boolean(),
|
|
25322
|
+
p95Ms: number(),
|
|
25323
|
+
dropRatio: number(),
|
|
25324
|
+
/** Completed frames per second over the accounted window. */
|
|
25325
|
+
fps: number(),
|
|
25326
|
+
cpuPct: number().nullable(),
|
|
25327
|
+
ramFreePct: number().nullable(),
|
|
25328
|
+
failReasons: array(string()).readonly()
|
|
25329
|
+
});
|
|
25330
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25331
|
+
phase: literal("device"),
|
|
25332
|
+
deviceKey: string(),
|
|
25333
|
+
modelId: string(),
|
|
25334
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25335
|
+
p50Ms: number(),
|
|
25336
|
+
p95Ms: number(),
|
|
25337
|
+
p99Ms: number(),
|
|
25338
|
+
/** Frames per second sustained at the last passing step. */
|
|
25339
|
+
fps: number(),
|
|
25340
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25341
|
+
kMax: number(),
|
|
25342
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25343
|
+
/** First call (model load + warm-up). */
|
|
25344
|
+
warmupMs: number(),
|
|
25345
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25346
|
+
}), object({
|
|
25347
|
+
phase: literal("pipeline"),
|
|
25348
|
+
deviceKey: string(),
|
|
25349
|
+
modelId: string(),
|
|
25350
|
+
steps: array(string()).readonly(),
|
|
25351
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25352
|
+
maxSessions: number(),
|
|
25353
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25354
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25355
|
+
stepsFired: array(string()).readonly(),
|
|
25356
|
+
warmupMs: number(),
|
|
25357
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25358
|
+
})]);
|
|
25359
|
+
/**
|
|
25360
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25361
|
+
* the node no longer beats the table.
|
|
25362
|
+
*/
|
|
25363
|
+
var NodeBenchFingerprintSchema = object({
|
|
25364
|
+
pipelineVersion: string().nullable(),
|
|
25365
|
+
cpuModel: string().nullable(),
|
|
25366
|
+
ramGb: number().nullable(),
|
|
25367
|
+
os: string().nullable(),
|
|
25368
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25369
|
+
pools: record(string(), object({
|
|
25370
|
+
runtime: string(),
|
|
25371
|
+
numWorkers: number(),
|
|
25372
|
+
concurrency: number(),
|
|
25373
|
+
batchMode: string()
|
|
25374
|
+
})).default({})
|
|
25375
|
+
});
|
|
25376
|
+
/** The frames the run used. */
|
|
25377
|
+
var NodeBenchClipSchema = object({
|
|
25378
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25379
|
+
id: string(),
|
|
25380
|
+
revision: string().nullable(),
|
|
25381
|
+
frames: number(),
|
|
25382
|
+
width: number(),
|
|
25383
|
+
height: number()
|
|
25384
|
+
});
|
|
25385
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25386
|
+
runId: string().min(1),
|
|
25387
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25388
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25389
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25390
|
+
steps: array(string()).default([]),
|
|
25391
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25392
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25393
|
+
deadlineAtMs: number(),
|
|
25394
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25395
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25396
|
+
keepDownloadedModels: boolean().default(false)
|
|
25397
|
+
});
|
|
25398
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25399
|
+
"running",
|
|
25400
|
+
"done",
|
|
25401
|
+
"failed",
|
|
25402
|
+
"aborted"
|
|
25403
|
+
]);
|
|
25404
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25405
|
+
runId: string(),
|
|
25406
|
+
nodeId: string(),
|
|
25407
|
+
state: NodeBenchRunnerStateSchema,
|
|
25408
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25409
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25410
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25411
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25412
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25413
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25414
|
+
activeCameraIds: array(number()).readonly(),
|
|
25415
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25416
|
+
deletedModels: array(string()).readonly(),
|
|
25417
|
+
error: string().nullable(),
|
|
25418
|
+
startedAtMs: number(),
|
|
25419
|
+
finishedAtMs: number().nullable()
|
|
25420
|
+
});
|
|
25421
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25422
|
+
"draining",
|
|
25423
|
+
"measuring",
|
|
25424
|
+
"restoring",
|
|
25425
|
+
"done",
|
|
25426
|
+
"failed",
|
|
25427
|
+
"aborted"
|
|
25428
|
+
]);
|
|
25429
|
+
/** Why a run ended. */
|
|
25430
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25431
|
+
"completed",
|
|
25432
|
+
"operator-abort",
|
|
25433
|
+
"deadline",
|
|
25434
|
+
"node-lost",
|
|
25435
|
+
"runner-lost",
|
|
25436
|
+
"hub-restart",
|
|
25437
|
+
"drain-timeout",
|
|
25438
|
+
"failed"
|
|
25439
|
+
]);
|
|
25440
|
+
var NodeBenchmarkRunSchema = object({
|
|
25441
|
+
runId: string(),
|
|
25442
|
+
nodeId: string(),
|
|
25443
|
+
state: NodeBenchmarkStateSchema,
|
|
25444
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25445
|
+
startedAtMs: number(),
|
|
25446
|
+
deadlineAtMs: number(),
|
|
25447
|
+
finishedAtMs: number().nullable(),
|
|
25448
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25449
|
+
error: string().nullable(),
|
|
25450
|
+
/** Cameras moved off the node for the run. */
|
|
25451
|
+
moved: array(number()).readonly(),
|
|
25452
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25453
|
+
staying: array(number()).readonly(),
|
|
25454
|
+
/** Something else ran on the node's pools during the run. */
|
|
25455
|
+
contaminated: boolean(),
|
|
25456
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25457
|
+
resultIds: array(string()).readonly()
|
|
25458
|
+
});
|
|
25459
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25460
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25461
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25462
|
+
modeNodeId: string().nullable(),
|
|
25463
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25464
|
+
});
|
|
25465
|
+
/**
|
|
25466
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25467
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25468
|
+
* ends, never by anyone else.
|
|
25469
|
+
*/
|
|
25470
|
+
var NodeBenchmarkResultSchema = object({
|
|
25471
|
+
id: string(),
|
|
25472
|
+
runId: string(),
|
|
25473
|
+
nodeId: string(),
|
|
25474
|
+
cell: NodeBenchCellSchema,
|
|
25475
|
+
fpsPerStream: number(),
|
|
25476
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25477
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25478
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25479
|
+
contaminated: boolean(),
|
|
25480
|
+
stayingCameras: array(number()).readonly(),
|
|
25481
|
+
/** The run ended early; the cell itself completed. */
|
|
25482
|
+
partialRun: boolean(),
|
|
25483
|
+
measuredAtMs: number()
|
|
25484
|
+
});
|
|
25485
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25486
|
+
nodeId: string().optional(),
|
|
25487
|
+
deviceKey: string().optional()
|
|
25488
|
+
});
|
|
25489
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25490
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25491
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25492
|
+
standing: _enum([
|
|
25493
|
+
"fresh",
|
|
25494
|
+
"stale",
|
|
25495
|
+
"superseded"
|
|
25496
|
+
]),
|
|
25497
|
+
staleWhy: _enum([
|
|
25498
|
+
"age",
|
|
25499
|
+
"runtime",
|
|
25500
|
+
"pool-tuning"
|
|
25501
|
+
]).nullable()
|
|
25502
|
+
});
|
|
25503
|
+
object({
|
|
25504
|
+
runId: string(),
|
|
25505
|
+
nodeId: string(),
|
|
25506
|
+
startedAtMs: number(),
|
|
25507
|
+
deadlineAtMs: number(),
|
|
25508
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25509
|
+
moved: array(number()).readonly(),
|
|
25510
|
+
staying: array(number()).readonly()
|
|
25511
|
+
});
|
|
25512
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25513
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25514
|
+
nodeId: string(),
|
|
25515
|
+
reachable: boolean(),
|
|
25516
|
+
devices: array(object({
|
|
25517
|
+
deviceKey: string(),
|
|
25518
|
+
enabled: boolean(),
|
|
25519
|
+
available: boolean(),
|
|
25520
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25521
|
+
suggested: array(string()).readonly(),
|
|
25522
|
+
/** Every root detector the device has a build for. */
|
|
25523
|
+
all: array(string()).readonly(),
|
|
25524
|
+
/** The model the device runs now, when pinned. */
|
|
25525
|
+
currentModelId: string().nullable()
|
|
25526
|
+
})).readonly(),
|
|
25527
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25528
|
+
steps: array(object({
|
|
25529
|
+
id: string(),
|
|
25530
|
+
name: string(),
|
|
25531
|
+
slot: string()
|
|
25532
|
+
})).readonly()
|
|
25533
|
+
});
|
|
24052
25534
|
object({
|
|
24053
25535
|
activeCameras: number(),
|
|
24054
25536
|
throttledCameras: number(),
|
|
@@ -25137,7 +26619,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25137
26619
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25138
26620
|
deviceId: number(),
|
|
25139
26621
|
trackId: string()
|
|
25140
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26622
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26623
|
+
accepted: literal(true),
|
|
26624
|
+
runId: string()
|
|
26625
|
+
}), {
|
|
26626
|
+
kind: "mutation",
|
|
26627
|
+
auth: "admin"
|
|
26628
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
26629
|
+
kind: "mutation",
|
|
26630
|
+
auth: "admin"
|
|
26631
|
+
});
|
|
25141
26632
|
var CameraPipelineConfigSchema = object({
|
|
25142
26633
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25143
26634
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -25776,6 +27267,21 @@ method(object({
|
|
|
25776
27267
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
25777
27268
|
kind: "mutation",
|
|
25778
27269
|
auth: "admin"
|
|
27270
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27271
|
+
kind: literal("started"),
|
|
27272
|
+
runId: string()
|
|
27273
|
+
}), object({
|
|
27274
|
+
kind: literal("refused"),
|
|
27275
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27276
|
+
})]), {
|
|
27277
|
+
kind: "mutation",
|
|
27278
|
+
auth: "admin"
|
|
27279
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27280
|
+
kind: "mutation",
|
|
27281
|
+
auth: "admin"
|
|
27282
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27283
|
+
kind: "mutation",
|
|
27284
|
+
auth: "admin"
|
|
25779
27285
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25780
27286
|
deviceId: number(),
|
|
25781
27287
|
addonId: string(),
|
|
@@ -30892,6 +32398,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
30892
32398
|
enabled: boolean().optional(),
|
|
30893
32399
|
info: record(string(), unknown()).optional(),
|
|
30894
32400
|
settings: record(string(), unknown()).optional(),
|
|
32401
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
32402
|
+
* the keychain, not the table (D787). */
|
|
32403
|
+
secretKeys: array(string()).optional(),
|
|
30895
32404
|
skipRestart: boolean().optional()
|
|
30896
32405
|
});
|
|
30897
32406
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -30915,7 +32424,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
30915
32424
|
auth: "admin"
|
|
30916
32425
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
30917
32426
|
id: string(),
|
|
30918
|
-
settings: record(string(), unknown())
|
|
32427
|
+
settings: record(string(), unknown()),
|
|
32428
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
32429
|
+
secretKeys: array(string()).optional()
|
|
30919
32430
|
}), object({ success: boolean() }), {
|
|
30920
32431
|
kind: "mutation",
|
|
30921
32432
|
auth: "admin"
|
|
@@ -39620,6 +41131,90 @@ Object.freeze({
|
|
|
39620
41131
|
addonId: null,
|
|
39621
41132
|
access: "create"
|
|
39622
41133
|
},
|
|
41134
|
+
"keychain.delete": {
|
|
41135
|
+
capName: "keychain",
|
|
41136
|
+
capScope: "system",
|
|
41137
|
+
addonId: null,
|
|
41138
|
+
access: "delete"
|
|
41139
|
+
},
|
|
41140
|
+
"keychain.getState": {
|
|
41141
|
+
capName: "keychain",
|
|
41142
|
+
capScope: "system",
|
|
41143
|
+
addonId: null,
|
|
41144
|
+
access: "view"
|
|
41145
|
+
},
|
|
41146
|
+
"keychain.listMeta": {
|
|
41147
|
+
capName: "keychain",
|
|
41148
|
+
capScope: "system",
|
|
41149
|
+
addonId: null,
|
|
41150
|
+
access: "view"
|
|
41151
|
+
},
|
|
41152
|
+
"keychain.put": {
|
|
41153
|
+
capName: "keychain",
|
|
41154
|
+
capScope: "system",
|
|
41155
|
+
addonId: null,
|
|
41156
|
+
access: "create"
|
|
41157
|
+
},
|
|
41158
|
+
"keychain.resolve": {
|
|
41159
|
+
capName: "keychain",
|
|
41160
|
+
capScope: "system",
|
|
41161
|
+
addonId: null,
|
|
41162
|
+
access: "view"
|
|
41163
|
+
},
|
|
41164
|
+
"keychainAdmin.deleteOrphans": {
|
|
41165
|
+
capName: "keychain-admin",
|
|
41166
|
+
capScope: "system",
|
|
41167
|
+
addonId: null,
|
|
41168
|
+
access: "delete"
|
|
41169
|
+
},
|
|
41170
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
41171
|
+
capName: "keychain-admin",
|
|
41172
|
+
capScope: "system",
|
|
41173
|
+
addonId: null,
|
|
41174
|
+
access: "create"
|
|
41175
|
+
},
|
|
41176
|
+
"keychainAdmin.listAudit": {
|
|
41177
|
+
capName: "keychain-admin",
|
|
41178
|
+
capScope: "system",
|
|
41179
|
+
addonId: null,
|
|
41180
|
+
access: "view"
|
|
41181
|
+
},
|
|
41182
|
+
"keychainAdmin.listSecrets": {
|
|
41183
|
+
capName: "keychain-admin",
|
|
41184
|
+
capScope: "system",
|
|
41185
|
+
addonId: null,
|
|
41186
|
+
access: "view"
|
|
41187
|
+
},
|
|
41188
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
41189
|
+
capName: "keychain-admin",
|
|
41190
|
+
capScope: "system",
|
|
41191
|
+
addonId: null,
|
|
41192
|
+
access: "delete"
|
|
41193
|
+
},
|
|
41194
|
+
"keychainAdmin.resetKeychain": {
|
|
41195
|
+
capName: "keychain-admin",
|
|
41196
|
+
capScope: "system",
|
|
41197
|
+
addonId: null,
|
|
41198
|
+
access: "delete"
|
|
41199
|
+
},
|
|
41200
|
+
"keychainAdmin.reveal": {
|
|
41201
|
+
capName: "keychain-admin",
|
|
41202
|
+
capScope: "system",
|
|
41203
|
+
addonId: null,
|
|
41204
|
+
access: "create"
|
|
41205
|
+
},
|
|
41206
|
+
"keychainAdmin.rotateMasterKey": {
|
|
41207
|
+
capName: "keychain-admin",
|
|
41208
|
+
capScope: "system",
|
|
41209
|
+
addonId: null,
|
|
41210
|
+
access: "create"
|
|
41211
|
+
},
|
|
41212
|
+
"keychainAdmin.status": {
|
|
41213
|
+
capName: "keychain-admin",
|
|
41214
|
+
capScope: "system",
|
|
41215
|
+
addonId: null,
|
|
41216
|
+
access: "view"
|
|
41217
|
+
},
|
|
39623
41218
|
"lawnMowerControl.dock": {
|
|
39624
41219
|
capName: "lawn-mower-control",
|
|
39625
41220
|
capScope: "device",
|
|
@@ -40994,6 +42589,18 @@ Object.freeze({
|
|
|
40994
42589
|
addonId: null,
|
|
40995
42590
|
access: "create"
|
|
40996
42591
|
},
|
|
42592
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
42593
|
+
capName: "pipeline-analytics",
|
|
42594
|
+
capScope: "device",
|
|
42595
|
+
addonId: null,
|
|
42596
|
+
access: "create"
|
|
42597
|
+
},
|
|
42598
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
42599
|
+
capName: "pipeline-analytics",
|
|
42600
|
+
capScope: "device",
|
|
42601
|
+
addonId: null,
|
|
42602
|
+
access: "create"
|
|
42603
|
+
},
|
|
40997
42604
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
40998
42605
|
capName: "pipeline-analytics",
|
|
40999
42606
|
capScope: "device",
|
|
@@ -41042,12 +42649,24 @@ Object.freeze({
|
|
|
41042
42649
|
addonId: null,
|
|
41043
42650
|
access: "view"
|
|
41044
42651
|
},
|
|
42652
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
42653
|
+
capName: "pipeline-analytics",
|
|
42654
|
+
capScope: "device",
|
|
42655
|
+
addonId: null,
|
|
42656
|
+
access: "create"
|
|
42657
|
+
},
|
|
41045
42658
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
41046
42659
|
capName: "pipeline-analytics",
|
|
41047
42660
|
capScope: "device",
|
|
41048
42661
|
addonId: null,
|
|
41049
42662
|
access: "delete"
|
|
41050
42663
|
},
|
|
42664
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
42665
|
+
capName: "pipeline-analytics",
|
|
42666
|
+
capScope: "device",
|
|
42667
|
+
addonId: null,
|
|
42668
|
+
access: "delete"
|
|
42669
|
+
},
|
|
41051
42670
|
"pipelineAnalytics.deleteTracks": {
|
|
41052
42671
|
capName: "pipeline-analytics",
|
|
41053
42672
|
capScope: "device",
|
|
@@ -41252,6 +42871,24 @@ Object.freeze({
|
|
|
41252
42871
|
addonId: null,
|
|
41253
42872
|
access: "view"
|
|
41254
42873
|
},
|
|
42874
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
42875
|
+
capName: "pipeline-analytics",
|
|
42876
|
+
capScope: "device",
|
|
42877
|
+
addonId: null,
|
|
42878
|
+
access: "view"
|
|
42879
|
+
},
|
|
42880
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
42881
|
+
capName: "pipeline-analytics",
|
|
42882
|
+
capScope: "device",
|
|
42883
|
+
addonId: null,
|
|
42884
|
+
access: "view"
|
|
42885
|
+
},
|
|
42886
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
42887
|
+
capName: "pipeline-analytics",
|
|
42888
|
+
capScope: "device",
|
|
42889
|
+
addonId: null,
|
|
42890
|
+
access: "view"
|
|
42891
|
+
},
|
|
41255
42892
|
"pipelineAnalytics.listRetrainFrames": {
|
|
41256
42893
|
capName: "pipeline-analytics",
|
|
41257
42894
|
capScope: "device",
|
|
@@ -41300,6 +42937,12 @@ Object.freeze({
|
|
|
41300
42937
|
addonId: null,
|
|
41301
42938
|
access: "create"
|
|
41302
42939
|
},
|
|
42940
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
42941
|
+
capName: "pipeline-analytics",
|
|
42942
|
+
capScope: "device",
|
|
42943
|
+
addonId: null,
|
|
42944
|
+
access: "create"
|
|
42945
|
+
},
|
|
41303
42946
|
"pipelineAnalytics.pruneEvents": {
|
|
41304
42947
|
capName: "pipeline-analytics",
|
|
41305
42948
|
capScope: "device",
|
|
@@ -41354,6 +42997,18 @@ Object.freeze({
|
|
|
41354
42997
|
addonId: null,
|
|
41355
42998
|
access: "create"
|
|
41356
42999
|
},
|
|
43000
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
43001
|
+
capName: "pipeline-analytics",
|
|
43002
|
+
capScope: "device",
|
|
43003
|
+
addonId: null,
|
|
43004
|
+
access: "delete"
|
|
43005
|
+
},
|
|
43006
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
43007
|
+
capName: "pipeline-analytics",
|
|
43008
|
+
capScope: "device",
|
|
43009
|
+
addonId: null,
|
|
43010
|
+
access: "create"
|
|
43011
|
+
},
|
|
41357
43012
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
41358
43013
|
capName: "pipeline-analytics",
|
|
41359
43014
|
capScope: "device",
|
|
@@ -41642,6 +43297,12 @@ Object.freeze({
|
|
|
41642
43297
|
addonId: null,
|
|
41643
43298
|
access: "view"
|
|
41644
43299
|
},
|
|
43300
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
43301
|
+
capName: "pipeline-orchestrator",
|
|
43302
|
+
capScope: "system",
|
|
43303
|
+
addonId: null,
|
|
43304
|
+
access: "create"
|
|
43305
|
+
},
|
|
41645
43306
|
"pipelineOrchestrator.applyAutoTune": {
|
|
41646
43307
|
capName: "pipeline-orchestrator",
|
|
41647
43308
|
capScope: "system",
|
|
@@ -41666,6 +43327,12 @@ Object.freeze({
|
|
|
41666
43327
|
addonId: null,
|
|
41667
43328
|
access: "create"
|
|
41668
43329
|
},
|
|
43330
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
43331
|
+
capName: "pipeline-orchestrator",
|
|
43332
|
+
capScope: "system",
|
|
43333
|
+
addonId: null,
|
|
43334
|
+
access: "delete"
|
|
43335
|
+
},
|
|
41669
43336
|
"pipelineOrchestrator.getAgentLoad": {
|
|
41670
43337
|
capName: "pipeline-orchestrator",
|
|
41671
43338
|
capScope: "system",
|
|
@@ -41774,6 +43441,24 @@ Object.freeze({
|
|
|
41774
43441
|
addonId: null,
|
|
41775
43442
|
access: "view"
|
|
41776
43443
|
},
|
|
43444
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
43445
|
+
capName: "pipeline-orchestrator",
|
|
43446
|
+
capScope: "system",
|
|
43447
|
+
addonId: null,
|
|
43448
|
+
access: "view"
|
|
43449
|
+
},
|
|
43450
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
43451
|
+
capName: "pipeline-orchestrator",
|
|
43452
|
+
capScope: "system",
|
|
43453
|
+
addonId: null,
|
|
43454
|
+
access: "view"
|
|
43455
|
+
},
|
|
43456
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
43457
|
+
capName: "pipeline-orchestrator",
|
|
43458
|
+
capScope: "system",
|
|
43459
|
+
addonId: null,
|
|
43460
|
+
access: "view"
|
|
43461
|
+
},
|
|
41777
43462
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
41778
43463
|
capName: "pipeline-orchestrator",
|
|
41779
43464
|
capScope: "system",
|
|
@@ -41816,6 +43501,12 @@ Object.freeze({
|
|
|
41816
43501
|
addonId: null,
|
|
41817
43502
|
access: "view"
|
|
41818
43503
|
},
|
|
43504
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
43505
|
+
capName: "pipeline-orchestrator",
|
|
43506
|
+
capScope: "system",
|
|
43507
|
+
addonId: null,
|
|
43508
|
+
access: "view"
|
|
43509
|
+
},
|
|
41819
43510
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
41820
43511
|
capName: "pipeline-orchestrator",
|
|
41821
43512
|
capScope: "system",
|
|
@@ -41960,6 +43651,12 @@ Object.freeze({
|
|
|
41960
43651
|
addonId: null,
|
|
41961
43652
|
access: "create"
|
|
41962
43653
|
},
|
|
43654
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
43655
|
+
capName: "pipeline-orchestrator",
|
|
43656
|
+
capScope: "system",
|
|
43657
|
+
addonId: null,
|
|
43658
|
+
access: "create"
|
|
43659
|
+
},
|
|
41963
43660
|
"pipelineOrchestrator.suggestShares": {
|
|
41964
43661
|
capName: "pipeline-orchestrator",
|
|
41965
43662
|
capScope: "system",
|
|
@@ -41978,6 +43675,12 @@ Object.freeze({
|
|
|
41978
43675
|
addonId: null,
|
|
41979
43676
|
access: "create"
|
|
41980
43677
|
},
|
|
43678
|
+
"pipelineRunner.abortNodeBench": {
|
|
43679
|
+
capName: "pipeline-runner",
|
|
43680
|
+
capScope: "system",
|
|
43681
|
+
addonId: null,
|
|
43682
|
+
access: "create"
|
|
43683
|
+
},
|
|
41981
43684
|
"pipelineRunner.attachCamera": {
|
|
41982
43685
|
capName: "pipeline-runner",
|
|
41983
43686
|
capScope: "system",
|
|
@@ -42026,6 +43729,12 @@ Object.freeze({
|
|
|
42026
43729
|
addonId: null,
|
|
42027
43730
|
access: "view"
|
|
42028
43731
|
},
|
|
43732
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
43733
|
+
capName: "pipeline-runner",
|
|
43734
|
+
capScope: "system",
|
|
43735
|
+
addonId: null,
|
|
43736
|
+
access: "view"
|
|
43737
|
+
},
|
|
42029
43738
|
"pipelineRunner.getParkedTrackFrame": {
|
|
42030
43739
|
capName: "pipeline-runner",
|
|
42031
43740
|
capScope: "system",
|
|
@@ -42068,6 +43777,12 @@ Object.freeze({
|
|
|
42068
43777
|
addonId: null,
|
|
42069
43778
|
access: "create"
|
|
42070
43779
|
},
|
|
43780
|
+
"pipelineRunner.startNodeBench": {
|
|
43781
|
+
capName: "pipeline-runner",
|
|
43782
|
+
capScope: "system",
|
|
43783
|
+
addonId: null,
|
|
43784
|
+
access: "create"
|
|
43785
|
+
},
|
|
42071
43786
|
"plateGallery.assignPlate": {
|
|
42072
43787
|
capName: "plate-gallery",
|
|
42073
43788
|
capScope: "system",
|
|
@@ -47001,6 +48716,11 @@ Object.freeze({
|
|
|
47001
48716
|
form: "single",
|
|
47002
48717
|
optional: false
|
|
47003
48718
|
}],
|
|
48719
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
48720
|
+
name: "deviceId",
|
|
48721
|
+
form: "single",
|
|
48722
|
+
optional: false
|
|
48723
|
+
}],
|
|
47004
48724
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
47005
48725
|
name: "deviceId",
|
|
47006
48726
|
form: "single",
|
|
@@ -47191,6 +48911,11 @@ Object.freeze({
|
|
|
47191
48911
|
form: "single",
|
|
47192
48912
|
optional: false
|
|
47193
48913
|
}],
|
|
48914
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
48915
|
+
name: "deviceId",
|
|
48916
|
+
form: "single",
|
|
48917
|
+
optional: false
|
|
48918
|
+
}],
|
|
47194
48919
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
47195
48920
|
name: "deviceId",
|
|
47196
48921
|
form: "single",
|
|
@@ -49297,14 +51022,4 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
|
|
|
49297
51022
|
var MB = 1024 * 1024;
|
|
49298
51023
|
1024 * MB, 3072 * MB;
|
|
49299
51024
|
//#endregion
|
|
49300
|
-
|
|
49301
|
-
async function hubBrowserOrigin(localNetwork, logger) {
|
|
49302
|
-
try {
|
|
49303
|
-
return (await localNetwork.getAddresses.query()).roles.publicEndpoint.resolved;
|
|
49304
|
-
} catch (err) {
|
|
49305
|
-
logger.warn("hub address unavailable from local-network — using the localhost default", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
49306
|
-
return null;
|
|
49307
|
-
}
|
|
49308
|
-
}
|
|
49309
|
-
//#endregion
|
|
49310
|
-
export { buildAddonRouteProvider as a, userPasskeysCapability as c, array as d, boolean as f, string as h, authProviderCapability as i, errMsg as l, object as m, addonRoutesCapability as n, isDisplayIconKey as o, number as p, addonWidgetsSourceCapability as r, loginMethodCapability as s, hubBrowserOrigin as t, BaseAddon as u };
|
|
51025
|
+
export { isDisplayIconKey as a, errMsg as c, boolean as d, number as f, buildAddonRouteProvider as i, BaseAddon as l, string as m, addonWidgetsSourceCapability as n, loginMethodCapability as o, object as p, authProviderCapability as r, userPasskeysCapability as s, addonRoutesCapability as t, array as u };
|