@camstack/addon-export-hap 1.2.153 → 1.2.155
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/hap-export.addon.js +2041 -97
- package/dist/hap-export.addon.mjs +2041 -97
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
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
|
|
@@ -14886,6 +15553,196 @@ id: union([string(), number()]) }), {
|
|
|
14886
15553
|
auth: "admin"
|
|
14887
15554
|
});
|
|
14888
15555
|
/**
|
|
15556
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15557
|
+
*
|
|
15558
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15559
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15560
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15561
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15562
|
+
* against the CALLER, never against anything the caller claims.
|
|
15563
|
+
*
|
|
15564
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15565
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15566
|
+
* connection, the agent from its child's connection carried in
|
|
15567
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15568
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15569
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15570
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15571
|
+
* runner is the same OS user): see the threat model in
|
|
15572
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15573
|
+
*
|
|
15574
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15575
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15576
|
+
* floors every method to admin anyway (D240).
|
|
15577
|
+
*
|
|
15578
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15579
|
+
*/
|
|
15580
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15581
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15582
|
+
"key-missing",
|
|
15583
|
+
"wrong-key",
|
|
15584
|
+
"key-file-unreadable",
|
|
15585
|
+
"store-unavailable",
|
|
15586
|
+
"not-initialized",
|
|
15587
|
+
"decrypt-failed"
|
|
15588
|
+
]);
|
|
15589
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15590
|
+
state: literal("locked"),
|
|
15591
|
+
reason: KeychainUnavailableReasonSchema
|
|
15592
|
+
})]);
|
|
15593
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15594
|
+
object({
|
|
15595
|
+
kind: literal("value"),
|
|
15596
|
+
value: string(),
|
|
15597
|
+
version: number().int()
|
|
15598
|
+
}),
|
|
15599
|
+
object({ kind: literal("missing") }),
|
|
15600
|
+
object({
|
|
15601
|
+
kind: literal("unavailable"),
|
|
15602
|
+
reason: KeychainUnavailableReasonSchema
|
|
15603
|
+
}),
|
|
15604
|
+
object({ kind: literal("forbidden") })
|
|
15605
|
+
]);
|
|
15606
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15607
|
+
/** Metadata of one stored value — never the value. */
|
|
15608
|
+
var KeychainSecretMetaSchema = object({
|
|
15609
|
+
ref: string(),
|
|
15610
|
+
owner: string(),
|
|
15611
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15612
|
+
scope: string(),
|
|
15613
|
+
fieldPath: string(),
|
|
15614
|
+
version: number().int(),
|
|
15615
|
+
createdAt: number(),
|
|
15616
|
+
updatedAt: number(),
|
|
15617
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15618
|
+
updatedBy: string(),
|
|
15619
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15620
|
+
lastReadAt: number().nullable()
|
|
15621
|
+
});
|
|
15622
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15623
|
+
method(object({
|
|
15624
|
+
ref: string().min(1),
|
|
15625
|
+
value: string().min(1)
|
|
15626
|
+
}), object({
|
|
15627
|
+
ref: string(),
|
|
15628
|
+
version: number().int()
|
|
15629
|
+
}), {
|
|
15630
|
+
kind: "mutation",
|
|
15631
|
+
auth: "admin"
|
|
15632
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15633
|
+
kind: "mutation",
|
|
15634
|
+
auth: "admin"
|
|
15635
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15636
|
+
var KeychainKeySourceSchema = object({
|
|
15637
|
+
kind: _enum([
|
|
15638
|
+
"config-file",
|
|
15639
|
+
"previous-config-file",
|
|
15640
|
+
"platform",
|
|
15641
|
+
"default-file"
|
|
15642
|
+
]),
|
|
15643
|
+
/** File sources only — a path is not a secret. */
|
|
15644
|
+
path: string().optional(),
|
|
15645
|
+
/**
|
|
15646
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15647
|
+
* next to the database it protects (the default file). The page warns.
|
|
15648
|
+
*/
|
|
15649
|
+
sharesBackupWithDatabase: boolean()
|
|
15650
|
+
});
|
|
15651
|
+
var KeychainStatusSchema = object({
|
|
15652
|
+
keychain: KeychainStateSchema,
|
|
15653
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15654
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15655
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15656
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15657
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15658
|
+
fingerprint: string().nullable(),
|
|
15659
|
+
activeKeyId: string().nullable(),
|
|
15660
|
+
/**
|
|
15661
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15662
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15663
|
+
*/
|
|
15664
|
+
rotationPending: boolean(),
|
|
15665
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15666
|
+
retiredWraps: number().int(),
|
|
15667
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15668
|
+
secretCount: number().int()
|
|
15669
|
+
});
|
|
15670
|
+
/**
|
|
15671
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15672
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15673
|
+
* never reported as an orphan (and never deleted as one).
|
|
15674
|
+
*/
|
|
15675
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15676
|
+
"in-use",
|
|
15677
|
+
"orphan",
|
|
15678
|
+
"unknown"
|
|
15679
|
+
]);
|
|
15680
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15681
|
+
var KeychainAuditActionSchema = _enum([
|
|
15682
|
+
"put",
|
|
15683
|
+
"delete",
|
|
15684
|
+
"reveal",
|
|
15685
|
+
"rotate-master-key",
|
|
15686
|
+
"purge-retired-keys",
|
|
15687
|
+
"download-recovery-key",
|
|
15688
|
+
"delete-orphans",
|
|
15689
|
+
"reset",
|
|
15690
|
+
"initialize"
|
|
15691
|
+
]);
|
|
15692
|
+
var KeychainAuditEntrySchema = object({
|
|
15693
|
+
id: string(),
|
|
15694
|
+
at: number(),
|
|
15695
|
+
action: KeychainAuditActionSchema,
|
|
15696
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15697
|
+
actor: string(),
|
|
15698
|
+
ref: string().nullable(),
|
|
15699
|
+
detail: string().nullable()
|
|
15700
|
+
});
|
|
15701
|
+
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({
|
|
15702
|
+
value: string(),
|
|
15703
|
+
version: number().int()
|
|
15704
|
+
}), {
|
|
15705
|
+
kind: "mutation",
|
|
15706
|
+
auth: "admin",
|
|
15707
|
+
caller: "required"
|
|
15708
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15709
|
+
deleted: array(string()).readonly(),
|
|
15710
|
+
kept: array(object({
|
|
15711
|
+
ref: string(),
|
|
15712
|
+
usage: KeychainSecretUsageSchema
|
|
15713
|
+
})).readonly()
|
|
15714
|
+
}), {
|
|
15715
|
+
kind: "mutation",
|
|
15716
|
+
auth: "admin",
|
|
15717
|
+
caller: "required"
|
|
15718
|
+
}), method(object({}), object({
|
|
15719
|
+
fingerprint: string(),
|
|
15720
|
+
keySource: KeychainKeySourceSchema
|
|
15721
|
+
}), {
|
|
15722
|
+
kind: "mutation",
|
|
15723
|
+
auth: "admin",
|
|
15724
|
+
caller: "required"
|
|
15725
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15726
|
+
kind: "mutation",
|
|
15727
|
+
auth: "admin",
|
|
15728
|
+
caller: "required"
|
|
15729
|
+
}), method(object({}), object({
|
|
15730
|
+
key: string(),
|
|
15731
|
+
fingerprint: string(),
|
|
15732
|
+
keySource: KeychainKeySourceSchema
|
|
15733
|
+
}), {
|
|
15734
|
+
kind: "mutation",
|
|
15735
|
+
auth: "admin",
|
|
15736
|
+
caller: "required"
|
|
15737
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15738
|
+
archivedCollection: string().nullable(),
|
|
15739
|
+
archived: number().int()
|
|
15740
|
+
}), {
|
|
15741
|
+
kind: "mutation",
|
|
15742
|
+
auth: "admin",
|
|
15743
|
+
caller: "required"
|
|
15744
|
+
});
|
|
15745
|
+
/**
|
|
14889
15746
|
* Stable UI option list for the `hwaccel` setting. Decoder addons
|
|
14890
15747
|
* reuse this for `globalSettingsSchema()` so the dropdown is
|
|
14891
15748
|
* identical everywhere. Order: auto → off → common backends by
|
|
@@ -15783,6 +16640,10 @@ var DeviceInfoSchema = object({
|
|
|
15783
16640
|
isCamera: boolean(),
|
|
15784
16641
|
/** Current config values — serializable snapshot */
|
|
15785
16642
|
config: record(string(), unknown()),
|
|
16643
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16644
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16645
|
+
* when the owning runner has not reported them. */
|
|
16646
|
+
secretConfigPaths: array(string()).optional(),
|
|
15786
16647
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15787
16648
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15788
16649
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -15988,12 +16849,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15988
16849
|
* call (workers re-register on init), so probe-driven updates
|
|
15989
16850
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15990
16851
|
features: array(string()).optional(),
|
|
15991
|
-
config: record(string(), unknown())
|
|
16852
|
+
config: record(string(), unknown()),
|
|
16853
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16854
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16855
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16856
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16857
|
+
* omits it and the keyword backstop applies. */
|
|
16858
|
+
secretConfigPaths: array(string()).optional()
|
|
15992
16859
|
});
|
|
15993
16860
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15994
16861
|
var DevicePersistConfigPayloadSchema = object({
|
|
15995
16862
|
deviceId: number(),
|
|
15996
|
-
data: record(string(), unknown())
|
|
16863
|
+
data: record(string(), unknown()),
|
|
16864
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16865
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16866
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16867
|
+
secretConfigPaths: array(string()).optional()
|
|
15997
16868
|
});
|
|
15998
16869
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15999
16870
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17647,7 +18518,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17647
18518
|
icon: string().optional(),
|
|
17648
18519
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17649
18520
|
startUrl: string(),
|
|
17650
|
-
stage: LoginStageEnum
|
|
18521
|
+
stage: LoginStageEnum,
|
|
18522
|
+
/**
|
|
18523
|
+
* The provider names an external identity a signed-in user can link to
|
|
18524
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
18525
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18526
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
18527
|
+
*/
|
|
18528
|
+
linkable: boolean().optional()
|
|
17651
18529
|
}),
|
|
17652
18530
|
object({
|
|
17653
18531
|
kind: literal("widget"),
|
|
@@ -22965,8 +23843,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22965
23843
|
]);
|
|
22966
23844
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22967
23845
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22968
|
-
/**
|
|
22969
|
-
|
|
23846
|
+
/**
|
|
23847
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23848
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23849
|
+
*
|
|
23850
|
+
* - `operator` — drawn by hand.
|
|
23851
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23852
|
+
* model, or a larger teacher model).
|
|
23853
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23854
|
+
* back from the track store (never a re-run).
|
|
23855
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23856
|
+
*/
|
|
23857
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23858
|
+
"operator",
|
|
23859
|
+
"assist",
|
|
23860
|
+
"pipeline",
|
|
23861
|
+
"llm"
|
|
23862
|
+
]);
|
|
22970
23863
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22971
23864
|
var RetrainBboxSchema = object({
|
|
22972
23865
|
x: number(),
|
|
@@ -22984,7 +23877,8 @@ var RetrainBboxSchema = object({
|
|
|
22984
23877
|
*/
|
|
22985
23878
|
var RetrainAnnotationSchema = object({
|
|
22986
23879
|
id: string(),
|
|
22987
|
-
|
|
23880
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23881
|
+
trackId: string().optional(),
|
|
22988
23882
|
deviceId: number(),
|
|
22989
23883
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22990
23884
|
mediaKey: string(),
|
|
@@ -23033,18 +23927,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23033
23927
|
* fail, whatever became of the original. */
|
|
23034
23928
|
copied: boolean()
|
|
23035
23929
|
});
|
|
23930
|
+
/**
|
|
23931
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23932
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23933
|
+
* box recorded on the source media row when there is one, else the track
|
|
23934
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23935
|
+
* until the operator confirms it.
|
|
23936
|
+
*/
|
|
23937
|
+
var RetrainPipelineBoxSchema = object({
|
|
23938
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23939
|
+
bbox: RetrainBboxSchema,
|
|
23940
|
+
macroClass: RetrainMacroClassSchema,
|
|
23941
|
+
label: string().optional(),
|
|
23942
|
+
subLabel: string().optional(),
|
|
23943
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23944
|
+
score: number().optional(),
|
|
23945
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23946
|
+
modelId: string().optional(),
|
|
23947
|
+
trackId: string(),
|
|
23948
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23949
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23950
|
+
basis: _enum(["subject-box", "position"]),
|
|
23951
|
+
deltaMs: number()
|
|
23952
|
+
});
|
|
23953
|
+
/**
|
|
23954
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23955
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23956
|
+
* track at all.
|
|
23957
|
+
*/
|
|
23958
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23036
23959
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23037
23960
|
var RetrainFrameSchema = object({
|
|
23038
23961
|
frameId: string(),
|
|
23039
23962
|
deviceId: number(),
|
|
23040
|
-
|
|
23041
|
-
/**
|
|
23042
|
-
|
|
23963
|
+
origin: RetrainFrameOriginSchema,
|
|
23964
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23965
|
+
trackId: string().optional(),
|
|
23966
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23967
|
+
* Absent on a recording still. */
|
|
23968
|
+
sourceMediaId: number().int().optional(),
|
|
23969
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23970
|
+
epochMs: number().optional(),
|
|
23043
23971
|
sourceKind: MediaFileKindEnum,
|
|
23044
23972
|
sizeBytes: number().int(),
|
|
23045
23973
|
width: number().int(),
|
|
23046
23974
|
height: number().int(),
|
|
23047
|
-
copiedAt: number()
|
|
23975
|
+
copiedAt: number(),
|
|
23976
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
23977
|
+
capturedAt: number().optional(),
|
|
23978
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
23979
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23980
|
+
* a false positive. */
|
|
23981
|
+
complete: boolean(),
|
|
23982
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23983
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23984
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23985
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23986
|
+
collectionIds: array(string()).readonly().optional()
|
|
23048
23987
|
});
|
|
23049
23988
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23050
23989
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23065,6 +24004,53 @@ var RetrainFrameListSchema = object({
|
|
|
23065
24004
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
23066
24005
|
autoPickMediaId: number().int().optional()
|
|
23067
24006
|
});
|
|
24007
|
+
/**
|
|
24008
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
24009
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
24010
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
24011
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
24012
|
+
* export carried (`exportedInBatch`).
|
|
24013
|
+
*/
|
|
24014
|
+
var RetrainExportFilterSchema = object({
|
|
24015
|
+
deviceIds: array(number()).optional(),
|
|
24016
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
24017
|
+
/** Only frames in at least one of these named collections. */
|
|
24018
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24019
|
+
batchId: string().optional(),
|
|
24020
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24021
|
+
completeOnly: boolean().optional()
|
|
24022
|
+
});
|
|
24023
|
+
/**
|
|
24024
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
24025
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
24026
|
+
* convention — the classifier layout.
|
|
24027
|
+
*/
|
|
24028
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
24029
|
+
/**
|
|
24030
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
24031
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
24032
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
24033
|
+
* logged.
|
|
24034
|
+
*/
|
|
24035
|
+
var RetrainArchiveTargetSchema = object({
|
|
24036
|
+
kind: literal("http"),
|
|
24037
|
+
method: _enum(["PUT", "POST"]),
|
|
24038
|
+
url: string().url(),
|
|
24039
|
+
headers: record(string(), string()).optional()
|
|
24040
|
+
});
|
|
24041
|
+
var RetrainArchiveResultSchema = object({
|
|
24042
|
+
batchId: string(),
|
|
24043
|
+
frames: number().int(),
|
|
24044
|
+
crops: number().int(),
|
|
24045
|
+
annotations: number().int(),
|
|
24046
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
24047
|
+
missing: number().int(),
|
|
24048
|
+
bytes: number().int(),
|
|
24049
|
+
/** sha256 of the exact bytes sent. */
|
|
24050
|
+
sha256: string(),
|
|
24051
|
+
/** The target's HTTP status. */
|
|
24052
|
+
status: number().int()
|
|
24053
|
+
});
|
|
23068
24054
|
/** What the operator asked the assist to look for. */
|
|
23069
24055
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
23070
24056
|
kind: literal("package"),
|
|
@@ -23094,6 +24080,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23094
24080
|
reason: string(),
|
|
23095
24081
|
detail: string().optional()
|
|
23096
24082
|
})]);
|
|
24083
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24084
|
+
var RetrainCollectionSchema = object({
|
|
24085
|
+
id: string(),
|
|
24086
|
+
name: string(),
|
|
24087
|
+
createdAt: number(),
|
|
24088
|
+
frameCount: number().int()
|
|
24089
|
+
});
|
|
24090
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24091
|
+
kind: literal("created"),
|
|
24092
|
+
collection: RetrainCollectionSchema
|
|
24093
|
+
}), object({
|
|
24094
|
+
kind: literal("refused"),
|
|
24095
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24096
|
+
})]);
|
|
24097
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24098
|
+
kind: literal("renamed"),
|
|
24099
|
+
collection: RetrainCollectionSchema
|
|
24100
|
+
}), object({
|
|
24101
|
+
kind: literal("refused"),
|
|
24102
|
+
reason: _enum([
|
|
24103
|
+
"empty-name",
|
|
24104
|
+
"duplicate-name",
|
|
24105
|
+
"unknown-collection"
|
|
24106
|
+
])
|
|
24107
|
+
})]);
|
|
24108
|
+
/**
|
|
24109
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24110
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24111
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24112
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24113
|
+
*/
|
|
24114
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24115
|
+
kind: literal("added"),
|
|
24116
|
+
collectionId: string(),
|
|
24117
|
+
frame: RetrainFrameSchema,
|
|
24118
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24119
|
+
reused: boolean()
|
|
24120
|
+
}), object({
|
|
24121
|
+
kind: literal("refused"),
|
|
24122
|
+
reason: _enum([
|
|
24123
|
+
"unknown-collection",
|
|
24124
|
+
"still-unavailable",
|
|
24125
|
+
"still-busy",
|
|
24126
|
+
"unreadable-image",
|
|
24127
|
+
"write-failed"
|
|
24128
|
+
]),
|
|
24129
|
+
detail: string().optional()
|
|
24130
|
+
})]);
|
|
24131
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24132
|
+
var RetrainAssistProfileSchema = object({
|
|
24133
|
+
id: string(),
|
|
24134
|
+
name: string(),
|
|
24135
|
+
model: string(),
|
|
24136
|
+
kind: string(),
|
|
24137
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24138
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24139
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24140
|
+
leavesHouse: boolean()
|
|
24141
|
+
});
|
|
24142
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24143
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24144
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24145
|
+
var RetrainLlmReviewSchema = object({
|
|
24146
|
+
/** The `ref` the page sent the box under. */
|
|
24147
|
+
ref: string(),
|
|
24148
|
+
verdict: _enum([
|
|
24149
|
+
"confirmed",
|
|
24150
|
+
"wrong-class",
|
|
24151
|
+
"not-an-object",
|
|
24152
|
+
"uncertain"
|
|
24153
|
+
]),
|
|
24154
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24155
|
+
reason: string()
|
|
24156
|
+
});
|
|
24157
|
+
/**
|
|
24158
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24159
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24160
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24161
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24162
|
+
*/
|
|
24163
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24164
|
+
kind: literal("proposed"),
|
|
24165
|
+
profileId: string(),
|
|
24166
|
+
model: string(),
|
|
24167
|
+
/** The frame was sent outside the house for this answer. */
|
|
24168
|
+
leftHouse: boolean(),
|
|
24169
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24170
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24171
|
+
rejected: number().int()
|
|
24172
|
+
}), object({
|
|
24173
|
+
kind: literal("refused"),
|
|
24174
|
+
reason: _enum([
|
|
24175
|
+
"unknown-frame",
|
|
24176
|
+
"unreadable-frame",
|
|
24177
|
+
"unknown-profile",
|
|
24178
|
+
"profile-disabled",
|
|
24179
|
+
"no-vision",
|
|
24180
|
+
"cloud-not-confirmed",
|
|
24181
|
+
"llm-error",
|
|
24182
|
+
"malformed-answer"
|
|
24183
|
+
]),
|
|
24184
|
+
detail: string().optional()
|
|
24185
|
+
})]);
|
|
23097
24186
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23098
24187
|
var RetrainTransitionResultSchema = object({
|
|
23099
24188
|
trackId: string(),
|
|
@@ -23811,7 +24900,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23811
24900
|
auth: "admin"
|
|
23812
24901
|
}), method(object({
|
|
23813
24902
|
deviceId: number(),
|
|
23814
|
-
trackId: string(),
|
|
24903
|
+
trackId: string().optional(),
|
|
23815
24904
|
frameId: string()
|
|
23816
24905
|
}), object({
|
|
23817
24906
|
removed: boolean(),
|
|
@@ -23828,7 +24917,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23828
24917
|
auth: "admin"
|
|
23829
24918
|
}), method(object({
|
|
23830
24919
|
deviceId: number(),
|
|
23831
|
-
|
|
24920
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24921
|
+
trackId: string().optional(),
|
|
23832
24922
|
frameId: string(),
|
|
23833
24923
|
subject: RetrainAssistSubjectSchema,
|
|
23834
24924
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23836,12 +24926,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23836
24926
|
}), RetrainAssistResultSchema, {
|
|
23837
24927
|
kind: "mutation",
|
|
23838
24928
|
auth: "admin"
|
|
23839
|
-
}), method(object({
|
|
24929
|
+
}), method(object({
|
|
24930
|
+
trackId: string().optional(),
|
|
24931
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24932
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23840
24933
|
kind: "query",
|
|
23841
24934
|
auth: "admin"
|
|
23842
24935
|
}), method(object({
|
|
23843
24936
|
deviceId: number(),
|
|
23844
|
-
|
|
24937
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24938
|
+
trackId: string().optional(),
|
|
23845
24939
|
frameId: string(),
|
|
23846
24940
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23847
24941
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23859,7 +24953,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23859
24953
|
}), RetrainTransitionResultSchema, {
|
|
23860
24954
|
kind: "mutation",
|
|
23861
24955
|
auth: "admin"
|
|
23862
|
-
}), method(
|
|
24956
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
24957
|
+
kind: "query",
|
|
24958
|
+
auth: "admin"
|
|
24959
|
+
}), method(object({
|
|
24960
|
+
deviceId: number(),
|
|
24961
|
+
trackId: string().optional(),
|
|
24962
|
+
frameId: string(),
|
|
24963
|
+
complete: boolean()
|
|
24964
|
+
}), RetrainFrameSchema, {
|
|
24965
|
+
kind: "mutation",
|
|
24966
|
+
auth: "admin"
|
|
24967
|
+
}), method(object({
|
|
24968
|
+
filter: RetrainExportFilterSchema,
|
|
24969
|
+
layout: RetrainExportLayoutSchema,
|
|
24970
|
+
target: RetrainArchiveTargetSchema
|
|
24971
|
+
}), RetrainArchiveResultSchema, {
|
|
24972
|
+
kind: "mutation",
|
|
24973
|
+
auth: "admin",
|
|
24974
|
+
timeoutMs: 60 * 6e4
|
|
24975
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24976
|
+
kind: "query",
|
|
24977
|
+
auth: "admin"
|
|
24978
|
+
}), method(object({
|
|
24979
|
+
deviceId: number(),
|
|
24980
|
+
trackId: string().optional(),
|
|
24981
|
+
frameId: string(),
|
|
24982
|
+
profileId: string(),
|
|
24983
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24984
|
+
boxes: array(object({
|
|
24985
|
+
ref: string(),
|
|
24986
|
+
bbox: RetrainBboxSchema,
|
|
24987
|
+
macroClass: RetrainMacroClassSchema,
|
|
24988
|
+
label: string().optional()
|
|
24989
|
+
})).max(50),
|
|
24990
|
+
allowCloud: boolean()
|
|
24991
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24992
|
+
kind: "mutation",
|
|
24993
|
+
auth: "admin",
|
|
24994
|
+
timeoutMs: 18e4
|
|
24995
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24996
|
+
kind: "mutation",
|
|
24997
|
+
auth: "admin"
|
|
24998
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24999
|
+
kind: "query",
|
|
25000
|
+
auth: "admin"
|
|
25001
|
+
}), method(object({
|
|
25002
|
+
id: string(),
|
|
25003
|
+
name: string().max(120)
|
|
25004
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25005
|
+
kind: "mutation",
|
|
25006
|
+
auth: "admin"
|
|
25007
|
+
}), method(object({ id: string() }), object({
|
|
25008
|
+
deleted: boolean(),
|
|
25009
|
+
removedFrames: number().int()
|
|
25010
|
+
}), {
|
|
25011
|
+
kind: "mutation",
|
|
25012
|
+
auth: "admin"
|
|
25013
|
+
}), method(object({
|
|
25014
|
+
collectionId: string(),
|
|
25015
|
+
deviceId: number(),
|
|
25016
|
+
epochMs: number()
|
|
25017
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25018
|
+
kind: "mutation",
|
|
25019
|
+
auth: "admin",
|
|
25020
|
+
timeoutMs: 6e4
|
|
25021
|
+
}), method(object({
|
|
25022
|
+
collectionId: string(),
|
|
25023
|
+
frameIds: array(string()).min(1).max(500)
|
|
25024
|
+
}), object({
|
|
25025
|
+
added: number().int(),
|
|
25026
|
+
alreadyMember: number().int(),
|
|
25027
|
+
unknownFrameIds: array(string()).readonly()
|
|
25028
|
+
}), {
|
|
25029
|
+
kind: "mutation",
|
|
25030
|
+
auth: "admin"
|
|
25031
|
+
}), method(object({
|
|
25032
|
+
collectionId: string(),
|
|
25033
|
+
frameId: string()
|
|
25034
|
+
}), object({
|
|
25035
|
+
removed: boolean(),
|
|
25036
|
+
deletedFrame: boolean()
|
|
25037
|
+
}), {
|
|
25038
|
+
kind: "mutation",
|
|
25039
|
+
auth: "admin"
|
|
25040
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
23863
25041
|
kind: "query",
|
|
23864
25042
|
auth: "admin"
|
|
23865
25043
|
}), method(object({
|
|
@@ -24485,13 +25663,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24485
25663
|
object({
|
|
24486
25664
|
kind: literal("no-family-build"),
|
|
24487
25665
|
format: ModelFormatSchema$1
|
|
25666
|
+
}),
|
|
25667
|
+
object({
|
|
25668
|
+
kind: literal("kept-custom-pin"),
|
|
25669
|
+
modelId: string(),
|
|
25670
|
+
deviceKey: string()
|
|
24488
25671
|
})
|
|
24489
25672
|
]);
|
|
25673
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25674
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25675
|
+
/**
|
|
25676
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25677
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25678
|
+
*/
|
|
25679
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25680
|
+
kind: literal("node-benchmark"),
|
|
25681
|
+
resultId: string(),
|
|
25682
|
+
measuredAtMs: number()
|
|
25683
|
+
})]);
|
|
24490
25684
|
var DeviceModelChoiceSchema = object({
|
|
24491
25685
|
modelId: string(),
|
|
24492
25686
|
p50Ms: number(),
|
|
24493
25687
|
fps: number(),
|
|
24494
25688
|
measured: boolean(),
|
|
25689
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25690
|
+
source: LatencySourceSchema.optional(),
|
|
24495
25691
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24496
25692
|
capacitySessions: number(),
|
|
24497
25693
|
personRecall: number()
|
|
@@ -24502,6 +25698,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24502
25698
|
enabled: boolean(),
|
|
24503
25699
|
available: boolean(),
|
|
24504
25700
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25701
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25702
|
+
kept: KeptReasonSchema.optional(),
|
|
24505
25703
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24506
25704
|
});
|
|
24507
25705
|
var NodeRecommendationSchema = object({
|
|
@@ -24555,6 +25753,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24555
25753
|
kind: literal("coral-enabled"),
|
|
24556
25754
|
nodeId: string(),
|
|
24557
25755
|
deviceKey: string()
|
|
25756
|
+
}),
|
|
25757
|
+
object({
|
|
25758
|
+
kind: literal("custom-pin-kept"),
|
|
25759
|
+
nodeId: string(),
|
|
25760
|
+
deviceKey: string().nullable(),
|
|
25761
|
+
deviceId: number().nullable(),
|
|
25762
|
+
modelId: string()
|
|
25763
|
+
}),
|
|
25764
|
+
object({
|
|
25765
|
+
kind: literal("custom-registry-unreadable"),
|
|
25766
|
+
error: string()
|
|
24558
25767
|
})
|
|
24559
25768
|
]);
|
|
24560
25769
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24733,13 +25942,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24733
25942
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24734
25943
|
});
|
|
24735
25944
|
/**
|
|
24736
|
-
* Where the node and device shares come from (D750, D755).
|
|
24737
|
-
* - `
|
|
24738
|
-
*
|
|
24739
|
-
*
|
|
24740
|
-
*
|
|
24741
|
-
*
|
|
24742
|
-
*
|
|
25945
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25946
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25947
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25948
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25949
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25950
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25951
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25952
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24743
25953
|
* - `manual` — the operator's stored sliders.
|
|
24744
25954
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24745
25955
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24788,6 +25998,362 @@ var EffectiveSharesSchema = object({
|
|
|
24788
25998
|
nodeWeights: record(string(), number()),
|
|
24789
25999
|
deviceWeights: record(string(), record(string(), number()))
|
|
24790
26000
|
});
|
|
26001
|
+
/**
|
|
26002
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26003
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26004
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26005
|
+
* shares read.
|
|
26006
|
+
*
|
|
26007
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26008
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26009
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26010
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26011
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26012
|
+
*
|
|
26013
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26014
|
+
* cross a process at frame rate, D9):
|
|
26015
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26016
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26017
|
+
* interval;
|
|
26018
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26019
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26020
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26021
|
+
* CPU, RAM or the event loop give out.
|
|
26022
|
+
*/
|
|
26023
|
+
/** Defaults and bounds, one place. */
|
|
26024
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26025
|
+
fpsPerStream: 10,
|
|
26026
|
+
budgetMinutes: 45,
|
|
26027
|
+
minBudgetMinutes: 10,
|
|
26028
|
+
maxBudgetMinutes: 120,
|
|
26029
|
+
/** A result older than this no longer beats the table. */
|
|
26030
|
+
staleAfterDays: 30,
|
|
26031
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26032
|
+
settleSec: 5,
|
|
26033
|
+
/** Accounted window per ramp step. */
|
|
26034
|
+
measureSec: 20,
|
|
26035
|
+
/** Longest the drain may take before the run is refused. */
|
|
26036
|
+
drainTimeoutSec: 120,
|
|
26037
|
+
/** Candidate models per device in one run. */
|
|
26038
|
+
maxModelsPerDevice: 6
|
|
26039
|
+
};
|
|
26040
|
+
/** The two measurements a run can make. */
|
|
26041
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26042
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26043
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26044
|
+
deviceKey: string().min(1),
|
|
26045
|
+
/**
|
|
26046
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26047
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26048
|
+
*/
|
|
26049
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26050
|
+
});
|
|
26051
|
+
/** What the operator confirmed. */
|
|
26052
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26053
|
+
nodeId: string().min(1),
|
|
26054
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26055
|
+
/** Which measurements run. At least one. */
|
|
26056
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26057
|
+
/**
|
|
26058
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26059
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26060
|
+
* detector always runs.
|
|
26061
|
+
*/
|
|
26062
|
+
steps: array(string().min(1)).default([]),
|
|
26063
|
+
/** Offered rate of one stream / session. */
|
|
26064
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26065
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26066
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26067
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26068
|
+
keepDownloadedModels: boolean().default(false),
|
|
26069
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26070
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26071
|
+
});
|
|
26072
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26073
|
+
kind: _enum([
|
|
26074
|
+
"benchmark-active",
|
|
26075
|
+
"node-offline",
|
|
26076
|
+
"unknown-device",
|
|
26077
|
+
"no-phase",
|
|
26078
|
+
"insufficient-headroom"
|
|
26079
|
+
]),
|
|
26080
|
+
detail: string(),
|
|
26081
|
+
overridable: boolean()
|
|
26082
|
+
});
|
|
26083
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26084
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26085
|
+
deviceId: number(),
|
|
26086
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26087
|
+
placedOnNode: boolean(),
|
|
26088
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26089
|
+
pinnedToNode: boolean()
|
|
26090
|
+
});
|
|
26091
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26092
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26093
|
+
deviceId: number(),
|
|
26094
|
+
reason: literal("only-frame-source")
|
|
26095
|
+
});
|
|
26096
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26097
|
+
nodeId: string(),
|
|
26098
|
+
online: boolean(),
|
|
26099
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26100
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26101
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26102
|
+
estimatedDurationMs: number(),
|
|
26103
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26104
|
+
budgetMs: number(),
|
|
26105
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26106
|
+
steps: array(string()).readonly(),
|
|
26107
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26108
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26109
|
+
headroom: object({
|
|
26110
|
+
sessionsNow: number(),
|
|
26111
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26112
|
+
}),
|
|
26113
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26114
|
+
canStart: boolean()
|
|
26115
|
+
});
|
|
26116
|
+
/** Where the measuring runner is. */
|
|
26117
|
+
var NodeBenchProgressSchema = object({
|
|
26118
|
+
phase: _enum([
|
|
26119
|
+
"preparing",
|
|
26120
|
+
"device",
|
|
26121
|
+
"pipeline",
|
|
26122
|
+
"cleanup"
|
|
26123
|
+
]),
|
|
26124
|
+
deviceKey: string().nullable(),
|
|
26125
|
+
modelId: string().nullable(),
|
|
26126
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26127
|
+
load: number().nullable(),
|
|
26128
|
+
cellsDone: number(),
|
|
26129
|
+
cellsTotal: number(),
|
|
26130
|
+
message: string()
|
|
26131
|
+
});
|
|
26132
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26133
|
+
var NodeBenchLimitSchema = _enum([
|
|
26134
|
+
"p95",
|
|
26135
|
+
"drops",
|
|
26136
|
+
"errors",
|
|
26137
|
+
"stall",
|
|
26138
|
+
"cpu",
|
|
26139
|
+
"ram",
|
|
26140
|
+
"none"
|
|
26141
|
+
]);
|
|
26142
|
+
var NodeBenchRampStepSchema = object({
|
|
26143
|
+
load: number(),
|
|
26144
|
+
pass: boolean(),
|
|
26145
|
+
p95Ms: number(),
|
|
26146
|
+
dropRatio: number(),
|
|
26147
|
+
/** Completed frames per second over the accounted window. */
|
|
26148
|
+
fps: number(),
|
|
26149
|
+
cpuPct: number().nullable(),
|
|
26150
|
+
ramFreePct: number().nullable(),
|
|
26151
|
+
failReasons: array(string()).readonly()
|
|
26152
|
+
});
|
|
26153
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26154
|
+
phase: literal("device"),
|
|
26155
|
+
deviceKey: string(),
|
|
26156
|
+
modelId: string(),
|
|
26157
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26158
|
+
p50Ms: number(),
|
|
26159
|
+
p95Ms: number(),
|
|
26160
|
+
p99Ms: number(),
|
|
26161
|
+
/** Frames per second sustained at the last passing step. */
|
|
26162
|
+
fps: number(),
|
|
26163
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26164
|
+
kMax: number(),
|
|
26165
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26166
|
+
/** First call (model load + warm-up). */
|
|
26167
|
+
warmupMs: number(),
|
|
26168
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26169
|
+
}), object({
|
|
26170
|
+
phase: literal("pipeline"),
|
|
26171
|
+
deviceKey: string(),
|
|
26172
|
+
modelId: string(),
|
|
26173
|
+
steps: array(string()).readonly(),
|
|
26174
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26175
|
+
maxSessions: number(),
|
|
26176
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26177
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26178
|
+
stepsFired: array(string()).readonly(),
|
|
26179
|
+
warmupMs: number(),
|
|
26180
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26181
|
+
})]);
|
|
26182
|
+
/**
|
|
26183
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26184
|
+
* the node no longer beats the table.
|
|
26185
|
+
*/
|
|
26186
|
+
var NodeBenchFingerprintSchema = object({
|
|
26187
|
+
pipelineVersion: string().nullable(),
|
|
26188
|
+
cpuModel: string().nullable(),
|
|
26189
|
+
ramGb: number().nullable(),
|
|
26190
|
+
os: string().nullable(),
|
|
26191
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26192
|
+
pools: record(string(), object({
|
|
26193
|
+
runtime: string(),
|
|
26194
|
+
numWorkers: number(),
|
|
26195
|
+
concurrency: number(),
|
|
26196
|
+
batchMode: string()
|
|
26197
|
+
})).default({})
|
|
26198
|
+
});
|
|
26199
|
+
/** The frames the run used. */
|
|
26200
|
+
var NodeBenchClipSchema = object({
|
|
26201
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26202
|
+
id: string(),
|
|
26203
|
+
revision: string().nullable(),
|
|
26204
|
+
frames: number(),
|
|
26205
|
+
width: number(),
|
|
26206
|
+
height: number()
|
|
26207
|
+
});
|
|
26208
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26209
|
+
runId: string().min(1),
|
|
26210
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26211
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26212
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26213
|
+
steps: array(string()).default([]),
|
|
26214
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26215
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26216
|
+
deadlineAtMs: number(),
|
|
26217
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26218
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26219
|
+
keepDownloadedModels: boolean().default(false)
|
|
26220
|
+
});
|
|
26221
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26222
|
+
"running",
|
|
26223
|
+
"done",
|
|
26224
|
+
"failed",
|
|
26225
|
+
"aborted"
|
|
26226
|
+
]);
|
|
26227
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26228
|
+
runId: string(),
|
|
26229
|
+
nodeId: string(),
|
|
26230
|
+
state: NodeBenchRunnerStateSchema,
|
|
26231
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26232
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26233
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26234
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26235
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26236
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26237
|
+
activeCameraIds: array(number()).readonly(),
|
|
26238
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26239
|
+
deletedModels: array(string()).readonly(),
|
|
26240
|
+
error: string().nullable(),
|
|
26241
|
+
startedAtMs: number(),
|
|
26242
|
+
finishedAtMs: number().nullable()
|
|
26243
|
+
});
|
|
26244
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26245
|
+
"draining",
|
|
26246
|
+
"measuring",
|
|
26247
|
+
"restoring",
|
|
26248
|
+
"done",
|
|
26249
|
+
"failed",
|
|
26250
|
+
"aborted"
|
|
26251
|
+
]);
|
|
26252
|
+
/** Why a run ended. */
|
|
26253
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26254
|
+
"completed",
|
|
26255
|
+
"operator-abort",
|
|
26256
|
+
"deadline",
|
|
26257
|
+
"node-lost",
|
|
26258
|
+
"runner-lost",
|
|
26259
|
+
"hub-restart",
|
|
26260
|
+
"drain-timeout",
|
|
26261
|
+
"failed"
|
|
26262
|
+
]);
|
|
26263
|
+
var NodeBenchmarkRunSchema = object({
|
|
26264
|
+
runId: string(),
|
|
26265
|
+
nodeId: string(),
|
|
26266
|
+
state: NodeBenchmarkStateSchema,
|
|
26267
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26268
|
+
startedAtMs: number(),
|
|
26269
|
+
deadlineAtMs: number(),
|
|
26270
|
+
finishedAtMs: number().nullable(),
|
|
26271
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26272
|
+
error: string().nullable(),
|
|
26273
|
+
/** Cameras moved off the node for the run. */
|
|
26274
|
+
moved: array(number()).readonly(),
|
|
26275
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26276
|
+
staying: array(number()).readonly(),
|
|
26277
|
+
/** Something else ran on the node's pools during the run. */
|
|
26278
|
+
contaminated: boolean(),
|
|
26279
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26280
|
+
resultIds: array(string()).readonly()
|
|
26281
|
+
});
|
|
26282
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26283
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26284
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26285
|
+
modeNodeId: string().nullable(),
|
|
26286
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26287
|
+
});
|
|
26288
|
+
/**
|
|
26289
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26290
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26291
|
+
* ends, never by anyone else.
|
|
26292
|
+
*/
|
|
26293
|
+
var NodeBenchmarkResultSchema = object({
|
|
26294
|
+
id: string(),
|
|
26295
|
+
runId: string(),
|
|
26296
|
+
nodeId: string(),
|
|
26297
|
+
cell: NodeBenchCellSchema,
|
|
26298
|
+
fpsPerStream: number(),
|
|
26299
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26300
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26301
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26302
|
+
contaminated: boolean(),
|
|
26303
|
+
stayingCameras: array(number()).readonly(),
|
|
26304
|
+
/** The run ended early; the cell itself completed. */
|
|
26305
|
+
partialRun: boolean(),
|
|
26306
|
+
measuredAtMs: number()
|
|
26307
|
+
});
|
|
26308
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26309
|
+
nodeId: string().optional(),
|
|
26310
|
+
deviceKey: string().optional()
|
|
26311
|
+
});
|
|
26312
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26313
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26314
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26315
|
+
standing: _enum([
|
|
26316
|
+
"fresh",
|
|
26317
|
+
"stale",
|
|
26318
|
+
"superseded"
|
|
26319
|
+
]),
|
|
26320
|
+
staleWhy: _enum([
|
|
26321
|
+
"age",
|
|
26322
|
+
"runtime",
|
|
26323
|
+
"pool-tuning"
|
|
26324
|
+
]).nullable()
|
|
26325
|
+
});
|
|
26326
|
+
object({
|
|
26327
|
+
runId: string(),
|
|
26328
|
+
nodeId: string(),
|
|
26329
|
+
startedAtMs: number(),
|
|
26330
|
+
deadlineAtMs: number(),
|
|
26331
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26332
|
+
moved: array(number()).readonly(),
|
|
26333
|
+
staying: array(number()).readonly()
|
|
26334
|
+
});
|
|
26335
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26336
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26337
|
+
nodeId: string(),
|
|
26338
|
+
reachable: boolean(),
|
|
26339
|
+
devices: array(object({
|
|
26340
|
+
deviceKey: string(),
|
|
26341
|
+
enabled: boolean(),
|
|
26342
|
+
available: boolean(),
|
|
26343
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26344
|
+
suggested: array(string()).readonly(),
|
|
26345
|
+
/** Every root detector the device has a build for. */
|
|
26346
|
+
all: array(string()).readonly(),
|
|
26347
|
+
/** The model the device runs now, when pinned. */
|
|
26348
|
+
currentModelId: string().nullable()
|
|
26349
|
+
})).readonly(),
|
|
26350
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26351
|
+
steps: array(object({
|
|
26352
|
+
id: string(),
|
|
26353
|
+
name: string(),
|
|
26354
|
+
slot: string()
|
|
26355
|
+
})).readonly()
|
|
26356
|
+
});
|
|
24791
26357
|
object({
|
|
24792
26358
|
activeCameras: number(),
|
|
24793
26359
|
throttledCameras: number(),
|
|
@@ -25876,7 +27442,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25876
27442
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25877
27443
|
deviceId: number(),
|
|
25878
27444
|
trackId: string()
|
|
25879
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27445
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27446
|
+
accepted: literal(true),
|
|
27447
|
+
runId: string()
|
|
27448
|
+
}), {
|
|
27449
|
+
kind: "mutation",
|
|
27450
|
+
auth: "admin"
|
|
27451
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27452
|
+
kind: "mutation",
|
|
27453
|
+
auth: "admin"
|
|
27454
|
+
});
|
|
25880
27455
|
var CameraPipelineConfigSchema = object({
|
|
25881
27456
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25882
27457
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26515,6 +28090,21 @@ method(object({
|
|
|
26515
28090
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26516
28091
|
kind: "mutation",
|
|
26517
28092
|
auth: "admin"
|
|
28093
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28094
|
+
kind: literal("started"),
|
|
28095
|
+
runId: string()
|
|
28096
|
+
}), object({
|
|
28097
|
+
kind: literal("refused"),
|
|
28098
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28099
|
+
})]), {
|
|
28100
|
+
kind: "mutation",
|
|
28101
|
+
auth: "admin"
|
|
28102
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28103
|
+
kind: "mutation",
|
|
28104
|
+
auth: "admin"
|
|
28105
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28106
|
+
kind: "mutation",
|
|
28107
|
+
auth: "admin"
|
|
26518
28108
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26519
28109
|
deviceId: number(),
|
|
26520
28110
|
addonId: string(),
|
|
@@ -27151,7 +28741,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27151
28741
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
27152
28742
|
* operator already consented to.
|
|
27153
28743
|
*/
|
|
27154
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
28744
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
28745
|
+
/**
|
|
28746
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
28747
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
28748
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
28749
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
28750
|
+
*/
|
|
28751
|
+
linkIntent: string().optional(),
|
|
28752
|
+
/**
|
|
28753
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28754
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
28755
|
+
*/
|
|
28756
|
+
issuer: string().optional()
|
|
27155
28757
|
});
|
|
27156
28758
|
method(object({
|
|
27157
28759
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -29250,7 +30852,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
29250
30852
|
* field their hints were silently stripped by the schema and the
|
|
29251
30853
|
* adaptive ladder started blind on the client's display size.
|
|
29252
30854
|
*/
|
|
29253
|
-
hints: webrtcClientHintsSchema.optional()
|
|
30855
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
30856
|
+
/**
|
|
30857
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
30858
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
30859
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
30860
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
30861
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
30862
|
+
*
|
|
30863
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
30864
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
30865
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
30866
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
30867
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
30868
|
+
* flag must not become a second door to the camera's speaker.
|
|
30869
|
+
*/
|
|
30870
|
+
talkback: boolean().optional()
|
|
29254
30871
|
}), object({
|
|
29255
30872
|
sessionId: string(),
|
|
29256
30873
|
sdpAnswer: string()
|
|
@@ -31798,6 +33415,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
31798
33415
|
enabled: boolean().optional(),
|
|
31799
33416
|
info: record(string(), unknown()).optional(),
|
|
31800
33417
|
settings: record(string(), unknown()).optional(),
|
|
33418
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33419
|
+
* the keychain, not the table (D787). */
|
|
33420
|
+
secretKeys: array(string()).optional(),
|
|
31801
33421
|
skipRestart: boolean().optional()
|
|
31802
33422
|
});
|
|
31803
33423
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -31821,7 +33441,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
31821
33441
|
auth: "admin"
|
|
31822
33442
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
31823
33443
|
id: string(),
|
|
31824
|
-
settings: record(string(), unknown())
|
|
33444
|
+
settings: record(string(), unknown()),
|
|
33445
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33446
|
+
secretKeys: array(string()).optional()
|
|
31825
33447
|
}), object({ success: boolean() }), {
|
|
31826
33448
|
kind: "mutation",
|
|
31827
33449
|
auth: "admin"
|
|
@@ -37355,6 +38977,32 @@ var TotpStatusSchema = object({
|
|
|
37355
38977
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
37356
38978
|
confirmedAt: number().nullable()
|
|
37357
38979
|
});
|
|
38980
|
+
/**
|
|
38981
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
38982
|
+
* and scoped tokens.
|
|
38983
|
+
*
|
|
38984
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
38985
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
38986
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
38987
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
38988
|
+
* provider.
|
|
38989
|
+
*/
|
|
38990
|
+
var ExternalIdentitySchema = object({
|
|
38991
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
38992
|
+
provider: string(),
|
|
38993
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
38994
|
+
subject: string(),
|
|
38995
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
38996
|
+
issuer: string(),
|
|
38997
|
+
userId: string(),
|
|
38998
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
38999
|
+
label: string().optional(),
|
|
39000
|
+
linkedAt: number()
|
|
39001
|
+
});
|
|
39002
|
+
var ExternalIdentityKeySchema = object({
|
|
39003
|
+
provider: string().min(1),
|
|
39004
|
+
subject: string().min(1)
|
|
39005
|
+
});
|
|
37358
39006
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
37359
39007
|
kind: "mutation",
|
|
37360
39008
|
auth: "admin",
|
|
@@ -37468,7 +39116,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
37468
39116
|
userId: string(),
|
|
37469
39117
|
username: string(),
|
|
37470
39118
|
scopes: array(TokenScopeSchema)
|
|
37471
|
-
}).nullable(), { access: "view" }), method(
|
|
39119
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39120
|
+
userId: string(),
|
|
39121
|
+
issuer: string()
|
|
39122
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39123
|
+
userId: string(),
|
|
39124
|
+
issuer: string().min(1),
|
|
39125
|
+
label: string().optional()
|
|
39126
|
+
}), object({ success: literal(true) }), {
|
|
39127
|
+
kind: "mutation",
|
|
39128
|
+
auth: "admin",
|
|
39129
|
+
access: "create"
|
|
39130
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39131
|
+
kind: "mutation",
|
|
39132
|
+
auth: "admin",
|
|
39133
|
+
access: "delete"
|
|
39134
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
37472
39135
|
kind: "mutation",
|
|
37473
39136
|
auth: "admin",
|
|
37474
39137
|
access: "delete"
|
|
@@ -40510,6 +42173,90 @@ Object.freeze({
|
|
|
40510
42173
|
addonId: null,
|
|
40511
42174
|
access: "create"
|
|
40512
42175
|
},
|
|
42176
|
+
"keychain.delete": {
|
|
42177
|
+
capName: "keychain",
|
|
42178
|
+
capScope: "system",
|
|
42179
|
+
addonId: null,
|
|
42180
|
+
access: "delete"
|
|
42181
|
+
},
|
|
42182
|
+
"keychain.getState": {
|
|
42183
|
+
capName: "keychain",
|
|
42184
|
+
capScope: "system",
|
|
42185
|
+
addonId: null,
|
|
42186
|
+
access: "view"
|
|
42187
|
+
},
|
|
42188
|
+
"keychain.listMeta": {
|
|
42189
|
+
capName: "keychain",
|
|
42190
|
+
capScope: "system",
|
|
42191
|
+
addonId: null,
|
|
42192
|
+
access: "view"
|
|
42193
|
+
},
|
|
42194
|
+
"keychain.put": {
|
|
42195
|
+
capName: "keychain",
|
|
42196
|
+
capScope: "system",
|
|
42197
|
+
addonId: null,
|
|
42198
|
+
access: "create"
|
|
42199
|
+
},
|
|
42200
|
+
"keychain.resolve": {
|
|
42201
|
+
capName: "keychain",
|
|
42202
|
+
capScope: "system",
|
|
42203
|
+
addonId: null,
|
|
42204
|
+
access: "view"
|
|
42205
|
+
},
|
|
42206
|
+
"keychainAdmin.deleteOrphans": {
|
|
42207
|
+
capName: "keychain-admin",
|
|
42208
|
+
capScope: "system",
|
|
42209
|
+
addonId: null,
|
|
42210
|
+
access: "delete"
|
|
42211
|
+
},
|
|
42212
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
42213
|
+
capName: "keychain-admin",
|
|
42214
|
+
capScope: "system",
|
|
42215
|
+
addonId: null,
|
|
42216
|
+
access: "create"
|
|
42217
|
+
},
|
|
42218
|
+
"keychainAdmin.listAudit": {
|
|
42219
|
+
capName: "keychain-admin",
|
|
42220
|
+
capScope: "system",
|
|
42221
|
+
addonId: null,
|
|
42222
|
+
access: "view"
|
|
42223
|
+
},
|
|
42224
|
+
"keychainAdmin.listSecrets": {
|
|
42225
|
+
capName: "keychain-admin",
|
|
42226
|
+
capScope: "system",
|
|
42227
|
+
addonId: null,
|
|
42228
|
+
access: "view"
|
|
42229
|
+
},
|
|
42230
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
42231
|
+
capName: "keychain-admin",
|
|
42232
|
+
capScope: "system",
|
|
42233
|
+
addonId: null,
|
|
42234
|
+
access: "delete"
|
|
42235
|
+
},
|
|
42236
|
+
"keychainAdmin.resetKeychain": {
|
|
42237
|
+
capName: "keychain-admin",
|
|
42238
|
+
capScope: "system",
|
|
42239
|
+
addonId: null,
|
|
42240
|
+
access: "delete"
|
|
42241
|
+
},
|
|
42242
|
+
"keychainAdmin.reveal": {
|
|
42243
|
+
capName: "keychain-admin",
|
|
42244
|
+
capScope: "system",
|
|
42245
|
+
addonId: null,
|
|
42246
|
+
access: "create"
|
|
42247
|
+
},
|
|
42248
|
+
"keychainAdmin.rotateMasterKey": {
|
|
42249
|
+
capName: "keychain-admin",
|
|
42250
|
+
capScope: "system",
|
|
42251
|
+
addonId: null,
|
|
42252
|
+
access: "create"
|
|
42253
|
+
},
|
|
42254
|
+
"keychainAdmin.status": {
|
|
42255
|
+
capName: "keychain-admin",
|
|
42256
|
+
capScope: "system",
|
|
42257
|
+
addonId: null,
|
|
42258
|
+
access: "view"
|
|
42259
|
+
},
|
|
40513
42260
|
"lawnMowerControl.dock": {
|
|
40514
42261
|
capName: "lawn-mower-control",
|
|
40515
42262
|
capScope: "device",
|
|
@@ -41884,6 +43631,18 @@ Object.freeze({
|
|
|
41884
43631
|
addonId: null,
|
|
41885
43632
|
access: "create"
|
|
41886
43633
|
},
|
|
43634
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
43635
|
+
capName: "pipeline-analytics",
|
|
43636
|
+
capScope: "device",
|
|
43637
|
+
addonId: null,
|
|
43638
|
+
access: "create"
|
|
43639
|
+
},
|
|
43640
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
43641
|
+
capName: "pipeline-analytics",
|
|
43642
|
+
capScope: "device",
|
|
43643
|
+
addonId: null,
|
|
43644
|
+
access: "create"
|
|
43645
|
+
},
|
|
41887
43646
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
41888
43647
|
capName: "pipeline-analytics",
|
|
41889
43648
|
capScope: "device",
|
|
@@ -41932,12 +43691,24 @@ Object.freeze({
|
|
|
41932
43691
|
addonId: null,
|
|
41933
43692
|
access: "view"
|
|
41934
43693
|
},
|
|
43694
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
43695
|
+
capName: "pipeline-analytics",
|
|
43696
|
+
capScope: "device",
|
|
43697
|
+
addonId: null,
|
|
43698
|
+
access: "create"
|
|
43699
|
+
},
|
|
41935
43700
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
41936
43701
|
capName: "pipeline-analytics",
|
|
41937
43702
|
capScope: "device",
|
|
41938
43703
|
addonId: null,
|
|
41939
43704
|
access: "delete"
|
|
41940
43705
|
},
|
|
43706
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
43707
|
+
capName: "pipeline-analytics",
|
|
43708
|
+
capScope: "device",
|
|
43709
|
+
addonId: null,
|
|
43710
|
+
access: "delete"
|
|
43711
|
+
},
|
|
41941
43712
|
"pipelineAnalytics.deleteTracks": {
|
|
41942
43713
|
capName: "pipeline-analytics",
|
|
41943
43714
|
capScope: "device",
|
|
@@ -42142,6 +43913,24 @@ Object.freeze({
|
|
|
42142
43913
|
addonId: null,
|
|
42143
43914
|
access: "view"
|
|
42144
43915
|
},
|
|
43916
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
43917
|
+
capName: "pipeline-analytics",
|
|
43918
|
+
capScope: "device",
|
|
43919
|
+
addonId: null,
|
|
43920
|
+
access: "view"
|
|
43921
|
+
},
|
|
43922
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
43923
|
+
capName: "pipeline-analytics",
|
|
43924
|
+
capScope: "device",
|
|
43925
|
+
addonId: null,
|
|
43926
|
+
access: "view"
|
|
43927
|
+
},
|
|
43928
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
43929
|
+
capName: "pipeline-analytics",
|
|
43930
|
+
capScope: "device",
|
|
43931
|
+
addonId: null,
|
|
43932
|
+
access: "view"
|
|
43933
|
+
},
|
|
42145
43934
|
"pipelineAnalytics.listRetrainFrames": {
|
|
42146
43935
|
capName: "pipeline-analytics",
|
|
42147
43936
|
capScope: "device",
|
|
@@ -42190,6 +43979,12 @@ Object.freeze({
|
|
|
42190
43979
|
addonId: null,
|
|
42191
43980
|
access: "create"
|
|
42192
43981
|
},
|
|
43982
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
43983
|
+
capName: "pipeline-analytics",
|
|
43984
|
+
capScope: "device",
|
|
43985
|
+
addonId: null,
|
|
43986
|
+
access: "create"
|
|
43987
|
+
},
|
|
42193
43988
|
"pipelineAnalytics.pruneEvents": {
|
|
42194
43989
|
capName: "pipeline-analytics",
|
|
42195
43990
|
capScope: "device",
|
|
@@ -42244,6 +44039,18 @@ Object.freeze({
|
|
|
42244
44039
|
addonId: null,
|
|
42245
44040
|
access: "create"
|
|
42246
44041
|
},
|
|
44042
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
44043
|
+
capName: "pipeline-analytics",
|
|
44044
|
+
capScope: "device",
|
|
44045
|
+
addonId: null,
|
|
44046
|
+
access: "delete"
|
|
44047
|
+
},
|
|
44048
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
44049
|
+
capName: "pipeline-analytics",
|
|
44050
|
+
capScope: "device",
|
|
44051
|
+
addonId: null,
|
|
44052
|
+
access: "create"
|
|
44053
|
+
},
|
|
42247
44054
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
42248
44055
|
capName: "pipeline-analytics",
|
|
42249
44056
|
capScope: "device",
|
|
@@ -42274,6 +44081,12 @@ Object.freeze({
|
|
|
42274
44081
|
addonId: null,
|
|
42275
44082
|
access: "create"
|
|
42276
44083
|
},
|
|
44084
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
44085
|
+
capName: "pipeline-analytics",
|
|
44086
|
+
capScope: "device",
|
|
44087
|
+
addonId: null,
|
|
44088
|
+
access: "create"
|
|
44089
|
+
},
|
|
42277
44090
|
"pipelineAnalytics.setTrackFlags": {
|
|
42278
44091
|
capName: "pipeline-analytics",
|
|
42279
44092
|
capScope: "device",
|
|
@@ -42310,6 +44123,12 @@ Object.freeze({
|
|
|
42310
44123
|
addonId: null,
|
|
42311
44124
|
access: "delete"
|
|
42312
44125
|
},
|
|
44126
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
44127
|
+
capName: "pipeline-analytics",
|
|
44128
|
+
capScope: "device",
|
|
44129
|
+
addonId: null,
|
|
44130
|
+
access: "create"
|
|
44131
|
+
},
|
|
42313
44132
|
"pipelineExecutor.cacheFrameInPool": {
|
|
42314
44133
|
capName: "pipeline-executor",
|
|
42315
44134
|
capScope: "system",
|
|
@@ -42520,6 +44339,12 @@ Object.freeze({
|
|
|
42520
44339
|
addonId: null,
|
|
42521
44340
|
access: "view"
|
|
42522
44341
|
},
|
|
44342
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
44343
|
+
capName: "pipeline-orchestrator",
|
|
44344
|
+
capScope: "system",
|
|
44345
|
+
addonId: null,
|
|
44346
|
+
access: "create"
|
|
44347
|
+
},
|
|
42523
44348
|
"pipelineOrchestrator.applyAutoTune": {
|
|
42524
44349
|
capName: "pipeline-orchestrator",
|
|
42525
44350
|
capScope: "system",
|
|
@@ -42544,6 +44369,12 @@ Object.freeze({
|
|
|
42544
44369
|
addonId: null,
|
|
42545
44370
|
access: "create"
|
|
42546
44371
|
},
|
|
44372
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
44373
|
+
capName: "pipeline-orchestrator",
|
|
44374
|
+
capScope: "system",
|
|
44375
|
+
addonId: null,
|
|
44376
|
+
access: "delete"
|
|
44377
|
+
},
|
|
42547
44378
|
"pipelineOrchestrator.getAgentLoad": {
|
|
42548
44379
|
capName: "pipeline-orchestrator",
|
|
42549
44380
|
capScope: "system",
|
|
@@ -42652,6 +44483,24 @@ Object.freeze({
|
|
|
42652
44483
|
addonId: null,
|
|
42653
44484
|
access: "view"
|
|
42654
44485
|
},
|
|
44486
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
44487
|
+
capName: "pipeline-orchestrator",
|
|
44488
|
+
capScope: "system",
|
|
44489
|
+
addonId: null,
|
|
44490
|
+
access: "view"
|
|
44491
|
+
},
|
|
44492
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
44493
|
+
capName: "pipeline-orchestrator",
|
|
44494
|
+
capScope: "system",
|
|
44495
|
+
addonId: null,
|
|
44496
|
+
access: "view"
|
|
44497
|
+
},
|
|
44498
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
44499
|
+
capName: "pipeline-orchestrator",
|
|
44500
|
+
capScope: "system",
|
|
44501
|
+
addonId: null,
|
|
44502
|
+
access: "view"
|
|
44503
|
+
},
|
|
42655
44504
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
42656
44505
|
capName: "pipeline-orchestrator",
|
|
42657
44506
|
capScope: "system",
|
|
@@ -42694,6 +44543,12 @@ Object.freeze({
|
|
|
42694
44543
|
addonId: null,
|
|
42695
44544
|
access: "view"
|
|
42696
44545
|
},
|
|
44546
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
44547
|
+
capName: "pipeline-orchestrator",
|
|
44548
|
+
capScope: "system",
|
|
44549
|
+
addonId: null,
|
|
44550
|
+
access: "view"
|
|
44551
|
+
},
|
|
42697
44552
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
42698
44553
|
capName: "pipeline-orchestrator",
|
|
42699
44554
|
capScope: "system",
|
|
@@ -42838,6 +44693,12 @@ Object.freeze({
|
|
|
42838
44693
|
addonId: null,
|
|
42839
44694
|
access: "create"
|
|
42840
44695
|
},
|
|
44696
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
44697
|
+
capName: "pipeline-orchestrator",
|
|
44698
|
+
capScope: "system",
|
|
44699
|
+
addonId: null,
|
|
44700
|
+
access: "create"
|
|
44701
|
+
},
|
|
42841
44702
|
"pipelineOrchestrator.suggestShares": {
|
|
42842
44703
|
capName: "pipeline-orchestrator",
|
|
42843
44704
|
capScope: "system",
|
|
@@ -42856,6 +44717,12 @@ Object.freeze({
|
|
|
42856
44717
|
addonId: null,
|
|
42857
44718
|
access: "create"
|
|
42858
44719
|
},
|
|
44720
|
+
"pipelineRunner.abortNodeBench": {
|
|
44721
|
+
capName: "pipeline-runner",
|
|
44722
|
+
capScope: "system",
|
|
44723
|
+
addonId: null,
|
|
44724
|
+
access: "create"
|
|
44725
|
+
},
|
|
42859
44726
|
"pipelineRunner.attachCamera": {
|
|
42860
44727
|
capName: "pipeline-runner",
|
|
42861
44728
|
capScope: "system",
|
|
@@ -42904,6 +44771,12 @@ Object.freeze({
|
|
|
42904
44771
|
addonId: null,
|
|
42905
44772
|
access: "view"
|
|
42906
44773
|
},
|
|
44774
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
44775
|
+
capName: "pipeline-runner",
|
|
44776
|
+
capScope: "system",
|
|
44777
|
+
addonId: null,
|
|
44778
|
+
access: "view"
|
|
44779
|
+
},
|
|
42907
44780
|
"pipelineRunner.getParkedTrackFrame": {
|
|
42908
44781
|
capName: "pipeline-runner",
|
|
42909
44782
|
capScope: "system",
|
|
@@ -42946,6 +44819,12 @@ Object.freeze({
|
|
|
42946
44819
|
addonId: null,
|
|
42947
44820
|
access: "create"
|
|
42948
44821
|
},
|
|
44822
|
+
"pipelineRunner.startNodeBench": {
|
|
44823
|
+
capName: "pipeline-runner",
|
|
44824
|
+
capScope: "system",
|
|
44825
|
+
addonId: null,
|
|
44826
|
+
access: "create"
|
|
44827
|
+
},
|
|
42949
44828
|
"plateGallery.assignPlate": {
|
|
42950
44829
|
capName: "plate-gallery",
|
|
42951
44830
|
capScope: "system",
|
|
@@ -44662,18 +46541,36 @@ Object.freeze({
|
|
|
44662
46541
|
addonId: null,
|
|
44663
46542
|
access: "delete"
|
|
44664
46543
|
},
|
|
46544
|
+
"userManagement.findUserByExternalIdentity": {
|
|
46545
|
+
capName: "user-management",
|
|
46546
|
+
capScope: "system",
|
|
46547
|
+
addonId: null,
|
|
46548
|
+
access: "view"
|
|
46549
|
+
},
|
|
44665
46550
|
"userManagement.getTotpStatus": {
|
|
44666
46551
|
capName: "user-management",
|
|
44667
46552
|
capScope: "system",
|
|
44668
46553
|
addonId: null,
|
|
44669
46554
|
access: "view"
|
|
44670
46555
|
},
|
|
46556
|
+
"userManagement.linkExternalIdentity": {
|
|
46557
|
+
capName: "user-management",
|
|
46558
|
+
capScope: "system",
|
|
46559
|
+
addonId: null,
|
|
46560
|
+
access: "create"
|
|
46561
|
+
},
|
|
44671
46562
|
"userManagement.listApiKeys": {
|
|
44672
46563
|
capName: "user-management",
|
|
44673
46564
|
capScope: "system",
|
|
44674
46565
|
addonId: null,
|
|
44675
46566
|
access: "view"
|
|
44676
46567
|
},
|
|
46568
|
+
"userManagement.listExternalIdentities": {
|
|
46569
|
+
capName: "user-management",
|
|
46570
|
+
capScope: "system",
|
|
46571
|
+
addonId: null,
|
|
46572
|
+
access: "view"
|
|
46573
|
+
},
|
|
44677
46574
|
"userManagement.listOauthSessions": {
|
|
44678
46575
|
capName: "user-management",
|
|
44679
46576
|
capScope: "system",
|
|
@@ -44752,6 +46649,12 @@ Object.freeze({
|
|
|
44752
46649
|
addonId: null,
|
|
44753
46650
|
access: "create"
|
|
44754
46651
|
},
|
|
46652
|
+
"userManagement.unlinkExternalIdentity": {
|
|
46653
|
+
capName: "user-management",
|
|
46654
|
+
capScope: "system",
|
|
46655
|
+
addonId: null,
|
|
46656
|
+
access: "delete"
|
|
46657
|
+
},
|
|
44755
46658
|
"userManagement.updateUser": {
|
|
44756
46659
|
capName: "user-management",
|
|
44757
46660
|
capScope: "system",
|
|
@@ -47851,6 +49754,11 @@ Object.freeze({
|
|
|
47851
49754
|
form: "single",
|
|
47852
49755
|
optional: false
|
|
47853
49756
|
}],
|
|
49757
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
49758
|
+
name: "deviceId",
|
|
49759
|
+
form: "single",
|
|
49760
|
+
optional: false
|
|
49761
|
+
}],
|
|
47854
49762
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
47855
49763
|
name: "deviceId",
|
|
47856
49764
|
form: "single",
|
|
@@ -48041,6 +49949,11 @@ Object.freeze({
|
|
|
48041
49949
|
form: "single",
|
|
48042
49950
|
optional: false
|
|
48043
49951
|
}],
|
|
49952
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
49953
|
+
name: "deviceId",
|
|
49954
|
+
form: "single",
|
|
49955
|
+
optional: false
|
|
49956
|
+
}],
|
|
48044
49957
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
48045
49958
|
name: "deviceId",
|
|
48046
49959
|
form: "single",
|
|
@@ -48091,6 +50004,11 @@ Object.freeze({
|
|
|
48091
50004
|
form: "single",
|
|
48092
50005
|
optional: false
|
|
48093
50006
|
}],
|
|
50007
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
50008
|
+
name: "deviceId",
|
|
50009
|
+
form: "single",
|
|
50010
|
+
optional: false
|
|
50011
|
+
}],
|
|
48094
50012
|
"pipelineAnalytics.setTrackFlags": [{
|
|
48095
50013
|
name: "deviceId",
|
|
48096
50014
|
form: "single",
|
|
@@ -113715,8 +115633,10 @@ function ptzPresetLabel(presetName) {
|
|
|
113715
115633
|
* `proxy.ptz.getPresets({})`. Toggling ON calls
|
|
113716
115634
|
* `proxy.ptz.goToPreset({presetId})` and auto-resets to OFF after 1s.
|
|
113717
115635
|
* - Four directional momentary switches ("Pan Left", "Pan Right",
|
|
113718
|
-
* "Tilt Up", "Tilt Down") that issue
|
|
113719
|
-
*
|
|
115636
|
+
* "Tilt Up", "Tilt Down") that issue ONE `ptz.move` — the PTZ cap's
|
|
115637
|
+
* self-terminating burst, whose duration the DRIVER owns and reports as
|
|
115638
|
+
* `getOptions().moveImpulseMs` (ptz.cap.ts). The exporter carries no
|
|
115639
|
+
* duration of its own. Auto-reset to OFF once the pulse is over.
|
|
113720
115640
|
* - One stateful switch "Autotrack" when the proxy has the
|
|
113721
115641
|
* `ptz-autotrack` cap bound. Toggling sets
|
|
113722
115642
|
* `proxy.ptzAutotrack.setEnabled({enabled})`. Initial value is
|
|
@@ -113732,7 +115652,7 @@ function ptzPresetLabel(presetName) {
|
|
|
113732
115652
|
*/
|
|
113733
115653
|
var MOMENTARY_RESET_MS = 1e3;
|
|
113734
115654
|
async function buildPtz(bctx) {
|
|
113735
|
-
const { ctx, accessory, proxy, numericDeviceId
|
|
115655
|
+
const { ctx, accessory, proxy, numericDeviceId } = bctx;
|
|
113736
115656
|
const log = ctx.logger.withTags({ deviceId: numericDeviceId });
|
|
113737
115657
|
const timers = /* @__PURE__ */ new Set();
|
|
113738
115658
|
const armReset = (cb, delay) => {
|
|
@@ -113761,30 +115681,29 @@ async function buildPtz(bctx) {
|
|
|
113761
115681
|
armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
|
|
113762
115682
|
});
|
|
113763
115683
|
}
|
|
113764
|
-
if (proxy.ptz)
|
|
113765
|
-
const
|
|
113766
|
-
const
|
|
113767
|
-
|
|
113768
|
-
|
|
113769
|
-
|
|
113770
|
-
|
|
113771
|
-
|
|
113772
|
-
|
|
113773
|
-
|
|
113774
|
-
|
|
113775
|
-
|
|
113776
|
-
|
|
113777
|
-
|
|
113778
|
-
|
|
113779
|
-
|
|
113780
|
-
|
|
113781
|
-
|
|
113782
|
-
|
|
113783
|
-
|
|
113784
|
-
|
|
113785
|
-
|
|
113786
|
-
|
|
113787
|
-
});
|
|
115684
|
+
if (proxy.ptz) {
|
|
115685
|
+
const impulse = createImpulseReader(bctx);
|
|
115686
|
+
for (const dir of PTZ_DIRECTIONS) {
|
|
115687
|
+
const label = ptzServiceName(dir.label);
|
|
115688
|
+
const service = accessory.addService(import_dist.Service.Switch, label, dir.subtype);
|
|
115689
|
+
applyServiceLabel(service, label);
|
|
115690
|
+
const reset = (delayMs) => armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), delayMs);
|
|
115691
|
+
service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
|
|
115692
|
+
if (value !== true) return;
|
|
115693
|
+
const startedAt = Date.now();
|
|
115694
|
+
try {
|
|
115695
|
+
await proxy.ptz?.move({ ...dir.cmd });
|
|
115696
|
+
} catch (err) {
|
|
115697
|
+
log.warn("export-hap: ptz.move failed", { meta: {
|
|
115698
|
+
dir: dir.label,
|
|
115699
|
+
error: errMsg$4(err)
|
|
115700
|
+
} });
|
|
115701
|
+
reset(0);
|
|
115702
|
+
return;
|
|
115703
|
+
}
|
|
115704
|
+
reset(remainingPulseMs(await impulse.read(), Date.now() - startedAt));
|
|
115705
|
+
});
|
|
115706
|
+
}
|
|
113788
115707
|
}
|
|
113789
115708
|
const autotrackHandle = await tryBuildAutotrack(bctx);
|
|
113790
115709
|
return { async dispose() {
|
|
@@ -113842,6 +115761,38 @@ async function tryBuildAutotrack(bctx) {
|
|
|
113842
115761
|
});
|
|
113843
115762
|
return { async dispose() {} };
|
|
113844
115763
|
}
|
|
115764
|
+
/**
|
|
115765
|
+
* How long the switch should still read ON after `move` resolved.
|
|
115766
|
+
*
|
|
115767
|
+
* Drivers differ in WHEN `move` returns: hikvision awaits its own pulse before
|
|
115768
|
+
* resolving, while reolink (`autoStopMs`), amcrest (background stop) and onvif
|
|
115769
|
+
* (`timeout`) return as soon as the burst has started. Subtracting the time the
|
|
115770
|
+
* call took covers both: the switch stays ON for the pulse, never longer. An
|
|
115771
|
+
* unknown impulse (`null`) resets at once — the head still stops on its own.
|
|
115772
|
+
*/
|
|
115773
|
+
function remainingPulseMs(moveImpulseMs, elapsedMs) {
|
|
115774
|
+
if (moveImpulseMs === null) return 0;
|
|
115775
|
+
return Math.max(0, moveImpulseMs - elapsedMs);
|
|
115776
|
+
}
|
|
115777
|
+
/**
|
|
115778
|
+
* Reads `ptz.getOptions().moveImpulseMs` once and keeps it. A failed or
|
|
115779
|
+
* unreported read is NOT cached, so a camera that was offline at the first
|
|
115780
|
+
* press answers on a later one.
|
|
115781
|
+
*/
|
|
115782
|
+
function createImpulseReader(bctx) {
|
|
115783
|
+
const { ctx, proxy, numericDeviceId } = bctx;
|
|
115784
|
+
let known = null;
|
|
115785
|
+
return { async read() {
|
|
115786
|
+
if (known !== null) return known;
|
|
115787
|
+
try {
|
|
115788
|
+
const ms = (await proxy.ptz?.getOptions({}))?.moveImpulseMs;
|
|
115789
|
+
known = typeof ms === "number" && ms > 0 ? ms : null;
|
|
115790
|
+
} catch (err) {
|
|
115791
|
+
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getOptions failed (non-fatal)", { meta: { error: errMsg$4(err) } });
|
|
115792
|
+
}
|
|
115793
|
+
return known;
|
|
115794
|
+
} };
|
|
115795
|
+
}
|
|
113845
115796
|
function errMsg$4(err) {
|
|
113846
115797
|
return err instanceof Error ? err.message : String(err);
|
|
113847
115798
|
}
|
|
@@ -116479,7 +118430,6 @@ var DEFAULT_CONFIG = {
|
|
|
116479
118430
|
bridgeName: "CamStack Bridge",
|
|
116480
118431
|
fixedPin: "",
|
|
116481
118432
|
interfaceName: "",
|
|
116482
|
-
ptzPulseMs: 400,
|
|
116483
118433
|
clipRetentionDays: 14,
|
|
116484
118434
|
identity: {
|
|
116485
118435
|
username: "",
|
|
@@ -116525,6 +118475,8 @@ function buildBridgeUuid(bridgeName) {
|
|
|
116525
118475
|
return import_dist.uuid.generate(`camstack:bridge:${bridgeName}:${Date.now()}`);
|
|
116526
118476
|
}
|
|
116527
118477
|
var ExportHapAddon = class extends BaseAddon {
|
|
118478
|
+
/** The bridge setup code pairs a controller: a credential, kept in the keychain (D787). */
|
|
118479
|
+
secretStatePaths = ["identity.pincode"];
|
|
116528
118480
|
exposed = /* @__PURE__ */ new Map();
|
|
116529
118481
|
lastError;
|
|
116530
118482
|
/** Shared HAP setup code applied to every published accessory. */
|
|
@@ -116824,7 +118776,6 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
116824
118776
|
deviceId: entry.deviceId,
|
|
116825
118777
|
displayName: entry.displayName,
|
|
116826
118778
|
options: {
|
|
116827
|
-
ptzPulseMs: this.config.ptzPulseMs,
|
|
116828
118779
|
decodeMemos: this.decodeMemos,
|
|
116829
118780
|
resolveFfmpeg: this.pinnedFfmpeg,
|
|
116830
118781
|
hksvClipStore: this.hksvClipStore,
|
|
@@ -117161,6 +119112,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
117161
119112
|
this.field({
|
|
117162
119113
|
type: "text",
|
|
117163
119114
|
key: "fixedPin",
|
|
119115
|
+
secret: true,
|
|
117164
119116
|
label: "Fixed setup code (XXX-XX-XXX)",
|
|
117165
119117
|
description: "Optional. Leave blank to use the auto-generated code persisted on first boot. Useful for CI replay.",
|
|
117166
119118
|
default: DEFAULT_CONFIG.fixedPin,
|
|
@@ -117183,14 +119135,6 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
117183
119135
|
description: "CamStack keeps its own copy of every clip it sends to HomeKit Secure Video — HomeKit itself never gives one back. This is the fleet default; each camera can override it, and each can switch the copies off entirely. Clips are also capped at 200 per camera, 512 MB per camera and 4 GB overall — whichever limit is reached first wins, and the log names which one.",
|
|
117184
119136
|
default: DEFAULT_CONFIG.clipRetentionDays,
|
|
117185
119137
|
placement: { tab: "advanced" }
|
|
117186
|
-
}),
|
|
117187
|
-
this.field({
|
|
117188
|
-
type: "number",
|
|
117189
|
-
key: "ptzPulseMs",
|
|
117190
|
-
label: "PTZ pulse duration (ms)",
|
|
117191
|
-
description: "Duration of a single pan/tilt momentary command issued by the PTZ direction switches in Apple Home. Lower = finer steps; higher = bigger sweeps per tap. Defaults to 400ms.",
|
|
117192
|
-
default: DEFAULT_CONFIG.ptzPulseMs,
|
|
117193
|
-
placement: { tab: "advanced" }
|
|
117194
119138
|
})
|
|
117195
119139
|
]
|
|
117196
119140
|
}] });
|