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