@camstack/addon-export-google 0.1.88 → 0.1.89
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/export-google.addon.js +1780 -55
- package/dist/export-google.addon.mjs +1780 -55
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@ function createApiDeviceGateway(deps) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region ../types/dist/event-category-
|
|
76
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
77
77
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
78
78
|
EventCategory["SystemBoot"] = "system.boot";
|
|
79
79
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -152,6 +152,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
152
152
|
*/
|
|
153
153
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
154
154
|
/**
|
|
155
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
156
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
157
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
158
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
159
|
+
*/
|
|
160
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
161
|
+
/**
|
|
155
162
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
156
163
|
* transitions from `failed` back to `healthy` (typically via the
|
|
157
164
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5444,7 +5451,7 @@ var ZodIssueCode = {
|
|
|
5444
5451
|
var ZodFirstPartyTypeKind;
|
|
5445
5452
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5446
5453
|
//#endregion
|
|
5447
|
-
//#region ../types/dist/sleep-
|
|
5454
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5448
5455
|
/**
|
|
5449
5456
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5450
5457
|
* window to float samples (D455).
|
|
@@ -5523,6 +5530,97 @@ function buildAlawTable() {
|
|
|
5523
5530
|
}
|
|
5524
5531
|
buildUlawTable();
|
|
5525
5532
|
buildAlawTable();
|
|
5533
|
+
/** Is this field's stored value a credential? */
|
|
5534
|
+
function isSecretConfigField(field) {
|
|
5535
|
+
if (field.type === "password") return true;
|
|
5536
|
+
return "secret" in field && field.secret === true;
|
|
5537
|
+
}
|
|
5538
|
+
/**
|
|
5539
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5540
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5541
|
+
*/
|
|
5542
|
+
function isKeychainStoredField(field) {
|
|
5543
|
+
if (!isSecretConfigField(field)) return false;
|
|
5544
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5545
|
+
return !("storage" in field && field.storage === "inline");
|
|
5546
|
+
}
|
|
5547
|
+
/**
|
|
5548
|
+
* What a settings blob holds where a secret used to be.
|
|
5549
|
+
*
|
|
5550
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5551
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5552
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5553
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5554
|
+
*
|
|
5555
|
+
* The same shapes travel to and from the admin UI:
|
|
5556
|
+
*
|
|
5557
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5558
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5559
|
+
* value is set, never the value.
|
|
5560
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5561
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5562
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5563
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5564
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5565
|
+
*
|
|
5566
|
+
* Pure and browser-safe.
|
|
5567
|
+
*/
|
|
5568
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5569
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5570
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5571
|
+
function isRecord$1(value) {
|
|
5572
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5573
|
+
}
|
|
5574
|
+
function makeSecretMarker(ref) {
|
|
5575
|
+
return {
|
|
5576
|
+
$secret: ref,
|
|
5577
|
+
v: 1
|
|
5578
|
+
};
|
|
5579
|
+
}
|
|
5580
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5581
|
+
function isSecretMarker(value) {
|
|
5582
|
+
if (!isRecord$1(value)) return false;
|
|
5583
|
+
const ref = value["$secret"];
|
|
5584
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5585
|
+
}
|
|
5586
|
+
function isSecretClear(value) {
|
|
5587
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5588
|
+
}
|
|
5589
|
+
/**
|
|
5590
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5591
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5592
|
+
* survives this function.
|
|
5593
|
+
*/
|
|
5594
|
+
function toSecretFieldView(stored) {
|
|
5595
|
+
if (isSecretMarker(stored)) return {
|
|
5596
|
+
$secret: stored.$secret,
|
|
5597
|
+
v: 1,
|
|
5598
|
+
set: true
|
|
5599
|
+
};
|
|
5600
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5601
|
+
$secret: null,
|
|
5602
|
+
v: 1,
|
|
5603
|
+
set: true,
|
|
5604
|
+
inline: true
|
|
5605
|
+
};
|
|
5606
|
+
return null;
|
|
5607
|
+
}
|
|
5608
|
+
/**
|
|
5609
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5610
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5611
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5612
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5613
|
+
*/
|
|
5614
|
+
function classifySecretWrite(incoming) {
|
|
5615
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5616
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5617
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5618
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5619
|
+
return {
|
|
5620
|
+
kind: "set",
|
|
5621
|
+
value: incoming
|
|
5622
|
+
};
|
|
5623
|
+
}
|
|
5526
5624
|
Object.fromEntries([
|
|
5527
5625
|
{
|
|
5528
5626
|
id: "overview",
|
|
@@ -5694,33 +5792,19 @@ Object.fromEntries([
|
|
|
5694
5792
|
function isValuelessField(field) {
|
|
5695
5793
|
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";
|
|
5696
5794
|
}
|
|
5697
|
-
|
|
5698
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5699
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5700
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5701
|
-
*
|
|
5702
|
-
* For each leaf field:
|
|
5703
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5704
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5705
|
-
*
|
|
5706
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5707
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5708
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5709
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5710
|
-
*/
|
|
5711
|
-
function hydrateSchema(schema, values) {
|
|
5795
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5712
5796
|
return {
|
|
5713
5797
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5714
5798
|
sections: schema.sections.map((section) => ({
|
|
5715
5799
|
...section,
|
|
5716
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5800
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5717
5801
|
}))
|
|
5718
5802
|
};
|
|
5719
5803
|
}
|
|
5720
|
-
function hydrateField(field, values) {
|
|
5804
|
+
function hydrateField(field, values, options) {
|
|
5721
5805
|
if (isValuelessField(field)) return field;
|
|
5722
5806
|
if (field.type === "group") {
|
|
5723
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5807
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5724
5808
|
return {
|
|
5725
5809
|
...field,
|
|
5726
5810
|
fields: hydratedChildren
|
|
@@ -5729,7 +5813,7 @@ function hydrateField(field, values) {
|
|
|
5729
5813
|
if (field.type === "sub-tabs") {
|
|
5730
5814
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5731
5815
|
...tab,
|
|
5732
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5816
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5733
5817
|
}));
|
|
5734
5818
|
return {
|
|
5735
5819
|
...field,
|
|
@@ -5739,6 +5823,33 @@ function hydrateField(field, values) {
|
|
|
5739
5823
|
const key = field.key;
|
|
5740
5824
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5741
5825
|
const defaultValue = field.default;
|
|
5826
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5827
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5828
|
+
...field,
|
|
5829
|
+
value: toSecretFieldView(storedValue)
|
|
5830
|
+
};
|
|
5831
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5832
|
+
...field,
|
|
5833
|
+
value: null
|
|
5834
|
+
};
|
|
5835
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5836
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5837
|
+
if (secretItemKeys.length > 0) {
|
|
5838
|
+
const rows = storedValue.map((row) => {
|
|
5839
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5840
|
+
const out = { ...row };
|
|
5841
|
+
for (const k of secretItemKeys) {
|
|
5842
|
+
const v = Reflect.get(row, k);
|
|
5843
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5844
|
+
}
|
|
5845
|
+
return out;
|
|
5846
|
+
});
|
|
5847
|
+
return {
|
|
5848
|
+
...field,
|
|
5849
|
+
value: rows
|
|
5850
|
+
};
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5742
5853
|
if (field.multiple) {
|
|
5743
5854
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5744
5855
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5981,6 +6092,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5981
6092
|
}
|
|
5982
6093
|
return out;
|
|
5983
6094
|
}
|
|
6095
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6096
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6097
|
+
function globalSecretScope() {
|
|
6098
|
+
return GLOBAL_SCOPE;
|
|
6099
|
+
}
|
|
6100
|
+
function encodeSegment(value) {
|
|
6101
|
+
return encodeURIComponent(value);
|
|
6102
|
+
}
|
|
6103
|
+
/**
|
|
6104
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6105
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6106
|
+
* `providers[authentik].clientSecret`.
|
|
6107
|
+
*/
|
|
6108
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6109
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6110
|
+
}
|
|
6111
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6112
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6113
|
+
fieldPath;
|
|
6114
|
+
constructor(fieldPath, cause) {
|
|
6115
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6116
|
+
this.fieldPath = fieldPath;
|
|
6117
|
+
this.name = "KeychainWriteRefusedError";
|
|
6118
|
+
}
|
|
6119
|
+
};
|
|
6120
|
+
var KEEP = { kind: "keep" };
|
|
6121
|
+
function isRecord(value) {
|
|
6122
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6123
|
+
}
|
|
6124
|
+
function defaultMintId() {
|
|
6125
|
+
return globalThis.crypto.randomUUID();
|
|
6126
|
+
}
|
|
6127
|
+
/** Every marker ref anywhere under `value`. */
|
|
6128
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6129
|
+
if (isSecretMarker(value)) {
|
|
6130
|
+
out.push(value.$secret);
|
|
6131
|
+
return out;
|
|
6132
|
+
}
|
|
6133
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6134
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6135
|
+
return out;
|
|
6136
|
+
}
|
|
6137
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6138
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6139
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6140
|
+
}
|
|
6141
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6142
|
+
const intent = classifySecretWrite(incoming);
|
|
6143
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6144
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6145
|
+
if (intent.kind === "keep") return KEEP;
|
|
6146
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6147
|
+
if (intent.kind === "clear") {
|
|
6148
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6149
|
+
return {
|
|
6150
|
+
kind: "value",
|
|
6151
|
+
value: null
|
|
6152
|
+
};
|
|
6153
|
+
}
|
|
6154
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6155
|
+
kind: "value",
|
|
6156
|
+
value: stored
|
|
6157
|
+
};
|
|
6158
|
+
try {
|
|
6159
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6160
|
+
} catch (err) {
|
|
6161
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6162
|
+
}
|
|
6163
|
+
return {
|
|
6164
|
+
kind: "value",
|
|
6165
|
+
value: makeSecretMarker(ref)
|
|
6166
|
+
};
|
|
6167
|
+
}
|
|
6168
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6169
|
+
function applyMember(out, key, result, storedParent) {
|
|
6170
|
+
if (result.kind === "value") {
|
|
6171
|
+
out[key] = result.value;
|
|
6172
|
+
return;
|
|
6173
|
+
}
|
|
6174
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6175
|
+
else delete out[key];
|
|
6176
|
+
}
|
|
6177
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6178
|
+
const out = { ...incoming };
|
|
6179
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6180
|
+
return out;
|
|
6181
|
+
}
|
|
6182
|
+
function rowId(row, idKey) {
|
|
6183
|
+
const raw = row[idKey];
|
|
6184
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6185
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6186
|
+
return null;
|
|
6187
|
+
}
|
|
6188
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6189
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6190
|
+
if (!Array.isArray(incoming)) {
|
|
6191
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6192
|
+
return {
|
|
6193
|
+
kind: "value",
|
|
6194
|
+
value: incoming
|
|
6195
|
+
};
|
|
6196
|
+
}
|
|
6197
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6198
|
+
for (const row of storedRows) {
|
|
6199
|
+
const id = rowId(row, node.idKey);
|
|
6200
|
+
if (id !== null) storedById.set(id, row);
|
|
6201
|
+
}
|
|
6202
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6203
|
+
const rows = [];
|
|
6204
|
+
for (const row of incoming) {
|
|
6205
|
+
if (!isRecord(row)) {
|
|
6206
|
+
rows.push(row);
|
|
6207
|
+
continue;
|
|
6208
|
+
}
|
|
6209
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6210
|
+
kept.add(id);
|
|
6211
|
+
const withId = {
|
|
6212
|
+
...row,
|
|
6213
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6214
|
+
};
|
|
6215
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6216
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6217
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6218
|
+
}
|
|
6219
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6220
|
+
return {
|
|
6221
|
+
kind: "value",
|
|
6222
|
+
value: rows
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6226
|
+
switch (node.kind) {
|
|
6227
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6228
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6229
|
+
case "object": {
|
|
6230
|
+
if (!isRecord(incoming)) {
|
|
6231
|
+
if (incoming === void 0) return KEEP;
|
|
6232
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6233
|
+
return {
|
|
6234
|
+
kind: "value",
|
|
6235
|
+
value: incoming
|
|
6236
|
+
};
|
|
6237
|
+
}
|
|
6238
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6239
|
+
return {
|
|
6240
|
+
kind: "value",
|
|
6241
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6242
|
+
};
|
|
6243
|
+
}
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6247
|
+
function splitNodeKey(key) {
|
|
6248
|
+
const at = key.indexOf("@");
|
|
6249
|
+
return at <= 0 ? {
|
|
6250
|
+
base: key,
|
|
6251
|
+
nodeId: null
|
|
6252
|
+
} : {
|
|
6253
|
+
base: key.slice(0, at),
|
|
6254
|
+
nodeId: key.slice(at + 1)
|
|
6255
|
+
};
|
|
6256
|
+
}
|
|
6257
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6258
|
+
async function transformSecretWrite(input) {
|
|
6259
|
+
const deletes = [];
|
|
6260
|
+
const base = {
|
|
6261
|
+
secrets: input.secrets,
|
|
6262
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6263
|
+
deletes,
|
|
6264
|
+
operatorWrite: input.operatorWrite === true
|
|
6265
|
+
};
|
|
6266
|
+
const out = {};
|
|
6267
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6268
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6269
|
+
const node = input.tree.get(baseKey);
|
|
6270
|
+
if (node === void 0) {
|
|
6271
|
+
out[key] = incoming;
|
|
6272
|
+
continue;
|
|
6273
|
+
}
|
|
6274
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6275
|
+
kind: "node",
|
|
6276
|
+
nodeId
|
|
6277
|
+
} : input.scope ?? globalSecretScope();
|
|
6278
|
+
const result = await writeNode({
|
|
6279
|
+
...base,
|
|
6280
|
+
scope
|
|
6281
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6282
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6283
|
+
}
|
|
6284
|
+
return {
|
|
6285
|
+
patch: out,
|
|
6286
|
+
afterWrite: async () => {
|
|
6287
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6288
|
+
try {
|
|
6289
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6290
|
+
return { orphaned: [] };
|
|
6291
|
+
} catch {
|
|
6292
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6293
|
+
}
|
|
6294
|
+
}
|
|
6295
|
+
};
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6299
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6300
|
+
*/
|
|
6301
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6302
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6303
|
+
if (refs.length === 0) return {
|
|
6304
|
+
value,
|
|
6305
|
+
unresolved: []
|
|
6306
|
+
};
|
|
6307
|
+
const answers = await secrets.resolve(refs);
|
|
6308
|
+
const unresolved = [];
|
|
6309
|
+
for (const ref of new Set(refs)) {
|
|
6310
|
+
const answer = answers[ref];
|
|
6311
|
+
if (answer === void 0) unresolved.push({
|
|
6312
|
+
ref,
|
|
6313
|
+
reason: "not-initialized"
|
|
6314
|
+
});
|
|
6315
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6316
|
+
ref,
|
|
6317
|
+
reason: answer.reason
|
|
6318
|
+
});
|
|
6319
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6320
|
+
ref,
|
|
6321
|
+
reason: answer.kind
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
const substitute = (v) => {
|
|
6325
|
+
if (isSecretMarker(v)) {
|
|
6326
|
+
const answer = answers[v.$secret];
|
|
6327
|
+
return answer?.kind === "value" ? {
|
|
6328
|
+
keep: true,
|
|
6329
|
+
value: answer.value
|
|
6330
|
+
} : {
|
|
6331
|
+
keep: false,
|
|
6332
|
+
value: void 0
|
|
6333
|
+
};
|
|
6334
|
+
}
|
|
6335
|
+
if (Array.isArray(v)) {
|
|
6336
|
+
const items = [];
|
|
6337
|
+
for (const item of v) {
|
|
6338
|
+
const s = substitute(item);
|
|
6339
|
+
if (s.keep) items.push(s.value);
|
|
6340
|
+
}
|
|
6341
|
+
return {
|
|
6342
|
+
keep: true,
|
|
6343
|
+
value: items
|
|
6344
|
+
};
|
|
6345
|
+
}
|
|
6346
|
+
if (isRecord(v)) {
|
|
6347
|
+
const out = {};
|
|
6348
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6349
|
+
const s = substitute(child);
|
|
6350
|
+
if (s.keep) out[k] = s.value;
|
|
6351
|
+
}
|
|
6352
|
+
return {
|
|
6353
|
+
keep: true,
|
|
6354
|
+
value: out
|
|
6355
|
+
};
|
|
6356
|
+
}
|
|
6357
|
+
return {
|
|
6358
|
+
keep: true,
|
|
6359
|
+
value: v
|
|
6360
|
+
};
|
|
6361
|
+
};
|
|
6362
|
+
return {
|
|
6363
|
+
value: substitute(value).value,
|
|
6364
|
+
unresolved
|
|
6365
|
+
};
|
|
6366
|
+
}
|
|
6367
|
+
function touchesTree(tree, patch) {
|
|
6368
|
+
if (tree.size === 0) return false;
|
|
6369
|
+
for (const key of Object.keys(patch)) {
|
|
6370
|
+
const at = key.indexOf("@");
|
|
6371
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6372
|
+
}
|
|
6373
|
+
return false;
|
|
6374
|
+
}
|
|
6375
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6376
|
+
async function readStoredAddonBlob(raw) {
|
|
6377
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6378
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6379
|
+
const result = await threeWay.call(raw);
|
|
6380
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6381
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6382
|
+
}
|
|
6383
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6384
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6385
|
+
const serialize = (key, fn) => {
|
|
6386
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6387
|
+
const tail = next.catch(() => void 0);
|
|
6388
|
+
chains.set(key, tail);
|
|
6389
|
+
tail.then(() => {
|
|
6390
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6391
|
+
});
|
|
6392
|
+
return next;
|
|
6393
|
+
};
|
|
6394
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6395
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6396
|
+
return serialize(chainKey, async () => {
|
|
6397
|
+
const stored = await readStored();
|
|
6398
|
+
const result = await transformSecretWrite({
|
|
6399
|
+
tree,
|
|
6400
|
+
secrets: opts.secrets,
|
|
6401
|
+
patch,
|
|
6402
|
+
stored,
|
|
6403
|
+
...scope !== void 0 ? { scope } : {},
|
|
6404
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6405
|
+
});
|
|
6406
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6407
|
+
const { orphaned } = await result.afterWrite();
|
|
6408
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6409
|
+
});
|
|
6410
|
+
};
|
|
6411
|
+
const wrapped = {
|
|
6412
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6413
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6414
|
+
kind: "device",
|
|
6415
|
+
deviceId
|
|
6416
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6417
|
+
};
|
|
6418
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6419
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6420
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6421
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6422
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6423
|
+
} });
|
|
6424
|
+
}
|
|
6425
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6426
|
+
function withSecretAwareSettings(context, opts) {
|
|
6427
|
+
const raw = context.settings;
|
|
6428
|
+
if (raw === void 0) return context;
|
|
6429
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6430
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6431
|
+
if (prop === "settings") return settings;
|
|
6432
|
+
return Reflect.get(target, prop, receiver);
|
|
6433
|
+
} });
|
|
6434
|
+
}
|
|
6435
|
+
var LEAF = { kind: "leaf" };
|
|
6436
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6437
|
+
function collectFields(fields, out) {
|
|
6438
|
+
for (const field of fields) {
|
|
6439
|
+
if (field.type === "group") {
|
|
6440
|
+
collectFields(field.fields, out);
|
|
6441
|
+
continue;
|
|
6442
|
+
}
|
|
6443
|
+
if (field.type === "sub-tabs") {
|
|
6444
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6445
|
+
continue;
|
|
6446
|
+
}
|
|
6447
|
+
if (field.type === "editable-array") {
|
|
6448
|
+
const item = /* @__PURE__ */ new Map();
|
|
6449
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6450
|
+
if (item.size > 0) out.set(field.key, {
|
|
6451
|
+
kind: "array",
|
|
6452
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6453
|
+
item
|
|
6454
|
+
});
|
|
6455
|
+
continue;
|
|
6456
|
+
}
|
|
6457
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6458
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
/** The secret tree a settings schema declares. */
|
|
6462
|
+
function secretTreeFromSchema(schema) {
|
|
6463
|
+
const out = /* @__PURE__ */ new Map();
|
|
6464
|
+
if (schema === null) return out;
|
|
6465
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6466
|
+
return out;
|
|
6467
|
+
}
|
|
6468
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6469
|
+
function parseSecretStatePath(path) {
|
|
6470
|
+
const segments = [];
|
|
6471
|
+
for (const raw of path.split(".")) {
|
|
6472
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6473
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6474
|
+
segments.push(m[2] !== void 0 ? {
|
|
6475
|
+
key: m[1],
|
|
6476
|
+
idKey: m[2]
|
|
6477
|
+
} : { key: m[1] });
|
|
6478
|
+
}
|
|
6479
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6480
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6481
|
+
return segments;
|
|
6482
|
+
}
|
|
6483
|
+
function insert(into, segments) {
|
|
6484
|
+
const [head, ...rest] = segments;
|
|
6485
|
+
if (head === void 0) return;
|
|
6486
|
+
if (rest.length === 0) {
|
|
6487
|
+
into.set(head.key, LEAF);
|
|
6488
|
+
return;
|
|
6489
|
+
}
|
|
6490
|
+
const existing = into.get(head.key);
|
|
6491
|
+
if (head.idKey !== void 0) {
|
|
6492
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6493
|
+
insert(item, rest);
|
|
6494
|
+
into.set(head.key, {
|
|
6495
|
+
kind: "array",
|
|
6496
|
+
idKey: head.idKey,
|
|
6497
|
+
item
|
|
6498
|
+
});
|
|
6499
|
+
return;
|
|
6500
|
+
}
|
|
6501
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6502
|
+
insert(children, rest);
|
|
6503
|
+
into.set(head.key, {
|
|
6504
|
+
kind: "object",
|
|
6505
|
+
children
|
|
6506
|
+
});
|
|
6507
|
+
}
|
|
6508
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6509
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6510
|
+
if (paths.length === 0) return tree;
|
|
6511
|
+
const out = new Map(tree);
|
|
6512
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6513
|
+
return out;
|
|
6514
|
+
}
|
|
6515
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6516
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6517
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6518
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6519
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5984
6520
|
/**
|
|
5985
6521
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5986
6522
|
*
|
|
@@ -6050,6 +6586,25 @@ var BaseAddon = class {
|
|
|
6050
6586
|
settingsStoreReady = false;
|
|
6051
6587
|
/** Default config values. Provided via constructor. */
|
|
6052
6588
|
defaults;
|
|
6589
|
+
/**
|
|
6590
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6591
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6592
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6593
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6594
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6595
|
+
*/
|
|
6596
|
+
secretStatePaths = [];
|
|
6597
|
+
_addonSecretTree = null;
|
|
6598
|
+
_deviceSecretTree = null;
|
|
6599
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6600
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6601
|
+
_unresolvedSecrets = [];
|
|
6602
|
+
_secretRetryTimer = null;
|
|
6603
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6604
|
+
_secretChangeTimer = null;
|
|
6605
|
+
_secretChangeUnsub = null;
|
|
6606
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6607
|
+
_operatorWriteDepth = 0;
|
|
6053
6608
|
constructor(defaults) {
|
|
6054
6609
|
this.defaults = defaults;
|
|
6055
6610
|
this._config = { ...defaults };
|
|
@@ -6085,8 +6640,18 @@ var BaseAddon = class {
|
|
|
6085
6640
|
return this._config;
|
|
6086
6641
|
}
|
|
6087
6642
|
async initialize(context) {
|
|
6088
|
-
|
|
6643
|
+
const secrets = context.secrets;
|
|
6644
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6645
|
+
secrets,
|
|
6646
|
+
addonTree: () => this.addonSecretTree(),
|
|
6647
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6648
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6649
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6650
|
+
}) : context;
|
|
6089
6651
|
await this.resolveConfig();
|
|
6652
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6653
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6654
|
+
});
|
|
6090
6655
|
const result = await this.onInitialize();
|
|
6091
6656
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6092
6657
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6119,6 +6684,12 @@ var BaseAddon = class {
|
|
|
6119
6684
|
*/
|
|
6120
6685
|
async onHubReachable() {}
|
|
6121
6686
|
async shutdown() {
|
|
6687
|
+
this._secretChangeUnsub?.();
|
|
6688
|
+
this._secretChangeUnsub = null;
|
|
6689
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6690
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6691
|
+
this._secretRetryTimer = null;
|
|
6692
|
+
this._secretChangeTimer = null;
|
|
6122
6693
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6123
6694
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6124
6695
|
await this.onShutdown();
|
|
@@ -6197,7 +6768,7 @@ var BaseAddon = class {
|
|
|
6197
6768
|
return hydrateSchema(schema, overlay ? {
|
|
6198
6769
|
...projected,
|
|
6199
6770
|
...overlay
|
|
6200
|
-
} : projected);
|
|
6771
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6201
6772
|
}
|
|
6202
6773
|
/**
|
|
6203
6774
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6246,7 +6817,7 @@ var BaseAddon = class {
|
|
|
6246
6817
|
return hydrateSchema({
|
|
6247
6818
|
...schema,
|
|
6248
6819
|
sections
|
|
6249
|
-
}, projected);
|
|
6820
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6250
6821
|
}
|
|
6251
6822
|
/**
|
|
6252
6823
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6300,18 +6871,50 @@ var BaseAddon = class {
|
|
|
6300
6871
|
value: result.value[key]
|
|
6301
6872
|
};
|
|
6302
6873
|
}
|
|
6874
|
+
/**
|
|
6875
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6876
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6877
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6878
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6879
|
+
* writing back what it read is not (D787).
|
|
6880
|
+
*/
|
|
6881
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6882
|
+
this._operatorWriteDepth++;
|
|
6883
|
+
try {
|
|
6884
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6885
|
+
} finally {
|
|
6886
|
+
this._operatorWriteDepth--;
|
|
6887
|
+
}
|
|
6888
|
+
}
|
|
6303
6889
|
async updateGlobalSettings(patch, nodeId) {
|
|
6890
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6891
|
+
}
|
|
6892
|
+
/**
|
|
6893
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6894
|
+
*
|
|
6895
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6896
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6897
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6898
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6899
|
+
*/
|
|
6900
|
+
async clearSecrets(keys, nodeId) {
|
|
6901
|
+
const tree = this.addonSecretTree();
|
|
6902
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6903
|
+
const patch = {};
|
|
6904
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6905
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6906
|
+
}
|
|
6907
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6304
6908
|
const keys = this.perNodeKeys();
|
|
6305
6909
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6306
6910
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6307
|
-
const barePatch = patch;
|
|
6308
6911
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6309
6912
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6310
6913
|
if (target !== localNode) return;
|
|
6311
6914
|
await this.resolveConfig();
|
|
6312
6915
|
await this.onConfigChanged();
|
|
6313
6916
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6314
|
-
this.maybeAutoRestart(
|
|
6917
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6315
6918
|
}
|
|
6316
6919
|
/**
|
|
6317
6920
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6336,7 +6939,7 @@ var BaseAddon = class {
|
|
|
6336
6939
|
* time to return its response before the addon is torn down and
|
|
6337
6940
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6338
6941
|
*/
|
|
6339
|
-
maybeAutoRestart(
|
|
6942
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6340
6943
|
if (!schema) return;
|
|
6341
6944
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6342
6945
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6344,13 +6947,13 @@ var BaseAddon = class {
|
|
|
6344
6947
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6345
6948
|
}
|
|
6346
6949
|
if (restartKeys.size === 0) return;
|
|
6347
|
-
if (!
|
|
6950
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6348
6951
|
const ctx = this._ctx;
|
|
6349
6952
|
if (!ctx) return;
|
|
6350
6953
|
const addonId = ctx.id;
|
|
6351
6954
|
setImmediate(() => {
|
|
6352
6955
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6353
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6956
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6354
6957
|
}).catch((err) => {
|
|
6355
6958
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6356
6959
|
});
|
|
@@ -6359,7 +6962,7 @@ var BaseAddon = class {
|
|
|
6359
6962
|
async getDeviceSettings(deviceId) {
|
|
6360
6963
|
const schema = this.deviceSettingsSchema();
|
|
6361
6964
|
if (!schema) return { sections: [] };
|
|
6362
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6965
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6363
6966
|
}
|
|
6364
6967
|
async updateDeviceSettings(deviceId, patch) {
|
|
6365
6968
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6489,7 +7092,7 @@ var BaseAddon = class {
|
|
|
6489
7092
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6490
7093
|
*/
|
|
6491
7094
|
async resolveConfig() {
|
|
6492
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7095
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6493
7096
|
const perNode = this.perNodeKeys();
|
|
6494
7097
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6495
7098
|
const resolved = { ...this.defaults };
|
|
@@ -6514,7 +7117,7 @@ var BaseAddon = class {
|
|
|
6514
7117
|
key,
|
|
6515
7118
|
schema,
|
|
6516
7119
|
fallback,
|
|
6517
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7120
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6518
7121
|
write: async (patch) => {
|
|
6519
7122
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6520
7123
|
},
|
|
@@ -6531,7 +7134,7 @@ var BaseAddon = class {
|
|
|
6531
7134
|
key,
|
|
6532
7135
|
schema,
|
|
6533
7136
|
fallback,
|
|
6534
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7137
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6535
7138
|
write: async (patch) => {
|
|
6536
7139
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6537
7140
|
},
|
|
@@ -6543,6 +7146,70 @@ var BaseAddon = class {
|
|
|
6543
7146
|
} })
|
|
6544
7147
|
});
|
|
6545
7148
|
}
|
|
7149
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7150
|
+
addonSecretTree() {
|
|
7151
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7152
|
+
return this._addonSecretTree;
|
|
7153
|
+
}
|
|
7154
|
+
deviceSecretTree() {
|
|
7155
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7156
|
+
return this._deviceSecretTree;
|
|
7157
|
+
}
|
|
7158
|
+
/**
|
|
7159
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7160
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7161
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7162
|
+
* than start on an empty credential.
|
|
7163
|
+
*/
|
|
7164
|
+
get unresolvedSecrets() {
|
|
7165
|
+
return this._unresolvedSecrets;
|
|
7166
|
+
}
|
|
7167
|
+
/**
|
|
7168
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7169
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7170
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7171
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7172
|
+
* ever written back from here.
|
|
7173
|
+
*/
|
|
7174
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7175
|
+
const secrets = this._ctx?.secrets;
|
|
7176
|
+
if (secrets === void 0) return blob;
|
|
7177
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7178
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7179
|
+
if (refs.length === 0) {
|
|
7180
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7181
|
+
return blob;
|
|
7182
|
+
}
|
|
7183
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7184
|
+
if (trackForConfig) {
|
|
7185
|
+
this._unresolvedSecrets = unresolved;
|
|
7186
|
+
if (unresolved.length > 0) {
|
|
7187
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7188
|
+
ref: u.ref,
|
|
7189
|
+
reason: u.reason
|
|
7190
|
+
})) } });
|
|
7191
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7192
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7193
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7194
|
+
}
|
|
7195
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7196
|
+
}
|
|
7197
|
+
return value;
|
|
7198
|
+
}
|
|
7199
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7200
|
+
scheduleSecretReresolve(delayMs) {
|
|
7201
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7202
|
+
if (this[timerOf] !== null) return;
|
|
7203
|
+
const timer = setTimeout(() => {
|
|
7204
|
+
this[timerOf] = null;
|
|
7205
|
+
if (this._ctx === null) return;
|
|
7206
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7207
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7208
|
+
});
|
|
7209
|
+
}, delayMs);
|
|
7210
|
+
timer.unref?.();
|
|
7211
|
+
this[timerOf] = timer;
|
|
7212
|
+
}
|
|
6546
7213
|
/**
|
|
6547
7214
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6548
7215
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -14207,6 +14874,196 @@ id: union([string(), number()]) }), {
|
|
|
14207
14874
|
kind: "mutation",
|
|
14208
14875
|
auth: "admin"
|
|
14209
14876
|
});
|
|
14877
|
+
/**
|
|
14878
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14879
|
+
*
|
|
14880
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14881
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14882
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14883
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14884
|
+
* against the CALLER, never against anything the caller claims.
|
|
14885
|
+
*
|
|
14886
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14887
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14888
|
+
* connection, the agent from its child's connection carried in
|
|
14889
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14890
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14891
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14892
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14893
|
+
* runner is the same OS user): see the threat model in
|
|
14894
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14895
|
+
*
|
|
14896
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14897
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14898
|
+
* floors every method to admin anyway (D240).
|
|
14899
|
+
*
|
|
14900
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14901
|
+
*/
|
|
14902
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14903
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14904
|
+
"key-missing",
|
|
14905
|
+
"wrong-key",
|
|
14906
|
+
"key-file-unreadable",
|
|
14907
|
+
"store-unavailable",
|
|
14908
|
+
"not-initialized",
|
|
14909
|
+
"decrypt-failed"
|
|
14910
|
+
]);
|
|
14911
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14912
|
+
state: literal("locked"),
|
|
14913
|
+
reason: KeychainUnavailableReasonSchema
|
|
14914
|
+
})]);
|
|
14915
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14916
|
+
object({
|
|
14917
|
+
kind: literal("value"),
|
|
14918
|
+
value: string(),
|
|
14919
|
+
version: number().int()
|
|
14920
|
+
}),
|
|
14921
|
+
object({ kind: literal("missing") }),
|
|
14922
|
+
object({
|
|
14923
|
+
kind: literal("unavailable"),
|
|
14924
|
+
reason: KeychainUnavailableReasonSchema
|
|
14925
|
+
}),
|
|
14926
|
+
object({ kind: literal("forbidden") })
|
|
14927
|
+
]);
|
|
14928
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14929
|
+
/** Metadata of one stored value — never the value. */
|
|
14930
|
+
var KeychainSecretMetaSchema = object({
|
|
14931
|
+
ref: string(),
|
|
14932
|
+
owner: string(),
|
|
14933
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14934
|
+
scope: string(),
|
|
14935
|
+
fieldPath: string(),
|
|
14936
|
+
version: number().int(),
|
|
14937
|
+
createdAt: number(),
|
|
14938
|
+
updatedAt: number(),
|
|
14939
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14940
|
+
updatedBy: string(),
|
|
14941
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14942
|
+
lastReadAt: number().nullable()
|
|
14943
|
+
});
|
|
14944
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14945
|
+
method(object({
|
|
14946
|
+
ref: string().min(1),
|
|
14947
|
+
value: string().min(1)
|
|
14948
|
+
}), object({
|
|
14949
|
+
ref: string(),
|
|
14950
|
+
version: number().int()
|
|
14951
|
+
}), {
|
|
14952
|
+
kind: "mutation",
|
|
14953
|
+
auth: "admin"
|
|
14954
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14955
|
+
kind: "mutation",
|
|
14956
|
+
auth: "admin"
|
|
14957
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14958
|
+
var KeychainKeySourceSchema = object({
|
|
14959
|
+
kind: _enum([
|
|
14960
|
+
"config-file",
|
|
14961
|
+
"previous-config-file",
|
|
14962
|
+
"platform",
|
|
14963
|
+
"default-file"
|
|
14964
|
+
]),
|
|
14965
|
+
/** File sources only — a path is not a secret. */
|
|
14966
|
+
path: string().optional(),
|
|
14967
|
+
/**
|
|
14968
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14969
|
+
* next to the database it protects (the default file). The page warns.
|
|
14970
|
+
*/
|
|
14971
|
+
sharesBackupWithDatabase: boolean()
|
|
14972
|
+
});
|
|
14973
|
+
var KeychainStatusSchema = object({
|
|
14974
|
+
keychain: KeychainStateSchema,
|
|
14975
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14976
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14977
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14978
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14979
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14980
|
+
fingerprint: string().nullable(),
|
|
14981
|
+
activeKeyId: string().nullable(),
|
|
14982
|
+
/**
|
|
14983
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14984
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14985
|
+
*/
|
|
14986
|
+
rotationPending: boolean(),
|
|
14987
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14988
|
+
retiredWraps: number().int(),
|
|
14989
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14990
|
+
secretCount: number().int()
|
|
14991
|
+
});
|
|
14992
|
+
/**
|
|
14993
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14994
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14995
|
+
* never reported as an orphan (and never deleted as one).
|
|
14996
|
+
*/
|
|
14997
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14998
|
+
"in-use",
|
|
14999
|
+
"orphan",
|
|
15000
|
+
"unknown"
|
|
15001
|
+
]);
|
|
15002
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15003
|
+
var KeychainAuditActionSchema = _enum([
|
|
15004
|
+
"put",
|
|
15005
|
+
"delete",
|
|
15006
|
+
"reveal",
|
|
15007
|
+
"rotate-master-key",
|
|
15008
|
+
"purge-retired-keys",
|
|
15009
|
+
"download-recovery-key",
|
|
15010
|
+
"delete-orphans",
|
|
15011
|
+
"reset",
|
|
15012
|
+
"initialize"
|
|
15013
|
+
]);
|
|
15014
|
+
var KeychainAuditEntrySchema = object({
|
|
15015
|
+
id: string(),
|
|
15016
|
+
at: number(),
|
|
15017
|
+
action: KeychainAuditActionSchema,
|
|
15018
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15019
|
+
actor: string(),
|
|
15020
|
+
ref: string().nullable(),
|
|
15021
|
+
detail: string().nullable()
|
|
15022
|
+
});
|
|
15023
|
+
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({
|
|
15024
|
+
value: string(),
|
|
15025
|
+
version: number().int()
|
|
15026
|
+
}), {
|
|
15027
|
+
kind: "mutation",
|
|
15028
|
+
auth: "admin",
|
|
15029
|
+
caller: "required"
|
|
15030
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15031
|
+
deleted: array(string()).readonly(),
|
|
15032
|
+
kept: array(object({
|
|
15033
|
+
ref: string(),
|
|
15034
|
+
usage: KeychainSecretUsageSchema
|
|
15035
|
+
})).readonly()
|
|
15036
|
+
}), {
|
|
15037
|
+
kind: "mutation",
|
|
15038
|
+
auth: "admin",
|
|
15039
|
+
caller: "required"
|
|
15040
|
+
}), method(object({}), object({
|
|
15041
|
+
fingerprint: string(),
|
|
15042
|
+
keySource: KeychainKeySourceSchema
|
|
15043
|
+
}), {
|
|
15044
|
+
kind: "mutation",
|
|
15045
|
+
auth: "admin",
|
|
15046
|
+
caller: "required"
|
|
15047
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15048
|
+
kind: "mutation",
|
|
15049
|
+
auth: "admin",
|
|
15050
|
+
caller: "required"
|
|
15051
|
+
}), method(object({}), object({
|
|
15052
|
+
key: string(),
|
|
15053
|
+
fingerprint: string(),
|
|
15054
|
+
keySource: KeychainKeySourceSchema
|
|
15055
|
+
}), {
|
|
15056
|
+
kind: "mutation",
|
|
15057
|
+
auth: "admin",
|
|
15058
|
+
caller: "required"
|
|
15059
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15060
|
+
archivedCollection: string().nullable(),
|
|
15061
|
+
archived: number().int()
|
|
15062
|
+
}), {
|
|
15063
|
+
kind: "mutation",
|
|
15064
|
+
auth: "admin",
|
|
15065
|
+
caller: "required"
|
|
15066
|
+
});
|
|
14210
15067
|
method(_void(), object({
|
|
14211
15068
|
id: string(),
|
|
14212
15069
|
name: string(),
|
|
@@ -15269,7 +16126,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15269
16126
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15270
16127
|
var DevicePersistConfigPayloadSchema = object({
|
|
15271
16128
|
deviceId: number(),
|
|
15272
|
-
data: record(string(), unknown())
|
|
16129
|
+
data: record(string(), unknown()),
|
|
16130
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16131
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16132
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16133
|
+
secretConfigPaths: array(string()).optional()
|
|
15273
16134
|
});
|
|
15274
16135
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15275
16136
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -22264,8 +23125,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22264
23125
|
]);
|
|
22265
23126
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22266
23127
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22267
|
-
/**
|
|
22268
|
-
|
|
23128
|
+
/**
|
|
23129
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23130
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23131
|
+
*
|
|
23132
|
+
* - `operator` — drawn by hand.
|
|
23133
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23134
|
+
* model, or a larger teacher model).
|
|
23135
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23136
|
+
* back from the track store (never a re-run).
|
|
23137
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23138
|
+
*/
|
|
23139
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23140
|
+
"operator",
|
|
23141
|
+
"assist",
|
|
23142
|
+
"pipeline",
|
|
23143
|
+
"llm"
|
|
23144
|
+
]);
|
|
22269
23145
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22270
23146
|
var RetrainBboxSchema = object({
|
|
22271
23147
|
x: number(),
|
|
@@ -22283,7 +23159,8 @@ var RetrainBboxSchema = object({
|
|
|
22283
23159
|
*/
|
|
22284
23160
|
var RetrainAnnotationSchema = object({
|
|
22285
23161
|
id: string(),
|
|
22286
|
-
|
|
23162
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23163
|
+
trackId: string().optional(),
|
|
22287
23164
|
deviceId: number(),
|
|
22288
23165
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22289
23166
|
mediaKey: string(),
|
|
@@ -22332,13 +23209,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22332
23209
|
* fail, whatever became of the original. */
|
|
22333
23210
|
copied: boolean()
|
|
22334
23211
|
});
|
|
23212
|
+
/**
|
|
23213
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23214
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23215
|
+
* box recorded on the source media row when there is one, else the track
|
|
23216
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23217
|
+
* until the operator confirms it.
|
|
23218
|
+
*/
|
|
23219
|
+
var RetrainPipelineBoxSchema = object({
|
|
23220
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23221
|
+
bbox: RetrainBboxSchema,
|
|
23222
|
+
macroClass: RetrainMacroClassSchema,
|
|
23223
|
+
label: string().optional(),
|
|
23224
|
+
subLabel: string().optional(),
|
|
23225
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23226
|
+
score: number().optional(),
|
|
23227
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23228
|
+
modelId: string().optional(),
|
|
23229
|
+
trackId: string(),
|
|
23230
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23231
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23232
|
+
basis: _enum(["subject-box", "position"]),
|
|
23233
|
+
deltaMs: number()
|
|
23234
|
+
});
|
|
23235
|
+
/**
|
|
23236
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23237
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23238
|
+
* track at all.
|
|
23239
|
+
*/
|
|
23240
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22335
23241
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22336
23242
|
var RetrainFrameSchema = object({
|
|
22337
23243
|
frameId: string(),
|
|
22338
23244
|
deviceId: number(),
|
|
22339
|
-
|
|
22340
|
-
/**
|
|
22341
|
-
|
|
23245
|
+
origin: RetrainFrameOriginSchema,
|
|
23246
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23247
|
+
trackId: string().optional(),
|
|
23248
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23249
|
+
* Absent on a recording still. */
|
|
23250
|
+
sourceMediaId: number().int().optional(),
|
|
23251
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23252
|
+
epochMs: number().optional(),
|
|
22342
23253
|
sourceKind: MediaFileKindEnum,
|
|
22343
23254
|
sizeBytes: number().int(),
|
|
22344
23255
|
width: number().int(),
|
|
@@ -22349,7 +23260,12 @@ var RetrainFrameSchema = object({
|
|
|
22349
23260
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22350
23261
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22351
23262
|
* a false positive. */
|
|
22352
|
-
complete: boolean()
|
|
23263
|
+
complete: boolean(),
|
|
23264
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23265
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23266
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23267
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23268
|
+
collectionIds: array(string()).readonly().optional()
|
|
22353
23269
|
});
|
|
22354
23270
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22355
23271
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22380,6 +23296,8 @@ var RetrainFrameListSchema = object({
|
|
|
22380
23296
|
var RetrainExportFilterSchema = object({
|
|
22381
23297
|
deviceIds: array(number()).optional(),
|
|
22382
23298
|
frameIds: array(string()).max(2e4).optional(),
|
|
23299
|
+
/** Only frames in at least one of these named collections. */
|
|
23300
|
+
collectionIds: array(string()).max(200).optional(),
|
|
22383
23301
|
batchId: string().optional(),
|
|
22384
23302
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22385
23303
|
completeOnly: boolean().optional()
|
|
@@ -22444,6 +23362,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22444
23362
|
reason: string(),
|
|
22445
23363
|
detail: string().optional()
|
|
22446
23364
|
})]);
|
|
23365
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23366
|
+
var RetrainCollectionSchema = object({
|
|
23367
|
+
id: string(),
|
|
23368
|
+
name: string(),
|
|
23369
|
+
createdAt: number(),
|
|
23370
|
+
frameCount: number().int()
|
|
23371
|
+
});
|
|
23372
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23373
|
+
kind: literal("created"),
|
|
23374
|
+
collection: RetrainCollectionSchema
|
|
23375
|
+
}), object({
|
|
23376
|
+
kind: literal("refused"),
|
|
23377
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23378
|
+
})]);
|
|
23379
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23380
|
+
kind: literal("renamed"),
|
|
23381
|
+
collection: RetrainCollectionSchema
|
|
23382
|
+
}), object({
|
|
23383
|
+
kind: literal("refused"),
|
|
23384
|
+
reason: _enum([
|
|
23385
|
+
"empty-name",
|
|
23386
|
+
"duplicate-name",
|
|
23387
|
+
"unknown-collection"
|
|
23388
|
+
])
|
|
23389
|
+
})]);
|
|
23390
|
+
/**
|
|
23391
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23392
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23393
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23394
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23395
|
+
*/
|
|
23396
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23397
|
+
kind: literal("added"),
|
|
23398
|
+
collectionId: string(),
|
|
23399
|
+
frame: RetrainFrameSchema,
|
|
23400
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23401
|
+
reused: boolean()
|
|
23402
|
+
}), object({
|
|
23403
|
+
kind: literal("refused"),
|
|
23404
|
+
reason: _enum([
|
|
23405
|
+
"unknown-collection",
|
|
23406
|
+
"still-unavailable",
|
|
23407
|
+
"still-busy",
|
|
23408
|
+
"unreadable-image",
|
|
23409
|
+
"write-failed"
|
|
23410
|
+
]),
|
|
23411
|
+
detail: string().optional()
|
|
23412
|
+
})]);
|
|
23413
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23414
|
+
var RetrainAssistProfileSchema = object({
|
|
23415
|
+
id: string(),
|
|
23416
|
+
name: string(),
|
|
23417
|
+
model: string(),
|
|
23418
|
+
kind: string(),
|
|
23419
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23420
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23421
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23422
|
+
leavesHouse: boolean()
|
|
23423
|
+
});
|
|
23424
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23425
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23426
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23427
|
+
var RetrainLlmReviewSchema = object({
|
|
23428
|
+
/** The `ref` the page sent the box under. */
|
|
23429
|
+
ref: string(),
|
|
23430
|
+
verdict: _enum([
|
|
23431
|
+
"confirmed",
|
|
23432
|
+
"wrong-class",
|
|
23433
|
+
"not-an-object",
|
|
23434
|
+
"uncertain"
|
|
23435
|
+
]),
|
|
23436
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23437
|
+
reason: string()
|
|
23438
|
+
});
|
|
23439
|
+
/**
|
|
23440
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23441
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23442
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23443
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23444
|
+
*/
|
|
23445
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23446
|
+
kind: literal("proposed"),
|
|
23447
|
+
profileId: string(),
|
|
23448
|
+
model: string(),
|
|
23449
|
+
/** The frame was sent outside the house for this answer. */
|
|
23450
|
+
leftHouse: boolean(),
|
|
23451
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23452
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23453
|
+
rejected: number().int()
|
|
23454
|
+
}), object({
|
|
23455
|
+
kind: literal("refused"),
|
|
23456
|
+
reason: _enum([
|
|
23457
|
+
"unknown-frame",
|
|
23458
|
+
"unreadable-frame",
|
|
23459
|
+
"unknown-profile",
|
|
23460
|
+
"profile-disabled",
|
|
23461
|
+
"no-vision",
|
|
23462
|
+
"cloud-not-confirmed",
|
|
23463
|
+
"llm-error",
|
|
23464
|
+
"malformed-answer"
|
|
23465
|
+
]),
|
|
23466
|
+
detail: string().optional()
|
|
23467
|
+
})]);
|
|
22447
23468
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22448
23469
|
var RetrainTransitionResultSchema = object({
|
|
22449
23470
|
trackId: string(),
|
|
@@ -23161,7 +24182,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23161
24182
|
auth: "admin"
|
|
23162
24183
|
}), method(object({
|
|
23163
24184
|
deviceId: number(),
|
|
23164
|
-
trackId: string(),
|
|
24185
|
+
trackId: string().optional(),
|
|
23165
24186
|
frameId: string()
|
|
23166
24187
|
}), object({
|
|
23167
24188
|
removed: boolean(),
|
|
@@ -23178,7 +24199,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23178
24199
|
auth: "admin"
|
|
23179
24200
|
}), method(object({
|
|
23180
24201
|
deviceId: number(),
|
|
23181
|
-
|
|
24202
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24203
|
+
trackId: string().optional(),
|
|
23182
24204
|
frameId: string(),
|
|
23183
24205
|
subject: RetrainAssistSubjectSchema,
|
|
23184
24206
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23186,12 +24208,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23186
24208
|
}), RetrainAssistResultSchema, {
|
|
23187
24209
|
kind: "mutation",
|
|
23188
24210
|
auth: "admin"
|
|
23189
|
-
}), method(object({
|
|
24211
|
+
}), method(object({
|
|
24212
|
+
trackId: string().optional(),
|
|
24213
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24214
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23190
24215
|
kind: "query",
|
|
23191
24216
|
auth: "admin"
|
|
23192
24217
|
}), method(object({
|
|
23193
24218
|
deviceId: number(),
|
|
23194
|
-
|
|
24219
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24220
|
+
trackId: string().optional(),
|
|
23195
24221
|
frameId: string(),
|
|
23196
24222
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23197
24223
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23214,7 +24240,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23214
24240
|
auth: "admin"
|
|
23215
24241
|
}), method(object({
|
|
23216
24242
|
deviceId: number(),
|
|
23217
|
-
trackId: string(),
|
|
24243
|
+
trackId: string().optional(),
|
|
23218
24244
|
frameId: string(),
|
|
23219
24245
|
complete: boolean()
|
|
23220
24246
|
}), RetrainFrameSchema, {
|
|
@@ -23228,6 +24254,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23228
24254
|
kind: "mutation",
|
|
23229
24255
|
auth: "admin",
|
|
23230
24256
|
timeoutMs: 60 * 6e4
|
|
24257
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24258
|
+
kind: "query",
|
|
24259
|
+
auth: "admin"
|
|
24260
|
+
}), method(object({
|
|
24261
|
+
deviceId: number(),
|
|
24262
|
+
trackId: string().optional(),
|
|
24263
|
+
frameId: string(),
|
|
24264
|
+
profileId: string(),
|
|
24265
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24266
|
+
boxes: array(object({
|
|
24267
|
+
ref: string(),
|
|
24268
|
+
bbox: RetrainBboxSchema,
|
|
24269
|
+
macroClass: RetrainMacroClassSchema,
|
|
24270
|
+
label: string().optional()
|
|
24271
|
+
})).max(50),
|
|
24272
|
+
allowCloud: boolean()
|
|
24273
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24274
|
+
kind: "mutation",
|
|
24275
|
+
auth: "admin",
|
|
24276
|
+
timeoutMs: 18e4
|
|
24277
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24278
|
+
kind: "mutation",
|
|
24279
|
+
auth: "admin"
|
|
24280
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24281
|
+
kind: "query",
|
|
24282
|
+
auth: "admin"
|
|
24283
|
+
}), method(object({
|
|
24284
|
+
id: string(),
|
|
24285
|
+
name: string().max(120)
|
|
24286
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24287
|
+
kind: "mutation",
|
|
24288
|
+
auth: "admin"
|
|
24289
|
+
}), method(object({ id: string() }), object({
|
|
24290
|
+
deleted: boolean(),
|
|
24291
|
+
removedFrames: number().int()
|
|
24292
|
+
}), {
|
|
24293
|
+
kind: "mutation",
|
|
24294
|
+
auth: "admin"
|
|
24295
|
+
}), method(object({
|
|
24296
|
+
collectionId: string(),
|
|
24297
|
+
deviceId: number(),
|
|
24298
|
+
epochMs: number()
|
|
24299
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24300
|
+
kind: "mutation",
|
|
24301
|
+
auth: "admin",
|
|
24302
|
+
timeoutMs: 6e4
|
|
24303
|
+
}), method(object({
|
|
24304
|
+
collectionId: string(),
|
|
24305
|
+
frameIds: array(string()).min(1).max(500)
|
|
24306
|
+
}), object({
|
|
24307
|
+
added: number().int(),
|
|
24308
|
+
alreadyMember: number().int(),
|
|
24309
|
+
unknownFrameIds: array(string()).readonly()
|
|
24310
|
+
}), {
|
|
24311
|
+
kind: "mutation",
|
|
24312
|
+
auth: "admin"
|
|
24313
|
+
}), method(object({
|
|
24314
|
+
collectionId: string(),
|
|
24315
|
+
frameId: string()
|
|
24316
|
+
}), object({
|
|
24317
|
+
removed: boolean(),
|
|
24318
|
+
deletedFrame: boolean()
|
|
24319
|
+
}), {
|
|
24320
|
+
kind: "mutation",
|
|
24321
|
+
auth: "admin"
|
|
24322
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
24323
|
+
kind: "query",
|
|
24324
|
+
auth: "admin"
|
|
23231
24325
|
}), method(object({
|
|
23232
24326
|
/** Which of the three event tables owns the row. */
|
|
23233
24327
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23851,13 +24945,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23851
24945
|
object({
|
|
23852
24946
|
kind: literal("no-family-build"),
|
|
23853
24947
|
format: ModelFormatSchema$1
|
|
24948
|
+
}),
|
|
24949
|
+
object({
|
|
24950
|
+
kind: literal("kept-custom-pin"),
|
|
24951
|
+
modelId: string(),
|
|
24952
|
+
deviceKey: string()
|
|
23854
24953
|
})
|
|
23855
24954
|
]);
|
|
24955
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
24956
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
24957
|
+
/**
|
|
24958
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
24959
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
24960
|
+
*/
|
|
24961
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
24962
|
+
kind: literal("node-benchmark"),
|
|
24963
|
+
resultId: string(),
|
|
24964
|
+
measuredAtMs: number()
|
|
24965
|
+
})]);
|
|
23856
24966
|
var DeviceModelChoiceSchema = object({
|
|
23857
24967
|
modelId: string(),
|
|
23858
24968
|
p50Ms: number(),
|
|
23859
24969
|
fps: number(),
|
|
23860
24970
|
measured: boolean(),
|
|
24971
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
24972
|
+
source: LatencySourceSchema.optional(),
|
|
23861
24973
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23862
24974
|
capacitySessions: number(),
|
|
23863
24975
|
personRecall: number()
|
|
@@ -23868,6 +24980,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23868
24980
|
enabled: boolean(),
|
|
23869
24981
|
available: boolean(),
|
|
23870
24982
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
24983
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
24984
|
+
kept: KeptReasonSchema.optional(),
|
|
23871
24985
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23872
24986
|
});
|
|
23873
24987
|
var NodeRecommendationSchema = object({
|
|
@@ -23921,6 +25035,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
23921
25035
|
kind: literal("coral-enabled"),
|
|
23922
25036
|
nodeId: string(),
|
|
23923
25037
|
deviceKey: string()
|
|
25038
|
+
}),
|
|
25039
|
+
object({
|
|
25040
|
+
kind: literal("custom-pin-kept"),
|
|
25041
|
+
nodeId: string(),
|
|
25042
|
+
deviceKey: string().nullable(),
|
|
25043
|
+
deviceId: number().nullable(),
|
|
25044
|
+
modelId: string()
|
|
25045
|
+
}),
|
|
25046
|
+
object({
|
|
25047
|
+
kind: literal("custom-registry-unreadable"),
|
|
25048
|
+
error: string()
|
|
23924
25049
|
})
|
|
23925
25050
|
]);
|
|
23926
25051
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24099,13 +25224,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24099
25224
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24100
25225
|
});
|
|
24101
25226
|
/**
|
|
24102
|
-
* Where the node and device shares come from (D750, D755).
|
|
24103
|
-
* - `
|
|
24104
|
-
*
|
|
24105
|
-
*
|
|
24106
|
-
*
|
|
24107
|
-
*
|
|
24108
|
-
*
|
|
25227
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25228
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25229
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25230
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25231
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25232
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25233
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25234
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24109
25235
|
* - `manual` — the operator's stored sliders.
|
|
24110
25236
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24111
25237
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24154,6 +25280,362 @@ var EffectiveSharesSchema = object({
|
|
|
24154
25280
|
nodeWeights: record(string(), number()),
|
|
24155
25281
|
deviceWeights: record(string(), record(string(), number()))
|
|
24156
25282
|
});
|
|
25283
|
+
/**
|
|
25284
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25285
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25286
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25287
|
+
* shares read.
|
|
25288
|
+
*
|
|
25289
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25290
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25291
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25292
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25293
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25294
|
+
*
|
|
25295
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25296
|
+
* cross a process at frame rate, D9):
|
|
25297
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25298
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25299
|
+
* interval;
|
|
25300
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25301
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25302
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25303
|
+
* CPU, RAM or the event loop give out.
|
|
25304
|
+
*/
|
|
25305
|
+
/** Defaults and bounds, one place. */
|
|
25306
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25307
|
+
fpsPerStream: 10,
|
|
25308
|
+
budgetMinutes: 45,
|
|
25309
|
+
minBudgetMinutes: 10,
|
|
25310
|
+
maxBudgetMinutes: 120,
|
|
25311
|
+
/** A result older than this no longer beats the table. */
|
|
25312
|
+
staleAfterDays: 30,
|
|
25313
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25314
|
+
settleSec: 5,
|
|
25315
|
+
/** Accounted window per ramp step. */
|
|
25316
|
+
measureSec: 20,
|
|
25317
|
+
/** Longest the drain may take before the run is refused. */
|
|
25318
|
+
drainTimeoutSec: 120,
|
|
25319
|
+
/** Candidate models per device in one run. */
|
|
25320
|
+
maxModelsPerDevice: 6
|
|
25321
|
+
};
|
|
25322
|
+
/** The two measurements a run can make. */
|
|
25323
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25324
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25325
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25326
|
+
deviceKey: string().min(1),
|
|
25327
|
+
/**
|
|
25328
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25329
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25330
|
+
*/
|
|
25331
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25332
|
+
});
|
|
25333
|
+
/** What the operator confirmed. */
|
|
25334
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25335
|
+
nodeId: string().min(1),
|
|
25336
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25337
|
+
/** Which measurements run. At least one. */
|
|
25338
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25339
|
+
/**
|
|
25340
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25341
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25342
|
+
* detector always runs.
|
|
25343
|
+
*/
|
|
25344
|
+
steps: array(string().min(1)).default([]),
|
|
25345
|
+
/** Offered rate of one stream / session. */
|
|
25346
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25347
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25348
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25349
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25350
|
+
keepDownloadedModels: boolean().default(false),
|
|
25351
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25352
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25353
|
+
});
|
|
25354
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25355
|
+
kind: _enum([
|
|
25356
|
+
"benchmark-active",
|
|
25357
|
+
"node-offline",
|
|
25358
|
+
"unknown-device",
|
|
25359
|
+
"no-phase",
|
|
25360
|
+
"insufficient-headroom"
|
|
25361
|
+
]),
|
|
25362
|
+
detail: string(),
|
|
25363
|
+
overridable: boolean()
|
|
25364
|
+
});
|
|
25365
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25366
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25367
|
+
deviceId: number(),
|
|
25368
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25369
|
+
placedOnNode: boolean(),
|
|
25370
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25371
|
+
pinnedToNode: boolean()
|
|
25372
|
+
});
|
|
25373
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25374
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25375
|
+
deviceId: number(),
|
|
25376
|
+
reason: literal("only-frame-source")
|
|
25377
|
+
});
|
|
25378
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25379
|
+
nodeId: string(),
|
|
25380
|
+
online: boolean(),
|
|
25381
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25382
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25383
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25384
|
+
estimatedDurationMs: number(),
|
|
25385
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25386
|
+
budgetMs: number(),
|
|
25387
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25388
|
+
steps: array(string()).readonly(),
|
|
25389
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25390
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25391
|
+
headroom: object({
|
|
25392
|
+
sessionsNow: number(),
|
|
25393
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25394
|
+
}),
|
|
25395
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25396
|
+
canStart: boolean()
|
|
25397
|
+
});
|
|
25398
|
+
/** Where the measuring runner is. */
|
|
25399
|
+
var NodeBenchProgressSchema = object({
|
|
25400
|
+
phase: _enum([
|
|
25401
|
+
"preparing",
|
|
25402
|
+
"device",
|
|
25403
|
+
"pipeline",
|
|
25404
|
+
"cleanup"
|
|
25405
|
+
]),
|
|
25406
|
+
deviceKey: string().nullable(),
|
|
25407
|
+
modelId: string().nullable(),
|
|
25408
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25409
|
+
load: number().nullable(),
|
|
25410
|
+
cellsDone: number(),
|
|
25411
|
+
cellsTotal: number(),
|
|
25412
|
+
message: string()
|
|
25413
|
+
});
|
|
25414
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25415
|
+
var NodeBenchLimitSchema = _enum([
|
|
25416
|
+
"p95",
|
|
25417
|
+
"drops",
|
|
25418
|
+
"errors",
|
|
25419
|
+
"stall",
|
|
25420
|
+
"cpu",
|
|
25421
|
+
"ram",
|
|
25422
|
+
"none"
|
|
25423
|
+
]);
|
|
25424
|
+
var NodeBenchRampStepSchema = object({
|
|
25425
|
+
load: number(),
|
|
25426
|
+
pass: boolean(),
|
|
25427
|
+
p95Ms: number(),
|
|
25428
|
+
dropRatio: number(),
|
|
25429
|
+
/** Completed frames per second over the accounted window. */
|
|
25430
|
+
fps: number(),
|
|
25431
|
+
cpuPct: number().nullable(),
|
|
25432
|
+
ramFreePct: number().nullable(),
|
|
25433
|
+
failReasons: array(string()).readonly()
|
|
25434
|
+
});
|
|
25435
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25436
|
+
phase: literal("device"),
|
|
25437
|
+
deviceKey: string(),
|
|
25438
|
+
modelId: string(),
|
|
25439
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25440
|
+
p50Ms: number(),
|
|
25441
|
+
p95Ms: number(),
|
|
25442
|
+
p99Ms: number(),
|
|
25443
|
+
/** Frames per second sustained at the last passing step. */
|
|
25444
|
+
fps: number(),
|
|
25445
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25446
|
+
kMax: number(),
|
|
25447
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25448
|
+
/** First call (model load + warm-up). */
|
|
25449
|
+
warmupMs: number(),
|
|
25450
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25451
|
+
}), object({
|
|
25452
|
+
phase: literal("pipeline"),
|
|
25453
|
+
deviceKey: string(),
|
|
25454
|
+
modelId: string(),
|
|
25455
|
+
steps: array(string()).readonly(),
|
|
25456
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25457
|
+
maxSessions: number(),
|
|
25458
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25459
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25460
|
+
stepsFired: array(string()).readonly(),
|
|
25461
|
+
warmupMs: number(),
|
|
25462
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25463
|
+
})]);
|
|
25464
|
+
/**
|
|
25465
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25466
|
+
* the node no longer beats the table.
|
|
25467
|
+
*/
|
|
25468
|
+
var NodeBenchFingerprintSchema = object({
|
|
25469
|
+
pipelineVersion: string().nullable(),
|
|
25470
|
+
cpuModel: string().nullable(),
|
|
25471
|
+
ramGb: number().nullable(),
|
|
25472
|
+
os: string().nullable(),
|
|
25473
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25474
|
+
pools: record(string(), object({
|
|
25475
|
+
runtime: string(),
|
|
25476
|
+
numWorkers: number(),
|
|
25477
|
+
concurrency: number(),
|
|
25478
|
+
batchMode: string()
|
|
25479
|
+
})).default({})
|
|
25480
|
+
});
|
|
25481
|
+
/** The frames the run used. */
|
|
25482
|
+
var NodeBenchClipSchema = object({
|
|
25483
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25484
|
+
id: string(),
|
|
25485
|
+
revision: string().nullable(),
|
|
25486
|
+
frames: number(),
|
|
25487
|
+
width: number(),
|
|
25488
|
+
height: number()
|
|
25489
|
+
});
|
|
25490
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25491
|
+
runId: string().min(1),
|
|
25492
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25493
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25494
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25495
|
+
steps: array(string()).default([]),
|
|
25496
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25497
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25498
|
+
deadlineAtMs: number(),
|
|
25499
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25500
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25501
|
+
keepDownloadedModels: boolean().default(false)
|
|
25502
|
+
});
|
|
25503
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25504
|
+
"running",
|
|
25505
|
+
"done",
|
|
25506
|
+
"failed",
|
|
25507
|
+
"aborted"
|
|
25508
|
+
]);
|
|
25509
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25510
|
+
runId: string(),
|
|
25511
|
+
nodeId: string(),
|
|
25512
|
+
state: NodeBenchRunnerStateSchema,
|
|
25513
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25514
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25515
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25516
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25517
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25518
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25519
|
+
activeCameraIds: array(number()).readonly(),
|
|
25520
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25521
|
+
deletedModels: array(string()).readonly(),
|
|
25522
|
+
error: string().nullable(),
|
|
25523
|
+
startedAtMs: number(),
|
|
25524
|
+
finishedAtMs: number().nullable()
|
|
25525
|
+
});
|
|
25526
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25527
|
+
"draining",
|
|
25528
|
+
"measuring",
|
|
25529
|
+
"restoring",
|
|
25530
|
+
"done",
|
|
25531
|
+
"failed",
|
|
25532
|
+
"aborted"
|
|
25533
|
+
]);
|
|
25534
|
+
/** Why a run ended. */
|
|
25535
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25536
|
+
"completed",
|
|
25537
|
+
"operator-abort",
|
|
25538
|
+
"deadline",
|
|
25539
|
+
"node-lost",
|
|
25540
|
+
"runner-lost",
|
|
25541
|
+
"hub-restart",
|
|
25542
|
+
"drain-timeout",
|
|
25543
|
+
"failed"
|
|
25544
|
+
]);
|
|
25545
|
+
var NodeBenchmarkRunSchema = object({
|
|
25546
|
+
runId: string(),
|
|
25547
|
+
nodeId: string(),
|
|
25548
|
+
state: NodeBenchmarkStateSchema,
|
|
25549
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25550
|
+
startedAtMs: number(),
|
|
25551
|
+
deadlineAtMs: number(),
|
|
25552
|
+
finishedAtMs: number().nullable(),
|
|
25553
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25554
|
+
error: string().nullable(),
|
|
25555
|
+
/** Cameras moved off the node for the run. */
|
|
25556
|
+
moved: array(number()).readonly(),
|
|
25557
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25558
|
+
staying: array(number()).readonly(),
|
|
25559
|
+
/** Something else ran on the node's pools during the run. */
|
|
25560
|
+
contaminated: boolean(),
|
|
25561
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25562
|
+
resultIds: array(string()).readonly()
|
|
25563
|
+
});
|
|
25564
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25565
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25566
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25567
|
+
modeNodeId: string().nullable(),
|
|
25568
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25569
|
+
});
|
|
25570
|
+
/**
|
|
25571
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25572
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25573
|
+
* ends, never by anyone else.
|
|
25574
|
+
*/
|
|
25575
|
+
var NodeBenchmarkResultSchema = object({
|
|
25576
|
+
id: string(),
|
|
25577
|
+
runId: string(),
|
|
25578
|
+
nodeId: string(),
|
|
25579
|
+
cell: NodeBenchCellSchema,
|
|
25580
|
+
fpsPerStream: number(),
|
|
25581
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25582
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25583
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25584
|
+
contaminated: boolean(),
|
|
25585
|
+
stayingCameras: array(number()).readonly(),
|
|
25586
|
+
/** The run ended early; the cell itself completed. */
|
|
25587
|
+
partialRun: boolean(),
|
|
25588
|
+
measuredAtMs: number()
|
|
25589
|
+
});
|
|
25590
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25591
|
+
nodeId: string().optional(),
|
|
25592
|
+
deviceKey: string().optional()
|
|
25593
|
+
});
|
|
25594
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25595
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25596
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25597
|
+
standing: _enum([
|
|
25598
|
+
"fresh",
|
|
25599
|
+
"stale",
|
|
25600
|
+
"superseded"
|
|
25601
|
+
]),
|
|
25602
|
+
staleWhy: _enum([
|
|
25603
|
+
"age",
|
|
25604
|
+
"runtime",
|
|
25605
|
+
"pool-tuning"
|
|
25606
|
+
]).nullable()
|
|
25607
|
+
});
|
|
25608
|
+
object({
|
|
25609
|
+
runId: string(),
|
|
25610
|
+
nodeId: string(),
|
|
25611
|
+
startedAtMs: number(),
|
|
25612
|
+
deadlineAtMs: number(),
|
|
25613
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25614
|
+
moved: array(number()).readonly(),
|
|
25615
|
+
staying: array(number()).readonly()
|
|
25616
|
+
});
|
|
25617
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25618
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25619
|
+
nodeId: string(),
|
|
25620
|
+
reachable: boolean(),
|
|
25621
|
+
devices: array(object({
|
|
25622
|
+
deviceKey: string(),
|
|
25623
|
+
enabled: boolean(),
|
|
25624
|
+
available: boolean(),
|
|
25625
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25626
|
+
suggested: array(string()).readonly(),
|
|
25627
|
+
/** Every root detector the device has a build for. */
|
|
25628
|
+
all: array(string()).readonly(),
|
|
25629
|
+
/** The model the device runs now, when pinned. */
|
|
25630
|
+
currentModelId: string().nullable()
|
|
25631
|
+
})).readonly(),
|
|
25632
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25633
|
+
steps: array(object({
|
|
25634
|
+
id: string(),
|
|
25635
|
+
name: string(),
|
|
25636
|
+
slot: string()
|
|
25637
|
+
})).readonly()
|
|
25638
|
+
});
|
|
24157
25639
|
object({
|
|
24158
25640
|
activeCameras: number(),
|
|
24159
25641
|
throttledCameras: number(),
|
|
@@ -25242,7 +26724,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25242
26724
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25243
26725
|
deviceId: number(),
|
|
25244
26726
|
trackId: string()
|
|
25245
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26727
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26728
|
+
accepted: literal(true),
|
|
26729
|
+
runId: string()
|
|
26730
|
+
}), {
|
|
26731
|
+
kind: "mutation",
|
|
26732
|
+
auth: "admin"
|
|
26733
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
26734
|
+
kind: "mutation",
|
|
26735
|
+
auth: "admin"
|
|
26736
|
+
});
|
|
25246
26737
|
var CameraPipelineConfigSchema = object({
|
|
25247
26738
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25248
26739
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -25881,6 +27372,21 @@ method(object({
|
|
|
25881
27372
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
25882
27373
|
kind: "mutation",
|
|
25883
27374
|
auth: "admin"
|
|
27375
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27376
|
+
kind: literal("started"),
|
|
27377
|
+
runId: string()
|
|
27378
|
+
}), object({
|
|
27379
|
+
kind: literal("refused"),
|
|
27380
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27381
|
+
})]), {
|
|
27382
|
+
kind: "mutation",
|
|
27383
|
+
auth: "admin"
|
|
27384
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27385
|
+
kind: "mutation",
|
|
27386
|
+
auth: "admin"
|
|
27387
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27388
|
+
kind: "mutation",
|
|
27389
|
+
auth: "admin"
|
|
25884
27390
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25885
27391
|
deviceId: number(),
|
|
25886
27392
|
addonId: string(),
|
|
@@ -30974,6 +32480,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
30974
32480
|
enabled: boolean().optional(),
|
|
30975
32481
|
info: record(string(), unknown()).optional(),
|
|
30976
32482
|
settings: record(string(), unknown()).optional(),
|
|
32483
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
32484
|
+
* the keychain, not the table (D787). */
|
|
32485
|
+
secretKeys: array(string()).optional(),
|
|
30977
32486
|
skipRestart: boolean().optional()
|
|
30978
32487
|
});
|
|
30979
32488
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -30997,7 +32506,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
30997
32506
|
auth: "admin"
|
|
30998
32507
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
30999
32508
|
id: string(),
|
|
31000
|
-
settings: record(string(), unknown())
|
|
32509
|
+
settings: record(string(), unknown()),
|
|
32510
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
32511
|
+
secretKeys: array(string()).optional()
|
|
31001
32512
|
}), object({ success: boolean() }), {
|
|
31002
32513
|
kind: "mutation",
|
|
31003
32514
|
auth: "admin"
|
|
@@ -39709,6 +41220,90 @@ Object.freeze({
|
|
|
39709
41220
|
addonId: null,
|
|
39710
41221
|
access: "create"
|
|
39711
41222
|
},
|
|
41223
|
+
"keychain.delete": {
|
|
41224
|
+
capName: "keychain",
|
|
41225
|
+
capScope: "system",
|
|
41226
|
+
addonId: null,
|
|
41227
|
+
access: "delete"
|
|
41228
|
+
},
|
|
41229
|
+
"keychain.getState": {
|
|
41230
|
+
capName: "keychain",
|
|
41231
|
+
capScope: "system",
|
|
41232
|
+
addonId: null,
|
|
41233
|
+
access: "view"
|
|
41234
|
+
},
|
|
41235
|
+
"keychain.listMeta": {
|
|
41236
|
+
capName: "keychain",
|
|
41237
|
+
capScope: "system",
|
|
41238
|
+
addonId: null,
|
|
41239
|
+
access: "view"
|
|
41240
|
+
},
|
|
41241
|
+
"keychain.put": {
|
|
41242
|
+
capName: "keychain",
|
|
41243
|
+
capScope: "system",
|
|
41244
|
+
addonId: null,
|
|
41245
|
+
access: "create"
|
|
41246
|
+
},
|
|
41247
|
+
"keychain.resolve": {
|
|
41248
|
+
capName: "keychain",
|
|
41249
|
+
capScope: "system",
|
|
41250
|
+
addonId: null,
|
|
41251
|
+
access: "view"
|
|
41252
|
+
},
|
|
41253
|
+
"keychainAdmin.deleteOrphans": {
|
|
41254
|
+
capName: "keychain-admin",
|
|
41255
|
+
capScope: "system",
|
|
41256
|
+
addonId: null,
|
|
41257
|
+
access: "delete"
|
|
41258
|
+
},
|
|
41259
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
41260
|
+
capName: "keychain-admin",
|
|
41261
|
+
capScope: "system",
|
|
41262
|
+
addonId: null,
|
|
41263
|
+
access: "create"
|
|
41264
|
+
},
|
|
41265
|
+
"keychainAdmin.listAudit": {
|
|
41266
|
+
capName: "keychain-admin",
|
|
41267
|
+
capScope: "system",
|
|
41268
|
+
addonId: null,
|
|
41269
|
+
access: "view"
|
|
41270
|
+
},
|
|
41271
|
+
"keychainAdmin.listSecrets": {
|
|
41272
|
+
capName: "keychain-admin",
|
|
41273
|
+
capScope: "system",
|
|
41274
|
+
addonId: null,
|
|
41275
|
+
access: "view"
|
|
41276
|
+
},
|
|
41277
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
41278
|
+
capName: "keychain-admin",
|
|
41279
|
+
capScope: "system",
|
|
41280
|
+
addonId: null,
|
|
41281
|
+
access: "delete"
|
|
41282
|
+
},
|
|
41283
|
+
"keychainAdmin.resetKeychain": {
|
|
41284
|
+
capName: "keychain-admin",
|
|
41285
|
+
capScope: "system",
|
|
41286
|
+
addonId: null,
|
|
41287
|
+
access: "delete"
|
|
41288
|
+
},
|
|
41289
|
+
"keychainAdmin.reveal": {
|
|
41290
|
+
capName: "keychain-admin",
|
|
41291
|
+
capScope: "system",
|
|
41292
|
+
addonId: null,
|
|
41293
|
+
access: "create"
|
|
41294
|
+
},
|
|
41295
|
+
"keychainAdmin.rotateMasterKey": {
|
|
41296
|
+
capName: "keychain-admin",
|
|
41297
|
+
capScope: "system",
|
|
41298
|
+
addonId: null,
|
|
41299
|
+
access: "create"
|
|
41300
|
+
},
|
|
41301
|
+
"keychainAdmin.status": {
|
|
41302
|
+
capName: "keychain-admin",
|
|
41303
|
+
capScope: "system",
|
|
41304
|
+
addonId: null,
|
|
41305
|
+
access: "view"
|
|
41306
|
+
},
|
|
39712
41307
|
"lawnMowerControl.dock": {
|
|
39713
41308
|
capName: "lawn-mower-control",
|
|
39714
41309
|
capScope: "device",
|
|
@@ -41083,6 +42678,18 @@ Object.freeze({
|
|
|
41083
42678
|
addonId: null,
|
|
41084
42679
|
access: "create"
|
|
41085
42680
|
},
|
|
42681
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
42682
|
+
capName: "pipeline-analytics",
|
|
42683
|
+
capScope: "device",
|
|
42684
|
+
addonId: null,
|
|
42685
|
+
access: "create"
|
|
42686
|
+
},
|
|
42687
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
42688
|
+
capName: "pipeline-analytics",
|
|
42689
|
+
capScope: "device",
|
|
42690
|
+
addonId: null,
|
|
42691
|
+
access: "create"
|
|
42692
|
+
},
|
|
41086
42693
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
41087
42694
|
capName: "pipeline-analytics",
|
|
41088
42695
|
capScope: "device",
|
|
@@ -41131,12 +42738,24 @@ Object.freeze({
|
|
|
41131
42738
|
addonId: null,
|
|
41132
42739
|
access: "view"
|
|
41133
42740
|
},
|
|
42741
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
42742
|
+
capName: "pipeline-analytics",
|
|
42743
|
+
capScope: "device",
|
|
42744
|
+
addonId: null,
|
|
42745
|
+
access: "create"
|
|
42746
|
+
},
|
|
41134
42747
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
41135
42748
|
capName: "pipeline-analytics",
|
|
41136
42749
|
capScope: "device",
|
|
41137
42750
|
addonId: null,
|
|
41138
42751
|
access: "delete"
|
|
41139
42752
|
},
|
|
42753
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
42754
|
+
capName: "pipeline-analytics",
|
|
42755
|
+
capScope: "device",
|
|
42756
|
+
addonId: null,
|
|
42757
|
+
access: "delete"
|
|
42758
|
+
},
|
|
41140
42759
|
"pipelineAnalytics.deleteTracks": {
|
|
41141
42760
|
capName: "pipeline-analytics",
|
|
41142
42761
|
capScope: "device",
|
|
@@ -41341,6 +42960,24 @@ Object.freeze({
|
|
|
41341
42960
|
addonId: null,
|
|
41342
42961
|
access: "view"
|
|
41343
42962
|
},
|
|
42963
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
42964
|
+
capName: "pipeline-analytics",
|
|
42965
|
+
capScope: "device",
|
|
42966
|
+
addonId: null,
|
|
42967
|
+
access: "view"
|
|
42968
|
+
},
|
|
42969
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
42970
|
+
capName: "pipeline-analytics",
|
|
42971
|
+
capScope: "device",
|
|
42972
|
+
addonId: null,
|
|
42973
|
+
access: "view"
|
|
42974
|
+
},
|
|
42975
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
42976
|
+
capName: "pipeline-analytics",
|
|
42977
|
+
capScope: "device",
|
|
42978
|
+
addonId: null,
|
|
42979
|
+
access: "view"
|
|
42980
|
+
},
|
|
41344
42981
|
"pipelineAnalytics.listRetrainFrames": {
|
|
41345
42982
|
capName: "pipeline-analytics",
|
|
41346
42983
|
capScope: "device",
|
|
@@ -41389,6 +43026,12 @@ Object.freeze({
|
|
|
41389
43026
|
addonId: null,
|
|
41390
43027
|
access: "create"
|
|
41391
43028
|
},
|
|
43029
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
43030
|
+
capName: "pipeline-analytics",
|
|
43031
|
+
capScope: "device",
|
|
43032
|
+
addonId: null,
|
|
43033
|
+
access: "create"
|
|
43034
|
+
},
|
|
41392
43035
|
"pipelineAnalytics.pruneEvents": {
|
|
41393
43036
|
capName: "pipeline-analytics",
|
|
41394
43037
|
capScope: "device",
|
|
@@ -41443,6 +43086,18 @@ Object.freeze({
|
|
|
41443
43086
|
addonId: null,
|
|
41444
43087
|
access: "create"
|
|
41445
43088
|
},
|
|
43089
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
43090
|
+
capName: "pipeline-analytics",
|
|
43091
|
+
capScope: "device",
|
|
43092
|
+
addonId: null,
|
|
43093
|
+
access: "delete"
|
|
43094
|
+
},
|
|
43095
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
43096
|
+
capName: "pipeline-analytics",
|
|
43097
|
+
capScope: "device",
|
|
43098
|
+
addonId: null,
|
|
43099
|
+
access: "create"
|
|
43100
|
+
},
|
|
41446
43101
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
41447
43102
|
capName: "pipeline-analytics",
|
|
41448
43103
|
capScope: "device",
|
|
@@ -41731,6 +43386,12 @@ Object.freeze({
|
|
|
41731
43386
|
addonId: null,
|
|
41732
43387
|
access: "view"
|
|
41733
43388
|
},
|
|
43389
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
43390
|
+
capName: "pipeline-orchestrator",
|
|
43391
|
+
capScope: "system",
|
|
43392
|
+
addonId: null,
|
|
43393
|
+
access: "create"
|
|
43394
|
+
},
|
|
41734
43395
|
"pipelineOrchestrator.applyAutoTune": {
|
|
41735
43396
|
capName: "pipeline-orchestrator",
|
|
41736
43397
|
capScope: "system",
|
|
@@ -41755,6 +43416,12 @@ Object.freeze({
|
|
|
41755
43416
|
addonId: null,
|
|
41756
43417
|
access: "create"
|
|
41757
43418
|
},
|
|
43419
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
43420
|
+
capName: "pipeline-orchestrator",
|
|
43421
|
+
capScope: "system",
|
|
43422
|
+
addonId: null,
|
|
43423
|
+
access: "delete"
|
|
43424
|
+
},
|
|
41758
43425
|
"pipelineOrchestrator.getAgentLoad": {
|
|
41759
43426
|
capName: "pipeline-orchestrator",
|
|
41760
43427
|
capScope: "system",
|
|
@@ -41863,6 +43530,24 @@ Object.freeze({
|
|
|
41863
43530
|
addonId: null,
|
|
41864
43531
|
access: "view"
|
|
41865
43532
|
},
|
|
43533
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
43534
|
+
capName: "pipeline-orchestrator",
|
|
43535
|
+
capScope: "system",
|
|
43536
|
+
addonId: null,
|
|
43537
|
+
access: "view"
|
|
43538
|
+
},
|
|
43539
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
43540
|
+
capName: "pipeline-orchestrator",
|
|
43541
|
+
capScope: "system",
|
|
43542
|
+
addonId: null,
|
|
43543
|
+
access: "view"
|
|
43544
|
+
},
|
|
43545
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
43546
|
+
capName: "pipeline-orchestrator",
|
|
43547
|
+
capScope: "system",
|
|
43548
|
+
addonId: null,
|
|
43549
|
+
access: "view"
|
|
43550
|
+
},
|
|
41866
43551
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
41867
43552
|
capName: "pipeline-orchestrator",
|
|
41868
43553
|
capScope: "system",
|
|
@@ -41905,6 +43590,12 @@ Object.freeze({
|
|
|
41905
43590
|
addonId: null,
|
|
41906
43591
|
access: "view"
|
|
41907
43592
|
},
|
|
43593
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
43594
|
+
capName: "pipeline-orchestrator",
|
|
43595
|
+
capScope: "system",
|
|
43596
|
+
addonId: null,
|
|
43597
|
+
access: "view"
|
|
43598
|
+
},
|
|
41908
43599
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
41909
43600
|
capName: "pipeline-orchestrator",
|
|
41910
43601
|
capScope: "system",
|
|
@@ -42049,6 +43740,12 @@ Object.freeze({
|
|
|
42049
43740
|
addonId: null,
|
|
42050
43741
|
access: "create"
|
|
42051
43742
|
},
|
|
43743
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
43744
|
+
capName: "pipeline-orchestrator",
|
|
43745
|
+
capScope: "system",
|
|
43746
|
+
addonId: null,
|
|
43747
|
+
access: "create"
|
|
43748
|
+
},
|
|
42052
43749
|
"pipelineOrchestrator.suggestShares": {
|
|
42053
43750
|
capName: "pipeline-orchestrator",
|
|
42054
43751
|
capScope: "system",
|
|
@@ -42067,6 +43764,12 @@ Object.freeze({
|
|
|
42067
43764
|
addonId: null,
|
|
42068
43765
|
access: "create"
|
|
42069
43766
|
},
|
|
43767
|
+
"pipelineRunner.abortNodeBench": {
|
|
43768
|
+
capName: "pipeline-runner",
|
|
43769
|
+
capScope: "system",
|
|
43770
|
+
addonId: null,
|
|
43771
|
+
access: "create"
|
|
43772
|
+
},
|
|
42070
43773
|
"pipelineRunner.attachCamera": {
|
|
42071
43774
|
capName: "pipeline-runner",
|
|
42072
43775
|
capScope: "system",
|
|
@@ -42115,6 +43818,12 @@ Object.freeze({
|
|
|
42115
43818
|
addonId: null,
|
|
42116
43819
|
access: "view"
|
|
42117
43820
|
},
|
|
43821
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
43822
|
+
capName: "pipeline-runner",
|
|
43823
|
+
capScope: "system",
|
|
43824
|
+
addonId: null,
|
|
43825
|
+
access: "view"
|
|
43826
|
+
},
|
|
42118
43827
|
"pipelineRunner.getParkedTrackFrame": {
|
|
42119
43828
|
capName: "pipeline-runner",
|
|
42120
43829
|
capScope: "system",
|
|
@@ -42157,6 +43866,12 @@ Object.freeze({
|
|
|
42157
43866
|
addonId: null,
|
|
42158
43867
|
access: "create"
|
|
42159
43868
|
},
|
|
43869
|
+
"pipelineRunner.startNodeBench": {
|
|
43870
|
+
capName: "pipeline-runner",
|
|
43871
|
+
capScope: "system",
|
|
43872
|
+
addonId: null,
|
|
43873
|
+
access: "create"
|
|
43874
|
+
},
|
|
42160
43875
|
"plateGallery.assignPlate": {
|
|
42161
43876
|
capName: "plate-gallery",
|
|
42162
43877
|
capScope: "system",
|
|
@@ -47086,6 +48801,11 @@ Object.freeze({
|
|
|
47086
48801
|
form: "single",
|
|
47087
48802
|
optional: false
|
|
47088
48803
|
}],
|
|
48804
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
48805
|
+
name: "deviceId",
|
|
48806
|
+
form: "single",
|
|
48807
|
+
optional: false
|
|
48808
|
+
}],
|
|
47089
48809
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
47090
48810
|
name: "deviceId",
|
|
47091
48811
|
form: "single",
|
|
@@ -47276,6 +48996,11 @@ Object.freeze({
|
|
|
47276
48996
|
form: "single",
|
|
47277
48997
|
optional: false
|
|
47278
48998
|
}],
|
|
48999
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
49000
|
+
name: "deviceId",
|
|
49001
|
+
form: "single",
|
|
49002
|
+
optional: false
|
|
49003
|
+
}],
|
|
47279
49004
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
47280
49005
|
name: "deviceId",
|
|
47281
49006
|
form: "single",
|