@camstack/addon-import-alexa 0.2.121 → 0.2.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +2047 -65
- package/dist/addon.mjs +2047 -65
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
39
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region ../types/dist/event-category-
|
|
41
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
42
42
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
43
43
|
EventCategory["SystemBoot"] = "system.boot";
|
|
44
44
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -117,6 +117,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
117
117
|
*/
|
|
118
118
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
119
119
|
/**
|
|
120
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
121
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
122
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
123
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
124
|
+
*/
|
|
125
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
126
|
+
/**
|
|
120
127
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
121
128
|
* transitions from `failed` back to `healthy` (typically via the
|
|
122
129
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5409,7 +5416,7 @@ var ZodIssueCode = {
|
|
|
5409
5416
|
var ZodFirstPartyTypeKind;
|
|
5410
5417
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5411
5418
|
//#endregion
|
|
5412
|
-
//#region ../types/dist/sleep-
|
|
5419
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5413
5420
|
/**
|
|
5414
5421
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5415
5422
|
* window to float samples (D455).
|
|
@@ -5488,6 +5495,97 @@ function buildAlawTable() {
|
|
|
5488
5495
|
}
|
|
5489
5496
|
buildUlawTable();
|
|
5490
5497
|
buildAlawTable();
|
|
5498
|
+
/** Is this field's stored value a credential? */
|
|
5499
|
+
function isSecretConfigField(field) {
|
|
5500
|
+
if (field.type === "password") return true;
|
|
5501
|
+
return "secret" in field && field.secret === true;
|
|
5502
|
+
}
|
|
5503
|
+
/**
|
|
5504
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5505
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5506
|
+
*/
|
|
5507
|
+
function isKeychainStoredField(field) {
|
|
5508
|
+
if (!isSecretConfigField(field)) return false;
|
|
5509
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5510
|
+
return !("storage" in field && field.storage === "inline");
|
|
5511
|
+
}
|
|
5512
|
+
/**
|
|
5513
|
+
* What a settings blob holds where a secret used to be.
|
|
5514
|
+
*
|
|
5515
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5516
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5517
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5518
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5519
|
+
*
|
|
5520
|
+
* The same shapes travel to and from the admin UI:
|
|
5521
|
+
*
|
|
5522
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5523
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5524
|
+
* value is set, never the value.
|
|
5525
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5526
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5527
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5528
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5529
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5530
|
+
*
|
|
5531
|
+
* Pure and browser-safe.
|
|
5532
|
+
*/
|
|
5533
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5534
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5535
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5536
|
+
function isRecord$1$1(value) {
|
|
5537
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5538
|
+
}
|
|
5539
|
+
function makeSecretMarker(ref) {
|
|
5540
|
+
return {
|
|
5541
|
+
$secret: ref,
|
|
5542
|
+
v: 1
|
|
5543
|
+
};
|
|
5544
|
+
}
|
|
5545
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5546
|
+
function isSecretMarker(value) {
|
|
5547
|
+
if (!isRecord$1$1(value)) return false;
|
|
5548
|
+
const ref = value["$secret"];
|
|
5549
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5550
|
+
}
|
|
5551
|
+
function isSecretClear(value) {
|
|
5552
|
+
return isRecord$1$1(value) && value["$secretClear"] === true;
|
|
5553
|
+
}
|
|
5554
|
+
/**
|
|
5555
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5556
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5557
|
+
* survives this function.
|
|
5558
|
+
*/
|
|
5559
|
+
function toSecretFieldView(stored) {
|
|
5560
|
+
if (isSecretMarker(stored)) return {
|
|
5561
|
+
$secret: stored.$secret,
|
|
5562
|
+
v: 1,
|
|
5563
|
+
set: true
|
|
5564
|
+
};
|
|
5565
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5566
|
+
$secret: null,
|
|
5567
|
+
v: 1,
|
|
5568
|
+
set: true,
|
|
5569
|
+
inline: true
|
|
5570
|
+
};
|
|
5571
|
+
return null;
|
|
5572
|
+
}
|
|
5573
|
+
/**
|
|
5574
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5575
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5576
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5577
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5578
|
+
*/
|
|
5579
|
+
function classifySecretWrite(incoming) {
|
|
5580
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5581
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5582
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5583
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5584
|
+
return {
|
|
5585
|
+
kind: "set",
|
|
5586
|
+
value: incoming
|
|
5587
|
+
};
|
|
5588
|
+
}
|
|
5491
5589
|
Object.fromEntries([
|
|
5492
5590
|
{
|
|
5493
5591
|
id: "overview",
|
|
@@ -5659,33 +5757,19 @@ Object.fromEntries([
|
|
|
5659
5757
|
function isValuelessField(field) {
|
|
5660
5758
|
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";
|
|
5661
5759
|
}
|
|
5662
|
-
|
|
5663
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5664
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5665
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5666
|
-
*
|
|
5667
|
-
* For each leaf field:
|
|
5668
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5669
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5670
|
-
*
|
|
5671
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5672
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5673
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5674
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5675
|
-
*/
|
|
5676
|
-
function hydrateSchema(schema, values) {
|
|
5760
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5677
5761
|
return {
|
|
5678
5762
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5679
5763
|
sections: schema.sections.map((section) => ({
|
|
5680
5764
|
...section,
|
|
5681
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5765
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5682
5766
|
}))
|
|
5683
5767
|
};
|
|
5684
5768
|
}
|
|
5685
|
-
function hydrateField(field, values) {
|
|
5769
|
+
function hydrateField(field, values, options) {
|
|
5686
5770
|
if (isValuelessField(field)) return field;
|
|
5687
5771
|
if (field.type === "group") {
|
|
5688
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5772
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5689
5773
|
return {
|
|
5690
5774
|
...field,
|
|
5691
5775
|
fields: hydratedChildren
|
|
@@ -5694,7 +5778,7 @@ function hydrateField(field, values) {
|
|
|
5694
5778
|
if (field.type === "sub-tabs") {
|
|
5695
5779
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5696
5780
|
...tab,
|
|
5697
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5781
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5698
5782
|
}));
|
|
5699
5783
|
return {
|
|
5700
5784
|
...field,
|
|
@@ -5704,6 +5788,33 @@ function hydrateField(field, values) {
|
|
|
5704
5788
|
const key = field.key;
|
|
5705
5789
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5706
5790
|
const defaultValue = field.default;
|
|
5791
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5792
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5793
|
+
...field,
|
|
5794
|
+
value: toSecretFieldView(storedValue)
|
|
5795
|
+
};
|
|
5796
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5797
|
+
...field,
|
|
5798
|
+
value: null
|
|
5799
|
+
};
|
|
5800
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5801
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5802
|
+
if (secretItemKeys.length > 0) {
|
|
5803
|
+
const rows = storedValue.map((row) => {
|
|
5804
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5805
|
+
const out = { ...row };
|
|
5806
|
+
for (const k of secretItemKeys) {
|
|
5807
|
+
const v = Reflect.get(row, k);
|
|
5808
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5809
|
+
}
|
|
5810
|
+
return out;
|
|
5811
|
+
});
|
|
5812
|
+
return {
|
|
5813
|
+
...field,
|
|
5814
|
+
value: rows
|
|
5815
|
+
};
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5707
5818
|
if (field.multiple) {
|
|
5708
5819
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5709
5820
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5946,6 +6057,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5946
6057
|
}
|
|
5947
6058
|
return out;
|
|
5948
6059
|
}
|
|
6060
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6061
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6062
|
+
function globalSecretScope() {
|
|
6063
|
+
return GLOBAL_SCOPE;
|
|
6064
|
+
}
|
|
6065
|
+
function encodeSegment(value) {
|
|
6066
|
+
return encodeURIComponent(value);
|
|
6067
|
+
}
|
|
6068
|
+
/**
|
|
6069
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6070
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6071
|
+
* `providers[authentik].clientSecret`.
|
|
6072
|
+
*/
|
|
6073
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6074
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6075
|
+
}
|
|
6076
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6077
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6078
|
+
fieldPath;
|
|
6079
|
+
constructor(fieldPath, cause) {
|
|
6080
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6081
|
+
this.fieldPath = fieldPath;
|
|
6082
|
+
this.name = "KeychainWriteRefusedError";
|
|
6083
|
+
}
|
|
6084
|
+
};
|
|
6085
|
+
var KEEP = { kind: "keep" };
|
|
6086
|
+
function isRecord$2(value) {
|
|
6087
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6088
|
+
}
|
|
6089
|
+
function defaultMintId() {
|
|
6090
|
+
return globalThis.crypto.randomUUID();
|
|
6091
|
+
}
|
|
6092
|
+
/** Every marker ref anywhere under `value`. */
|
|
6093
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6094
|
+
if (isSecretMarker(value)) {
|
|
6095
|
+
out.push(value.$secret);
|
|
6096
|
+
return out;
|
|
6097
|
+
}
|
|
6098
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6099
|
+
else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6100
|
+
return out;
|
|
6101
|
+
}
|
|
6102
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6103
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6104
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6105
|
+
}
|
|
6106
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6107
|
+
const intent = classifySecretWrite(incoming);
|
|
6108
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6109
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6110
|
+
if (intent.kind === "keep") return KEEP;
|
|
6111
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6112
|
+
if (intent.kind === "clear") {
|
|
6113
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6114
|
+
return {
|
|
6115
|
+
kind: "value",
|
|
6116
|
+
value: null
|
|
6117
|
+
};
|
|
6118
|
+
}
|
|
6119
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6120
|
+
kind: "value",
|
|
6121
|
+
value: stored
|
|
6122
|
+
};
|
|
6123
|
+
try {
|
|
6124
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6125
|
+
} catch (err) {
|
|
6126
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6127
|
+
}
|
|
6128
|
+
return {
|
|
6129
|
+
kind: "value",
|
|
6130
|
+
value: makeSecretMarker(ref)
|
|
6131
|
+
};
|
|
6132
|
+
}
|
|
6133
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6134
|
+
function applyMember(out, key, result, storedParent) {
|
|
6135
|
+
if (result.kind === "value") {
|
|
6136
|
+
out[key] = result.value;
|
|
6137
|
+
return;
|
|
6138
|
+
}
|
|
6139
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6140
|
+
else delete out[key];
|
|
6141
|
+
}
|
|
6142
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6143
|
+
const out = { ...incoming };
|
|
6144
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6145
|
+
return out;
|
|
6146
|
+
}
|
|
6147
|
+
function rowId(row, idKey) {
|
|
6148
|
+
const raw = row[idKey];
|
|
6149
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6150
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6151
|
+
return null;
|
|
6152
|
+
}
|
|
6153
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6154
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
|
|
6155
|
+
if (!Array.isArray(incoming)) {
|
|
6156
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6157
|
+
return {
|
|
6158
|
+
kind: "value",
|
|
6159
|
+
value: incoming
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6163
|
+
for (const row of storedRows) {
|
|
6164
|
+
const id = rowId(row, node.idKey);
|
|
6165
|
+
if (id !== null) storedById.set(id, row);
|
|
6166
|
+
}
|
|
6167
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6168
|
+
const rows = [];
|
|
6169
|
+
for (const row of incoming) {
|
|
6170
|
+
if (!isRecord$2(row)) {
|
|
6171
|
+
rows.push(row);
|
|
6172
|
+
continue;
|
|
6173
|
+
}
|
|
6174
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6175
|
+
kept.add(id);
|
|
6176
|
+
const withId = {
|
|
6177
|
+
...row,
|
|
6178
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6179
|
+
};
|
|
6180
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6181
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6182
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6183
|
+
}
|
|
6184
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6185
|
+
return {
|
|
6186
|
+
kind: "value",
|
|
6187
|
+
value: rows
|
|
6188
|
+
};
|
|
6189
|
+
}
|
|
6190
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6191
|
+
switch (node.kind) {
|
|
6192
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6193
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6194
|
+
case "object": {
|
|
6195
|
+
if (!isRecord$2(incoming)) {
|
|
6196
|
+
if (incoming === void 0) return KEEP;
|
|
6197
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6198
|
+
return {
|
|
6199
|
+
kind: "value",
|
|
6200
|
+
value: incoming
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
const storedObj = isRecord$2(stored) ? stored : {};
|
|
6204
|
+
return {
|
|
6205
|
+
kind: "value",
|
|
6206
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6207
|
+
};
|
|
6208
|
+
}
|
|
6209
|
+
}
|
|
6210
|
+
}
|
|
6211
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6212
|
+
function splitNodeKey(key) {
|
|
6213
|
+
const at = key.indexOf("@");
|
|
6214
|
+
return at <= 0 ? {
|
|
6215
|
+
base: key,
|
|
6216
|
+
nodeId: null
|
|
6217
|
+
} : {
|
|
6218
|
+
base: key.slice(0, at),
|
|
6219
|
+
nodeId: key.slice(at + 1)
|
|
6220
|
+
};
|
|
6221
|
+
}
|
|
6222
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6223
|
+
async function transformSecretWrite(input) {
|
|
6224
|
+
const deletes = [];
|
|
6225
|
+
const base = {
|
|
6226
|
+
secrets: input.secrets,
|
|
6227
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6228
|
+
deletes,
|
|
6229
|
+
operatorWrite: input.operatorWrite === true
|
|
6230
|
+
};
|
|
6231
|
+
const out = {};
|
|
6232
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6233
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6234
|
+
const node = input.tree.get(baseKey);
|
|
6235
|
+
if (node === void 0) {
|
|
6236
|
+
out[key] = incoming;
|
|
6237
|
+
continue;
|
|
6238
|
+
}
|
|
6239
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6240
|
+
kind: "node",
|
|
6241
|
+
nodeId
|
|
6242
|
+
} : input.scope ?? globalSecretScope();
|
|
6243
|
+
const result = await writeNode({
|
|
6244
|
+
...base,
|
|
6245
|
+
scope
|
|
6246
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6247
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6248
|
+
}
|
|
6249
|
+
return {
|
|
6250
|
+
patch: out,
|
|
6251
|
+
afterWrite: async () => {
|
|
6252
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6253
|
+
try {
|
|
6254
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6255
|
+
return { orphaned: [] };
|
|
6256
|
+
} catch {
|
|
6257
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
};
|
|
6261
|
+
}
|
|
6262
|
+
/**
|
|
6263
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6264
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6265
|
+
*/
|
|
6266
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6267
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6268
|
+
if (refs.length === 0) return {
|
|
6269
|
+
value,
|
|
6270
|
+
unresolved: []
|
|
6271
|
+
};
|
|
6272
|
+
const answers = await secrets.resolve(refs);
|
|
6273
|
+
const unresolved = [];
|
|
6274
|
+
for (const ref of new Set(refs)) {
|
|
6275
|
+
const answer = answers[ref];
|
|
6276
|
+
if (answer === void 0) unresolved.push({
|
|
6277
|
+
ref,
|
|
6278
|
+
reason: "not-initialized"
|
|
6279
|
+
});
|
|
6280
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6281
|
+
ref,
|
|
6282
|
+
reason: answer.reason
|
|
6283
|
+
});
|
|
6284
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6285
|
+
ref,
|
|
6286
|
+
reason: answer.kind
|
|
6287
|
+
});
|
|
6288
|
+
}
|
|
6289
|
+
const substitute = (v) => {
|
|
6290
|
+
if (isSecretMarker(v)) {
|
|
6291
|
+
const answer = answers[v.$secret];
|
|
6292
|
+
return answer?.kind === "value" ? {
|
|
6293
|
+
keep: true,
|
|
6294
|
+
value: answer.value
|
|
6295
|
+
} : {
|
|
6296
|
+
keep: false,
|
|
6297
|
+
value: void 0
|
|
6298
|
+
};
|
|
6299
|
+
}
|
|
6300
|
+
if (Array.isArray(v)) {
|
|
6301
|
+
const items = [];
|
|
6302
|
+
for (const item of v) {
|
|
6303
|
+
const s = substitute(item);
|
|
6304
|
+
if (s.keep) items.push(s.value);
|
|
6305
|
+
}
|
|
6306
|
+
return {
|
|
6307
|
+
keep: true,
|
|
6308
|
+
value: items
|
|
6309
|
+
};
|
|
6310
|
+
}
|
|
6311
|
+
if (isRecord$2(v)) {
|
|
6312
|
+
const out = {};
|
|
6313
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6314
|
+
const s = substitute(child);
|
|
6315
|
+
if (s.keep) out[k] = s.value;
|
|
6316
|
+
}
|
|
6317
|
+
return {
|
|
6318
|
+
keep: true,
|
|
6319
|
+
value: out
|
|
6320
|
+
};
|
|
6321
|
+
}
|
|
6322
|
+
return {
|
|
6323
|
+
keep: true,
|
|
6324
|
+
value: v
|
|
6325
|
+
};
|
|
6326
|
+
};
|
|
6327
|
+
return {
|
|
6328
|
+
value: substitute(value).value,
|
|
6329
|
+
unresolved
|
|
6330
|
+
};
|
|
6331
|
+
}
|
|
6332
|
+
function touchesTree(tree, patch) {
|
|
6333
|
+
if (tree.size === 0) return false;
|
|
6334
|
+
for (const key of Object.keys(patch)) {
|
|
6335
|
+
const at = key.indexOf("@");
|
|
6336
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6337
|
+
}
|
|
6338
|
+
return false;
|
|
6339
|
+
}
|
|
6340
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6341
|
+
async function readStoredAddonBlob(raw) {
|
|
6342
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6343
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6344
|
+
const result = await threeWay.call(raw);
|
|
6345
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6346
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6347
|
+
}
|
|
6348
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6349
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6350
|
+
const serialize = (key, fn) => {
|
|
6351
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6352
|
+
const tail = next.catch(() => void 0);
|
|
6353
|
+
chains.set(key, tail);
|
|
6354
|
+
tail.then(() => {
|
|
6355
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6356
|
+
});
|
|
6357
|
+
return next;
|
|
6358
|
+
};
|
|
6359
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6360
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6361
|
+
return serialize(chainKey, async () => {
|
|
6362
|
+
const stored = await readStored();
|
|
6363
|
+
const result = await transformSecretWrite({
|
|
6364
|
+
tree,
|
|
6365
|
+
secrets: opts.secrets,
|
|
6366
|
+
patch,
|
|
6367
|
+
stored,
|
|
6368
|
+
...scope !== void 0 ? { scope } : {},
|
|
6369
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6370
|
+
});
|
|
6371
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6372
|
+
const { orphaned } = await result.afterWrite();
|
|
6373
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6374
|
+
});
|
|
6375
|
+
};
|
|
6376
|
+
const wrapped = {
|
|
6377
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6378
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6379
|
+
kind: "device",
|
|
6380
|
+
deviceId
|
|
6381
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6382
|
+
};
|
|
6383
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6384
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6385
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6386
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6387
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6388
|
+
} });
|
|
6389
|
+
}
|
|
6390
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6391
|
+
function withSecretAwareSettings(context, opts) {
|
|
6392
|
+
const raw = context.settings;
|
|
6393
|
+
if (raw === void 0) return context;
|
|
6394
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6395
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6396
|
+
if (prop === "settings") return settings;
|
|
6397
|
+
return Reflect.get(target, prop, receiver);
|
|
6398
|
+
} });
|
|
6399
|
+
}
|
|
6400
|
+
var LEAF = { kind: "leaf" };
|
|
6401
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6402
|
+
function collectFields(fields, out) {
|
|
6403
|
+
for (const field of fields) {
|
|
6404
|
+
if (field.type === "group") {
|
|
6405
|
+
collectFields(field.fields, out);
|
|
6406
|
+
continue;
|
|
6407
|
+
}
|
|
6408
|
+
if (field.type === "sub-tabs") {
|
|
6409
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6410
|
+
continue;
|
|
6411
|
+
}
|
|
6412
|
+
if (field.type === "editable-array") {
|
|
6413
|
+
const item = /* @__PURE__ */ new Map();
|
|
6414
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6415
|
+
if (item.size > 0) out.set(field.key, {
|
|
6416
|
+
kind: "array",
|
|
6417
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6418
|
+
item
|
|
6419
|
+
});
|
|
6420
|
+
continue;
|
|
6421
|
+
}
|
|
6422
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6423
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
/** The secret tree a settings schema declares. */
|
|
6427
|
+
function secretTreeFromSchema(schema) {
|
|
6428
|
+
const out = /* @__PURE__ */ new Map();
|
|
6429
|
+
if (schema === null) return out;
|
|
6430
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6431
|
+
return out;
|
|
6432
|
+
}
|
|
6433
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6434
|
+
function parseSecretStatePath(path) {
|
|
6435
|
+
const segments = [];
|
|
6436
|
+
for (const raw of path.split(".")) {
|
|
6437
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6438
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6439
|
+
segments.push(m[2] !== void 0 ? {
|
|
6440
|
+
key: m[1],
|
|
6441
|
+
idKey: m[2]
|
|
6442
|
+
} : { key: m[1] });
|
|
6443
|
+
}
|
|
6444
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6445
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6446
|
+
return segments;
|
|
6447
|
+
}
|
|
6448
|
+
function insert(into, segments) {
|
|
6449
|
+
const [head, ...rest] = segments;
|
|
6450
|
+
if (head === void 0) return;
|
|
6451
|
+
if (rest.length === 0) {
|
|
6452
|
+
into.set(head.key, LEAF);
|
|
6453
|
+
return;
|
|
6454
|
+
}
|
|
6455
|
+
const existing = into.get(head.key);
|
|
6456
|
+
if (head.idKey !== void 0) {
|
|
6457
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6458
|
+
insert(item, rest);
|
|
6459
|
+
into.set(head.key, {
|
|
6460
|
+
kind: "array",
|
|
6461
|
+
idKey: head.idKey,
|
|
6462
|
+
item
|
|
6463
|
+
});
|
|
6464
|
+
return;
|
|
6465
|
+
}
|
|
6466
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6467
|
+
insert(children, rest);
|
|
6468
|
+
into.set(head.key, {
|
|
6469
|
+
kind: "object",
|
|
6470
|
+
children
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6474
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6475
|
+
if (paths.length === 0) return tree;
|
|
6476
|
+
const out = new Map(tree);
|
|
6477
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6478
|
+
return out;
|
|
6479
|
+
}
|
|
6480
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6481
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6482
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6483
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6484
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5949
6485
|
/**
|
|
5950
6486
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5951
6487
|
*
|
|
@@ -6015,6 +6551,25 @@ var BaseAddon = class {
|
|
|
6015
6551
|
settingsStoreReady = false;
|
|
6016
6552
|
/** Default config values. Provided via constructor. */
|
|
6017
6553
|
defaults;
|
|
6554
|
+
/**
|
|
6555
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6556
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6557
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6558
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6559
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6560
|
+
*/
|
|
6561
|
+
secretStatePaths = [];
|
|
6562
|
+
_addonSecretTree = null;
|
|
6563
|
+
_deviceSecretTree = null;
|
|
6564
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6565
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6566
|
+
_unresolvedSecrets = [];
|
|
6567
|
+
_secretRetryTimer = null;
|
|
6568
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6569
|
+
_secretChangeTimer = null;
|
|
6570
|
+
_secretChangeUnsub = null;
|
|
6571
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6572
|
+
_operatorWriteDepth = 0;
|
|
6018
6573
|
constructor(defaults) {
|
|
6019
6574
|
this.defaults = defaults;
|
|
6020
6575
|
this._config = { ...defaults };
|
|
@@ -6050,8 +6605,18 @@ var BaseAddon = class {
|
|
|
6050
6605
|
return this._config;
|
|
6051
6606
|
}
|
|
6052
6607
|
async initialize(context) {
|
|
6053
|
-
|
|
6608
|
+
const secrets = context.secrets;
|
|
6609
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6610
|
+
secrets,
|
|
6611
|
+
addonTree: () => this.addonSecretTree(),
|
|
6612
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6613
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6614
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6615
|
+
}) : context;
|
|
6054
6616
|
await this.resolveConfig();
|
|
6617
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6618
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6619
|
+
});
|
|
6055
6620
|
const result = await this.onInitialize();
|
|
6056
6621
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6057
6622
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6084,6 +6649,12 @@ var BaseAddon = class {
|
|
|
6084
6649
|
*/
|
|
6085
6650
|
async onHubReachable() {}
|
|
6086
6651
|
async shutdown() {
|
|
6652
|
+
this._secretChangeUnsub?.();
|
|
6653
|
+
this._secretChangeUnsub = null;
|
|
6654
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6655
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6656
|
+
this._secretRetryTimer = null;
|
|
6657
|
+
this._secretChangeTimer = null;
|
|
6087
6658
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6088
6659
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6089
6660
|
await this.onShutdown();
|
|
@@ -6162,7 +6733,7 @@ var BaseAddon = class {
|
|
|
6162
6733
|
return hydrateSchema(schema, overlay ? {
|
|
6163
6734
|
...projected,
|
|
6164
6735
|
...overlay
|
|
6165
|
-
} : projected);
|
|
6736
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6166
6737
|
}
|
|
6167
6738
|
/**
|
|
6168
6739
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6211,7 +6782,7 @@ var BaseAddon = class {
|
|
|
6211
6782
|
return hydrateSchema({
|
|
6212
6783
|
...schema,
|
|
6213
6784
|
sections
|
|
6214
|
-
}, projected);
|
|
6785
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6215
6786
|
}
|
|
6216
6787
|
/**
|
|
6217
6788
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6265,18 +6836,50 @@ var BaseAddon = class {
|
|
|
6265
6836
|
value: result.value[key]
|
|
6266
6837
|
};
|
|
6267
6838
|
}
|
|
6839
|
+
/**
|
|
6840
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6841
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6842
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6843
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6844
|
+
* writing back what it read is not (D787).
|
|
6845
|
+
*/
|
|
6846
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6847
|
+
this._operatorWriteDepth++;
|
|
6848
|
+
try {
|
|
6849
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6850
|
+
} finally {
|
|
6851
|
+
this._operatorWriteDepth--;
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6268
6854
|
async updateGlobalSettings(patch, nodeId) {
|
|
6855
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6856
|
+
}
|
|
6857
|
+
/**
|
|
6858
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6859
|
+
*
|
|
6860
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6861
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6862
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6863
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6864
|
+
*/
|
|
6865
|
+
async clearSecrets(keys, nodeId) {
|
|
6866
|
+
const tree = this.addonSecretTree();
|
|
6867
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6868
|
+
const patch = {};
|
|
6869
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6870
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6871
|
+
}
|
|
6872
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6269
6873
|
const keys = this.perNodeKeys();
|
|
6270
6874
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6271
6875
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6272
|
-
const barePatch = patch;
|
|
6273
6876
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6274
6877
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6275
6878
|
if (target !== localNode) return;
|
|
6276
6879
|
await this.resolveConfig();
|
|
6277
6880
|
await this.onConfigChanged();
|
|
6278
6881
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6279
|
-
this.maybeAutoRestart(
|
|
6882
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6280
6883
|
}
|
|
6281
6884
|
/**
|
|
6282
6885
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6301,7 +6904,7 @@ var BaseAddon = class {
|
|
|
6301
6904
|
* time to return its response before the addon is torn down and
|
|
6302
6905
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6303
6906
|
*/
|
|
6304
|
-
maybeAutoRestart(
|
|
6907
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6305
6908
|
if (!schema) return;
|
|
6306
6909
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6307
6910
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6309,13 +6912,13 @@ var BaseAddon = class {
|
|
|
6309
6912
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6310
6913
|
}
|
|
6311
6914
|
if (restartKeys.size === 0) return;
|
|
6312
|
-
if (!
|
|
6915
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6313
6916
|
const ctx = this._ctx;
|
|
6314
6917
|
if (!ctx) return;
|
|
6315
6918
|
const addonId = ctx.id;
|
|
6316
6919
|
setImmediate(() => {
|
|
6317
6920
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6318
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6921
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6319
6922
|
}).catch((err) => {
|
|
6320
6923
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6321
6924
|
});
|
|
@@ -6324,7 +6927,7 @@ var BaseAddon = class {
|
|
|
6324
6927
|
async getDeviceSettings(deviceId) {
|
|
6325
6928
|
const schema = this.deviceSettingsSchema();
|
|
6326
6929
|
if (!schema) return { sections: [] };
|
|
6327
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6930
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6328
6931
|
}
|
|
6329
6932
|
async updateDeviceSettings(deviceId, patch) {
|
|
6330
6933
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6454,7 +7057,7 @@ var BaseAddon = class {
|
|
|
6454
7057
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6455
7058
|
*/
|
|
6456
7059
|
async resolveConfig() {
|
|
6457
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7060
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6458
7061
|
const perNode = this.perNodeKeys();
|
|
6459
7062
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6460
7063
|
const resolved = { ...this.defaults };
|
|
@@ -6479,7 +7082,7 @@ var BaseAddon = class {
|
|
|
6479
7082
|
key,
|
|
6480
7083
|
schema,
|
|
6481
7084
|
fallback,
|
|
6482
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7085
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6483
7086
|
write: async (patch) => {
|
|
6484
7087
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6485
7088
|
},
|
|
@@ -6496,7 +7099,7 @@ var BaseAddon = class {
|
|
|
6496
7099
|
key,
|
|
6497
7100
|
schema,
|
|
6498
7101
|
fallback,
|
|
6499
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7102
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6500
7103
|
write: async (patch) => {
|
|
6501
7104
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6502
7105
|
},
|
|
@@ -6508,6 +7111,70 @@ var BaseAddon = class {
|
|
|
6508
7111
|
} })
|
|
6509
7112
|
});
|
|
6510
7113
|
}
|
|
7114
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7115
|
+
addonSecretTree() {
|
|
7116
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7117
|
+
return this._addonSecretTree;
|
|
7118
|
+
}
|
|
7119
|
+
deviceSecretTree() {
|
|
7120
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7121
|
+
return this._deviceSecretTree;
|
|
7122
|
+
}
|
|
7123
|
+
/**
|
|
7124
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7125
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7126
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7127
|
+
* than start on an empty credential.
|
|
7128
|
+
*/
|
|
7129
|
+
get unresolvedSecrets() {
|
|
7130
|
+
return this._unresolvedSecrets;
|
|
7131
|
+
}
|
|
7132
|
+
/**
|
|
7133
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7134
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7135
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7136
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7137
|
+
* ever written back from here.
|
|
7138
|
+
*/
|
|
7139
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7140
|
+
const secrets = this._ctx?.secrets;
|
|
7141
|
+
if (secrets === void 0) return blob;
|
|
7142
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7143
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7144
|
+
if (refs.length === 0) {
|
|
7145
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7146
|
+
return blob;
|
|
7147
|
+
}
|
|
7148
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7149
|
+
if (trackForConfig) {
|
|
7150
|
+
this._unresolvedSecrets = unresolved;
|
|
7151
|
+
if (unresolved.length > 0) {
|
|
7152
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7153
|
+
ref: u.ref,
|
|
7154
|
+
reason: u.reason
|
|
7155
|
+
})) } });
|
|
7156
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7157
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7158
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7159
|
+
}
|
|
7160
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7161
|
+
}
|
|
7162
|
+
return value;
|
|
7163
|
+
}
|
|
7164
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7165
|
+
scheduleSecretReresolve(delayMs) {
|
|
7166
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7167
|
+
if (this[timerOf] !== null) return;
|
|
7168
|
+
const timer = setTimeout(() => {
|
|
7169
|
+
this[timerOf] = null;
|
|
7170
|
+
if (this._ctx === null) return;
|
|
7171
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7172
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7173
|
+
});
|
|
7174
|
+
}, delayMs);
|
|
7175
|
+
timer.unref?.();
|
|
7176
|
+
this[timerOf] = timer;
|
|
7177
|
+
}
|
|
6511
7178
|
/**
|
|
6512
7179
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6513
7180
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7083,6 +7750,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7083
7750
|
kind: "mutation",
|
|
7084
7751
|
auth: "admin"
|
|
7085
7752
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
7753
|
+
function defOf(schema) {
|
|
7754
|
+
return schema._zod?.def ?? {};
|
|
7755
|
+
}
|
|
7756
|
+
function declaredHere(schema) {
|
|
7757
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7758
|
+
}
|
|
7759
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7760
|
+
var WRAPPERS = new Set([
|
|
7761
|
+
"optional",
|
|
7762
|
+
"nullable",
|
|
7763
|
+
"default",
|
|
7764
|
+
"prefault",
|
|
7765
|
+
"catch",
|
|
7766
|
+
"readonly",
|
|
7767
|
+
"nonoptional"
|
|
7768
|
+
]);
|
|
7769
|
+
/**
|
|
7770
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7771
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7772
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7773
|
+
* `.transform` on `in`).
|
|
7774
|
+
*/
|
|
7775
|
+
function layersOf(schema) {
|
|
7776
|
+
const out = [];
|
|
7777
|
+
const queue = [schema];
|
|
7778
|
+
while (queue.length > 0) {
|
|
7779
|
+
const s = queue.shift();
|
|
7780
|
+
if (!s || out.includes(s)) continue;
|
|
7781
|
+
out.push(s);
|
|
7782
|
+
const def = defOf(s);
|
|
7783
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7784
|
+
if (def.type === "pipe") {
|
|
7785
|
+
if (def.in) queue.push(def.in);
|
|
7786
|
+
if (def.out) queue.push(def.out);
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
return out;
|
|
7790
|
+
}
|
|
7791
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7792
|
+
function isZodSecret(schema) {
|
|
7793
|
+
return layersOf(schema).some(declaredHere);
|
|
7794
|
+
}
|
|
7795
|
+
/**
|
|
7796
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7797
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7798
|
+
* object or array is reported as one path and not descended into — everything
|
|
7799
|
+
* under it is secret.
|
|
7800
|
+
*/
|
|
7801
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7802
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7803
|
+
const paths = [];
|
|
7804
|
+
for (const layer of layersOf(schema)) {
|
|
7805
|
+
const def = defOf(layer);
|
|
7806
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7807
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7808
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7809
|
+
else if (def.type === "intersection") {
|
|
7810
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7811
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
return [...new Set(paths)];
|
|
7815
|
+
}
|
|
7086
7816
|
//#endregion
|
|
7087
7817
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7088
7818
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8348,8 +9078,8 @@ function buildAddonRouteProvider(id, routes) {
|
|
|
8348
9078
|
const reply = buildCapturingReply(envelope);
|
|
8349
9079
|
const request = {
|
|
8350
9080
|
params: {
|
|
8351
|
-
...
|
|
8352
|
-
...
|
|
9081
|
+
...match.params,
|
|
9082
|
+
...input.params
|
|
8353
9083
|
},
|
|
8354
9084
|
query: input.query,
|
|
8355
9085
|
body: input.body,
|
|
@@ -14298,6 +15028,196 @@ id: union([string(), number()]) }), {
|
|
|
14298
15028
|
kind: "mutation",
|
|
14299
15029
|
auth: "admin"
|
|
14300
15030
|
});
|
|
15031
|
+
/**
|
|
15032
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15033
|
+
*
|
|
15034
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15035
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15036
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15037
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15038
|
+
* against the CALLER, never against anything the caller claims.
|
|
15039
|
+
*
|
|
15040
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15041
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15042
|
+
* connection, the agent from its child's connection carried in
|
|
15043
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15044
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15045
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15046
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15047
|
+
* runner is the same OS user): see the threat model in
|
|
15048
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15049
|
+
*
|
|
15050
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15051
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15052
|
+
* floors every method to admin anyway (D240).
|
|
15053
|
+
*
|
|
15054
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15055
|
+
*/
|
|
15056
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15057
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15058
|
+
"key-missing",
|
|
15059
|
+
"wrong-key",
|
|
15060
|
+
"key-file-unreadable",
|
|
15061
|
+
"store-unavailable",
|
|
15062
|
+
"not-initialized",
|
|
15063
|
+
"decrypt-failed"
|
|
15064
|
+
]);
|
|
15065
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15066
|
+
state: literal("locked"),
|
|
15067
|
+
reason: KeychainUnavailableReasonSchema
|
|
15068
|
+
})]);
|
|
15069
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15070
|
+
object({
|
|
15071
|
+
kind: literal("value"),
|
|
15072
|
+
value: string(),
|
|
15073
|
+
version: number().int()
|
|
15074
|
+
}),
|
|
15075
|
+
object({ kind: literal("missing") }),
|
|
15076
|
+
object({
|
|
15077
|
+
kind: literal("unavailable"),
|
|
15078
|
+
reason: KeychainUnavailableReasonSchema
|
|
15079
|
+
}),
|
|
15080
|
+
object({ kind: literal("forbidden") })
|
|
15081
|
+
]);
|
|
15082
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15083
|
+
/** Metadata of one stored value — never the value. */
|
|
15084
|
+
var KeychainSecretMetaSchema = object({
|
|
15085
|
+
ref: string(),
|
|
15086
|
+
owner: string(),
|
|
15087
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15088
|
+
scope: string(),
|
|
15089
|
+
fieldPath: string(),
|
|
15090
|
+
version: number().int(),
|
|
15091
|
+
createdAt: number(),
|
|
15092
|
+
updatedAt: number(),
|
|
15093
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15094
|
+
updatedBy: string(),
|
|
15095
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15096
|
+
lastReadAt: number().nullable()
|
|
15097
|
+
});
|
|
15098
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15099
|
+
method(object({
|
|
15100
|
+
ref: string().min(1),
|
|
15101
|
+
value: string().min(1)
|
|
15102
|
+
}), object({
|
|
15103
|
+
ref: string(),
|
|
15104
|
+
version: number().int()
|
|
15105
|
+
}), {
|
|
15106
|
+
kind: "mutation",
|
|
15107
|
+
auth: "admin"
|
|
15108
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15109
|
+
kind: "mutation",
|
|
15110
|
+
auth: "admin"
|
|
15111
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15112
|
+
var KeychainKeySourceSchema = object({
|
|
15113
|
+
kind: _enum([
|
|
15114
|
+
"config-file",
|
|
15115
|
+
"previous-config-file",
|
|
15116
|
+
"platform",
|
|
15117
|
+
"default-file"
|
|
15118
|
+
]),
|
|
15119
|
+
/** File sources only — a path is not a secret. */
|
|
15120
|
+
path: string().optional(),
|
|
15121
|
+
/**
|
|
15122
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15123
|
+
* next to the database it protects (the default file). The page warns.
|
|
15124
|
+
*/
|
|
15125
|
+
sharesBackupWithDatabase: boolean()
|
|
15126
|
+
});
|
|
15127
|
+
var KeychainStatusSchema = object({
|
|
15128
|
+
keychain: KeychainStateSchema,
|
|
15129
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15130
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15131
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15132
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15133
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15134
|
+
fingerprint: string().nullable(),
|
|
15135
|
+
activeKeyId: string().nullable(),
|
|
15136
|
+
/**
|
|
15137
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15138
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15139
|
+
*/
|
|
15140
|
+
rotationPending: boolean(),
|
|
15141
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15142
|
+
retiredWraps: number().int(),
|
|
15143
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15144
|
+
secretCount: number().int()
|
|
15145
|
+
});
|
|
15146
|
+
/**
|
|
15147
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15148
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15149
|
+
* never reported as an orphan (and never deleted as one).
|
|
15150
|
+
*/
|
|
15151
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15152
|
+
"in-use",
|
|
15153
|
+
"orphan",
|
|
15154
|
+
"unknown"
|
|
15155
|
+
]);
|
|
15156
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15157
|
+
var KeychainAuditActionSchema = _enum([
|
|
15158
|
+
"put",
|
|
15159
|
+
"delete",
|
|
15160
|
+
"reveal",
|
|
15161
|
+
"rotate-master-key",
|
|
15162
|
+
"purge-retired-keys",
|
|
15163
|
+
"download-recovery-key",
|
|
15164
|
+
"delete-orphans",
|
|
15165
|
+
"reset",
|
|
15166
|
+
"initialize"
|
|
15167
|
+
]);
|
|
15168
|
+
var KeychainAuditEntrySchema = object({
|
|
15169
|
+
id: string(),
|
|
15170
|
+
at: number(),
|
|
15171
|
+
action: KeychainAuditActionSchema,
|
|
15172
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15173
|
+
actor: string(),
|
|
15174
|
+
ref: string().nullable(),
|
|
15175
|
+
detail: string().nullable()
|
|
15176
|
+
});
|
|
15177
|
+
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({
|
|
15178
|
+
value: string(),
|
|
15179
|
+
version: number().int()
|
|
15180
|
+
}), {
|
|
15181
|
+
kind: "mutation",
|
|
15182
|
+
auth: "admin",
|
|
15183
|
+
caller: "required"
|
|
15184
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15185
|
+
deleted: array(string()).readonly(),
|
|
15186
|
+
kept: array(object({
|
|
15187
|
+
ref: string(),
|
|
15188
|
+
usage: KeychainSecretUsageSchema
|
|
15189
|
+
})).readonly()
|
|
15190
|
+
}), {
|
|
15191
|
+
kind: "mutation",
|
|
15192
|
+
auth: "admin",
|
|
15193
|
+
caller: "required"
|
|
15194
|
+
}), method(object({}), object({
|
|
15195
|
+
fingerprint: string(),
|
|
15196
|
+
keySource: KeychainKeySourceSchema
|
|
15197
|
+
}), {
|
|
15198
|
+
kind: "mutation",
|
|
15199
|
+
auth: "admin",
|
|
15200
|
+
caller: "required"
|
|
15201
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15202
|
+
kind: "mutation",
|
|
15203
|
+
auth: "admin",
|
|
15204
|
+
caller: "required"
|
|
15205
|
+
}), method(object({}), object({
|
|
15206
|
+
key: string(),
|
|
15207
|
+
fingerprint: string(),
|
|
15208
|
+
keySource: KeychainKeySourceSchema
|
|
15209
|
+
}), {
|
|
15210
|
+
kind: "mutation",
|
|
15211
|
+
auth: "admin",
|
|
15212
|
+
caller: "required"
|
|
15213
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15214
|
+
archivedCollection: string().nullable(),
|
|
15215
|
+
archived: number().int()
|
|
15216
|
+
}), {
|
|
15217
|
+
kind: "mutation",
|
|
15218
|
+
auth: "admin",
|
|
15219
|
+
caller: "required"
|
|
15220
|
+
});
|
|
14301
15221
|
method(_void(), object({
|
|
14302
15222
|
id: string(),
|
|
14303
15223
|
name: string(),
|
|
@@ -15320,6 +16240,10 @@ var DeviceInfoSchema = object({
|
|
|
15320
16240
|
isCamera: boolean(),
|
|
15321
16241
|
/** Current config values — serializable snapshot */
|
|
15322
16242
|
config: record(string(), unknown()),
|
|
16243
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16244
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16245
|
+
* when the owning runner has not reported them. */
|
|
16246
|
+
secretConfigPaths: array(string()).optional(),
|
|
15323
16247
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15324
16248
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15325
16249
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -15525,12 +16449,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15525
16449
|
* call (workers re-register on init), so probe-driven updates
|
|
15526
16450
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15527
16451
|
features: array(string()).optional(),
|
|
15528
|
-
config: record(string(), unknown())
|
|
16452
|
+
config: record(string(), unknown()),
|
|
16453
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16454
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16455
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16456
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16457
|
+
* omits it and the keyword backstop applies. */
|
|
16458
|
+
secretConfigPaths: array(string()).optional()
|
|
15529
16459
|
});
|
|
15530
16460
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15531
16461
|
var DevicePersistConfigPayloadSchema = object({
|
|
15532
16462
|
deviceId: number(),
|
|
15533
|
-
data: record(string(), unknown())
|
|
16463
|
+
data: record(string(), unknown()),
|
|
16464
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16465
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16466
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16467
|
+
secretConfigPaths: array(string()).optional()
|
|
15534
16468
|
});
|
|
15535
16469
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15536
16470
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17184,7 +18118,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17184
18118
|
icon: string().optional(),
|
|
17185
18119
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17186
18120
|
startUrl: string(),
|
|
17187
|
-
stage: LoginStageEnum
|
|
18121
|
+
stage: LoginStageEnum,
|
|
18122
|
+
/**
|
|
18123
|
+
* The provider names an external identity a signed-in user can link to
|
|
18124
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
18125
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18126
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
18127
|
+
*/
|
|
18128
|
+
linkable: boolean().optional()
|
|
17188
18129
|
}),
|
|
17189
18130
|
object({
|
|
17190
18131
|
kind: literal("widget"),
|
|
@@ -22540,8 +23481,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22540
23481
|
]);
|
|
22541
23482
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22542
23483
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22543
|
-
/**
|
|
22544
|
-
|
|
23484
|
+
/**
|
|
23485
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23486
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23487
|
+
*
|
|
23488
|
+
* - `operator` — drawn by hand.
|
|
23489
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23490
|
+
* model, or a larger teacher model).
|
|
23491
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23492
|
+
* back from the track store (never a re-run).
|
|
23493
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23494
|
+
*/
|
|
23495
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23496
|
+
"operator",
|
|
23497
|
+
"assist",
|
|
23498
|
+
"pipeline",
|
|
23499
|
+
"llm"
|
|
23500
|
+
]);
|
|
22545
23501
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22546
23502
|
var RetrainBboxSchema = object({
|
|
22547
23503
|
x: number(),
|
|
@@ -22559,7 +23515,8 @@ var RetrainBboxSchema = object({
|
|
|
22559
23515
|
*/
|
|
22560
23516
|
var RetrainAnnotationSchema = object({
|
|
22561
23517
|
id: string(),
|
|
22562
|
-
|
|
23518
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23519
|
+
trackId: string().optional(),
|
|
22563
23520
|
deviceId: number(),
|
|
22564
23521
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22565
23522
|
mediaKey: string(),
|
|
@@ -22608,18 +23565,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22608
23565
|
* fail, whatever became of the original. */
|
|
22609
23566
|
copied: boolean()
|
|
22610
23567
|
});
|
|
23568
|
+
/**
|
|
23569
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23570
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23571
|
+
* box recorded on the source media row when there is one, else the track
|
|
23572
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23573
|
+
* until the operator confirms it.
|
|
23574
|
+
*/
|
|
23575
|
+
var RetrainPipelineBoxSchema = object({
|
|
23576
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23577
|
+
bbox: RetrainBboxSchema,
|
|
23578
|
+
macroClass: RetrainMacroClassSchema,
|
|
23579
|
+
label: string().optional(),
|
|
23580
|
+
subLabel: string().optional(),
|
|
23581
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23582
|
+
score: number().optional(),
|
|
23583
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23584
|
+
modelId: string().optional(),
|
|
23585
|
+
trackId: string(),
|
|
23586
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23587
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23588
|
+
basis: _enum(["subject-box", "position"]),
|
|
23589
|
+
deltaMs: number()
|
|
23590
|
+
});
|
|
23591
|
+
/**
|
|
23592
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23593
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23594
|
+
* track at all.
|
|
23595
|
+
*/
|
|
23596
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22611
23597
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22612
23598
|
var RetrainFrameSchema = object({
|
|
22613
23599
|
frameId: string(),
|
|
22614
23600
|
deviceId: number(),
|
|
22615
|
-
|
|
22616
|
-
/**
|
|
22617
|
-
|
|
23601
|
+
origin: RetrainFrameOriginSchema,
|
|
23602
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23603
|
+
trackId: string().optional(),
|
|
23604
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23605
|
+
* Absent on a recording still. */
|
|
23606
|
+
sourceMediaId: number().int().optional(),
|
|
23607
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23608
|
+
epochMs: number().optional(),
|
|
22618
23609
|
sourceKind: MediaFileKindEnum,
|
|
22619
23610
|
sizeBytes: number().int(),
|
|
22620
23611
|
width: number().int(),
|
|
22621
23612
|
height: number().int(),
|
|
22622
|
-
copiedAt: number()
|
|
23613
|
+
copiedAt: number(),
|
|
23614
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
23615
|
+
capturedAt: number().optional(),
|
|
23616
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
23617
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23618
|
+
* a false positive. */
|
|
23619
|
+
complete: boolean(),
|
|
23620
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23621
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23622
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23623
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23624
|
+
collectionIds: array(string()).readonly().optional()
|
|
22623
23625
|
});
|
|
22624
23626
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22625
23627
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22640,6 +23642,53 @@ var RetrainFrameListSchema = object({
|
|
|
22640
23642
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
22641
23643
|
autoPickMediaId: number().int().optional()
|
|
22642
23644
|
});
|
|
23645
|
+
/**
|
|
23646
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
23647
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
23648
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
23649
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
23650
|
+
* export carried (`exportedInBatch`).
|
|
23651
|
+
*/
|
|
23652
|
+
var RetrainExportFilterSchema = object({
|
|
23653
|
+
deviceIds: array(number()).optional(),
|
|
23654
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
23655
|
+
/** Only frames in at least one of these named collections. */
|
|
23656
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23657
|
+
batchId: string().optional(),
|
|
23658
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23659
|
+
completeOnly: boolean().optional()
|
|
23660
|
+
});
|
|
23661
|
+
/**
|
|
23662
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
23663
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
23664
|
+
* convention — the classifier layout.
|
|
23665
|
+
*/
|
|
23666
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
23667
|
+
/**
|
|
23668
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
23669
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
23670
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
23671
|
+
* logged.
|
|
23672
|
+
*/
|
|
23673
|
+
var RetrainArchiveTargetSchema = object({
|
|
23674
|
+
kind: literal("http"),
|
|
23675
|
+
method: _enum(["PUT", "POST"]),
|
|
23676
|
+
url: string().url(),
|
|
23677
|
+
headers: record(string(), string()).optional()
|
|
23678
|
+
});
|
|
23679
|
+
var RetrainArchiveResultSchema = object({
|
|
23680
|
+
batchId: string(),
|
|
23681
|
+
frames: number().int(),
|
|
23682
|
+
crops: number().int(),
|
|
23683
|
+
annotations: number().int(),
|
|
23684
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
23685
|
+
missing: number().int(),
|
|
23686
|
+
bytes: number().int(),
|
|
23687
|
+
/** sha256 of the exact bytes sent. */
|
|
23688
|
+
sha256: string(),
|
|
23689
|
+
/** The target's HTTP status. */
|
|
23690
|
+
status: number().int()
|
|
23691
|
+
});
|
|
22643
23692
|
/** What the operator asked the assist to look for. */
|
|
22644
23693
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
22645
23694
|
kind: literal("package"),
|
|
@@ -22669,6 +23718,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22669
23718
|
reason: string(),
|
|
22670
23719
|
detail: string().optional()
|
|
22671
23720
|
})]);
|
|
23721
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23722
|
+
var RetrainCollectionSchema = object({
|
|
23723
|
+
id: string(),
|
|
23724
|
+
name: string(),
|
|
23725
|
+
createdAt: number(),
|
|
23726
|
+
frameCount: number().int()
|
|
23727
|
+
});
|
|
23728
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23729
|
+
kind: literal("created"),
|
|
23730
|
+
collection: RetrainCollectionSchema
|
|
23731
|
+
}), object({
|
|
23732
|
+
kind: literal("refused"),
|
|
23733
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23734
|
+
})]);
|
|
23735
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23736
|
+
kind: literal("renamed"),
|
|
23737
|
+
collection: RetrainCollectionSchema
|
|
23738
|
+
}), object({
|
|
23739
|
+
kind: literal("refused"),
|
|
23740
|
+
reason: _enum([
|
|
23741
|
+
"empty-name",
|
|
23742
|
+
"duplicate-name",
|
|
23743
|
+
"unknown-collection"
|
|
23744
|
+
])
|
|
23745
|
+
})]);
|
|
23746
|
+
/**
|
|
23747
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23748
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23749
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23750
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23751
|
+
*/
|
|
23752
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23753
|
+
kind: literal("added"),
|
|
23754
|
+
collectionId: string(),
|
|
23755
|
+
frame: RetrainFrameSchema,
|
|
23756
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23757
|
+
reused: boolean()
|
|
23758
|
+
}), object({
|
|
23759
|
+
kind: literal("refused"),
|
|
23760
|
+
reason: _enum([
|
|
23761
|
+
"unknown-collection",
|
|
23762
|
+
"still-unavailable",
|
|
23763
|
+
"still-busy",
|
|
23764
|
+
"unreadable-image",
|
|
23765
|
+
"write-failed"
|
|
23766
|
+
]),
|
|
23767
|
+
detail: string().optional()
|
|
23768
|
+
})]);
|
|
23769
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23770
|
+
var RetrainAssistProfileSchema = object({
|
|
23771
|
+
id: string(),
|
|
23772
|
+
name: string(),
|
|
23773
|
+
model: string(),
|
|
23774
|
+
kind: string(),
|
|
23775
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23776
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23777
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23778
|
+
leavesHouse: boolean()
|
|
23779
|
+
});
|
|
23780
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23781
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23782
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23783
|
+
var RetrainLlmReviewSchema = object({
|
|
23784
|
+
/** The `ref` the page sent the box under. */
|
|
23785
|
+
ref: string(),
|
|
23786
|
+
verdict: _enum([
|
|
23787
|
+
"confirmed",
|
|
23788
|
+
"wrong-class",
|
|
23789
|
+
"not-an-object",
|
|
23790
|
+
"uncertain"
|
|
23791
|
+
]),
|
|
23792
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23793
|
+
reason: string()
|
|
23794
|
+
});
|
|
23795
|
+
/**
|
|
23796
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23797
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23798
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23799
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23800
|
+
*/
|
|
23801
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23802
|
+
kind: literal("proposed"),
|
|
23803
|
+
profileId: string(),
|
|
23804
|
+
model: string(),
|
|
23805
|
+
/** The frame was sent outside the house for this answer. */
|
|
23806
|
+
leftHouse: boolean(),
|
|
23807
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23808
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23809
|
+
rejected: number().int()
|
|
23810
|
+
}), object({
|
|
23811
|
+
kind: literal("refused"),
|
|
23812
|
+
reason: _enum([
|
|
23813
|
+
"unknown-frame",
|
|
23814
|
+
"unreadable-frame",
|
|
23815
|
+
"unknown-profile",
|
|
23816
|
+
"profile-disabled",
|
|
23817
|
+
"no-vision",
|
|
23818
|
+
"cloud-not-confirmed",
|
|
23819
|
+
"llm-error",
|
|
23820
|
+
"malformed-answer"
|
|
23821
|
+
]),
|
|
23822
|
+
detail: string().optional()
|
|
23823
|
+
})]);
|
|
22672
23824
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22673
23825
|
var RetrainTransitionResultSchema = object({
|
|
22674
23826
|
trackId: string(),
|
|
@@ -23386,7 +24538,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23386
24538
|
auth: "admin"
|
|
23387
24539
|
}), method(object({
|
|
23388
24540
|
deviceId: number(),
|
|
23389
|
-
trackId: string(),
|
|
24541
|
+
trackId: string().optional(),
|
|
23390
24542
|
frameId: string()
|
|
23391
24543
|
}), object({
|
|
23392
24544
|
removed: boolean(),
|
|
@@ -23403,7 +24555,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23403
24555
|
auth: "admin"
|
|
23404
24556
|
}), method(object({
|
|
23405
24557
|
deviceId: number(),
|
|
23406
|
-
|
|
24558
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24559
|
+
trackId: string().optional(),
|
|
23407
24560
|
frameId: string(),
|
|
23408
24561
|
subject: RetrainAssistSubjectSchema,
|
|
23409
24562
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23411,12 +24564,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23411
24564
|
}), RetrainAssistResultSchema, {
|
|
23412
24565
|
kind: "mutation",
|
|
23413
24566
|
auth: "admin"
|
|
23414
|
-
}), method(object({
|
|
24567
|
+
}), method(object({
|
|
24568
|
+
trackId: string().optional(),
|
|
24569
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24570
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23415
24571
|
kind: "query",
|
|
23416
24572
|
auth: "admin"
|
|
23417
24573
|
}), method(object({
|
|
23418
24574
|
deviceId: number(),
|
|
23419
|
-
|
|
24575
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24576
|
+
trackId: string().optional(),
|
|
23420
24577
|
frameId: string(),
|
|
23421
24578
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23422
24579
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23434,7 +24591,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23434
24591
|
}), RetrainTransitionResultSchema, {
|
|
23435
24592
|
kind: "mutation",
|
|
23436
24593
|
auth: "admin"
|
|
23437
|
-
}), method(
|
|
24594
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
24595
|
+
kind: "query",
|
|
24596
|
+
auth: "admin"
|
|
24597
|
+
}), method(object({
|
|
24598
|
+
deviceId: number(),
|
|
24599
|
+
trackId: string().optional(),
|
|
24600
|
+
frameId: string(),
|
|
24601
|
+
complete: boolean()
|
|
24602
|
+
}), RetrainFrameSchema, {
|
|
24603
|
+
kind: "mutation",
|
|
24604
|
+
auth: "admin"
|
|
24605
|
+
}), method(object({
|
|
24606
|
+
filter: RetrainExportFilterSchema,
|
|
24607
|
+
layout: RetrainExportLayoutSchema,
|
|
24608
|
+
target: RetrainArchiveTargetSchema
|
|
24609
|
+
}), RetrainArchiveResultSchema, {
|
|
24610
|
+
kind: "mutation",
|
|
24611
|
+
auth: "admin",
|
|
24612
|
+
timeoutMs: 60 * 6e4
|
|
24613
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24614
|
+
kind: "query",
|
|
24615
|
+
auth: "admin"
|
|
24616
|
+
}), method(object({
|
|
24617
|
+
deviceId: number(),
|
|
24618
|
+
trackId: string().optional(),
|
|
24619
|
+
frameId: string(),
|
|
24620
|
+
profileId: string(),
|
|
24621
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24622
|
+
boxes: array(object({
|
|
24623
|
+
ref: string(),
|
|
24624
|
+
bbox: RetrainBboxSchema,
|
|
24625
|
+
macroClass: RetrainMacroClassSchema,
|
|
24626
|
+
label: string().optional()
|
|
24627
|
+
})).max(50),
|
|
24628
|
+
allowCloud: boolean()
|
|
24629
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24630
|
+
kind: "mutation",
|
|
24631
|
+
auth: "admin",
|
|
24632
|
+
timeoutMs: 18e4
|
|
24633
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24634
|
+
kind: "mutation",
|
|
24635
|
+
auth: "admin"
|
|
24636
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24637
|
+
kind: "query",
|
|
24638
|
+
auth: "admin"
|
|
24639
|
+
}), method(object({
|
|
24640
|
+
id: string(),
|
|
24641
|
+
name: string().max(120)
|
|
24642
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24643
|
+
kind: "mutation",
|
|
24644
|
+
auth: "admin"
|
|
24645
|
+
}), method(object({ id: string() }), object({
|
|
24646
|
+
deleted: boolean(),
|
|
24647
|
+
removedFrames: number().int()
|
|
24648
|
+
}), {
|
|
24649
|
+
kind: "mutation",
|
|
24650
|
+
auth: "admin"
|
|
24651
|
+
}), method(object({
|
|
24652
|
+
collectionId: string(),
|
|
24653
|
+
deviceId: number(),
|
|
24654
|
+
epochMs: number()
|
|
24655
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24656
|
+
kind: "mutation",
|
|
24657
|
+
auth: "admin",
|
|
24658
|
+
timeoutMs: 6e4
|
|
24659
|
+
}), method(object({
|
|
24660
|
+
collectionId: string(),
|
|
24661
|
+
frameIds: array(string()).min(1).max(500)
|
|
24662
|
+
}), object({
|
|
24663
|
+
added: number().int(),
|
|
24664
|
+
alreadyMember: number().int(),
|
|
24665
|
+
unknownFrameIds: array(string()).readonly()
|
|
24666
|
+
}), {
|
|
24667
|
+
kind: "mutation",
|
|
24668
|
+
auth: "admin"
|
|
24669
|
+
}), method(object({
|
|
24670
|
+
collectionId: string(),
|
|
24671
|
+
frameId: string()
|
|
24672
|
+
}), object({
|
|
24673
|
+
removed: boolean(),
|
|
24674
|
+
deletedFrame: boolean()
|
|
24675
|
+
}), {
|
|
24676
|
+
kind: "mutation",
|
|
24677
|
+
auth: "admin"
|
|
24678
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
23438
24679
|
kind: "query",
|
|
23439
24680
|
auth: "admin"
|
|
23440
24681
|
}), method(object({
|
|
@@ -24060,13 +25301,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24060
25301
|
object({
|
|
24061
25302
|
kind: literal("no-family-build"),
|
|
24062
25303
|
format: ModelFormatSchema$1
|
|
25304
|
+
}),
|
|
25305
|
+
object({
|
|
25306
|
+
kind: literal("kept-custom-pin"),
|
|
25307
|
+
modelId: string(),
|
|
25308
|
+
deviceKey: string()
|
|
24063
25309
|
})
|
|
24064
25310
|
]);
|
|
25311
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25312
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25313
|
+
/**
|
|
25314
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25315
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25316
|
+
*/
|
|
25317
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25318
|
+
kind: literal("node-benchmark"),
|
|
25319
|
+
resultId: string(),
|
|
25320
|
+
measuredAtMs: number()
|
|
25321
|
+
})]);
|
|
24065
25322
|
var DeviceModelChoiceSchema = object({
|
|
24066
25323
|
modelId: string(),
|
|
24067
25324
|
p50Ms: number(),
|
|
24068
25325
|
fps: number(),
|
|
24069
25326
|
measured: boolean(),
|
|
25327
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25328
|
+
source: LatencySourceSchema.optional(),
|
|
24070
25329
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24071
25330
|
capacitySessions: number(),
|
|
24072
25331
|
personRecall: number()
|
|
@@ -24077,6 +25336,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24077
25336
|
enabled: boolean(),
|
|
24078
25337
|
available: boolean(),
|
|
24079
25338
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25339
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25340
|
+
kept: KeptReasonSchema.optional(),
|
|
24080
25341
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24081
25342
|
});
|
|
24082
25343
|
var NodeRecommendationSchema = object({
|
|
@@ -24130,6 +25391,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24130
25391
|
kind: literal("coral-enabled"),
|
|
24131
25392
|
nodeId: string(),
|
|
24132
25393
|
deviceKey: string()
|
|
25394
|
+
}),
|
|
25395
|
+
object({
|
|
25396
|
+
kind: literal("custom-pin-kept"),
|
|
25397
|
+
nodeId: string(),
|
|
25398
|
+
deviceKey: string().nullable(),
|
|
25399
|
+
deviceId: number().nullable(),
|
|
25400
|
+
modelId: string()
|
|
25401
|
+
}),
|
|
25402
|
+
object({
|
|
25403
|
+
kind: literal("custom-registry-unreadable"),
|
|
25404
|
+
error: string()
|
|
24133
25405
|
})
|
|
24134
25406
|
]);
|
|
24135
25407
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24308,13 +25580,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24308
25580
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24309
25581
|
});
|
|
24310
25582
|
/**
|
|
24311
|
-
* Where the node and device shares come from (D750, D755).
|
|
24312
|
-
* - `
|
|
24313
|
-
*
|
|
24314
|
-
*
|
|
24315
|
-
*
|
|
24316
|
-
*
|
|
24317
|
-
*
|
|
25583
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25584
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25585
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25586
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25587
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25588
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25589
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25590
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24318
25591
|
* - `manual` — the operator's stored sliders.
|
|
24319
25592
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24320
25593
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24363,6 +25636,362 @@ var EffectiveSharesSchema = object({
|
|
|
24363
25636
|
nodeWeights: record(string(), number()),
|
|
24364
25637
|
deviceWeights: record(string(), record(string(), number()))
|
|
24365
25638
|
});
|
|
25639
|
+
/**
|
|
25640
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25641
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25642
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25643
|
+
* shares read.
|
|
25644
|
+
*
|
|
25645
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25646
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25647
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25648
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25649
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25650
|
+
*
|
|
25651
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25652
|
+
* cross a process at frame rate, D9):
|
|
25653
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25654
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25655
|
+
* interval;
|
|
25656
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25657
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25658
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25659
|
+
* CPU, RAM or the event loop give out.
|
|
25660
|
+
*/
|
|
25661
|
+
/** Defaults and bounds, one place. */
|
|
25662
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25663
|
+
fpsPerStream: 10,
|
|
25664
|
+
budgetMinutes: 45,
|
|
25665
|
+
minBudgetMinutes: 10,
|
|
25666
|
+
maxBudgetMinutes: 120,
|
|
25667
|
+
/** A result older than this no longer beats the table. */
|
|
25668
|
+
staleAfterDays: 30,
|
|
25669
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25670
|
+
settleSec: 5,
|
|
25671
|
+
/** Accounted window per ramp step. */
|
|
25672
|
+
measureSec: 20,
|
|
25673
|
+
/** Longest the drain may take before the run is refused. */
|
|
25674
|
+
drainTimeoutSec: 120,
|
|
25675
|
+
/** Candidate models per device in one run. */
|
|
25676
|
+
maxModelsPerDevice: 6
|
|
25677
|
+
};
|
|
25678
|
+
/** The two measurements a run can make. */
|
|
25679
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25680
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25681
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25682
|
+
deviceKey: string().min(1),
|
|
25683
|
+
/**
|
|
25684
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25685
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25686
|
+
*/
|
|
25687
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25688
|
+
});
|
|
25689
|
+
/** What the operator confirmed. */
|
|
25690
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25691
|
+
nodeId: string().min(1),
|
|
25692
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25693
|
+
/** Which measurements run. At least one. */
|
|
25694
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25695
|
+
/**
|
|
25696
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25697
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25698
|
+
* detector always runs.
|
|
25699
|
+
*/
|
|
25700
|
+
steps: array(string().min(1)).default([]),
|
|
25701
|
+
/** Offered rate of one stream / session. */
|
|
25702
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25703
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25704
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25705
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25706
|
+
keepDownloadedModels: boolean().default(false),
|
|
25707
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25708
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25709
|
+
});
|
|
25710
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25711
|
+
kind: _enum([
|
|
25712
|
+
"benchmark-active",
|
|
25713
|
+
"node-offline",
|
|
25714
|
+
"unknown-device",
|
|
25715
|
+
"no-phase",
|
|
25716
|
+
"insufficient-headroom"
|
|
25717
|
+
]),
|
|
25718
|
+
detail: string(),
|
|
25719
|
+
overridable: boolean()
|
|
25720
|
+
});
|
|
25721
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25722
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25723
|
+
deviceId: number(),
|
|
25724
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25725
|
+
placedOnNode: boolean(),
|
|
25726
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25727
|
+
pinnedToNode: boolean()
|
|
25728
|
+
});
|
|
25729
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25730
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25731
|
+
deviceId: number(),
|
|
25732
|
+
reason: literal("only-frame-source")
|
|
25733
|
+
});
|
|
25734
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25735
|
+
nodeId: string(),
|
|
25736
|
+
online: boolean(),
|
|
25737
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25738
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25739
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25740
|
+
estimatedDurationMs: number(),
|
|
25741
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25742
|
+
budgetMs: number(),
|
|
25743
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25744
|
+
steps: array(string()).readonly(),
|
|
25745
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25746
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25747
|
+
headroom: object({
|
|
25748
|
+
sessionsNow: number(),
|
|
25749
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25750
|
+
}),
|
|
25751
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25752
|
+
canStart: boolean()
|
|
25753
|
+
});
|
|
25754
|
+
/** Where the measuring runner is. */
|
|
25755
|
+
var NodeBenchProgressSchema = object({
|
|
25756
|
+
phase: _enum([
|
|
25757
|
+
"preparing",
|
|
25758
|
+
"device",
|
|
25759
|
+
"pipeline",
|
|
25760
|
+
"cleanup"
|
|
25761
|
+
]),
|
|
25762
|
+
deviceKey: string().nullable(),
|
|
25763
|
+
modelId: string().nullable(),
|
|
25764
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25765
|
+
load: number().nullable(),
|
|
25766
|
+
cellsDone: number(),
|
|
25767
|
+
cellsTotal: number(),
|
|
25768
|
+
message: string()
|
|
25769
|
+
});
|
|
25770
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25771
|
+
var NodeBenchLimitSchema = _enum([
|
|
25772
|
+
"p95",
|
|
25773
|
+
"drops",
|
|
25774
|
+
"errors",
|
|
25775
|
+
"stall",
|
|
25776
|
+
"cpu",
|
|
25777
|
+
"ram",
|
|
25778
|
+
"none"
|
|
25779
|
+
]);
|
|
25780
|
+
var NodeBenchRampStepSchema = object({
|
|
25781
|
+
load: number(),
|
|
25782
|
+
pass: boolean(),
|
|
25783
|
+
p95Ms: number(),
|
|
25784
|
+
dropRatio: number(),
|
|
25785
|
+
/** Completed frames per second over the accounted window. */
|
|
25786
|
+
fps: number(),
|
|
25787
|
+
cpuPct: number().nullable(),
|
|
25788
|
+
ramFreePct: number().nullable(),
|
|
25789
|
+
failReasons: array(string()).readonly()
|
|
25790
|
+
});
|
|
25791
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25792
|
+
phase: literal("device"),
|
|
25793
|
+
deviceKey: string(),
|
|
25794
|
+
modelId: string(),
|
|
25795
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25796
|
+
p50Ms: number(),
|
|
25797
|
+
p95Ms: number(),
|
|
25798
|
+
p99Ms: number(),
|
|
25799
|
+
/** Frames per second sustained at the last passing step. */
|
|
25800
|
+
fps: number(),
|
|
25801
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25802
|
+
kMax: number(),
|
|
25803
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25804
|
+
/** First call (model load + warm-up). */
|
|
25805
|
+
warmupMs: number(),
|
|
25806
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25807
|
+
}), object({
|
|
25808
|
+
phase: literal("pipeline"),
|
|
25809
|
+
deviceKey: string(),
|
|
25810
|
+
modelId: string(),
|
|
25811
|
+
steps: array(string()).readonly(),
|
|
25812
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25813
|
+
maxSessions: number(),
|
|
25814
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25815
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25816
|
+
stepsFired: array(string()).readonly(),
|
|
25817
|
+
warmupMs: number(),
|
|
25818
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25819
|
+
})]);
|
|
25820
|
+
/**
|
|
25821
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25822
|
+
* the node no longer beats the table.
|
|
25823
|
+
*/
|
|
25824
|
+
var NodeBenchFingerprintSchema = object({
|
|
25825
|
+
pipelineVersion: string().nullable(),
|
|
25826
|
+
cpuModel: string().nullable(),
|
|
25827
|
+
ramGb: number().nullable(),
|
|
25828
|
+
os: string().nullable(),
|
|
25829
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25830
|
+
pools: record(string(), object({
|
|
25831
|
+
runtime: string(),
|
|
25832
|
+
numWorkers: number(),
|
|
25833
|
+
concurrency: number(),
|
|
25834
|
+
batchMode: string()
|
|
25835
|
+
})).default({})
|
|
25836
|
+
});
|
|
25837
|
+
/** The frames the run used. */
|
|
25838
|
+
var NodeBenchClipSchema = object({
|
|
25839
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25840
|
+
id: string(),
|
|
25841
|
+
revision: string().nullable(),
|
|
25842
|
+
frames: number(),
|
|
25843
|
+
width: number(),
|
|
25844
|
+
height: number()
|
|
25845
|
+
});
|
|
25846
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25847
|
+
runId: string().min(1),
|
|
25848
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25849
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25850
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25851
|
+
steps: array(string()).default([]),
|
|
25852
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25853
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25854
|
+
deadlineAtMs: number(),
|
|
25855
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25856
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25857
|
+
keepDownloadedModels: boolean().default(false)
|
|
25858
|
+
});
|
|
25859
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25860
|
+
"running",
|
|
25861
|
+
"done",
|
|
25862
|
+
"failed",
|
|
25863
|
+
"aborted"
|
|
25864
|
+
]);
|
|
25865
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25866
|
+
runId: string(),
|
|
25867
|
+
nodeId: string(),
|
|
25868
|
+
state: NodeBenchRunnerStateSchema,
|
|
25869
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25870
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25871
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25872
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25873
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25874
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25875
|
+
activeCameraIds: array(number()).readonly(),
|
|
25876
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25877
|
+
deletedModels: array(string()).readonly(),
|
|
25878
|
+
error: string().nullable(),
|
|
25879
|
+
startedAtMs: number(),
|
|
25880
|
+
finishedAtMs: number().nullable()
|
|
25881
|
+
});
|
|
25882
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25883
|
+
"draining",
|
|
25884
|
+
"measuring",
|
|
25885
|
+
"restoring",
|
|
25886
|
+
"done",
|
|
25887
|
+
"failed",
|
|
25888
|
+
"aborted"
|
|
25889
|
+
]);
|
|
25890
|
+
/** Why a run ended. */
|
|
25891
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25892
|
+
"completed",
|
|
25893
|
+
"operator-abort",
|
|
25894
|
+
"deadline",
|
|
25895
|
+
"node-lost",
|
|
25896
|
+
"runner-lost",
|
|
25897
|
+
"hub-restart",
|
|
25898
|
+
"drain-timeout",
|
|
25899
|
+
"failed"
|
|
25900
|
+
]);
|
|
25901
|
+
var NodeBenchmarkRunSchema = object({
|
|
25902
|
+
runId: string(),
|
|
25903
|
+
nodeId: string(),
|
|
25904
|
+
state: NodeBenchmarkStateSchema,
|
|
25905
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25906
|
+
startedAtMs: number(),
|
|
25907
|
+
deadlineAtMs: number(),
|
|
25908
|
+
finishedAtMs: number().nullable(),
|
|
25909
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25910
|
+
error: string().nullable(),
|
|
25911
|
+
/** Cameras moved off the node for the run. */
|
|
25912
|
+
moved: array(number()).readonly(),
|
|
25913
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25914
|
+
staying: array(number()).readonly(),
|
|
25915
|
+
/** Something else ran on the node's pools during the run. */
|
|
25916
|
+
contaminated: boolean(),
|
|
25917
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25918
|
+
resultIds: array(string()).readonly()
|
|
25919
|
+
});
|
|
25920
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25921
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25922
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25923
|
+
modeNodeId: string().nullable(),
|
|
25924
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25925
|
+
});
|
|
25926
|
+
/**
|
|
25927
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25928
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25929
|
+
* ends, never by anyone else.
|
|
25930
|
+
*/
|
|
25931
|
+
var NodeBenchmarkResultSchema = object({
|
|
25932
|
+
id: string(),
|
|
25933
|
+
runId: string(),
|
|
25934
|
+
nodeId: string(),
|
|
25935
|
+
cell: NodeBenchCellSchema,
|
|
25936
|
+
fpsPerStream: number(),
|
|
25937
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25938
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25939
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25940
|
+
contaminated: boolean(),
|
|
25941
|
+
stayingCameras: array(number()).readonly(),
|
|
25942
|
+
/** The run ended early; the cell itself completed. */
|
|
25943
|
+
partialRun: boolean(),
|
|
25944
|
+
measuredAtMs: number()
|
|
25945
|
+
});
|
|
25946
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25947
|
+
nodeId: string().optional(),
|
|
25948
|
+
deviceKey: string().optional()
|
|
25949
|
+
});
|
|
25950
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25951
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25952
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25953
|
+
standing: _enum([
|
|
25954
|
+
"fresh",
|
|
25955
|
+
"stale",
|
|
25956
|
+
"superseded"
|
|
25957
|
+
]),
|
|
25958
|
+
staleWhy: _enum([
|
|
25959
|
+
"age",
|
|
25960
|
+
"runtime",
|
|
25961
|
+
"pool-tuning"
|
|
25962
|
+
]).nullable()
|
|
25963
|
+
});
|
|
25964
|
+
object({
|
|
25965
|
+
runId: string(),
|
|
25966
|
+
nodeId: string(),
|
|
25967
|
+
startedAtMs: number(),
|
|
25968
|
+
deadlineAtMs: number(),
|
|
25969
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25970
|
+
moved: array(number()).readonly(),
|
|
25971
|
+
staying: array(number()).readonly()
|
|
25972
|
+
});
|
|
25973
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25974
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25975
|
+
nodeId: string(),
|
|
25976
|
+
reachable: boolean(),
|
|
25977
|
+
devices: array(object({
|
|
25978
|
+
deviceKey: string(),
|
|
25979
|
+
enabled: boolean(),
|
|
25980
|
+
available: boolean(),
|
|
25981
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25982
|
+
suggested: array(string()).readonly(),
|
|
25983
|
+
/** Every root detector the device has a build for. */
|
|
25984
|
+
all: array(string()).readonly(),
|
|
25985
|
+
/** The model the device runs now, when pinned. */
|
|
25986
|
+
currentModelId: string().nullable()
|
|
25987
|
+
})).readonly(),
|
|
25988
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25989
|
+
steps: array(object({
|
|
25990
|
+
id: string(),
|
|
25991
|
+
name: string(),
|
|
25992
|
+
slot: string()
|
|
25993
|
+
})).readonly()
|
|
25994
|
+
});
|
|
24366
25995
|
object({
|
|
24367
25996
|
activeCameras: number(),
|
|
24368
25997
|
throttledCameras: number(),
|
|
@@ -25491,7 +27120,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25491
27120
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25492
27121
|
deviceId: number(),
|
|
25493
27122
|
trackId: string()
|
|
25494
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27123
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27124
|
+
accepted: literal(true),
|
|
27125
|
+
runId: string()
|
|
27126
|
+
}), {
|
|
27127
|
+
kind: "mutation",
|
|
27128
|
+
auth: "admin"
|
|
27129
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27130
|
+
kind: "mutation",
|
|
27131
|
+
auth: "admin"
|
|
27132
|
+
});
|
|
25495
27133
|
var CameraPipelineConfigSchema = object({
|
|
25496
27134
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25497
27135
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26130,6 +27768,21 @@ method(object({
|
|
|
26130
27768
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26131
27769
|
kind: "mutation",
|
|
26132
27770
|
auth: "admin"
|
|
27771
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27772
|
+
kind: literal("started"),
|
|
27773
|
+
runId: string()
|
|
27774
|
+
}), object({
|
|
27775
|
+
kind: literal("refused"),
|
|
27776
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27777
|
+
})]), {
|
|
27778
|
+
kind: "mutation",
|
|
27779
|
+
auth: "admin"
|
|
27780
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27781
|
+
kind: "mutation",
|
|
27782
|
+
auth: "admin"
|
|
27783
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27784
|
+
kind: "mutation",
|
|
27785
|
+
auth: "admin"
|
|
26133
27786
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26134
27787
|
deviceId: number(),
|
|
26135
27788
|
addonId: string(),
|
|
@@ -26766,7 +28419,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26766
28419
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
26767
28420
|
* operator already consented to.
|
|
26768
28421
|
*/
|
|
26769
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
28422
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
28423
|
+
/**
|
|
28424
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
28425
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
28426
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
28427
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
28428
|
+
*/
|
|
28429
|
+
linkIntent: string().optional(),
|
|
28430
|
+
/**
|
|
28431
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28432
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
28433
|
+
*/
|
|
28434
|
+
issuer: string().optional()
|
|
26770
28435
|
});
|
|
26771
28436
|
method(object({
|
|
26772
28437
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -28701,7 +30366,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
28701
30366
|
* field their hints were silently stripped by the schema and the
|
|
28702
30367
|
* adaptive ladder started blind on the client's display size.
|
|
28703
30368
|
*/
|
|
28704
|
-
hints: webrtcClientHintsSchema.optional()
|
|
30369
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
30370
|
+
/**
|
|
30371
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
30372
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
30373
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
30374
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
30375
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
30376
|
+
*
|
|
30377
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
30378
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
30379
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
30380
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
30381
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
30382
|
+
* flag must not become a second door to the camera's speaker.
|
|
30383
|
+
*/
|
|
30384
|
+
talkback: boolean().optional()
|
|
28705
30385
|
}), object({
|
|
28706
30386
|
sessionId: string(),
|
|
28707
30387
|
sdpAnswer: string()
|
|
@@ -32227,6 +33907,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32227
33907
|
enabled: boolean().optional(),
|
|
32228
33908
|
info: record(string(), unknown()).optional(),
|
|
32229
33909
|
settings: record(string(), unknown()).optional(),
|
|
33910
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33911
|
+
* the keychain, not the table (D787). */
|
|
33912
|
+
secretKeys: array(string()).optional(),
|
|
32230
33913
|
skipRestart: boolean().optional()
|
|
32231
33914
|
});
|
|
32232
33915
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32250,7 +33933,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32250
33933
|
auth: "admin"
|
|
32251
33934
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32252
33935
|
id: string(),
|
|
32253
|
-
settings: record(string(), unknown())
|
|
33936
|
+
settings: record(string(), unknown()),
|
|
33937
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33938
|
+
secretKeys: array(string()).optional()
|
|
32254
33939
|
}), object({ success: boolean() }), {
|
|
32255
33940
|
kind: "mutation",
|
|
32256
33941
|
auth: "admin"
|
|
@@ -39072,6 +40757,32 @@ var TotpStatusSchema = object({
|
|
|
39072
40757
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
39073
40758
|
confirmedAt: number().nullable()
|
|
39074
40759
|
});
|
|
40760
|
+
/**
|
|
40761
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
40762
|
+
* and scoped tokens.
|
|
40763
|
+
*
|
|
40764
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
40765
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
40766
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
40767
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
40768
|
+
* provider.
|
|
40769
|
+
*/
|
|
40770
|
+
var ExternalIdentitySchema = object({
|
|
40771
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
40772
|
+
provider: string(),
|
|
40773
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
40774
|
+
subject: string(),
|
|
40775
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
40776
|
+
issuer: string(),
|
|
40777
|
+
userId: string(),
|
|
40778
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
40779
|
+
label: string().optional(),
|
|
40780
|
+
linkedAt: number()
|
|
40781
|
+
});
|
|
40782
|
+
var ExternalIdentityKeySchema = object({
|
|
40783
|
+
provider: string().min(1),
|
|
40784
|
+
subject: string().min(1)
|
|
40785
|
+
});
|
|
39075
40786
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
39076
40787
|
kind: "mutation",
|
|
39077
40788
|
auth: "admin",
|
|
@@ -39185,7 +40896,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39185
40896
|
userId: string(),
|
|
39186
40897
|
username: string(),
|
|
39187
40898
|
scopes: array(TokenScopeSchema)
|
|
39188
|
-
}).nullable(), { access: "view" }), method(
|
|
40899
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40900
|
+
userId: string(),
|
|
40901
|
+
issuer: string()
|
|
40902
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40903
|
+
userId: string(),
|
|
40904
|
+
issuer: string().min(1),
|
|
40905
|
+
label: string().optional()
|
|
40906
|
+
}), object({ success: literal(true) }), {
|
|
40907
|
+
kind: "mutation",
|
|
40908
|
+
auth: "admin",
|
|
40909
|
+
access: "create"
|
|
40910
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40911
|
+
kind: "mutation",
|
|
40912
|
+
auth: "admin",
|
|
40913
|
+
access: "delete"
|
|
40914
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
39189
40915
|
kind: "mutation",
|
|
39190
40916
|
auth: "admin",
|
|
39191
40917
|
access: "delete"
|
|
@@ -40372,7 +42098,8 @@ var BaseDevice = class {
|
|
|
40372
42098
|
this.role = options.role;
|
|
40373
42099
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40374
42100
|
const seedData = ctx.persistedConfig ?? {};
|
|
40375
|
-
|
|
42101
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
42102
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40376
42103
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40377
42104
|
tags: {
|
|
40378
42105
|
deviceId: ctx.id,
|
|
@@ -44061,6 +45788,90 @@ Object.freeze({
|
|
|
44061
45788
|
addonId: null,
|
|
44062
45789
|
access: "create"
|
|
44063
45790
|
},
|
|
45791
|
+
"keychain.delete": {
|
|
45792
|
+
capName: "keychain",
|
|
45793
|
+
capScope: "system",
|
|
45794
|
+
addonId: null,
|
|
45795
|
+
access: "delete"
|
|
45796
|
+
},
|
|
45797
|
+
"keychain.getState": {
|
|
45798
|
+
capName: "keychain",
|
|
45799
|
+
capScope: "system",
|
|
45800
|
+
addonId: null,
|
|
45801
|
+
access: "view"
|
|
45802
|
+
},
|
|
45803
|
+
"keychain.listMeta": {
|
|
45804
|
+
capName: "keychain",
|
|
45805
|
+
capScope: "system",
|
|
45806
|
+
addonId: null,
|
|
45807
|
+
access: "view"
|
|
45808
|
+
},
|
|
45809
|
+
"keychain.put": {
|
|
45810
|
+
capName: "keychain",
|
|
45811
|
+
capScope: "system",
|
|
45812
|
+
addonId: null,
|
|
45813
|
+
access: "create"
|
|
45814
|
+
},
|
|
45815
|
+
"keychain.resolve": {
|
|
45816
|
+
capName: "keychain",
|
|
45817
|
+
capScope: "system",
|
|
45818
|
+
addonId: null,
|
|
45819
|
+
access: "view"
|
|
45820
|
+
},
|
|
45821
|
+
"keychainAdmin.deleteOrphans": {
|
|
45822
|
+
capName: "keychain-admin",
|
|
45823
|
+
capScope: "system",
|
|
45824
|
+
addonId: null,
|
|
45825
|
+
access: "delete"
|
|
45826
|
+
},
|
|
45827
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
45828
|
+
capName: "keychain-admin",
|
|
45829
|
+
capScope: "system",
|
|
45830
|
+
addonId: null,
|
|
45831
|
+
access: "create"
|
|
45832
|
+
},
|
|
45833
|
+
"keychainAdmin.listAudit": {
|
|
45834
|
+
capName: "keychain-admin",
|
|
45835
|
+
capScope: "system",
|
|
45836
|
+
addonId: null,
|
|
45837
|
+
access: "view"
|
|
45838
|
+
},
|
|
45839
|
+
"keychainAdmin.listSecrets": {
|
|
45840
|
+
capName: "keychain-admin",
|
|
45841
|
+
capScope: "system",
|
|
45842
|
+
addonId: null,
|
|
45843
|
+
access: "view"
|
|
45844
|
+
},
|
|
45845
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
45846
|
+
capName: "keychain-admin",
|
|
45847
|
+
capScope: "system",
|
|
45848
|
+
addonId: null,
|
|
45849
|
+
access: "delete"
|
|
45850
|
+
},
|
|
45851
|
+
"keychainAdmin.resetKeychain": {
|
|
45852
|
+
capName: "keychain-admin",
|
|
45853
|
+
capScope: "system",
|
|
45854
|
+
addonId: null,
|
|
45855
|
+
access: "delete"
|
|
45856
|
+
},
|
|
45857
|
+
"keychainAdmin.reveal": {
|
|
45858
|
+
capName: "keychain-admin",
|
|
45859
|
+
capScope: "system",
|
|
45860
|
+
addonId: null,
|
|
45861
|
+
access: "create"
|
|
45862
|
+
},
|
|
45863
|
+
"keychainAdmin.rotateMasterKey": {
|
|
45864
|
+
capName: "keychain-admin",
|
|
45865
|
+
capScope: "system",
|
|
45866
|
+
addonId: null,
|
|
45867
|
+
access: "create"
|
|
45868
|
+
},
|
|
45869
|
+
"keychainAdmin.status": {
|
|
45870
|
+
capName: "keychain-admin",
|
|
45871
|
+
capScope: "system",
|
|
45872
|
+
addonId: null,
|
|
45873
|
+
access: "view"
|
|
45874
|
+
},
|
|
44064
45875
|
"lawnMowerControl.dock": {
|
|
44065
45876
|
capName: "lawn-mower-control",
|
|
44066
45877
|
capScope: "device",
|
|
@@ -45435,6 +47246,18 @@ Object.freeze({
|
|
|
45435
47246
|
addonId: null,
|
|
45436
47247
|
access: "create"
|
|
45437
47248
|
},
|
|
47249
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
47250
|
+
capName: "pipeline-analytics",
|
|
47251
|
+
capScope: "device",
|
|
47252
|
+
addonId: null,
|
|
47253
|
+
access: "create"
|
|
47254
|
+
},
|
|
47255
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
47256
|
+
capName: "pipeline-analytics",
|
|
47257
|
+
capScope: "device",
|
|
47258
|
+
addonId: null,
|
|
47259
|
+
access: "create"
|
|
47260
|
+
},
|
|
45438
47261
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45439
47262
|
capName: "pipeline-analytics",
|
|
45440
47263
|
capScope: "device",
|
|
@@ -45483,12 +47306,24 @@ Object.freeze({
|
|
|
45483
47306
|
addonId: null,
|
|
45484
47307
|
access: "view"
|
|
45485
47308
|
},
|
|
47309
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
47310
|
+
capName: "pipeline-analytics",
|
|
47311
|
+
capScope: "device",
|
|
47312
|
+
addonId: null,
|
|
47313
|
+
access: "create"
|
|
47314
|
+
},
|
|
45486
47315
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45487
47316
|
capName: "pipeline-analytics",
|
|
45488
47317
|
capScope: "device",
|
|
45489
47318
|
addonId: null,
|
|
45490
47319
|
access: "delete"
|
|
45491
47320
|
},
|
|
47321
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
47322
|
+
capName: "pipeline-analytics",
|
|
47323
|
+
capScope: "device",
|
|
47324
|
+
addonId: null,
|
|
47325
|
+
access: "delete"
|
|
47326
|
+
},
|
|
45492
47327
|
"pipelineAnalytics.deleteTracks": {
|
|
45493
47328
|
capName: "pipeline-analytics",
|
|
45494
47329
|
capScope: "device",
|
|
@@ -45693,6 +47528,24 @@ Object.freeze({
|
|
|
45693
47528
|
addonId: null,
|
|
45694
47529
|
access: "view"
|
|
45695
47530
|
},
|
|
47531
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
47532
|
+
capName: "pipeline-analytics",
|
|
47533
|
+
capScope: "device",
|
|
47534
|
+
addonId: null,
|
|
47535
|
+
access: "view"
|
|
47536
|
+
},
|
|
47537
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
47538
|
+
capName: "pipeline-analytics",
|
|
47539
|
+
capScope: "device",
|
|
47540
|
+
addonId: null,
|
|
47541
|
+
access: "view"
|
|
47542
|
+
},
|
|
47543
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
47544
|
+
capName: "pipeline-analytics",
|
|
47545
|
+
capScope: "device",
|
|
47546
|
+
addonId: null,
|
|
47547
|
+
access: "view"
|
|
47548
|
+
},
|
|
45696
47549
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45697
47550
|
capName: "pipeline-analytics",
|
|
45698
47551
|
capScope: "device",
|
|
@@ -45741,6 +47594,12 @@ Object.freeze({
|
|
|
45741
47594
|
addonId: null,
|
|
45742
47595
|
access: "create"
|
|
45743
47596
|
},
|
|
47597
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
47598
|
+
capName: "pipeline-analytics",
|
|
47599
|
+
capScope: "device",
|
|
47600
|
+
addonId: null,
|
|
47601
|
+
access: "create"
|
|
47602
|
+
},
|
|
45744
47603
|
"pipelineAnalytics.pruneEvents": {
|
|
45745
47604
|
capName: "pipeline-analytics",
|
|
45746
47605
|
capScope: "device",
|
|
@@ -45795,6 +47654,18 @@ Object.freeze({
|
|
|
45795
47654
|
addonId: null,
|
|
45796
47655
|
access: "create"
|
|
45797
47656
|
},
|
|
47657
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
47658
|
+
capName: "pipeline-analytics",
|
|
47659
|
+
capScope: "device",
|
|
47660
|
+
addonId: null,
|
|
47661
|
+
access: "delete"
|
|
47662
|
+
},
|
|
47663
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
47664
|
+
capName: "pipeline-analytics",
|
|
47665
|
+
capScope: "device",
|
|
47666
|
+
addonId: null,
|
|
47667
|
+
access: "create"
|
|
47668
|
+
},
|
|
45798
47669
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45799
47670
|
capName: "pipeline-analytics",
|
|
45800
47671
|
capScope: "device",
|
|
@@ -45825,6 +47696,12 @@ Object.freeze({
|
|
|
45825
47696
|
addonId: null,
|
|
45826
47697
|
access: "create"
|
|
45827
47698
|
},
|
|
47699
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
47700
|
+
capName: "pipeline-analytics",
|
|
47701
|
+
capScope: "device",
|
|
47702
|
+
addonId: null,
|
|
47703
|
+
access: "create"
|
|
47704
|
+
},
|
|
45828
47705
|
"pipelineAnalytics.setTrackFlags": {
|
|
45829
47706
|
capName: "pipeline-analytics",
|
|
45830
47707
|
capScope: "device",
|
|
@@ -45861,6 +47738,12 @@ Object.freeze({
|
|
|
45861
47738
|
addonId: null,
|
|
45862
47739
|
access: "delete"
|
|
45863
47740
|
},
|
|
47741
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
47742
|
+
capName: "pipeline-analytics",
|
|
47743
|
+
capScope: "device",
|
|
47744
|
+
addonId: null,
|
|
47745
|
+
access: "create"
|
|
47746
|
+
},
|
|
45864
47747
|
"pipelineExecutor.cacheFrameInPool": {
|
|
45865
47748
|
capName: "pipeline-executor",
|
|
45866
47749
|
capScope: "system",
|
|
@@ -46071,6 +47954,12 @@ Object.freeze({
|
|
|
46071
47954
|
addonId: null,
|
|
46072
47955
|
access: "view"
|
|
46073
47956
|
},
|
|
47957
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
47958
|
+
capName: "pipeline-orchestrator",
|
|
47959
|
+
capScope: "system",
|
|
47960
|
+
addonId: null,
|
|
47961
|
+
access: "create"
|
|
47962
|
+
},
|
|
46074
47963
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46075
47964
|
capName: "pipeline-orchestrator",
|
|
46076
47965
|
capScope: "system",
|
|
@@ -46095,6 +47984,12 @@ Object.freeze({
|
|
|
46095
47984
|
addonId: null,
|
|
46096
47985
|
access: "create"
|
|
46097
47986
|
},
|
|
47987
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
47988
|
+
capName: "pipeline-orchestrator",
|
|
47989
|
+
capScope: "system",
|
|
47990
|
+
addonId: null,
|
|
47991
|
+
access: "delete"
|
|
47992
|
+
},
|
|
46098
47993
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46099
47994
|
capName: "pipeline-orchestrator",
|
|
46100
47995
|
capScope: "system",
|
|
@@ -46203,6 +48098,24 @@ Object.freeze({
|
|
|
46203
48098
|
addonId: null,
|
|
46204
48099
|
access: "view"
|
|
46205
48100
|
},
|
|
48101
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
48102
|
+
capName: "pipeline-orchestrator",
|
|
48103
|
+
capScope: "system",
|
|
48104
|
+
addonId: null,
|
|
48105
|
+
access: "view"
|
|
48106
|
+
},
|
|
48107
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
48108
|
+
capName: "pipeline-orchestrator",
|
|
48109
|
+
capScope: "system",
|
|
48110
|
+
addonId: null,
|
|
48111
|
+
access: "view"
|
|
48112
|
+
},
|
|
48113
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
48114
|
+
capName: "pipeline-orchestrator",
|
|
48115
|
+
capScope: "system",
|
|
48116
|
+
addonId: null,
|
|
48117
|
+
access: "view"
|
|
48118
|
+
},
|
|
46206
48119
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46207
48120
|
capName: "pipeline-orchestrator",
|
|
46208
48121
|
capScope: "system",
|
|
@@ -46245,6 +48158,12 @@ Object.freeze({
|
|
|
46245
48158
|
addonId: null,
|
|
46246
48159
|
access: "view"
|
|
46247
48160
|
},
|
|
48161
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
48162
|
+
capName: "pipeline-orchestrator",
|
|
48163
|
+
capScope: "system",
|
|
48164
|
+
addonId: null,
|
|
48165
|
+
access: "view"
|
|
48166
|
+
},
|
|
46248
48167
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46249
48168
|
capName: "pipeline-orchestrator",
|
|
46250
48169
|
capScope: "system",
|
|
@@ -46389,6 +48308,12 @@ Object.freeze({
|
|
|
46389
48308
|
addonId: null,
|
|
46390
48309
|
access: "create"
|
|
46391
48310
|
},
|
|
48311
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
48312
|
+
capName: "pipeline-orchestrator",
|
|
48313
|
+
capScope: "system",
|
|
48314
|
+
addonId: null,
|
|
48315
|
+
access: "create"
|
|
48316
|
+
},
|
|
46392
48317
|
"pipelineOrchestrator.suggestShares": {
|
|
46393
48318
|
capName: "pipeline-orchestrator",
|
|
46394
48319
|
capScope: "system",
|
|
@@ -46407,6 +48332,12 @@ Object.freeze({
|
|
|
46407
48332
|
addonId: null,
|
|
46408
48333
|
access: "create"
|
|
46409
48334
|
},
|
|
48335
|
+
"pipelineRunner.abortNodeBench": {
|
|
48336
|
+
capName: "pipeline-runner",
|
|
48337
|
+
capScope: "system",
|
|
48338
|
+
addonId: null,
|
|
48339
|
+
access: "create"
|
|
48340
|
+
},
|
|
46410
48341
|
"pipelineRunner.attachCamera": {
|
|
46411
48342
|
capName: "pipeline-runner",
|
|
46412
48343
|
capScope: "system",
|
|
@@ -46455,6 +48386,12 @@ Object.freeze({
|
|
|
46455
48386
|
addonId: null,
|
|
46456
48387
|
access: "view"
|
|
46457
48388
|
},
|
|
48389
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
48390
|
+
capName: "pipeline-runner",
|
|
48391
|
+
capScope: "system",
|
|
48392
|
+
addonId: null,
|
|
48393
|
+
access: "view"
|
|
48394
|
+
},
|
|
46458
48395
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46459
48396
|
capName: "pipeline-runner",
|
|
46460
48397
|
capScope: "system",
|
|
@@ -46497,6 +48434,12 @@ Object.freeze({
|
|
|
46497
48434
|
addonId: null,
|
|
46498
48435
|
access: "create"
|
|
46499
48436
|
},
|
|
48437
|
+
"pipelineRunner.startNodeBench": {
|
|
48438
|
+
capName: "pipeline-runner",
|
|
48439
|
+
capScope: "system",
|
|
48440
|
+
addonId: null,
|
|
48441
|
+
access: "create"
|
|
48442
|
+
},
|
|
46500
48443
|
"plateGallery.assignPlate": {
|
|
46501
48444
|
capName: "plate-gallery",
|
|
46502
48445
|
capScope: "system",
|
|
@@ -48213,18 +50156,36 @@ Object.freeze({
|
|
|
48213
50156
|
addonId: null,
|
|
48214
50157
|
access: "delete"
|
|
48215
50158
|
},
|
|
50159
|
+
"userManagement.findUserByExternalIdentity": {
|
|
50160
|
+
capName: "user-management",
|
|
50161
|
+
capScope: "system",
|
|
50162
|
+
addonId: null,
|
|
50163
|
+
access: "view"
|
|
50164
|
+
},
|
|
48216
50165
|
"userManagement.getTotpStatus": {
|
|
48217
50166
|
capName: "user-management",
|
|
48218
50167
|
capScope: "system",
|
|
48219
50168
|
addonId: null,
|
|
48220
50169
|
access: "view"
|
|
48221
50170
|
},
|
|
50171
|
+
"userManagement.linkExternalIdentity": {
|
|
50172
|
+
capName: "user-management",
|
|
50173
|
+
capScope: "system",
|
|
50174
|
+
addonId: null,
|
|
50175
|
+
access: "create"
|
|
50176
|
+
},
|
|
48222
50177
|
"userManagement.listApiKeys": {
|
|
48223
50178
|
capName: "user-management",
|
|
48224
50179
|
capScope: "system",
|
|
48225
50180
|
addonId: null,
|
|
48226
50181
|
access: "view"
|
|
48227
50182
|
},
|
|
50183
|
+
"userManagement.listExternalIdentities": {
|
|
50184
|
+
capName: "user-management",
|
|
50185
|
+
capScope: "system",
|
|
50186
|
+
addonId: null,
|
|
50187
|
+
access: "view"
|
|
50188
|
+
},
|
|
48228
50189
|
"userManagement.listOauthSessions": {
|
|
48229
50190
|
capName: "user-management",
|
|
48230
50191
|
capScope: "system",
|
|
@@ -48303,6 +50264,12 @@ Object.freeze({
|
|
|
48303
50264
|
addonId: null,
|
|
48304
50265
|
access: "create"
|
|
48305
50266
|
},
|
|
50267
|
+
"userManagement.unlinkExternalIdentity": {
|
|
50268
|
+
capName: "user-management",
|
|
50269
|
+
capScope: "system",
|
|
50270
|
+
addonId: null,
|
|
50271
|
+
access: "delete"
|
|
50272
|
+
},
|
|
48306
50273
|
"userManagement.updateUser": {
|
|
48307
50274
|
capName: "user-management",
|
|
48308
50275
|
capScope: "system",
|
|
@@ -51402,6 +53369,11 @@ Object.freeze({
|
|
|
51402
53369
|
form: "single",
|
|
51403
53370
|
optional: false
|
|
51404
53371
|
}],
|
|
53372
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
53373
|
+
name: "deviceId",
|
|
53374
|
+
form: "single",
|
|
53375
|
+
optional: false
|
|
53376
|
+
}],
|
|
51405
53377
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51406
53378
|
name: "deviceId",
|
|
51407
53379
|
form: "single",
|
|
@@ -51592,6 +53564,11 @@ Object.freeze({
|
|
|
51592
53564
|
form: "single",
|
|
51593
53565
|
optional: false
|
|
51594
53566
|
}],
|
|
53567
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
53568
|
+
name: "deviceId",
|
|
53569
|
+
form: "single",
|
|
53570
|
+
optional: false
|
|
53571
|
+
}],
|
|
51595
53572
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51596
53573
|
name: "deviceId",
|
|
51597
53574
|
form: "single",
|
|
@@ -51642,6 +53619,11 @@ Object.freeze({
|
|
|
51642
53619
|
form: "single",
|
|
51643
53620
|
optional: false
|
|
51644
53621
|
}],
|
|
53622
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
53623
|
+
name: "deviceId",
|
|
53624
|
+
form: "single",
|
|
53625
|
+
optional: false
|
|
53626
|
+
}],
|
|
51645
53627
|
"pipelineAnalytics.setTrackFlags": [{
|
|
51646
53628
|
name: "deviceId",
|
|
51647
53629
|
form: "single",
|
|
@@ -53711,13 +55693,13 @@ var alexaConnectionSchema = object({
|
|
|
53711
55693
|
* proxy login (preferred: it carries the refresh token + lets the session
|
|
53712
55694
|
* auto-refresh). This is the primary auth input.
|
|
53713
55695
|
*/
|
|
53714
|
-
cookie: string().default("").describe("Captured Alexa cookie / cookieData blob (from proxy login)"),
|
|
55696
|
+
cookie: string().default("").describe("Captured Alexa cookie / cookieData blob (from proxy login)").meta({ secret: true }),
|
|
53715
55697
|
/**
|
|
53716
55698
|
* Refresh token. NOTE: a bare refresh token alone is NOT sufficient to init
|
|
53717
55699
|
* alexa-remote2 — supply the full cookie / cookieData blob (which embeds it).
|
|
53718
55700
|
* Retained for provenance / forward-compat.
|
|
53719
55701
|
*/
|
|
53720
|
-
refreshToken: string().default("").describe("Alexa refresh token (must be inside cookie blob)"),
|
|
55702
|
+
refreshToken: string().default("").describe("Alexa refresh token (must be inside cookie blob)").meta({ secret: true }),
|
|
53721
55703
|
/** Device-registration secret some flows need. */
|
|
53722
55704
|
macDms: string().default("").describe("macDms device-registration secret (optional)"),
|
|
53723
55705
|
/** Poll interval for state sync (Alexa has no clean 3rd-party push). */
|