@camstack/addon-post-analysis 1.2.342 → 1.2.344
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/{clip-model-registry-Dhjpee-Q.mjs → clip-model-registry-C44gfwjm.mjs} +2279 -62
- package/dist/{clip-model-registry-ClEoe-WP.js → clip-model-registry-Ca_IbZyD.js} +2290 -61
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/pipeline-analytics/_stub.js +2 -2
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-XzFWnlu-.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-D73dyYqt.mjs} +2 -2
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-C-2BbuN4.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-ZZJLA-YE.mjs +26 -0
- package/dist/pipeline-analytics/{hostInit-C6P0R93E.mjs → hostInit-h_8fvfFv.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +2420 -359
- package/dist/pipeline-analytics/index.mjs +2412 -351
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CsAksj5u.mjs +0 -26
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Cp4eQz57.mjs +0 -26
|
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
}) : target, mod));
|
|
31
31
|
//#endregion
|
|
32
32
|
let node_crypto = require("node:crypto");
|
|
33
|
-
//#region ../types/dist/event-category-
|
|
33
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
34
34
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
35
35
|
EventCategory["SystemBoot"] = "system.boot";
|
|
36
36
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -109,6 +109,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
109
109
|
*/
|
|
110
110
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
111
111
|
/**
|
|
112
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
113
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
114
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
115
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
116
|
+
*/
|
|
117
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
118
|
+
/**
|
|
112
119
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
113
120
|
* transitions from `failed` back to `healthy` (typically via the
|
|
114
121
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5473,7 +5480,7 @@ var ZodIssueCode = {
|
|
|
5473
5480
|
var ZodFirstPartyTypeKind;
|
|
5474
5481
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5475
5482
|
//#endregion
|
|
5476
|
-
//#region ../types/dist/sleep-
|
|
5483
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5477
5484
|
/**
|
|
5478
5485
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5479
5486
|
* window to float samples (D455).
|
|
@@ -5552,6 +5559,97 @@ function buildAlawTable() {
|
|
|
5552
5559
|
}
|
|
5553
5560
|
buildUlawTable();
|
|
5554
5561
|
buildAlawTable();
|
|
5562
|
+
/** Is this field's stored value a credential? */
|
|
5563
|
+
function isSecretConfigField(field) {
|
|
5564
|
+
if (field.type === "password") return true;
|
|
5565
|
+
return "secret" in field && field.secret === true;
|
|
5566
|
+
}
|
|
5567
|
+
/**
|
|
5568
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5569
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5570
|
+
*/
|
|
5571
|
+
function isKeychainStoredField(field) {
|
|
5572
|
+
if (!isSecretConfigField(field)) return false;
|
|
5573
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5574
|
+
return !("storage" in field && field.storage === "inline");
|
|
5575
|
+
}
|
|
5576
|
+
/**
|
|
5577
|
+
* What a settings blob holds where a secret used to be.
|
|
5578
|
+
*
|
|
5579
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5580
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5581
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5582
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5583
|
+
*
|
|
5584
|
+
* The same shapes travel to and from the admin UI:
|
|
5585
|
+
*
|
|
5586
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5587
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5588
|
+
* value is set, never the value.
|
|
5589
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5590
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5591
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5592
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5593
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5594
|
+
*
|
|
5595
|
+
* Pure and browser-safe.
|
|
5596
|
+
*/
|
|
5597
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5598
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5599
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5600
|
+
function isRecord$1(value) {
|
|
5601
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5602
|
+
}
|
|
5603
|
+
function makeSecretMarker(ref) {
|
|
5604
|
+
return {
|
|
5605
|
+
$secret: ref,
|
|
5606
|
+
v: 1
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5609
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5610
|
+
function isSecretMarker(value) {
|
|
5611
|
+
if (!isRecord$1(value)) return false;
|
|
5612
|
+
const ref = value["$secret"];
|
|
5613
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5614
|
+
}
|
|
5615
|
+
function isSecretClear(value) {
|
|
5616
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5617
|
+
}
|
|
5618
|
+
/**
|
|
5619
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5620
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5621
|
+
* survives this function.
|
|
5622
|
+
*/
|
|
5623
|
+
function toSecretFieldView(stored) {
|
|
5624
|
+
if (isSecretMarker(stored)) return {
|
|
5625
|
+
$secret: stored.$secret,
|
|
5626
|
+
v: 1,
|
|
5627
|
+
set: true
|
|
5628
|
+
};
|
|
5629
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5630
|
+
$secret: null,
|
|
5631
|
+
v: 1,
|
|
5632
|
+
set: true,
|
|
5633
|
+
inline: true
|
|
5634
|
+
};
|
|
5635
|
+
return null;
|
|
5636
|
+
}
|
|
5637
|
+
/**
|
|
5638
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5639
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5640
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5641
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5642
|
+
*/
|
|
5643
|
+
function classifySecretWrite(incoming) {
|
|
5644
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5645
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5646
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5647
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5648
|
+
return {
|
|
5649
|
+
kind: "set",
|
|
5650
|
+
value: incoming
|
|
5651
|
+
};
|
|
5652
|
+
}
|
|
5555
5653
|
Object.fromEntries([
|
|
5556
5654
|
{
|
|
5557
5655
|
id: "overview",
|
|
@@ -5723,33 +5821,19 @@ Object.fromEntries([
|
|
|
5723
5821
|
function isValuelessField(field) {
|
|
5724
5822
|
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";
|
|
5725
5823
|
}
|
|
5726
|
-
|
|
5727
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5728
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5729
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5730
|
-
*
|
|
5731
|
-
* For each leaf field:
|
|
5732
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5733
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5734
|
-
*
|
|
5735
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5736
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5737
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5738
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5739
|
-
*/
|
|
5740
|
-
function hydrateSchema(schema, values) {
|
|
5824
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5741
5825
|
return {
|
|
5742
5826
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5743
5827
|
sections: schema.sections.map((section) => ({
|
|
5744
5828
|
...section,
|
|
5745
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5829
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5746
5830
|
}))
|
|
5747
5831
|
};
|
|
5748
5832
|
}
|
|
5749
|
-
function hydrateField(field, values) {
|
|
5833
|
+
function hydrateField(field, values, options) {
|
|
5750
5834
|
if (isValuelessField(field)) return field;
|
|
5751
5835
|
if (field.type === "group") {
|
|
5752
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5836
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5753
5837
|
return {
|
|
5754
5838
|
...field,
|
|
5755
5839
|
fields: hydratedChildren
|
|
@@ -5758,7 +5842,7 @@ function hydrateField(field, values) {
|
|
|
5758
5842
|
if (field.type === "sub-tabs") {
|
|
5759
5843
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5760
5844
|
...tab,
|
|
5761
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5845
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5762
5846
|
}));
|
|
5763
5847
|
return {
|
|
5764
5848
|
...field,
|
|
@@ -5768,6 +5852,33 @@ function hydrateField(field, values) {
|
|
|
5768
5852
|
const key = field.key;
|
|
5769
5853
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5770
5854
|
const defaultValue = field.default;
|
|
5855
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5856
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5857
|
+
...field,
|
|
5858
|
+
value: toSecretFieldView(storedValue)
|
|
5859
|
+
};
|
|
5860
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5861
|
+
...field,
|
|
5862
|
+
value: null
|
|
5863
|
+
};
|
|
5864
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5865
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5866
|
+
if (secretItemKeys.length > 0) {
|
|
5867
|
+
const rows = storedValue.map((row) => {
|
|
5868
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5869
|
+
const out = { ...row };
|
|
5870
|
+
for (const k of secretItemKeys) {
|
|
5871
|
+
const v = Reflect.get(row, k);
|
|
5872
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5873
|
+
}
|
|
5874
|
+
return out;
|
|
5875
|
+
});
|
|
5876
|
+
return {
|
|
5877
|
+
...field,
|
|
5878
|
+
value: rows
|
|
5879
|
+
};
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5771
5882
|
if (field.multiple) {
|
|
5772
5883
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5773
5884
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -6010,6 +6121,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
6010
6121
|
}
|
|
6011
6122
|
return out;
|
|
6012
6123
|
}
|
|
6124
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6125
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6126
|
+
function globalSecretScope() {
|
|
6127
|
+
return GLOBAL_SCOPE;
|
|
6128
|
+
}
|
|
6129
|
+
function encodeSegment(value) {
|
|
6130
|
+
return encodeURIComponent(value);
|
|
6131
|
+
}
|
|
6132
|
+
/**
|
|
6133
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6134
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6135
|
+
* `providers[authentik].clientSecret`.
|
|
6136
|
+
*/
|
|
6137
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6138
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6139
|
+
}
|
|
6140
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6141
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6142
|
+
fieldPath;
|
|
6143
|
+
constructor(fieldPath, cause) {
|
|
6144
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6145
|
+
this.fieldPath = fieldPath;
|
|
6146
|
+
this.name = "KeychainWriteRefusedError";
|
|
6147
|
+
}
|
|
6148
|
+
};
|
|
6149
|
+
var KEEP = { kind: "keep" };
|
|
6150
|
+
function isRecord(value) {
|
|
6151
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6152
|
+
}
|
|
6153
|
+
function defaultMintId() {
|
|
6154
|
+
return globalThis.crypto.randomUUID();
|
|
6155
|
+
}
|
|
6156
|
+
/** Every marker ref anywhere under `value`. */
|
|
6157
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6158
|
+
if (isSecretMarker(value)) {
|
|
6159
|
+
out.push(value.$secret);
|
|
6160
|
+
return out;
|
|
6161
|
+
}
|
|
6162
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6163
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6164
|
+
return out;
|
|
6165
|
+
}
|
|
6166
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6167
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6168
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6169
|
+
}
|
|
6170
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6171
|
+
const intent = classifySecretWrite(incoming);
|
|
6172
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6173
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6174
|
+
if (intent.kind === "keep") return KEEP;
|
|
6175
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6176
|
+
if (intent.kind === "clear") {
|
|
6177
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6178
|
+
return {
|
|
6179
|
+
kind: "value",
|
|
6180
|
+
value: null
|
|
6181
|
+
};
|
|
6182
|
+
}
|
|
6183
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6184
|
+
kind: "value",
|
|
6185
|
+
value: stored
|
|
6186
|
+
};
|
|
6187
|
+
try {
|
|
6188
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6189
|
+
} catch (err) {
|
|
6190
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6191
|
+
}
|
|
6192
|
+
return {
|
|
6193
|
+
kind: "value",
|
|
6194
|
+
value: makeSecretMarker(ref)
|
|
6195
|
+
};
|
|
6196
|
+
}
|
|
6197
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6198
|
+
function applyMember(out, key, result, storedParent) {
|
|
6199
|
+
if (result.kind === "value") {
|
|
6200
|
+
out[key] = result.value;
|
|
6201
|
+
return;
|
|
6202
|
+
}
|
|
6203
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6204
|
+
else delete out[key];
|
|
6205
|
+
}
|
|
6206
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6207
|
+
const out = { ...incoming };
|
|
6208
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6209
|
+
return out;
|
|
6210
|
+
}
|
|
6211
|
+
function rowId(row, idKey) {
|
|
6212
|
+
const raw = row[idKey];
|
|
6213
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6214
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6215
|
+
return null;
|
|
6216
|
+
}
|
|
6217
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6218
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6219
|
+
if (!Array.isArray(incoming)) {
|
|
6220
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6221
|
+
return {
|
|
6222
|
+
kind: "value",
|
|
6223
|
+
value: incoming
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6227
|
+
for (const row of storedRows) {
|
|
6228
|
+
const id = rowId(row, node.idKey);
|
|
6229
|
+
if (id !== null) storedById.set(id, row);
|
|
6230
|
+
}
|
|
6231
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6232
|
+
const rows = [];
|
|
6233
|
+
for (const row of incoming) {
|
|
6234
|
+
if (!isRecord(row)) {
|
|
6235
|
+
rows.push(row);
|
|
6236
|
+
continue;
|
|
6237
|
+
}
|
|
6238
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6239
|
+
kept.add(id);
|
|
6240
|
+
const withId = {
|
|
6241
|
+
...row,
|
|
6242
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6243
|
+
};
|
|
6244
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6245
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6246
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6247
|
+
}
|
|
6248
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6249
|
+
return {
|
|
6250
|
+
kind: "value",
|
|
6251
|
+
value: rows
|
|
6252
|
+
};
|
|
6253
|
+
}
|
|
6254
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6255
|
+
switch (node.kind) {
|
|
6256
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6257
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6258
|
+
case "object": {
|
|
6259
|
+
if (!isRecord(incoming)) {
|
|
6260
|
+
if (incoming === void 0) return KEEP;
|
|
6261
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6262
|
+
return {
|
|
6263
|
+
kind: "value",
|
|
6264
|
+
value: incoming
|
|
6265
|
+
};
|
|
6266
|
+
}
|
|
6267
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6268
|
+
return {
|
|
6269
|
+
kind: "value",
|
|
6270
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6276
|
+
function splitNodeKey(key) {
|
|
6277
|
+
const at = key.indexOf("@");
|
|
6278
|
+
return at <= 0 ? {
|
|
6279
|
+
base: key,
|
|
6280
|
+
nodeId: null
|
|
6281
|
+
} : {
|
|
6282
|
+
base: key.slice(0, at),
|
|
6283
|
+
nodeId: key.slice(at + 1)
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6287
|
+
async function transformSecretWrite(input) {
|
|
6288
|
+
const deletes = [];
|
|
6289
|
+
const base = {
|
|
6290
|
+
secrets: input.secrets,
|
|
6291
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6292
|
+
deletes,
|
|
6293
|
+
operatorWrite: input.operatorWrite === true
|
|
6294
|
+
};
|
|
6295
|
+
const out = {};
|
|
6296
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6297
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6298
|
+
const node = input.tree.get(baseKey);
|
|
6299
|
+
if (node === void 0) {
|
|
6300
|
+
out[key] = incoming;
|
|
6301
|
+
continue;
|
|
6302
|
+
}
|
|
6303
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6304
|
+
kind: "node",
|
|
6305
|
+
nodeId
|
|
6306
|
+
} : input.scope ?? globalSecretScope();
|
|
6307
|
+
const result = await writeNode({
|
|
6308
|
+
...base,
|
|
6309
|
+
scope
|
|
6310
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6311
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6312
|
+
}
|
|
6313
|
+
return {
|
|
6314
|
+
patch: out,
|
|
6315
|
+
afterWrite: async () => {
|
|
6316
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6317
|
+
try {
|
|
6318
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6319
|
+
return { orphaned: [] };
|
|
6320
|
+
} catch {
|
|
6321
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
};
|
|
6325
|
+
}
|
|
6326
|
+
/**
|
|
6327
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6328
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6329
|
+
*/
|
|
6330
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6331
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6332
|
+
if (refs.length === 0) return {
|
|
6333
|
+
value,
|
|
6334
|
+
unresolved: []
|
|
6335
|
+
};
|
|
6336
|
+
const answers = await secrets.resolve(refs);
|
|
6337
|
+
const unresolved = [];
|
|
6338
|
+
for (const ref of new Set(refs)) {
|
|
6339
|
+
const answer = answers[ref];
|
|
6340
|
+
if (answer === void 0) unresolved.push({
|
|
6341
|
+
ref,
|
|
6342
|
+
reason: "not-initialized"
|
|
6343
|
+
});
|
|
6344
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6345
|
+
ref,
|
|
6346
|
+
reason: answer.reason
|
|
6347
|
+
});
|
|
6348
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6349
|
+
ref,
|
|
6350
|
+
reason: answer.kind
|
|
6351
|
+
});
|
|
6352
|
+
}
|
|
6353
|
+
const substitute = (v) => {
|
|
6354
|
+
if (isSecretMarker(v)) {
|
|
6355
|
+
const answer = answers[v.$secret];
|
|
6356
|
+
return answer?.kind === "value" ? {
|
|
6357
|
+
keep: true,
|
|
6358
|
+
value: answer.value
|
|
6359
|
+
} : {
|
|
6360
|
+
keep: false,
|
|
6361
|
+
value: void 0
|
|
6362
|
+
};
|
|
6363
|
+
}
|
|
6364
|
+
if (Array.isArray(v)) {
|
|
6365
|
+
const items = [];
|
|
6366
|
+
for (const item of v) {
|
|
6367
|
+
const s = substitute(item);
|
|
6368
|
+
if (s.keep) items.push(s.value);
|
|
6369
|
+
}
|
|
6370
|
+
return {
|
|
6371
|
+
keep: true,
|
|
6372
|
+
value: items
|
|
6373
|
+
};
|
|
6374
|
+
}
|
|
6375
|
+
if (isRecord(v)) {
|
|
6376
|
+
const out = {};
|
|
6377
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6378
|
+
const s = substitute(child);
|
|
6379
|
+
if (s.keep) out[k] = s.value;
|
|
6380
|
+
}
|
|
6381
|
+
return {
|
|
6382
|
+
keep: true,
|
|
6383
|
+
value: out
|
|
6384
|
+
};
|
|
6385
|
+
}
|
|
6386
|
+
return {
|
|
6387
|
+
keep: true,
|
|
6388
|
+
value: v
|
|
6389
|
+
};
|
|
6390
|
+
};
|
|
6391
|
+
return {
|
|
6392
|
+
value: substitute(value).value,
|
|
6393
|
+
unresolved
|
|
6394
|
+
};
|
|
6395
|
+
}
|
|
6396
|
+
function touchesTree(tree, patch) {
|
|
6397
|
+
if (tree.size === 0) return false;
|
|
6398
|
+
for (const key of Object.keys(patch)) {
|
|
6399
|
+
const at = key.indexOf("@");
|
|
6400
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6401
|
+
}
|
|
6402
|
+
return false;
|
|
6403
|
+
}
|
|
6404
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6405
|
+
async function readStoredAddonBlob(raw) {
|
|
6406
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6407
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6408
|
+
const result = await threeWay.call(raw);
|
|
6409
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6410
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6411
|
+
}
|
|
6412
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6413
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6414
|
+
const serialize = (key, fn) => {
|
|
6415
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6416
|
+
const tail = next.catch(() => void 0);
|
|
6417
|
+
chains.set(key, tail);
|
|
6418
|
+
tail.then(() => {
|
|
6419
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6420
|
+
});
|
|
6421
|
+
return next;
|
|
6422
|
+
};
|
|
6423
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6424
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6425
|
+
return serialize(chainKey, async () => {
|
|
6426
|
+
const stored = await readStored();
|
|
6427
|
+
const result = await transformSecretWrite({
|
|
6428
|
+
tree,
|
|
6429
|
+
secrets: opts.secrets,
|
|
6430
|
+
patch,
|
|
6431
|
+
stored,
|
|
6432
|
+
...scope !== void 0 ? { scope } : {},
|
|
6433
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6434
|
+
});
|
|
6435
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6436
|
+
const { orphaned } = await result.afterWrite();
|
|
6437
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6438
|
+
});
|
|
6439
|
+
};
|
|
6440
|
+
const wrapped = {
|
|
6441
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6442
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6443
|
+
kind: "device",
|
|
6444
|
+
deviceId
|
|
6445
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6446
|
+
};
|
|
6447
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6448
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6449
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6450
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6451
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6452
|
+
} });
|
|
6453
|
+
}
|
|
6454
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6455
|
+
function withSecretAwareSettings(context, opts) {
|
|
6456
|
+
const raw = context.settings;
|
|
6457
|
+
if (raw === void 0) return context;
|
|
6458
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6459
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6460
|
+
if (prop === "settings") return settings;
|
|
6461
|
+
return Reflect.get(target, prop, receiver);
|
|
6462
|
+
} });
|
|
6463
|
+
}
|
|
6464
|
+
var LEAF = { kind: "leaf" };
|
|
6465
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6466
|
+
function collectFields(fields, out) {
|
|
6467
|
+
for (const field of fields) {
|
|
6468
|
+
if (field.type === "group") {
|
|
6469
|
+
collectFields(field.fields, out);
|
|
6470
|
+
continue;
|
|
6471
|
+
}
|
|
6472
|
+
if (field.type === "sub-tabs") {
|
|
6473
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6474
|
+
continue;
|
|
6475
|
+
}
|
|
6476
|
+
if (field.type === "editable-array") {
|
|
6477
|
+
const item = /* @__PURE__ */ new Map();
|
|
6478
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6479
|
+
if (item.size > 0) out.set(field.key, {
|
|
6480
|
+
kind: "array",
|
|
6481
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6482
|
+
item
|
|
6483
|
+
});
|
|
6484
|
+
continue;
|
|
6485
|
+
}
|
|
6486
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6487
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6488
|
+
}
|
|
6489
|
+
}
|
|
6490
|
+
/** The secret tree a settings schema declares. */
|
|
6491
|
+
function secretTreeFromSchema(schema) {
|
|
6492
|
+
const out = /* @__PURE__ */ new Map();
|
|
6493
|
+
if (schema === null) return out;
|
|
6494
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6495
|
+
return out;
|
|
6496
|
+
}
|
|
6497
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6498
|
+
function parseSecretStatePath(path) {
|
|
6499
|
+
const segments = [];
|
|
6500
|
+
for (const raw of path.split(".")) {
|
|
6501
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6502
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6503
|
+
segments.push(m[2] !== void 0 ? {
|
|
6504
|
+
key: m[1],
|
|
6505
|
+
idKey: m[2]
|
|
6506
|
+
} : { key: m[1] });
|
|
6507
|
+
}
|
|
6508
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6509
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6510
|
+
return segments;
|
|
6511
|
+
}
|
|
6512
|
+
function insert(into, segments) {
|
|
6513
|
+
const [head, ...rest] = segments;
|
|
6514
|
+
if (head === void 0) return;
|
|
6515
|
+
if (rest.length === 0) {
|
|
6516
|
+
into.set(head.key, LEAF);
|
|
6517
|
+
return;
|
|
6518
|
+
}
|
|
6519
|
+
const existing = into.get(head.key);
|
|
6520
|
+
if (head.idKey !== void 0) {
|
|
6521
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6522
|
+
insert(item, rest);
|
|
6523
|
+
into.set(head.key, {
|
|
6524
|
+
kind: "array",
|
|
6525
|
+
idKey: head.idKey,
|
|
6526
|
+
item
|
|
6527
|
+
});
|
|
6528
|
+
return;
|
|
6529
|
+
}
|
|
6530
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6531
|
+
insert(children, rest);
|
|
6532
|
+
into.set(head.key, {
|
|
6533
|
+
kind: "object",
|
|
6534
|
+
children
|
|
6535
|
+
});
|
|
6536
|
+
}
|
|
6537
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6538
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6539
|
+
if (paths.length === 0) return tree;
|
|
6540
|
+
const out = new Map(tree);
|
|
6541
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6542
|
+
return out;
|
|
6543
|
+
}
|
|
6544
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6545
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6546
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6547
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6548
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
6013
6549
|
/**
|
|
6014
6550
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
6015
6551
|
*
|
|
@@ -6079,6 +6615,25 @@ var BaseAddon = class {
|
|
|
6079
6615
|
settingsStoreReady = false;
|
|
6080
6616
|
/** Default config values. Provided via constructor. */
|
|
6081
6617
|
defaults;
|
|
6618
|
+
/**
|
|
6619
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6620
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6621
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6622
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6623
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6624
|
+
*/
|
|
6625
|
+
secretStatePaths = [];
|
|
6626
|
+
_addonSecretTree = null;
|
|
6627
|
+
_deviceSecretTree = null;
|
|
6628
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6629
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6630
|
+
_unresolvedSecrets = [];
|
|
6631
|
+
_secretRetryTimer = null;
|
|
6632
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6633
|
+
_secretChangeTimer = null;
|
|
6634
|
+
_secretChangeUnsub = null;
|
|
6635
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6636
|
+
_operatorWriteDepth = 0;
|
|
6082
6637
|
constructor(defaults) {
|
|
6083
6638
|
this.defaults = defaults;
|
|
6084
6639
|
this._config = { ...defaults };
|
|
@@ -6114,8 +6669,18 @@ var BaseAddon = class {
|
|
|
6114
6669
|
return this._config;
|
|
6115
6670
|
}
|
|
6116
6671
|
async initialize(context) {
|
|
6117
|
-
|
|
6672
|
+
const secrets = context.secrets;
|
|
6673
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6674
|
+
secrets,
|
|
6675
|
+
addonTree: () => this.addonSecretTree(),
|
|
6676
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6677
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6678
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6679
|
+
}) : context;
|
|
6118
6680
|
await this.resolveConfig();
|
|
6681
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6682
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6683
|
+
});
|
|
6119
6684
|
const result = await this.onInitialize();
|
|
6120
6685
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6121
6686
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6148,6 +6713,12 @@ var BaseAddon = class {
|
|
|
6148
6713
|
*/
|
|
6149
6714
|
async onHubReachable() {}
|
|
6150
6715
|
async shutdown() {
|
|
6716
|
+
this._secretChangeUnsub?.();
|
|
6717
|
+
this._secretChangeUnsub = null;
|
|
6718
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6719
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6720
|
+
this._secretRetryTimer = null;
|
|
6721
|
+
this._secretChangeTimer = null;
|
|
6151
6722
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6152
6723
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6153
6724
|
await this.onShutdown();
|
|
@@ -6226,7 +6797,7 @@ var BaseAddon = class {
|
|
|
6226
6797
|
return hydrateSchema(schema, overlay ? {
|
|
6227
6798
|
...projected,
|
|
6228
6799
|
...overlay
|
|
6229
|
-
} : projected);
|
|
6800
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6230
6801
|
}
|
|
6231
6802
|
/**
|
|
6232
6803
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6275,7 +6846,7 @@ var BaseAddon = class {
|
|
|
6275
6846
|
return hydrateSchema({
|
|
6276
6847
|
...schema,
|
|
6277
6848
|
sections
|
|
6278
|
-
}, projected);
|
|
6849
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6279
6850
|
}
|
|
6280
6851
|
/**
|
|
6281
6852
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6329,18 +6900,50 @@ var BaseAddon = class {
|
|
|
6329
6900
|
value: result.value[key]
|
|
6330
6901
|
};
|
|
6331
6902
|
}
|
|
6903
|
+
/**
|
|
6904
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6905
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6906
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6907
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6908
|
+
* writing back what it read is not (D787).
|
|
6909
|
+
*/
|
|
6910
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6911
|
+
this._operatorWriteDepth++;
|
|
6912
|
+
try {
|
|
6913
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6914
|
+
} finally {
|
|
6915
|
+
this._operatorWriteDepth--;
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6332
6918
|
async updateGlobalSettings(patch, nodeId) {
|
|
6919
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6920
|
+
}
|
|
6921
|
+
/**
|
|
6922
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6923
|
+
*
|
|
6924
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6925
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6926
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6927
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6928
|
+
*/
|
|
6929
|
+
async clearSecrets(keys, nodeId) {
|
|
6930
|
+
const tree = this.addonSecretTree();
|
|
6931
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6932
|
+
const patch = {};
|
|
6933
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6934
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6935
|
+
}
|
|
6936
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6333
6937
|
const keys = this.perNodeKeys();
|
|
6334
6938
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6335
6939
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6336
|
-
const barePatch = patch;
|
|
6337
6940
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6338
6941
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6339
6942
|
if (target !== localNode) return;
|
|
6340
6943
|
await this.resolveConfig();
|
|
6341
6944
|
await this.onConfigChanged();
|
|
6342
6945
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6343
|
-
this.maybeAutoRestart(
|
|
6946
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6344
6947
|
}
|
|
6345
6948
|
/**
|
|
6346
6949
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6365,7 +6968,7 @@ var BaseAddon = class {
|
|
|
6365
6968
|
* time to return its response before the addon is torn down and
|
|
6366
6969
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6367
6970
|
*/
|
|
6368
|
-
maybeAutoRestart(
|
|
6971
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6369
6972
|
if (!schema) return;
|
|
6370
6973
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6371
6974
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6373,13 +6976,13 @@ var BaseAddon = class {
|
|
|
6373
6976
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6374
6977
|
}
|
|
6375
6978
|
if (restartKeys.size === 0) return;
|
|
6376
|
-
if (!
|
|
6979
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6377
6980
|
const ctx = this._ctx;
|
|
6378
6981
|
if (!ctx) return;
|
|
6379
6982
|
const addonId = ctx.id;
|
|
6380
6983
|
setImmediate(() => {
|
|
6381
6984
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6382
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6985
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6383
6986
|
}).catch((err) => {
|
|
6384
6987
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6385
6988
|
});
|
|
@@ -6388,7 +6991,7 @@ var BaseAddon = class {
|
|
|
6388
6991
|
async getDeviceSettings(deviceId) {
|
|
6389
6992
|
const schema = this.deviceSettingsSchema();
|
|
6390
6993
|
if (!schema) return { sections: [] };
|
|
6391
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6994
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6392
6995
|
}
|
|
6393
6996
|
async updateDeviceSettings(deviceId, patch) {
|
|
6394
6997
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6518,7 +7121,7 @@ var BaseAddon = class {
|
|
|
6518
7121
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6519
7122
|
*/
|
|
6520
7123
|
async resolveConfig() {
|
|
6521
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7124
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6522
7125
|
const perNode = this.perNodeKeys();
|
|
6523
7126
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6524
7127
|
const resolved = { ...this.defaults };
|
|
@@ -6543,7 +7146,7 @@ var BaseAddon = class {
|
|
|
6543
7146
|
key,
|
|
6544
7147
|
schema,
|
|
6545
7148
|
fallback,
|
|
6546
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7149
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6547
7150
|
write: async (patch) => {
|
|
6548
7151
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6549
7152
|
},
|
|
@@ -6560,7 +7163,7 @@ var BaseAddon = class {
|
|
|
6560
7163
|
key,
|
|
6561
7164
|
schema,
|
|
6562
7165
|
fallback,
|
|
6563
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7166
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6564
7167
|
write: async (patch) => {
|
|
6565
7168
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6566
7169
|
},
|
|
@@ -6572,6 +7175,70 @@ var BaseAddon = class {
|
|
|
6572
7175
|
} })
|
|
6573
7176
|
});
|
|
6574
7177
|
}
|
|
7178
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7179
|
+
addonSecretTree() {
|
|
7180
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7181
|
+
return this._addonSecretTree;
|
|
7182
|
+
}
|
|
7183
|
+
deviceSecretTree() {
|
|
7184
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7185
|
+
return this._deviceSecretTree;
|
|
7186
|
+
}
|
|
7187
|
+
/**
|
|
7188
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7189
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7190
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7191
|
+
* than start on an empty credential.
|
|
7192
|
+
*/
|
|
7193
|
+
get unresolvedSecrets() {
|
|
7194
|
+
return this._unresolvedSecrets;
|
|
7195
|
+
}
|
|
7196
|
+
/**
|
|
7197
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7198
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7199
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7200
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7201
|
+
* ever written back from here.
|
|
7202
|
+
*/
|
|
7203
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7204
|
+
const secrets = this._ctx?.secrets;
|
|
7205
|
+
if (secrets === void 0) return blob;
|
|
7206
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7207
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7208
|
+
if (refs.length === 0) {
|
|
7209
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7210
|
+
return blob;
|
|
7211
|
+
}
|
|
7212
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7213
|
+
if (trackForConfig) {
|
|
7214
|
+
this._unresolvedSecrets = unresolved;
|
|
7215
|
+
if (unresolved.length > 0) {
|
|
7216
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7217
|
+
ref: u.ref,
|
|
7218
|
+
reason: u.reason
|
|
7219
|
+
})) } });
|
|
7220
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7221
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7222
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7223
|
+
}
|
|
7224
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7225
|
+
}
|
|
7226
|
+
return value;
|
|
7227
|
+
}
|
|
7228
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7229
|
+
scheduleSecretReresolve(delayMs) {
|
|
7230
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7231
|
+
if (this[timerOf] !== null) return;
|
|
7232
|
+
const timer = setTimeout(() => {
|
|
7233
|
+
this[timerOf] = null;
|
|
7234
|
+
if (this._ctx === null) return;
|
|
7235
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7236
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7237
|
+
});
|
|
7238
|
+
}, delayMs);
|
|
7239
|
+
timer.unref?.();
|
|
7240
|
+
this[timerOf] = timer;
|
|
7241
|
+
}
|
|
6575
7242
|
/**
|
|
6576
7243
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6577
7244
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7336,6 +8003,69 @@ var deviceOpsCapability = {
|
|
|
7336
8003
|
getRawState: method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" })
|
|
7337
8004
|
}
|
|
7338
8005
|
};
|
|
8006
|
+
function defOf(schema) {
|
|
8007
|
+
return schema._zod?.def ?? {};
|
|
8008
|
+
}
|
|
8009
|
+
function declaredHere(schema) {
|
|
8010
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8011
|
+
}
|
|
8012
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8013
|
+
var WRAPPERS = new Set([
|
|
8014
|
+
"optional",
|
|
8015
|
+
"nullable",
|
|
8016
|
+
"default",
|
|
8017
|
+
"prefault",
|
|
8018
|
+
"catch",
|
|
8019
|
+
"readonly",
|
|
8020
|
+
"nonoptional"
|
|
8021
|
+
]);
|
|
8022
|
+
/**
|
|
8023
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8024
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8025
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8026
|
+
* `.transform` on `in`).
|
|
8027
|
+
*/
|
|
8028
|
+
function layersOf(schema) {
|
|
8029
|
+
const out = [];
|
|
8030
|
+
const queue = [schema];
|
|
8031
|
+
while (queue.length > 0) {
|
|
8032
|
+
const s = queue.shift();
|
|
8033
|
+
if (!s || out.includes(s)) continue;
|
|
8034
|
+
out.push(s);
|
|
8035
|
+
const def = defOf(s);
|
|
8036
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8037
|
+
if (def.type === "pipe") {
|
|
8038
|
+
if (def.in) queue.push(def.in);
|
|
8039
|
+
if (def.out) queue.push(def.out);
|
|
8040
|
+
}
|
|
8041
|
+
}
|
|
8042
|
+
return out;
|
|
8043
|
+
}
|
|
8044
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8045
|
+
function isZodSecret(schema) {
|
|
8046
|
+
return layersOf(schema).some(declaredHere);
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8050
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8051
|
+
* object or array is reported as one path and not descended into — everything
|
|
8052
|
+
* under it is secret.
|
|
8053
|
+
*/
|
|
8054
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8055
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8056
|
+
const paths = [];
|
|
8057
|
+
for (const layer of layersOf(schema)) {
|
|
8058
|
+
const def = defOf(layer);
|
|
8059
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8060
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8061
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8062
|
+
else if (def.type === "intersection") {
|
|
8063
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8064
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
return [...new Set(paths)];
|
|
8068
|
+
}
|
|
7339
8069
|
/**
|
|
7340
8070
|
* AUTO-GENERATED by scripts/generate-device-scoped-caps.ts — DO NOT EDIT.
|
|
7341
8071
|
*
|
|
@@ -16317,6 +17047,254 @@ id: union([string(), number()]) }), {
|
|
|
16317
17047
|
})
|
|
16318
17048
|
}
|
|
16319
17049
|
};
|
|
17050
|
+
/**
|
|
17051
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
17052
|
+
*
|
|
17053
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
17054
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
17055
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
17056
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
17057
|
+
* against the CALLER, never against anything the caller claims.
|
|
17058
|
+
*
|
|
17059
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
17060
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
17061
|
+
* connection, the agent from its child's connection carried in
|
|
17062
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
17063
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
17064
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
17065
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
17066
|
+
* runner is the same OS user): see the threat model in
|
|
17067
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
17068
|
+
*
|
|
17069
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
17070
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
17071
|
+
* floors every method to admin anyway (D240).
|
|
17072
|
+
*
|
|
17073
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
17074
|
+
*/
|
|
17075
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
17076
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
17077
|
+
"key-missing",
|
|
17078
|
+
"wrong-key",
|
|
17079
|
+
"key-file-unreadable",
|
|
17080
|
+
"store-unavailable",
|
|
17081
|
+
"not-initialized",
|
|
17082
|
+
"decrypt-failed"
|
|
17083
|
+
]);
|
|
17084
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
17085
|
+
state: literal("locked"),
|
|
17086
|
+
reason: KeychainUnavailableReasonSchema
|
|
17087
|
+
})]);
|
|
17088
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
17089
|
+
object({
|
|
17090
|
+
kind: literal("value"),
|
|
17091
|
+
value: string(),
|
|
17092
|
+
version: number().int()
|
|
17093
|
+
}),
|
|
17094
|
+
object({ kind: literal("missing") }),
|
|
17095
|
+
object({
|
|
17096
|
+
kind: literal("unavailable"),
|
|
17097
|
+
reason: KeychainUnavailableReasonSchema
|
|
17098
|
+
}),
|
|
17099
|
+
object({ kind: literal("forbidden") })
|
|
17100
|
+
]);
|
|
17101
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
17102
|
+
/** Metadata of one stored value — never the value. */
|
|
17103
|
+
var KeychainSecretMetaSchema = object({
|
|
17104
|
+
ref: string(),
|
|
17105
|
+
owner: string(),
|
|
17106
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
17107
|
+
scope: string(),
|
|
17108
|
+
fieldPath: string(),
|
|
17109
|
+
version: number().int(),
|
|
17110
|
+
createdAt: number(),
|
|
17111
|
+
updatedAt: number(),
|
|
17112
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
17113
|
+
updatedBy: string(),
|
|
17114
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
17115
|
+
lastReadAt: number().nullable()
|
|
17116
|
+
});
|
|
17117
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
17118
|
+
var keychainCapability = {
|
|
17119
|
+
name: "keychain",
|
|
17120
|
+
scope: "system",
|
|
17121
|
+
mode: "singleton",
|
|
17122
|
+
internal: true,
|
|
17123
|
+
methods: {
|
|
17124
|
+
/** Store (or replace) the caller's value at `ref`. Refused while locked. */
|
|
17125
|
+
put: method(object({
|
|
17126
|
+
ref: string().min(1),
|
|
17127
|
+
value: string().min(1)
|
|
17128
|
+
}), object({
|
|
17129
|
+
ref: string(),
|
|
17130
|
+
version: number().int()
|
|
17131
|
+
}), {
|
|
17132
|
+
kind: "mutation",
|
|
17133
|
+
auth: "admin"
|
|
17134
|
+
}),
|
|
17135
|
+
/**
|
|
17136
|
+
* Resolve the caller's refs in one round-trip. A locked keychain answers
|
|
17137
|
+
* `unavailable` per ref — never `missing`, never an empty value.
|
|
17138
|
+
*/
|
|
17139
|
+
resolve: method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }),
|
|
17140
|
+
/** Remove the caller's refs. Unknown refs are ignored. */
|
|
17141
|
+
delete: method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
17142
|
+
kind: "mutation",
|
|
17143
|
+
auth: "admin"
|
|
17144
|
+
}),
|
|
17145
|
+
/** The caller's own refs, metadata only. */
|
|
17146
|
+
listMeta: method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }),
|
|
17147
|
+
/** Whether values can be served — the save path refuses a write while locked. */
|
|
17148
|
+
getState: method(object({}), KeychainStateSchema, { auth: "admin" })
|
|
17149
|
+
}
|
|
17150
|
+
};
|
|
17151
|
+
var KeychainKeySourceSchema = object({
|
|
17152
|
+
kind: _enum([
|
|
17153
|
+
"config-file",
|
|
17154
|
+
"previous-config-file",
|
|
17155
|
+
"platform",
|
|
17156
|
+
"default-file"
|
|
17157
|
+
]),
|
|
17158
|
+
/** File sources only — a path is not a secret. */
|
|
17159
|
+
path: string().optional(),
|
|
17160
|
+
/**
|
|
17161
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
17162
|
+
* next to the database it protects (the default file). The page warns.
|
|
17163
|
+
*/
|
|
17164
|
+
sharesBackupWithDatabase: boolean()
|
|
17165
|
+
});
|
|
17166
|
+
var KeychainStatusSchema = object({
|
|
17167
|
+
keychain: KeychainStateSchema,
|
|
17168
|
+
/** The source of the master key in use; `null` while locked. */
|
|
17169
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
17170
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
17171
|
+
configuredSource: KeychainKeySourceSchema,
|
|
17172
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
17173
|
+
fingerprint: string().nullable(),
|
|
17174
|
+
activeKeyId: string().nullable(),
|
|
17175
|
+
/**
|
|
17176
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
17177
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
17178
|
+
*/
|
|
17179
|
+
rotationPending: boolean(),
|
|
17180
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
17181
|
+
retiredWraps: number().int(),
|
|
17182
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
17183
|
+
secretCount: number().int()
|
|
17184
|
+
});
|
|
17185
|
+
/**
|
|
17186
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
17187
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
17188
|
+
* never reported as an orphan (and never deleted as one).
|
|
17189
|
+
*/
|
|
17190
|
+
var KeychainSecretUsageSchema = _enum([
|
|
17191
|
+
"in-use",
|
|
17192
|
+
"orphan",
|
|
17193
|
+
"unknown"
|
|
17194
|
+
]);
|
|
17195
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
17196
|
+
var KeychainAuditActionSchema = _enum([
|
|
17197
|
+
"put",
|
|
17198
|
+
"delete",
|
|
17199
|
+
"reveal",
|
|
17200
|
+
"rotate-master-key",
|
|
17201
|
+
"purge-retired-keys",
|
|
17202
|
+
"download-recovery-key",
|
|
17203
|
+
"delete-orphans",
|
|
17204
|
+
"reset",
|
|
17205
|
+
"initialize"
|
|
17206
|
+
]);
|
|
17207
|
+
var KeychainAuditEntrySchema = object({
|
|
17208
|
+
id: string(),
|
|
17209
|
+
at: number(),
|
|
17210
|
+
action: KeychainAuditActionSchema,
|
|
17211
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
17212
|
+
actor: string(),
|
|
17213
|
+
ref: string().nullable(),
|
|
17214
|
+
detail: string().nullable()
|
|
17215
|
+
});
|
|
17216
|
+
var keychainAdminCapability = {
|
|
17217
|
+
name: "keychain-admin",
|
|
17218
|
+
scope: "system",
|
|
17219
|
+
mode: "singleton",
|
|
17220
|
+
methods: {
|
|
17221
|
+
status: method(object({}), KeychainStatusSchema, { auth: "admin" }),
|
|
17222
|
+
listSecrets: method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }),
|
|
17223
|
+
listAudit: method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }),
|
|
17224
|
+
/**
|
|
17225
|
+
* Show one value to the operator. Audited. The UI hides it again after a
|
|
17226
|
+
* few seconds; nothing caches it.
|
|
17227
|
+
*/
|
|
17228
|
+
reveal: method(object({ ref: string().min(1) }), object({
|
|
17229
|
+
value: string(),
|
|
17230
|
+
version: number().int()
|
|
17231
|
+
}), {
|
|
17232
|
+
kind: "mutation",
|
|
17233
|
+
auth: "admin",
|
|
17234
|
+
caller: "required"
|
|
17235
|
+
}),
|
|
17236
|
+
/** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
|
|
17237
|
+
deleteOrphans: method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
17238
|
+
deleted: array(string()).readonly(),
|
|
17239
|
+
kept: array(object({
|
|
17240
|
+
ref: string(),
|
|
17241
|
+
usage: KeychainSecretUsageSchema
|
|
17242
|
+
})).readonly()
|
|
17243
|
+
}), {
|
|
17244
|
+
kind: "mutation",
|
|
17245
|
+
auth: "admin",
|
|
17246
|
+
caller: "required"
|
|
17247
|
+
}),
|
|
17248
|
+
/**
|
|
17249
|
+
* Wrap the data key under the configured primary master key.
|
|
17250
|
+
*
|
|
17251
|
+
* Pending rotation (the keychain unlocked with a previous source): re-wrap
|
|
17252
|
+
* under the primary. Otherwise, with the default file as primary: generate
|
|
17253
|
+
* a new master key, write it there, re-wrap. A file or OS-keychain primary
|
|
17254
|
+
* that is already in use cannot be replaced from here — put the new key at
|
|
17255
|
+
* the source, keep the old one as `keychain.previousKeyFile`, restart, and
|
|
17256
|
+
* rotate. No value is re-encrypted either way; the previous wrap is kept
|
|
17257
|
+
* (retired) until purged.
|
|
17258
|
+
*/
|
|
17259
|
+
rotateMasterKey: method(object({}), object({
|
|
17260
|
+
fingerprint: string(),
|
|
17261
|
+
keySource: KeychainKeySourceSchema
|
|
17262
|
+
}), {
|
|
17263
|
+
kind: "mutation",
|
|
17264
|
+
auth: "admin",
|
|
17265
|
+
caller: "required"
|
|
17266
|
+
}),
|
|
17267
|
+
purgeRetiredKeys: method(object({}), object({ purged: number().int() }), {
|
|
17268
|
+
kind: "mutation",
|
|
17269
|
+
auth: "admin",
|
|
17270
|
+
caller: "required"
|
|
17271
|
+
}),
|
|
17272
|
+
/** The master key, base64. Audited; marks the recovery copy as taken. */
|
|
17273
|
+
downloadRecoveryKey: method(object({}), object({
|
|
17274
|
+
key: string(),
|
|
17275
|
+
fingerprint: string(),
|
|
17276
|
+
keySource: KeychainKeySourceSchema
|
|
17277
|
+
}), {
|
|
17278
|
+
kind: "mutation",
|
|
17279
|
+
auth: "admin",
|
|
17280
|
+
caller: "required"
|
|
17281
|
+
}),
|
|
17282
|
+
/**
|
|
17283
|
+
* Lost-key recovery: archive every stored value into a
|
|
17284
|
+
* `keychain:secrets-orphaned-<ts>` table and start over with a new data
|
|
17285
|
+
* key. Every secret field then reads "not set". Requires the typed
|
|
17286
|
+
* confirmation {@link KEYCHAIN_RESET_CONFIRMATION}.
|
|
17287
|
+
*/
|
|
17288
|
+
resetKeychain: method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
17289
|
+
archivedCollection: string().nullable(),
|
|
17290
|
+
archived: number().int()
|
|
17291
|
+
}), {
|
|
17292
|
+
kind: "mutation",
|
|
17293
|
+
auth: "admin",
|
|
17294
|
+
caller: "required"
|
|
17295
|
+
})
|
|
17296
|
+
}
|
|
17297
|
+
};
|
|
16320
17298
|
var decoderCapability = {
|
|
16321
17299
|
name: "decoder",
|
|
16322
17300
|
scope: "system",
|
|
@@ -17437,6 +18415,10 @@ var DeviceInfoSchema = object({
|
|
|
17437
18415
|
isCamera: boolean(),
|
|
17438
18416
|
/** Current config values — serializable snapshot */
|
|
17439
18417
|
config: record(string(), unknown()),
|
|
18418
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
18419
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
18420
|
+
* when the owning runner has not reported them. */
|
|
18421
|
+
secretConfigPaths: array(string()).optional(),
|
|
17440
18422
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
17441
18423
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
17442
18424
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -17657,12 +18639,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
17657
18639
|
* call (workers re-register on init), so probe-driven updates
|
|
17658
18640
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
17659
18641
|
features: array(string()).optional(),
|
|
17660
|
-
config: record(string(), unknown())
|
|
18642
|
+
config: record(string(), unknown()),
|
|
18643
|
+
/** Config paths the device's own schema DECLARES secret
|
|
18644
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
18645
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
18646
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
18647
|
+
* omits it and the keyword backstop applies. */
|
|
18648
|
+
secretConfigPaths: array(string()).optional()
|
|
17661
18649
|
});
|
|
17662
18650
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
17663
18651
|
var DevicePersistConfigPayloadSchema = object({
|
|
17664
18652
|
deviceId: number(),
|
|
17665
|
-
data: record(string(), unknown())
|
|
18653
|
+
data: record(string(), unknown()),
|
|
18654
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
18655
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
18656
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
18657
|
+
secretConfigPaths: array(string()).optional()
|
|
17666
18658
|
});
|
|
17667
18659
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
17668
18660
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -20401,7 +21393,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
20401
21393
|
icon: string().optional(),
|
|
20402
21394
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
20403
21395
|
startUrl: string(),
|
|
20404
|
-
stage: LoginStageEnum
|
|
21396
|
+
stage: LoginStageEnum,
|
|
21397
|
+
/**
|
|
21398
|
+
* The provider names an external identity a signed-in user can link to
|
|
21399
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
21400
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
21401
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
21402
|
+
*/
|
|
21403
|
+
linkable: boolean().optional()
|
|
20405
21404
|
}),
|
|
20406
21405
|
object({
|
|
20407
21406
|
kind: literal("widget"),
|
|
@@ -26907,8 +27906,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
26907
27906
|
]);
|
|
26908
27907
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
26909
27908
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
26910
|
-
/**
|
|
26911
|
-
|
|
27909
|
+
/**
|
|
27910
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
27911
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
27912
|
+
*
|
|
27913
|
+
* - `operator` — drawn by hand.
|
|
27914
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
27915
|
+
* model, or a larger teacher model).
|
|
27916
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
27917
|
+
* back from the track store (never a re-run).
|
|
27918
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
27919
|
+
*/
|
|
27920
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
27921
|
+
"operator",
|
|
27922
|
+
"assist",
|
|
27923
|
+
"pipeline",
|
|
27924
|
+
"llm"
|
|
27925
|
+
]);
|
|
26912
27926
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
26913
27927
|
var RetrainBboxSchema = object({
|
|
26914
27928
|
x: number(),
|
|
@@ -26926,7 +27940,8 @@ var RetrainBboxSchema = object({
|
|
|
26926
27940
|
*/
|
|
26927
27941
|
var RetrainAnnotationSchema = object({
|
|
26928
27942
|
id: string(),
|
|
26929
|
-
|
|
27943
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
27944
|
+
trackId: string().optional(),
|
|
26930
27945
|
deviceId: number(),
|
|
26931
27946
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
26932
27947
|
mediaKey: string(),
|
|
@@ -26975,18 +27990,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
26975
27990
|
* fail, whatever became of the original. */
|
|
26976
27991
|
copied: boolean()
|
|
26977
27992
|
});
|
|
27993
|
+
/**
|
|
27994
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
27995
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
27996
|
+
* box recorded on the source media row when there is one, else the track
|
|
27997
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
27998
|
+
* until the operator confirms it.
|
|
27999
|
+
*/
|
|
28000
|
+
var RetrainPipelineBoxSchema = object({
|
|
28001
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
28002
|
+
bbox: RetrainBboxSchema,
|
|
28003
|
+
macroClass: RetrainMacroClassSchema,
|
|
28004
|
+
label: string().optional(),
|
|
28005
|
+
subLabel: string().optional(),
|
|
28006
|
+
/** The detection score of the position used, when it was recorded. */
|
|
28007
|
+
score: number().optional(),
|
|
28008
|
+
/** The root model that produced the track, when it was recorded. */
|
|
28009
|
+
modelId: string().optional(),
|
|
28010
|
+
trackId: string(),
|
|
28011
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
28012
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
28013
|
+
basis: _enum(["subject-box", "position"]),
|
|
28014
|
+
deltaMs: number()
|
|
28015
|
+
});
|
|
28016
|
+
/**
|
|
28017
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
28018
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
28019
|
+
* track at all.
|
|
28020
|
+
*/
|
|
28021
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
26978
28022
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
26979
28023
|
var RetrainFrameSchema = object({
|
|
26980
28024
|
frameId: string(),
|
|
26981
28025
|
deviceId: number(),
|
|
26982
|
-
|
|
26983
|
-
/**
|
|
26984
|
-
|
|
28026
|
+
origin: RetrainFrameOriginSchema,
|
|
28027
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
28028
|
+
trackId: string().optional(),
|
|
28029
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
28030
|
+
* Absent on a recording still. */
|
|
28031
|
+
sourceMediaId: number().int().optional(),
|
|
28032
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
28033
|
+
epochMs: number().optional(),
|
|
26985
28034
|
sourceKind: MediaFileKindEnum,
|
|
26986
28035
|
sizeBytes: number().int(),
|
|
26987
28036
|
width: number().int(),
|
|
26988
28037
|
height: number().int(),
|
|
26989
|
-
copiedAt: number()
|
|
28038
|
+
copiedAt: number(),
|
|
28039
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
28040
|
+
capturedAt: number().optional(),
|
|
28041
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
28042
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
28043
|
+
* a false positive. */
|
|
28044
|
+
complete: boolean(),
|
|
28045
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
28046
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
28047
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
28048
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
28049
|
+
collectionIds: array(string()).readonly().optional()
|
|
26990
28050
|
});
|
|
26991
28051
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
26992
28052
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -27007,6 +28067,53 @@ var RetrainFrameListSchema = object({
|
|
|
27007
28067
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
27008
28068
|
autoPickMediaId: number().int().optional()
|
|
27009
28069
|
});
|
|
28070
|
+
/**
|
|
28071
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
28072
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
28073
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
28074
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
28075
|
+
* export carried (`exportedInBatch`).
|
|
28076
|
+
*/
|
|
28077
|
+
var RetrainExportFilterSchema = object({
|
|
28078
|
+
deviceIds: array(number()).optional(),
|
|
28079
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
28080
|
+
/** Only frames in at least one of these named collections. */
|
|
28081
|
+
collectionIds: array(string()).max(200).optional(),
|
|
28082
|
+
batchId: string().optional(),
|
|
28083
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
28084
|
+
completeOnly: boolean().optional()
|
|
28085
|
+
});
|
|
28086
|
+
/**
|
|
28087
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
28088
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
28089
|
+
* convention — the classifier layout.
|
|
28090
|
+
*/
|
|
28091
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
28092
|
+
/**
|
|
28093
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
28094
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
28095
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
28096
|
+
* logged.
|
|
28097
|
+
*/
|
|
28098
|
+
var RetrainArchiveTargetSchema = object({
|
|
28099
|
+
kind: literal("http"),
|
|
28100
|
+
method: _enum(["PUT", "POST"]),
|
|
28101
|
+
url: string().url(),
|
|
28102
|
+
headers: record(string(), string()).optional()
|
|
28103
|
+
});
|
|
28104
|
+
var RetrainArchiveResultSchema = object({
|
|
28105
|
+
batchId: string(),
|
|
28106
|
+
frames: number().int(),
|
|
28107
|
+
crops: number().int(),
|
|
28108
|
+
annotations: number().int(),
|
|
28109
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
28110
|
+
missing: number().int(),
|
|
28111
|
+
bytes: number().int(),
|
|
28112
|
+
/** sha256 of the exact bytes sent. */
|
|
28113
|
+
sha256: string(),
|
|
28114
|
+
/** The target's HTTP status. */
|
|
28115
|
+
status: number().int()
|
|
28116
|
+
});
|
|
27010
28117
|
/** What the operator asked the assist to look for. */
|
|
27011
28118
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
27012
28119
|
kind: literal("package"),
|
|
@@ -27036,6 +28143,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
27036
28143
|
reason: string(),
|
|
27037
28144
|
detail: string().optional()
|
|
27038
28145
|
})]);
|
|
28146
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
28147
|
+
var RetrainCollectionSchema = object({
|
|
28148
|
+
id: string(),
|
|
28149
|
+
name: string(),
|
|
28150
|
+
createdAt: number(),
|
|
28151
|
+
frameCount: number().int()
|
|
28152
|
+
});
|
|
28153
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
28154
|
+
kind: literal("created"),
|
|
28155
|
+
collection: RetrainCollectionSchema
|
|
28156
|
+
}), object({
|
|
28157
|
+
kind: literal("refused"),
|
|
28158
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
28159
|
+
})]);
|
|
28160
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
28161
|
+
kind: literal("renamed"),
|
|
28162
|
+
collection: RetrainCollectionSchema
|
|
28163
|
+
}), object({
|
|
28164
|
+
kind: literal("refused"),
|
|
28165
|
+
reason: _enum([
|
|
28166
|
+
"empty-name",
|
|
28167
|
+
"duplicate-name",
|
|
28168
|
+
"unknown-collection"
|
|
28169
|
+
])
|
|
28170
|
+
})]);
|
|
28171
|
+
/**
|
|
28172
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
28173
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
28174
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
28175
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
28176
|
+
*/
|
|
28177
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
28178
|
+
kind: literal("added"),
|
|
28179
|
+
collectionId: string(),
|
|
28180
|
+
frame: RetrainFrameSchema,
|
|
28181
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
28182
|
+
reused: boolean()
|
|
28183
|
+
}), object({
|
|
28184
|
+
kind: literal("refused"),
|
|
28185
|
+
reason: _enum([
|
|
28186
|
+
"unknown-collection",
|
|
28187
|
+
"still-unavailable",
|
|
28188
|
+
"still-busy",
|
|
28189
|
+
"unreadable-image",
|
|
28190
|
+
"write-failed"
|
|
28191
|
+
]),
|
|
28192
|
+
detail: string().optional()
|
|
28193
|
+
})]);
|
|
28194
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
28195
|
+
var RetrainAssistProfileSchema = object({
|
|
28196
|
+
id: string(),
|
|
28197
|
+
name: string(),
|
|
28198
|
+
model: string(),
|
|
28199
|
+
kind: string(),
|
|
28200
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
28201
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
28202
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
28203
|
+
leavesHouse: boolean()
|
|
28204
|
+
});
|
|
28205
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
28206
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
28207
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
28208
|
+
var RetrainLlmReviewSchema = object({
|
|
28209
|
+
/** The `ref` the page sent the box under. */
|
|
28210
|
+
ref: string(),
|
|
28211
|
+
verdict: _enum([
|
|
28212
|
+
"confirmed",
|
|
28213
|
+
"wrong-class",
|
|
28214
|
+
"not-an-object",
|
|
28215
|
+
"uncertain"
|
|
28216
|
+
]),
|
|
28217
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
28218
|
+
reason: string()
|
|
28219
|
+
});
|
|
28220
|
+
/**
|
|
28221
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
28222
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
28223
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
28224
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
28225
|
+
*/
|
|
28226
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
28227
|
+
kind: literal("proposed"),
|
|
28228
|
+
profileId: string(),
|
|
28229
|
+
model: string(),
|
|
28230
|
+
/** The frame was sent outside the house for this answer. */
|
|
28231
|
+
leftHouse: boolean(),
|
|
28232
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
28233
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
28234
|
+
rejected: number().int()
|
|
28235
|
+
}), object({
|
|
28236
|
+
kind: literal("refused"),
|
|
28237
|
+
reason: _enum([
|
|
28238
|
+
"unknown-frame",
|
|
28239
|
+
"unreadable-frame",
|
|
28240
|
+
"unknown-profile",
|
|
28241
|
+
"profile-disabled",
|
|
28242
|
+
"no-vision",
|
|
28243
|
+
"cloud-not-confirmed",
|
|
28244
|
+
"llm-error",
|
|
28245
|
+
"malformed-answer"
|
|
28246
|
+
]),
|
|
28247
|
+
detail: string().optional()
|
|
28248
|
+
})]);
|
|
27039
28249
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
27040
28250
|
var RetrainTransitionResultSchema = object({
|
|
27041
28251
|
trackId: string(),
|
|
@@ -28252,7 +29462,7 @@ var pipelineAnalyticsCapability = {
|
|
|
28252
29462
|
* a frame leaves the dataset before export. */
|
|
28253
29463
|
deselectRetrainFrame: method(object({
|
|
28254
29464
|
deviceId: number(),
|
|
28255
|
-
trackId: string(),
|
|
29465
|
+
trackId: string().optional(),
|
|
28256
29466
|
frameId: string()
|
|
28257
29467
|
}), object({
|
|
28258
29468
|
removed: boolean(),
|
|
@@ -28295,7 +29505,8 @@ var pipelineAnalyticsCapability = {
|
|
|
28295
29505
|
*/
|
|
28296
29506
|
proposeRetrainAnnotations: method(object({
|
|
28297
29507
|
deviceId: number(),
|
|
28298
|
-
|
|
29508
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
29509
|
+
trackId: string().optional(),
|
|
28299
29510
|
frameId: string(),
|
|
28300
29511
|
subject: RetrainAssistSubjectSchema,
|
|
28301
29512
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -28304,8 +29515,12 @@ var pipelineAnalyticsCapability = {
|
|
|
28304
29515
|
kind: "mutation",
|
|
28305
29516
|
auth: "admin"
|
|
28306
29517
|
}),
|
|
28307
|
-
/** Every annotation on a track,
|
|
28308
|
-
|
|
29518
|
+
/** Every annotation on a track, or on named frames (a recording still has
|
|
29519
|
+
* no track), oldest first. One of the two is required. */
|
|
29520
|
+
listRetrainAnnotations: method(object({
|
|
29521
|
+
trackId: string().optional(),
|
|
29522
|
+
frameIds: array(string()).max(2e3).optional()
|
|
29523
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
28309
29524
|
kind: "query",
|
|
28310
29525
|
auth: "admin"
|
|
28311
29526
|
}),
|
|
@@ -28324,7 +29539,8 @@ var pipelineAnalyticsCapability = {
|
|
|
28324
29539
|
*/
|
|
28325
29540
|
saveRetrainAnnotations: method(object({
|
|
28326
29541
|
deviceId: number(),
|
|
28327
|
-
|
|
29542
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
29543
|
+
trackId: string().optional(),
|
|
28328
29544
|
frameId: string(),
|
|
28329
29545
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
28330
29546
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -28376,7 +29592,146 @@ var pipelineAnalyticsCapability = {
|
|
|
28376
29592
|
* out, so two crops of the same subject can never end up in one feature
|
|
28377
29593
|
* space (D52).
|
|
28378
29594
|
*/
|
|
28379
|
-
getRetrainExportUrl: method(
|
|
29595
|
+
getRetrainExportUrl: method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
29596
|
+
kind: "query",
|
|
29597
|
+
auth: "admin"
|
|
29598
|
+
}),
|
|
29599
|
+
/**
|
|
29600
|
+
* The operator's "every subject in this frame is boxed" — set and cleared
|
|
29601
|
+
* by hand, never derived: a frame with no box may be a complete hard
|
|
29602
|
+
* negative, and a frame with three boxes may still miss a fourth person.
|
|
29603
|
+
*/
|
|
29604
|
+
setRetrainFrameComplete: method(object({
|
|
29605
|
+
deviceId: number(),
|
|
29606
|
+
trackId: string().optional(),
|
|
29607
|
+
frameId: string(),
|
|
29608
|
+
complete: boolean()
|
|
29609
|
+
}), RetrainFrameSchema, {
|
|
29610
|
+
kind: "mutation",
|
|
29611
|
+
auth: "admin"
|
|
29612
|
+
}),
|
|
29613
|
+
/**
|
|
29614
|
+
* Stream the annotated archive to a TARGET instead of a browser — the
|
|
29615
|
+
* same tar `getRetrainExportUrl` serves (manifest first, one JPEG in
|
|
29616
|
+
* memory at a time, paced), written chunk by chunk into one HTTP request.
|
|
29617
|
+
* The bytes never cross this cap and never land on the hub's disk; the
|
|
29618
|
+
* answer is what was sent, with its sha256.
|
|
29619
|
+
*/
|
|
29620
|
+
writeRetrainArchive: method(object({
|
|
29621
|
+
filter: RetrainExportFilterSchema,
|
|
29622
|
+
layout: RetrainExportLayoutSchema,
|
|
29623
|
+
target: RetrainArchiveTargetSchema
|
|
29624
|
+
}), RetrainArchiveResultSchema, {
|
|
29625
|
+
kind: "mutation",
|
|
29626
|
+
auth: "admin",
|
|
29627
|
+
timeoutMs: 60 * 6e4
|
|
29628
|
+
}),
|
|
29629
|
+
/** The enabled, vision-capable LLM profiles, each saying whether a frame
|
|
29630
|
+
* sent to it leaves the house. */
|
|
29631
|
+
listRetrainAssistProfiles: method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
29632
|
+
kind: "query",
|
|
29633
|
+
auth: "admin"
|
|
29634
|
+
}),
|
|
29635
|
+
/**
|
|
29636
|
+
* Ask a vision LLM (the `llm` capability) about ONE copied frame: list the
|
|
29637
|
+
* objects of `classes` with boxes, and review the boxes already on the
|
|
29638
|
+
* canvas (sent by `ref`). Answers drafts (`source: 'llm'`) and reviews —
|
|
29639
|
+
* nothing is stored, nothing is accepted. A profile that sends the frame
|
|
29640
|
+
* outside the house is refused unless `allowCloud` says the operator
|
|
29641
|
+
* confirmed this run.
|
|
29642
|
+
*/
|
|
29643
|
+
proposeRetrainAnnotationsWithLlm: method(object({
|
|
29644
|
+
deviceId: number(),
|
|
29645
|
+
trackId: string().optional(),
|
|
29646
|
+
frameId: string(),
|
|
29647
|
+
profileId: string(),
|
|
29648
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
29649
|
+
boxes: array(object({
|
|
29650
|
+
ref: string(),
|
|
29651
|
+
bbox: RetrainBboxSchema,
|
|
29652
|
+
macroClass: RetrainMacroClassSchema,
|
|
29653
|
+
label: string().optional()
|
|
29654
|
+
})).max(50),
|
|
29655
|
+
allowCloud: boolean()
|
|
29656
|
+
}), RetrainLlmAssistResultSchema, {
|
|
29657
|
+
kind: "mutation",
|
|
29658
|
+
auth: "admin",
|
|
29659
|
+
timeoutMs: 18e4
|
|
29660
|
+
}),
|
|
29661
|
+
/**
|
|
29662
|
+
* Create a named collection — a set over the retrain corpus ("packages
|
|
29663
|
+
* porch night"). Names are unique case-insensitively and never empty;
|
|
29664
|
+
* both refusals are named.
|
|
29665
|
+
*/
|
|
29666
|
+
createRetrainCollection: method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
29667
|
+
kind: "mutation",
|
|
29668
|
+
auth: "admin"
|
|
29669
|
+
}),
|
|
29670
|
+
/** Every collection, newest first, with its frame count. */
|
|
29671
|
+
listRetrainCollections: method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
29672
|
+
kind: "query",
|
|
29673
|
+
auth: "admin"
|
|
29674
|
+
}),
|
|
29675
|
+
renameRetrainCollection: method(object({
|
|
29676
|
+
id: string(),
|
|
29677
|
+
name: string().max(120)
|
|
29678
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
29679
|
+
kind: "mutation",
|
|
29680
|
+
auth: "admin"
|
|
29681
|
+
}),
|
|
29682
|
+
/**
|
|
29683
|
+
* Delete a collection. Its recording stills that no other collection
|
|
29684
|
+
* holds are deleted with their annotations (nothing else reaches them);
|
|
29685
|
+
* frames copied from tracks always stay in the dataset.
|
|
29686
|
+
*/
|
|
29687
|
+
deleteRetrainCollection: method(object({ id: string() }), object({
|
|
29688
|
+
deleted: boolean(),
|
|
29689
|
+
removedFrames: number().int()
|
|
29690
|
+
}), {
|
|
29691
|
+
kind: "mutation",
|
|
29692
|
+
auth: "admin"
|
|
29693
|
+
}),
|
|
29694
|
+
/**
|
|
29695
|
+
* Add the frame at a recording instant to a collection — the frame the
|
|
29696
|
+
* model may have seen NOTHING in. The recorder re-decodes the native
|
|
29697
|
+
* frame at `epochMs`; the dataset copies it (trackless, durable). The same
|
|
29698
|
+
* moment twice is one copy. Every refusal is named.
|
|
29699
|
+
*/
|
|
29700
|
+
addRetrainFrameFromRecording: method(object({
|
|
29701
|
+
collectionId: string(),
|
|
29702
|
+
deviceId: number(),
|
|
29703
|
+
epochMs: number()
|
|
29704
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
29705
|
+
kind: "mutation",
|
|
29706
|
+
auth: "admin",
|
|
29707
|
+
timeoutMs: 6e4
|
|
29708
|
+
}),
|
|
29709
|
+
/** Add frames already in the dataset to a collection. */
|
|
29710
|
+
addRetrainFramesToCollection: method(object({
|
|
29711
|
+
collectionId: string(),
|
|
29712
|
+
frameIds: array(string()).min(1).max(500)
|
|
29713
|
+
}), object({
|
|
29714
|
+
added: number().int(),
|
|
29715
|
+
alreadyMember: number().int(),
|
|
29716
|
+
unknownFrameIds: array(string()).readonly()
|
|
29717
|
+
}), {
|
|
29718
|
+
kind: "mutation",
|
|
29719
|
+
auth: "admin"
|
|
29720
|
+
}),
|
|
29721
|
+
/** Remove a frame from a collection. A recording still left in no
|
|
29722
|
+
* collection is deleted with its annotations (`deletedFrame`). */
|
|
29723
|
+
removeRetrainFrameFromCollection: method(object({
|
|
29724
|
+
collectionId: string(),
|
|
29725
|
+
frameId: string()
|
|
29726
|
+
}), object({
|
|
29727
|
+
removed: boolean(),
|
|
29728
|
+
deletedFrame: boolean()
|
|
29729
|
+
}), {
|
|
29730
|
+
kind: "mutation",
|
|
29731
|
+
auth: "admin"
|
|
29732
|
+
}),
|
|
29733
|
+
/** The frames of a collection, with their pipeline boxes. */
|
|
29734
|
+
listRetrainCollectionFrames: method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
28380
29735
|
kind: "query",
|
|
28381
29736
|
auth: "admin"
|
|
28382
29737
|
}),
|
|
@@ -29319,13 +30674,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
29319
30674
|
object({
|
|
29320
30675
|
kind: literal("no-family-build"),
|
|
29321
30676
|
format: ModelFormatSchema$1
|
|
30677
|
+
}),
|
|
30678
|
+
object({
|
|
30679
|
+
kind: literal("kept-custom-pin"),
|
|
30680
|
+
modelId: string(),
|
|
30681
|
+
deviceKey: string()
|
|
29322
30682
|
})
|
|
29323
30683
|
]);
|
|
30684
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
30685
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
30686
|
+
/**
|
|
30687
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
30688
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
30689
|
+
*/
|
|
30690
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
30691
|
+
kind: literal("node-benchmark"),
|
|
30692
|
+
resultId: string(),
|
|
30693
|
+
measuredAtMs: number()
|
|
30694
|
+
})]);
|
|
29324
30695
|
var DeviceModelChoiceSchema = object({
|
|
29325
30696
|
modelId: string(),
|
|
29326
30697
|
p50Ms: number(),
|
|
29327
30698
|
fps: number(),
|
|
29328
30699
|
measured: boolean(),
|
|
30700
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
30701
|
+
source: LatencySourceSchema.optional(),
|
|
29329
30702
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
29330
30703
|
capacitySessions: number(),
|
|
29331
30704
|
personRecall: number()
|
|
@@ -29336,6 +30709,8 @@ var DeviceRecommendationSchema = object({
|
|
|
29336
30709
|
enabled: boolean(),
|
|
29337
30710
|
available: boolean(),
|
|
29338
30711
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
30712
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
30713
|
+
kept: KeptReasonSchema.optional(),
|
|
29339
30714
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
29340
30715
|
});
|
|
29341
30716
|
var NodeRecommendationSchema = object({
|
|
@@ -29389,6 +30764,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
29389
30764
|
kind: literal("coral-enabled"),
|
|
29390
30765
|
nodeId: string(),
|
|
29391
30766
|
deviceKey: string()
|
|
30767
|
+
}),
|
|
30768
|
+
object({
|
|
30769
|
+
kind: literal("custom-pin-kept"),
|
|
30770
|
+
nodeId: string(),
|
|
30771
|
+
deviceKey: string().nullable(),
|
|
30772
|
+
deviceId: number().nullable(),
|
|
30773
|
+
modelId: string()
|
|
30774
|
+
}),
|
|
30775
|
+
object({
|
|
30776
|
+
kind: literal("custom-registry-unreadable"),
|
|
30777
|
+
error: string()
|
|
29392
30778
|
})
|
|
29393
30779
|
]);
|
|
29394
30780
|
var AutoTuneOptionsSchema = object({
|
|
@@ -29567,13 +30953,14 @@ var SuggestSharesResultSchema = object({
|
|
|
29567
30953
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
29568
30954
|
});
|
|
29569
30955
|
/**
|
|
29570
|
-
* Where the node and device shares come from (D750, D755).
|
|
29571
|
-
* - `
|
|
29572
|
-
*
|
|
29573
|
-
*
|
|
29574
|
-
*
|
|
29575
|
-
*
|
|
29576
|
-
*
|
|
30956
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
30957
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
30958
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
30959
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
30960
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
30961
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
30962
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
30963
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
29577
30964
|
* - `manual` — the operator's stored sliders.
|
|
29578
30965
|
* Either way a node or device that cannot take sessions gives its share to
|
|
29579
30966
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -29622,6 +31009,362 @@ var EffectiveSharesSchema = object({
|
|
|
29622
31009
|
nodeWeights: record(string(), number()),
|
|
29623
31010
|
deviceWeights: record(string(), record(string(), number()))
|
|
29624
31011
|
});
|
|
31012
|
+
/**
|
|
31013
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
31014
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
31015
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
31016
|
+
* shares read.
|
|
31017
|
+
*
|
|
31018
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
31019
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
31020
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
31021
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
31022
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
31023
|
+
*
|
|
31024
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
31025
|
+
* cross a process at frame rate, D9):
|
|
31026
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
31027
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
31028
|
+
* interval;
|
|
31029
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
31030
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
31031
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
31032
|
+
* CPU, RAM or the event loop give out.
|
|
31033
|
+
*/
|
|
31034
|
+
/** Defaults and bounds, one place. */
|
|
31035
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
31036
|
+
fpsPerStream: 10,
|
|
31037
|
+
budgetMinutes: 45,
|
|
31038
|
+
minBudgetMinutes: 10,
|
|
31039
|
+
maxBudgetMinutes: 120,
|
|
31040
|
+
/** A result older than this no longer beats the table. */
|
|
31041
|
+
staleAfterDays: 30,
|
|
31042
|
+
/** Warm-in per ramp step (not accounted). */
|
|
31043
|
+
settleSec: 5,
|
|
31044
|
+
/** Accounted window per ramp step. */
|
|
31045
|
+
measureSec: 20,
|
|
31046
|
+
/** Longest the drain may take before the run is refused. */
|
|
31047
|
+
drainTimeoutSec: 120,
|
|
31048
|
+
/** Candidate models per device in one run. */
|
|
31049
|
+
maxModelsPerDevice: 6
|
|
31050
|
+
};
|
|
31051
|
+
/** The two measurements a run can make. */
|
|
31052
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
31053
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
31054
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
31055
|
+
deviceKey: string().min(1),
|
|
31056
|
+
/**
|
|
31057
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
31058
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
31059
|
+
*/
|
|
31060
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
31061
|
+
});
|
|
31062
|
+
/** What the operator confirmed. */
|
|
31063
|
+
var NodeBenchmarkPlanSchema = object({
|
|
31064
|
+
nodeId: string().min(1),
|
|
31065
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
31066
|
+
/** Which measurements run. At least one. */
|
|
31067
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
31068
|
+
/**
|
|
31069
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
31070
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
31071
|
+
* detector always runs.
|
|
31072
|
+
*/
|
|
31073
|
+
steps: array(string().min(1)).default([]),
|
|
31074
|
+
/** Offered rate of one stream / session. */
|
|
31075
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
31076
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
31077
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
31078
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
31079
|
+
keepDownloadedModels: boolean().default(false),
|
|
31080
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
31081
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
31082
|
+
});
|
|
31083
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
31084
|
+
kind: _enum([
|
|
31085
|
+
"benchmark-active",
|
|
31086
|
+
"node-offline",
|
|
31087
|
+
"unknown-device",
|
|
31088
|
+
"no-phase",
|
|
31089
|
+
"insufficient-headroom"
|
|
31090
|
+
]),
|
|
31091
|
+
detail: string(),
|
|
31092
|
+
overridable: boolean()
|
|
31093
|
+
});
|
|
31094
|
+
/** A camera whose detection leaves the node for the run. */
|
|
31095
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
31096
|
+
deviceId: number(),
|
|
31097
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
31098
|
+
placedOnNode: boolean(),
|
|
31099
|
+
/** A node pin naming this node, ignored for the run. */
|
|
31100
|
+
pinnedToNode: boolean()
|
|
31101
|
+
});
|
|
31102
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
31103
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
31104
|
+
deviceId: number(),
|
|
31105
|
+
reason: literal("only-frame-source")
|
|
31106
|
+
});
|
|
31107
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
31108
|
+
nodeId: string(),
|
|
31109
|
+
online: boolean(),
|
|
31110
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
31111
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
31112
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
31113
|
+
estimatedDurationMs: number(),
|
|
31114
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
31115
|
+
budgetMs: number(),
|
|
31116
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
31117
|
+
steps: array(string()).readonly(),
|
|
31118
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
31119
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
31120
|
+
headroom: object({
|
|
31121
|
+
sessionsNow: number(),
|
|
31122
|
+
otherNodesCapacitySessions: number().nullable()
|
|
31123
|
+
}),
|
|
31124
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
31125
|
+
canStart: boolean()
|
|
31126
|
+
});
|
|
31127
|
+
/** Where the measuring runner is. */
|
|
31128
|
+
var NodeBenchProgressSchema = object({
|
|
31129
|
+
phase: _enum([
|
|
31130
|
+
"preparing",
|
|
31131
|
+
"device",
|
|
31132
|
+
"pipeline",
|
|
31133
|
+
"cleanup"
|
|
31134
|
+
]),
|
|
31135
|
+
deviceKey: string().nullable(),
|
|
31136
|
+
modelId: string().nullable(),
|
|
31137
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
31138
|
+
load: number().nullable(),
|
|
31139
|
+
cellsDone: number(),
|
|
31140
|
+
cellsTotal: number(),
|
|
31141
|
+
message: string()
|
|
31142
|
+
});
|
|
31143
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
31144
|
+
var NodeBenchLimitSchema = _enum([
|
|
31145
|
+
"p95",
|
|
31146
|
+
"drops",
|
|
31147
|
+
"errors",
|
|
31148
|
+
"stall",
|
|
31149
|
+
"cpu",
|
|
31150
|
+
"ram",
|
|
31151
|
+
"none"
|
|
31152
|
+
]);
|
|
31153
|
+
var NodeBenchRampStepSchema = object({
|
|
31154
|
+
load: number(),
|
|
31155
|
+
pass: boolean(),
|
|
31156
|
+
p95Ms: number(),
|
|
31157
|
+
dropRatio: number(),
|
|
31158
|
+
/** Completed frames per second over the accounted window. */
|
|
31159
|
+
fps: number(),
|
|
31160
|
+
cpuPct: number().nullable(),
|
|
31161
|
+
ramFreePct: number().nullable(),
|
|
31162
|
+
failReasons: array(string()).readonly()
|
|
31163
|
+
});
|
|
31164
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
31165
|
+
phase: literal("device"),
|
|
31166
|
+
deviceKey: string(),
|
|
31167
|
+
modelId: string(),
|
|
31168
|
+
/** Single-stream latency (the K = 1 step). */
|
|
31169
|
+
p50Ms: number(),
|
|
31170
|
+
p95Ms: number(),
|
|
31171
|
+
p99Ms: number(),
|
|
31172
|
+
/** Frames per second sustained at the last passing step. */
|
|
31173
|
+
fps: number(),
|
|
31174
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
31175
|
+
kMax: number(),
|
|
31176
|
+
limitedBy: NodeBenchLimitSchema,
|
|
31177
|
+
/** First call (model load + warm-up). */
|
|
31178
|
+
warmupMs: number(),
|
|
31179
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
31180
|
+
}), object({
|
|
31181
|
+
phase: literal("pipeline"),
|
|
31182
|
+
deviceKey: string(),
|
|
31183
|
+
modelId: string(),
|
|
31184
|
+
steps: array(string()).readonly(),
|
|
31185
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
31186
|
+
maxSessions: number(),
|
|
31187
|
+
limitedBy: NodeBenchLimitSchema,
|
|
31188
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
31189
|
+
stepsFired: array(string()).readonly(),
|
|
31190
|
+
warmupMs: number(),
|
|
31191
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
31192
|
+
})]);
|
|
31193
|
+
/**
|
|
31194
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
31195
|
+
* the node no longer beats the table.
|
|
31196
|
+
*/
|
|
31197
|
+
var NodeBenchFingerprintSchema = object({
|
|
31198
|
+
pipelineVersion: string().nullable(),
|
|
31199
|
+
cpuModel: string().nullable(),
|
|
31200
|
+
ramGb: number().nullable(),
|
|
31201
|
+
os: string().nullable(),
|
|
31202
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
31203
|
+
pools: record(string(), object({
|
|
31204
|
+
runtime: string(),
|
|
31205
|
+
numWorkers: number(),
|
|
31206
|
+
concurrency: number(),
|
|
31207
|
+
batchMode: string()
|
|
31208
|
+
})).default({})
|
|
31209
|
+
});
|
|
31210
|
+
/** The frames the run used. */
|
|
31211
|
+
var NodeBenchClipSchema = object({
|
|
31212
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
31213
|
+
id: string(),
|
|
31214
|
+
revision: string().nullable(),
|
|
31215
|
+
frames: number(),
|
|
31216
|
+
width: number(),
|
|
31217
|
+
height: number()
|
|
31218
|
+
});
|
|
31219
|
+
var NodeBenchRunnerInputSchema = object({
|
|
31220
|
+
runId: string().min(1),
|
|
31221
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
31222
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
31223
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
31224
|
+
steps: array(string()).default([]),
|
|
31225
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
31226
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
31227
|
+
deadlineAtMs: number(),
|
|
31228
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
31229
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
31230
|
+
keepDownloadedModels: boolean().default(false)
|
|
31231
|
+
});
|
|
31232
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
31233
|
+
"running",
|
|
31234
|
+
"done",
|
|
31235
|
+
"failed",
|
|
31236
|
+
"aborted"
|
|
31237
|
+
]);
|
|
31238
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
31239
|
+
runId: string(),
|
|
31240
|
+
nodeId: string(),
|
|
31241
|
+
state: NodeBenchRunnerStateSchema,
|
|
31242
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
31243
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
31244
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
31245
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
31246
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
31247
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
31248
|
+
activeCameraIds: array(number()).readonly(),
|
|
31249
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
31250
|
+
deletedModels: array(string()).readonly(),
|
|
31251
|
+
error: string().nullable(),
|
|
31252
|
+
startedAtMs: number(),
|
|
31253
|
+
finishedAtMs: number().nullable()
|
|
31254
|
+
});
|
|
31255
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
31256
|
+
"draining",
|
|
31257
|
+
"measuring",
|
|
31258
|
+
"restoring",
|
|
31259
|
+
"done",
|
|
31260
|
+
"failed",
|
|
31261
|
+
"aborted"
|
|
31262
|
+
]);
|
|
31263
|
+
/** Why a run ended. */
|
|
31264
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
31265
|
+
"completed",
|
|
31266
|
+
"operator-abort",
|
|
31267
|
+
"deadline",
|
|
31268
|
+
"node-lost",
|
|
31269
|
+
"runner-lost",
|
|
31270
|
+
"hub-restart",
|
|
31271
|
+
"drain-timeout",
|
|
31272
|
+
"failed"
|
|
31273
|
+
]);
|
|
31274
|
+
var NodeBenchmarkRunSchema = object({
|
|
31275
|
+
runId: string(),
|
|
31276
|
+
nodeId: string(),
|
|
31277
|
+
state: NodeBenchmarkStateSchema,
|
|
31278
|
+
plan: NodeBenchmarkPlanSchema,
|
|
31279
|
+
startedAtMs: number(),
|
|
31280
|
+
deadlineAtMs: number(),
|
|
31281
|
+
finishedAtMs: number().nullable(),
|
|
31282
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
31283
|
+
error: string().nullable(),
|
|
31284
|
+
/** Cameras moved off the node for the run. */
|
|
31285
|
+
moved: array(number()).readonly(),
|
|
31286
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
31287
|
+
staying: array(number()).readonly(),
|
|
31288
|
+
/** Something else ran on the node's pools during the run. */
|
|
31289
|
+
contaminated: boolean(),
|
|
31290
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
31291
|
+
resultIds: array(string()).readonly()
|
|
31292
|
+
});
|
|
31293
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
31294
|
+
var NodeBenchmarkStatusSchema = object({
|
|
31295
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
31296
|
+
modeNodeId: string().nullable(),
|
|
31297
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
31298
|
+
});
|
|
31299
|
+
/**
|
|
31300
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
31301
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
31302
|
+
* ends, never by anyone else.
|
|
31303
|
+
*/
|
|
31304
|
+
var NodeBenchmarkResultSchema = object({
|
|
31305
|
+
id: string(),
|
|
31306
|
+
runId: string(),
|
|
31307
|
+
nodeId: string(),
|
|
31308
|
+
cell: NodeBenchCellSchema,
|
|
31309
|
+
fpsPerStream: number(),
|
|
31310
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
31311
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
31312
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
31313
|
+
contaminated: boolean(),
|
|
31314
|
+
stayingCameras: array(number()).readonly(),
|
|
31315
|
+
/** The run ended early; the cell itself completed. */
|
|
31316
|
+
partialRun: boolean(),
|
|
31317
|
+
measuredAtMs: number()
|
|
31318
|
+
});
|
|
31319
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
31320
|
+
nodeId: string().optional(),
|
|
31321
|
+
deviceKey: string().optional()
|
|
31322
|
+
});
|
|
31323
|
+
/** A result with its standing today: does it still beat the table? */
|
|
31324
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
31325
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
31326
|
+
standing: _enum([
|
|
31327
|
+
"fresh",
|
|
31328
|
+
"stale",
|
|
31329
|
+
"superseded"
|
|
31330
|
+
]),
|
|
31331
|
+
staleWhy: _enum([
|
|
31332
|
+
"age",
|
|
31333
|
+
"runtime",
|
|
31334
|
+
"pool-tuning"
|
|
31335
|
+
]).nullable()
|
|
31336
|
+
});
|
|
31337
|
+
object({
|
|
31338
|
+
runId: string(),
|
|
31339
|
+
nodeId: string(),
|
|
31340
|
+
startedAtMs: number(),
|
|
31341
|
+
deadlineAtMs: number(),
|
|
31342
|
+
plan: NodeBenchmarkPlanSchema,
|
|
31343
|
+
moved: array(number()).readonly(),
|
|
31344
|
+
staying: array(number()).readonly()
|
|
31345
|
+
});
|
|
31346
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
31347
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
31348
|
+
nodeId: string(),
|
|
31349
|
+
reachable: boolean(),
|
|
31350
|
+
devices: array(object({
|
|
31351
|
+
deviceKey: string(),
|
|
31352
|
+
enabled: boolean(),
|
|
31353
|
+
available: boolean(),
|
|
31354
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
31355
|
+
suggested: array(string()).readonly(),
|
|
31356
|
+
/** Every root detector the device has a build for. */
|
|
31357
|
+
all: array(string()).readonly(),
|
|
31358
|
+
/** The model the device runs now, when pinned. */
|
|
31359
|
+
currentModelId: string().nullable()
|
|
31360
|
+
})).readonly(),
|
|
31361
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
31362
|
+
steps: array(object({
|
|
31363
|
+
id: string(),
|
|
31364
|
+
name: string(),
|
|
31365
|
+
slot: string()
|
|
31366
|
+
})).readonly()
|
|
31367
|
+
});
|
|
29625
31368
|
object({
|
|
29626
31369
|
activeCameras: number(),
|
|
29627
31370
|
throttledCameras: number(),
|
|
@@ -30940,7 +32683,30 @@ var pipelineRunnerCapability = {
|
|
|
30940
32683
|
releaseParkedTrackFrames: method(object({
|
|
30941
32684
|
deviceId: number(),
|
|
30942
32685
|
trackId: string()
|
|
30943
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
32686
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }),
|
|
32687
|
+
/**
|
|
32688
|
+
* Start measuring THIS node for the orchestrator's node benchmark: the
|
|
32689
|
+
* bench clip decoded once into RAM, each device × candidate detector on an
|
|
32690
|
+
* open-loop ramp (`device`), then the chosen pipeline with the requested
|
|
32691
|
+
* detail steps (`pipeline`). Everything runs in-process with the executor
|
|
32692
|
+
* — no frame crosses a node (D9) — and writes nothing: no track, event,
|
|
32693
|
+
* media or notification. Reached by `nodePin(nodeId)`. Answers at once;
|
|
32694
|
+
* one run per node; the run stops itself at `deadlineAtMs`.
|
|
32695
|
+
*/
|
|
32696
|
+
startNodeBench: method(NodeBenchRunnerInputSchema, object({
|
|
32697
|
+
accepted: literal(true),
|
|
32698
|
+
runId: string()
|
|
32699
|
+
}), {
|
|
32700
|
+
kind: "mutation",
|
|
32701
|
+
auth: "admin"
|
|
32702
|
+
}),
|
|
32703
|
+
/** The run's progress and every finished cell; null when this runner does not know `runId`. */
|
|
32704
|
+
getNodeBenchStatus: method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }),
|
|
32705
|
+
/** Stop the run; what it finished is kept. */
|
|
32706
|
+
abortNodeBench: method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
32707
|
+
kind: "mutation",
|
|
32708
|
+
auth: "admin"
|
|
32709
|
+
})
|
|
30944
32710
|
}
|
|
30945
32711
|
};
|
|
30946
32712
|
var CameraPipelineConfigSchema = object({
|
|
@@ -31868,6 +33634,51 @@ var pipelineOrchestratorCapability = {
|
|
|
31868
33634
|
kind: "mutation",
|
|
31869
33635
|
auth: "admin"
|
|
31870
33636
|
}),
|
|
33637
|
+
/**
|
|
33638
|
+
* Node benchmark — what a run of this plan would do, without doing it:
|
|
33639
|
+
* the cameras that leave the node, those that cannot (the node is their
|
|
33640
|
+
* only frame source; they stay and flag the run), the estimated duration
|
|
33641
|
+
* and every reason it may not start. The confirmation shows this.
|
|
33642
|
+
*/
|
|
33643
|
+
getNodeBenchmarkPreflight: method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }),
|
|
33644
|
+
/**
|
|
33645
|
+
* Node benchmark — start ONE run (cluster-wide lock). The orchestrator
|
|
33646
|
+
* persists a restore manifest, enters benchmark mode for the node (out of
|
|
33647
|
+
* placement, its camera pins ignored, nothing rewritten), drains it, drives
|
|
33648
|
+
* the node's own runner, then restores — always, including after an
|
|
33649
|
+
* abort, a lost node or a hub restart. Answers at once; poll
|
|
33650
|
+
* `getNodeBenchmarkStatus`. Refused runs carry the preflight.
|
|
33651
|
+
*/
|
|
33652
|
+
startNodeBenchmark: method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
33653
|
+
kind: literal("started"),
|
|
33654
|
+
runId: string()
|
|
33655
|
+
}), object({
|
|
33656
|
+
kind: literal("refused"),
|
|
33657
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
33658
|
+
})]), {
|
|
33659
|
+
kind: "mutation",
|
|
33660
|
+
auth: "admin"
|
|
33661
|
+
}),
|
|
33662
|
+
/** Node benchmark — the active run (or the last one) and the node in benchmark mode. */
|
|
33663
|
+
getNodeBenchmarkStatus: method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }),
|
|
33664
|
+
/** Node benchmark — stop the active run; the cluster is restored as it was. */
|
|
33665
|
+
abortNodeBenchmark: method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
33666
|
+
kind: "mutation",
|
|
33667
|
+
auth: "admin"
|
|
33668
|
+
}),
|
|
33669
|
+
/**
|
|
33670
|
+
* Node benchmark — root detector candidates per device (what Auto tune
|
|
33671
|
+
* would pick first, then the family) and the detail steps the node's
|
|
33672
|
+
* catalog offers, for the plan editor.
|
|
33673
|
+
*/
|
|
33674
|
+
getNodeBenchmarkCandidates: method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }),
|
|
33675
|
+
/** Node benchmark — stored results, newest first, each with its standing today. */
|
|
33676
|
+
listNodeBenchmarkResults: method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }),
|
|
33677
|
+
/** Node benchmark — delete one result; Auto tune and the shares stop reading it. */
|
|
33678
|
+
deleteNodeBenchmarkResult: method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
33679
|
+
kind: "mutation",
|
|
33680
|
+
auth: "admin"
|
|
33681
|
+
}),
|
|
31871
33682
|
/** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
|
|
31872
33683
|
getCameraSettings: method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()),
|
|
31873
33684
|
/** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
|
|
@@ -32785,7 +34596,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
32785
34596
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
32786
34597
|
* operator already consented to.
|
|
32787
34598
|
*/
|
|
32788
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
34599
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
34600
|
+
/**
|
|
34601
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
34602
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
34603
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
34604
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
34605
|
+
*/
|
|
34606
|
+
linkIntent: string().optional(),
|
|
34607
|
+
/**
|
|
34608
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
34609
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
34610
|
+
*/
|
|
34611
|
+
issuer: string().optional()
|
|
32789
34612
|
});
|
|
32790
34613
|
var ssoBridgeCapability = {
|
|
32791
34614
|
name: "sso-bridge",
|
|
@@ -35328,7 +37151,22 @@ var webrtcSessionCapability = {
|
|
|
35328
37151
|
* field their hints were silently stripped by the schema and the
|
|
35329
37152
|
* adaptive ladder started blind on the client's display size.
|
|
35330
37153
|
*/
|
|
35331
|
-
hints: webrtcClientHintsSchema.optional()
|
|
37154
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
37155
|
+
/**
|
|
37156
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
37157
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
37158
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
37159
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
37160
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
37161
|
+
*
|
|
37162
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
37163
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
37164
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
37165
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
37166
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
37167
|
+
* flag must not become a second door to the camera's speaker.
|
|
37168
|
+
*/
|
|
37169
|
+
talkback: boolean().optional()
|
|
35332
37170
|
}), object({
|
|
35333
37171
|
sessionId: string(),
|
|
35334
37172
|
sdpAnswer: string()
|
|
@@ -39321,6 +41159,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
39321
41159
|
enabled: boolean().optional(),
|
|
39322
41160
|
info: record(string(), unknown()).optional(),
|
|
39323
41161
|
settings: record(string(), unknown()).optional(),
|
|
41162
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
41163
|
+
* the keychain, not the table (D787). */
|
|
41164
|
+
secretKeys: array(string()).optional(),
|
|
39324
41165
|
skipRestart: boolean().optional()
|
|
39325
41166
|
});
|
|
39326
41167
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -39356,7 +41197,9 @@ var integrationsCapability = {
|
|
|
39356
41197
|
getSettings: method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }),
|
|
39357
41198
|
setSettings: method(object({
|
|
39358
41199
|
id: string(),
|
|
39359
|
-
settings: record(string(), unknown())
|
|
41200
|
+
settings: record(string(), unknown()),
|
|
41201
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
41202
|
+
secretKeys: array(string()).optional()
|
|
39360
41203
|
}), object({ success: boolean() }), {
|
|
39361
41204
|
kind: "mutation",
|
|
39362
41205
|
auth: "admin"
|
|
@@ -47252,6 +49095,22 @@ var TotpStatusSchema = object({
|
|
|
47252
49095
|
* delegation, structural caller-scope subset check goes inside the
|
|
47253
49096
|
* provider.
|
|
47254
49097
|
*/
|
|
49098
|
+
var ExternalIdentitySchema = object({
|
|
49099
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
49100
|
+
provider: string(),
|
|
49101
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
49102
|
+
subject: string(),
|
|
49103
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
49104
|
+
issuer: string(),
|
|
49105
|
+
userId: string(),
|
|
49106
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
49107
|
+
label: string().optional(),
|
|
49108
|
+
linkedAt: number()
|
|
49109
|
+
});
|
|
49110
|
+
var ExternalIdentityKeySchema = object({
|
|
49111
|
+
provider: string().min(1),
|
|
49112
|
+
subject: string().min(1)
|
|
49113
|
+
});
|
|
47255
49114
|
var userManagementCapability = {
|
|
47256
49115
|
name: "user-management",
|
|
47257
49116
|
scope: "system",
|
|
@@ -47394,6 +49253,32 @@ var userManagementCapability = {
|
|
|
47394
49253
|
username: string(),
|
|
47395
49254
|
scopes: array(TokenScopeSchema)
|
|
47396
49255
|
}).nullable(), { access: "view" }),
|
|
49256
|
+
listExternalIdentities: method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }),
|
|
49257
|
+
/** The user an identity is linked to, or `null`. */
|
|
49258
|
+
findUserByExternalIdentity: method(ExternalIdentityKeySchema, object({
|
|
49259
|
+
userId: string(),
|
|
49260
|
+
issuer: string()
|
|
49261
|
+
}).nullable(), { auth: "admin" }),
|
|
49262
|
+
/**
|
|
49263
|
+
* Link `(provider, subject)` to `userId`. Idempotent for the same user;
|
|
49264
|
+
* REFUSES (throws) an identity already linked to another user, and a
|
|
49265
|
+
* user that does not exist.
|
|
49266
|
+
*/
|
|
49267
|
+
linkExternalIdentity: method(ExternalIdentityKeySchema.extend({
|
|
49268
|
+
userId: string(),
|
|
49269
|
+
issuer: string().min(1),
|
|
49270
|
+
label: string().optional()
|
|
49271
|
+
}), object({ success: literal(true) }), {
|
|
49272
|
+
kind: "mutation",
|
|
49273
|
+
auth: "admin",
|
|
49274
|
+
access: "create"
|
|
49275
|
+
}),
|
|
49276
|
+
/** Remove one link of `userId`. `success: false` when it was not linked to that user. */
|
|
49277
|
+
unlinkExternalIdentity: method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
49278
|
+
kind: "mutation",
|
|
49279
|
+
auth: "admin",
|
|
49280
|
+
access: "delete"
|
|
49281
|
+
}),
|
|
47397
49282
|
listOauthSessions: method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }),
|
|
47398
49283
|
revokeOauthSession: method(object({ id: string() }), object({ success: boolean() }), {
|
|
47399
49284
|
kind: "mutation",
|
|
@@ -48637,7 +50522,8 @@ var BaseDevice = class {
|
|
|
48637
50522
|
this.role = options.role;
|
|
48638
50523
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
48639
50524
|
const seedData = ctx.persistedConfig ?? {};
|
|
48640
|
-
|
|
50525
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
50526
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
48641
50527
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
48642
50528
|
tags: {
|
|
48643
50529
|
deviceId: ctx.id,
|
|
@@ -51849,6 +53735,90 @@ Object.freeze({
|
|
|
51849
53735
|
addonId: null,
|
|
51850
53736
|
access: "create"
|
|
51851
53737
|
},
|
|
53738
|
+
"keychain.delete": {
|
|
53739
|
+
capName: "keychain",
|
|
53740
|
+
capScope: "system",
|
|
53741
|
+
addonId: null,
|
|
53742
|
+
access: "delete"
|
|
53743
|
+
},
|
|
53744
|
+
"keychain.getState": {
|
|
53745
|
+
capName: "keychain",
|
|
53746
|
+
capScope: "system",
|
|
53747
|
+
addonId: null,
|
|
53748
|
+
access: "view"
|
|
53749
|
+
},
|
|
53750
|
+
"keychain.listMeta": {
|
|
53751
|
+
capName: "keychain",
|
|
53752
|
+
capScope: "system",
|
|
53753
|
+
addonId: null,
|
|
53754
|
+
access: "view"
|
|
53755
|
+
},
|
|
53756
|
+
"keychain.put": {
|
|
53757
|
+
capName: "keychain",
|
|
53758
|
+
capScope: "system",
|
|
53759
|
+
addonId: null,
|
|
53760
|
+
access: "create"
|
|
53761
|
+
},
|
|
53762
|
+
"keychain.resolve": {
|
|
53763
|
+
capName: "keychain",
|
|
53764
|
+
capScope: "system",
|
|
53765
|
+
addonId: null,
|
|
53766
|
+
access: "view"
|
|
53767
|
+
},
|
|
53768
|
+
"keychainAdmin.deleteOrphans": {
|
|
53769
|
+
capName: "keychain-admin",
|
|
53770
|
+
capScope: "system",
|
|
53771
|
+
addonId: null,
|
|
53772
|
+
access: "delete"
|
|
53773
|
+
},
|
|
53774
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
53775
|
+
capName: "keychain-admin",
|
|
53776
|
+
capScope: "system",
|
|
53777
|
+
addonId: null,
|
|
53778
|
+
access: "create"
|
|
53779
|
+
},
|
|
53780
|
+
"keychainAdmin.listAudit": {
|
|
53781
|
+
capName: "keychain-admin",
|
|
53782
|
+
capScope: "system",
|
|
53783
|
+
addonId: null,
|
|
53784
|
+
access: "view"
|
|
53785
|
+
},
|
|
53786
|
+
"keychainAdmin.listSecrets": {
|
|
53787
|
+
capName: "keychain-admin",
|
|
53788
|
+
capScope: "system",
|
|
53789
|
+
addonId: null,
|
|
53790
|
+
access: "view"
|
|
53791
|
+
},
|
|
53792
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
53793
|
+
capName: "keychain-admin",
|
|
53794
|
+
capScope: "system",
|
|
53795
|
+
addonId: null,
|
|
53796
|
+
access: "delete"
|
|
53797
|
+
},
|
|
53798
|
+
"keychainAdmin.resetKeychain": {
|
|
53799
|
+
capName: "keychain-admin",
|
|
53800
|
+
capScope: "system",
|
|
53801
|
+
addonId: null,
|
|
53802
|
+
access: "delete"
|
|
53803
|
+
},
|
|
53804
|
+
"keychainAdmin.reveal": {
|
|
53805
|
+
capName: "keychain-admin",
|
|
53806
|
+
capScope: "system",
|
|
53807
|
+
addonId: null,
|
|
53808
|
+
access: "create"
|
|
53809
|
+
},
|
|
53810
|
+
"keychainAdmin.rotateMasterKey": {
|
|
53811
|
+
capName: "keychain-admin",
|
|
53812
|
+
capScope: "system",
|
|
53813
|
+
addonId: null,
|
|
53814
|
+
access: "create"
|
|
53815
|
+
},
|
|
53816
|
+
"keychainAdmin.status": {
|
|
53817
|
+
capName: "keychain-admin",
|
|
53818
|
+
capScope: "system",
|
|
53819
|
+
addonId: null,
|
|
53820
|
+
access: "view"
|
|
53821
|
+
},
|
|
51852
53822
|
"lawnMowerControl.dock": {
|
|
51853
53823
|
capName: "lawn-mower-control",
|
|
51854
53824
|
capScope: "device",
|
|
@@ -53223,6 +55193,18 @@ Object.freeze({
|
|
|
53223
55193
|
addonId: null,
|
|
53224
55194
|
access: "create"
|
|
53225
55195
|
},
|
|
55196
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
55197
|
+
capName: "pipeline-analytics",
|
|
55198
|
+
capScope: "device",
|
|
55199
|
+
addonId: null,
|
|
55200
|
+
access: "create"
|
|
55201
|
+
},
|
|
55202
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
55203
|
+
capName: "pipeline-analytics",
|
|
55204
|
+
capScope: "device",
|
|
55205
|
+
addonId: null,
|
|
55206
|
+
access: "create"
|
|
55207
|
+
},
|
|
53226
55208
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
53227
55209
|
capName: "pipeline-analytics",
|
|
53228
55210
|
capScope: "device",
|
|
@@ -53271,12 +55253,24 @@ Object.freeze({
|
|
|
53271
55253
|
addonId: null,
|
|
53272
55254
|
access: "view"
|
|
53273
55255
|
},
|
|
55256
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
55257
|
+
capName: "pipeline-analytics",
|
|
55258
|
+
capScope: "device",
|
|
55259
|
+
addonId: null,
|
|
55260
|
+
access: "create"
|
|
55261
|
+
},
|
|
53274
55262
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
53275
55263
|
capName: "pipeline-analytics",
|
|
53276
55264
|
capScope: "device",
|
|
53277
55265
|
addonId: null,
|
|
53278
55266
|
access: "delete"
|
|
53279
55267
|
},
|
|
55268
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
55269
|
+
capName: "pipeline-analytics",
|
|
55270
|
+
capScope: "device",
|
|
55271
|
+
addonId: null,
|
|
55272
|
+
access: "delete"
|
|
55273
|
+
},
|
|
53280
55274
|
"pipelineAnalytics.deleteTracks": {
|
|
53281
55275
|
capName: "pipeline-analytics",
|
|
53282
55276
|
capScope: "device",
|
|
@@ -53481,6 +55475,24 @@ Object.freeze({
|
|
|
53481
55475
|
addonId: null,
|
|
53482
55476
|
access: "view"
|
|
53483
55477
|
},
|
|
55478
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
55479
|
+
capName: "pipeline-analytics",
|
|
55480
|
+
capScope: "device",
|
|
55481
|
+
addonId: null,
|
|
55482
|
+
access: "view"
|
|
55483
|
+
},
|
|
55484
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
55485
|
+
capName: "pipeline-analytics",
|
|
55486
|
+
capScope: "device",
|
|
55487
|
+
addonId: null,
|
|
55488
|
+
access: "view"
|
|
55489
|
+
},
|
|
55490
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
55491
|
+
capName: "pipeline-analytics",
|
|
55492
|
+
capScope: "device",
|
|
55493
|
+
addonId: null,
|
|
55494
|
+
access: "view"
|
|
55495
|
+
},
|
|
53484
55496
|
"pipelineAnalytics.listRetrainFrames": {
|
|
53485
55497
|
capName: "pipeline-analytics",
|
|
53486
55498
|
capScope: "device",
|
|
@@ -53529,6 +55541,12 @@ Object.freeze({
|
|
|
53529
55541
|
addonId: null,
|
|
53530
55542
|
access: "create"
|
|
53531
55543
|
},
|
|
55544
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
55545
|
+
capName: "pipeline-analytics",
|
|
55546
|
+
capScope: "device",
|
|
55547
|
+
addonId: null,
|
|
55548
|
+
access: "create"
|
|
55549
|
+
},
|
|
53532
55550
|
"pipelineAnalytics.pruneEvents": {
|
|
53533
55551
|
capName: "pipeline-analytics",
|
|
53534
55552
|
capScope: "device",
|
|
@@ -53583,6 +55601,18 @@ Object.freeze({
|
|
|
53583
55601
|
addonId: null,
|
|
53584
55602
|
access: "create"
|
|
53585
55603
|
},
|
|
55604
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
55605
|
+
capName: "pipeline-analytics",
|
|
55606
|
+
capScope: "device",
|
|
55607
|
+
addonId: null,
|
|
55608
|
+
access: "delete"
|
|
55609
|
+
},
|
|
55610
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
55611
|
+
capName: "pipeline-analytics",
|
|
55612
|
+
capScope: "device",
|
|
55613
|
+
addonId: null,
|
|
55614
|
+
access: "create"
|
|
55615
|
+
},
|
|
53586
55616
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
53587
55617
|
capName: "pipeline-analytics",
|
|
53588
55618
|
capScope: "device",
|
|
@@ -53613,6 +55643,12 @@ Object.freeze({
|
|
|
53613
55643
|
addonId: null,
|
|
53614
55644
|
access: "create"
|
|
53615
55645
|
},
|
|
55646
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
55647
|
+
capName: "pipeline-analytics",
|
|
55648
|
+
capScope: "device",
|
|
55649
|
+
addonId: null,
|
|
55650
|
+
access: "create"
|
|
55651
|
+
},
|
|
53616
55652
|
"pipelineAnalytics.setTrackFlags": {
|
|
53617
55653
|
capName: "pipeline-analytics",
|
|
53618
55654
|
capScope: "device",
|
|
@@ -53649,6 +55685,12 @@ Object.freeze({
|
|
|
53649
55685
|
addonId: null,
|
|
53650
55686
|
access: "delete"
|
|
53651
55687
|
},
|
|
55688
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
55689
|
+
capName: "pipeline-analytics",
|
|
55690
|
+
capScope: "device",
|
|
55691
|
+
addonId: null,
|
|
55692
|
+
access: "create"
|
|
55693
|
+
},
|
|
53652
55694
|
"pipelineExecutor.cacheFrameInPool": {
|
|
53653
55695
|
capName: "pipeline-executor",
|
|
53654
55696
|
capScope: "system",
|
|
@@ -53859,6 +55901,12 @@ Object.freeze({
|
|
|
53859
55901
|
addonId: null,
|
|
53860
55902
|
access: "view"
|
|
53861
55903
|
},
|
|
55904
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
55905
|
+
capName: "pipeline-orchestrator",
|
|
55906
|
+
capScope: "system",
|
|
55907
|
+
addonId: null,
|
|
55908
|
+
access: "create"
|
|
55909
|
+
},
|
|
53862
55910
|
"pipelineOrchestrator.applyAutoTune": {
|
|
53863
55911
|
capName: "pipeline-orchestrator",
|
|
53864
55912
|
capScope: "system",
|
|
@@ -53883,6 +55931,12 @@ Object.freeze({
|
|
|
53883
55931
|
addonId: null,
|
|
53884
55932
|
access: "create"
|
|
53885
55933
|
},
|
|
55934
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
55935
|
+
capName: "pipeline-orchestrator",
|
|
55936
|
+
capScope: "system",
|
|
55937
|
+
addonId: null,
|
|
55938
|
+
access: "delete"
|
|
55939
|
+
},
|
|
53886
55940
|
"pipelineOrchestrator.getAgentLoad": {
|
|
53887
55941
|
capName: "pipeline-orchestrator",
|
|
53888
55942
|
capScope: "system",
|
|
@@ -53991,6 +56045,24 @@ Object.freeze({
|
|
|
53991
56045
|
addonId: null,
|
|
53992
56046
|
access: "view"
|
|
53993
56047
|
},
|
|
56048
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
56049
|
+
capName: "pipeline-orchestrator",
|
|
56050
|
+
capScope: "system",
|
|
56051
|
+
addonId: null,
|
|
56052
|
+
access: "view"
|
|
56053
|
+
},
|
|
56054
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
56055
|
+
capName: "pipeline-orchestrator",
|
|
56056
|
+
capScope: "system",
|
|
56057
|
+
addonId: null,
|
|
56058
|
+
access: "view"
|
|
56059
|
+
},
|
|
56060
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
56061
|
+
capName: "pipeline-orchestrator",
|
|
56062
|
+
capScope: "system",
|
|
56063
|
+
addonId: null,
|
|
56064
|
+
access: "view"
|
|
56065
|
+
},
|
|
53994
56066
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
53995
56067
|
capName: "pipeline-orchestrator",
|
|
53996
56068
|
capScope: "system",
|
|
@@ -54033,6 +56105,12 @@ Object.freeze({
|
|
|
54033
56105
|
addonId: null,
|
|
54034
56106
|
access: "view"
|
|
54035
56107
|
},
|
|
56108
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
56109
|
+
capName: "pipeline-orchestrator",
|
|
56110
|
+
capScope: "system",
|
|
56111
|
+
addonId: null,
|
|
56112
|
+
access: "view"
|
|
56113
|
+
},
|
|
54036
56114
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
54037
56115
|
capName: "pipeline-orchestrator",
|
|
54038
56116
|
capScope: "system",
|
|
@@ -54177,6 +56255,12 @@ Object.freeze({
|
|
|
54177
56255
|
addonId: null,
|
|
54178
56256
|
access: "create"
|
|
54179
56257
|
},
|
|
56258
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
56259
|
+
capName: "pipeline-orchestrator",
|
|
56260
|
+
capScope: "system",
|
|
56261
|
+
addonId: null,
|
|
56262
|
+
access: "create"
|
|
56263
|
+
},
|
|
54180
56264
|
"pipelineOrchestrator.suggestShares": {
|
|
54181
56265
|
capName: "pipeline-orchestrator",
|
|
54182
56266
|
capScope: "system",
|
|
@@ -54195,6 +56279,12 @@ Object.freeze({
|
|
|
54195
56279
|
addonId: null,
|
|
54196
56280
|
access: "create"
|
|
54197
56281
|
},
|
|
56282
|
+
"pipelineRunner.abortNodeBench": {
|
|
56283
|
+
capName: "pipeline-runner",
|
|
56284
|
+
capScope: "system",
|
|
56285
|
+
addonId: null,
|
|
56286
|
+
access: "create"
|
|
56287
|
+
},
|
|
54198
56288
|
"pipelineRunner.attachCamera": {
|
|
54199
56289
|
capName: "pipeline-runner",
|
|
54200
56290
|
capScope: "system",
|
|
@@ -54243,6 +56333,12 @@ Object.freeze({
|
|
|
54243
56333
|
addonId: null,
|
|
54244
56334
|
access: "view"
|
|
54245
56335
|
},
|
|
56336
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
56337
|
+
capName: "pipeline-runner",
|
|
56338
|
+
capScope: "system",
|
|
56339
|
+
addonId: null,
|
|
56340
|
+
access: "view"
|
|
56341
|
+
},
|
|
54246
56342
|
"pipelineRunner.getParkedTrackFrame": {
|
|
54247
56343
|
capName: "pipeline-runner",
|
|
54248
56344
|
capScope: "system",
|
|
@@ -54285,6 +56381,12 @@ Object.freeze({
|
|
|
54285
56381
|
addonId: null,
|
|
54286
56382
|
access: "create"
|
|
54287
56383
|
},
|
|
56384
|
+
"pipelineRunner.startNodeBench": {
|
|
56385
|
+
capName: "pipeline-runner",
|
|
56386
|
+
capScope: "system",
|
|
56387
|
+
addonId: null,
|
|
56388
|
+
access: "create"
|
|
56389
|
+
},
|
|
54288
56390
|
"plateGallery.assignPlate": {
|
|
54289
56391
|
capName: "plate-gallery",
|
|
54290
56392
|
capScope: "system",
|
|
@@ -56001,18 +58103,36 @@ Object.freeze({
|
|
|
56001
58103
|
addonId: null,
|
|
56002
58104
|
access: "delete"
|
|
56003
58105
|
},
|
|
58106
|
+
"userManagement.findUserByExternalIdentity": {
|
|
58107
|
+
capName: "user-management",
|
|
58108
|
+
capScope: "system",
|
|
58109
|
+
addonId: null,
|
|
58110
|
+
access: "view"
|
|
58111
|
+
},
|
|
56004
58112
|
"userManagement.getTotpStatus": {
|
|
56005
58113
|
capName: "user-management",
|
|
56006
58114
|
capScope: "system",
|
|
56007
58115
|
addonId: null,
|
|
56008
58116
|
access: "view"
|
|
56009
58117
|
},
|
|
58118
|
+
"userManagement.linkExternalIdentity": {
|
|
58119
|
+
capName: "user-management",
|
|
58120
|
+
capScope: "system",
|
|
58121
|
+
addonId: null,
|
|
58122
|
+
access: "create"
|
|
58123
|
+
},
|
|
56010
58124
|
"userManagement.listApiKeys": {
|
|
56011
58125
|
capName: "user-management",
|
|
56012
58126
|
capScope: "system",
|
|
56013
58127
|
addonId: null,
|
|
56014
58128
|
access: "view"
|
|
56015
58129
|
},
|
|
58130
|
+
"userManagement.listExternalIdentities": {
|
|
58131
|
+
capName: "user-management",
|
|
58132
|
+
capScope: "system",
|
|
58133
|
+
addonId: null,
|
|
58134
|
+
access: "view"
|
|
58135
|
+
},
|
|
56016
58136
|
"userManagement.listOauthSessions": {
|
|
56017
58137
|
capName: "user-management",
|
|
56018
58138
|
capScope: "system",
|
|
@@ -56091,6 +58211,12 @@ Object.freeze({
|
|
|
56091
58211
|
addonId: null,
|
|
56092
58212
|
access: "create"
|
|
56093
58213
|
},
|
|
58214
|
+
"userManagement.unlinkExternalIdentity": {
|
|
58215
|
+
capName: "user-management",
|
|
58216
|
+
capScope: "system",
|
|
58217
|
+
addonId: null,
|
|
58218
|
+
access: "delete"
|
|
58219
|
+
},
|
|
56094
58220
|
"userManagement.updateUser": {
|
|
56095
58221
|
capName: "user-management",
|
|
56096
58222
|
capScope: "system",
|
|
@@ -57940,6 +60066,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
57940
60066
|
imageSettingsCapability,
|
|
57941
60067
|
integrationsCapability,
|
|
57942
60068
|
intercomCapability,
|
|
60069
|
+
keychainCapability,
|
|
60070
|
+
keychainAdminCapability,
|
|
57943
60071
|
lawnMowerControlCapability,
|
|
57944
60072
|
llmCapability,
|
|
57945
60073
|
llmRuntimeCapability,
|
|
@@ -59366,6 +61494,11 @@ Object.freeze({
|
|
|
59366
61494
|
form: "single",
|
|
59367
61495
|
optional: false
|
|
59368
61496
|
}],
|
|
61497
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
61498
|
+
name: "deviceId",
|
|
61499
|
+
form: "single",
|
|
61500
|
+
optional: false
|
|
61501
|
+
}],
|
|
59369
61502
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
59370
61503
|
name: "deviceId",
|
|
59371
61504
|
form: "single",
|
|
@@ -59556,6 +61689,11 @@ Object.freeze({
|
|
|
59556
61689
|
form: "single",
|
|
59557
61690
|
optional: false
|
|
59558
61691
|
}],
|
|
61692
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
61693
|
+
name: "deviceId",
|
|
61694
|
+
form: "single",
|
|
61695
|
+
optional: false
|
|
61696
|
+
}],
|
|
59559
61697
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
59560
61698
|
name: "deviceId",
|
|
59561
61699
|
form: "single",
|
|
@@ -59606,6 +61744,11 @@ Object.freeze({
|
|
|
59606
61744
|
form: "single",
|
|
59607
61745
|
optional: false
|
|
59608
61746
|
}],
|
|
61747
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
61748
|
+
name: "deviceId",
|
|
61749
|
+
form: "single",
|
|
61750
|
+
optional: false
|
|
61751
|
+
}],
|
|
59609
61752
|
"pipelineAnalytics.setTrackFlags": [{
|
|
59610
61753
|
name: "deviceId",
|
|
59611
61754
|
form: "single",
|
|
@@ -63649,6 +65792,80 @@ var FULL_IMAGE_BBOX = Object.freeze({
|
|
|
63649
65792
|
});
|
|
63650
65793
|
DEFAULT_DETAIL_CROP_CONVENTION.paddingRatio;
|
|
63651
65794
|
/**
|
|
65795
|
+
* Derive the crop rectangle for one parent detection.
|
|
65796
|
+
*
|
|
65797
|
+
* Order: pad by `paddingRatio` of the box's own size → optionally square in
|
|
65798
|
+
* pixel space around the padded centre → keep it inside the frame. Pure:
|
|
65799
|
+
* always returns a new rect and never mutates `bbox`.
|
|
65800
|
+
*
|
|
65801
|
+
* Edge handling differs by mode, on purpose:
|
|
65802
|
+
*
|
|
65803
|
+
* - **unsquared** — TRUNCATED at the frame border, byte-for-byte what the live
|
|
65804
|
+
* path has always done (`padAndClampFrameBbox`). A subject against the edge
|
|
65805
|
+
* gets a slightly smaller window. Changing this would silently reinterpret
|
|
65806
|
+
* every edge-touching vector already in the index.
|
|
65807
|
+
* - **squared** — SLID inward instead, because a truncated square is not
|
|
65808
|
+
* square and squaring exists precisely to preserve the aspect the model
|
|
65809
|
+
* sees. It only shrinks when the square is larger than the frame itself.
|
|
65810
|
+
*/
|
|
65811
|
+
function deriveDetailCropRect(bbox, frameWidth, frameHeight, convention) {
|
|
65812
|
+
const padX = convention.paddingRatio * bbox.w;
|
|
65813
|
+
const padY = convention.paddingRatio * bbox.h;
|
|
65814
|
+
const padded = {
|
|
65815
|
+
x: bbox.x - padX,
|
|
65816
|
+
y: bbox.y - padY,
|
|
65817
|
+
w: bbox.w + 2 * padX,
|
|
65818
|
+
h: bbox.h + 2 * padY
|
|
65819
|
+
};
|
|
65820
|
+
return convention.square ? slideInsideFrame(squareInPixels(padded, frameWidth, frameHeight), frameWidth, frameHeight) : truncateToFrame(padded, frameWidth, frameHeight);
|
|
65821
|
+
}
|
|
65822
|
+
/**
|
|
65823
|
+
* Grow the shorter side to the longer one around the window's centre, bounded
|
|
65824
|
+
* by the frame's shorter side — a square larger than the frame cannot exist,
|
|
65825
|
+
* and collapsing to the frame's short side is the most that does.
|
|
65826
|
+
*/
|
|
65827
|
+
function squareInPixels(rect, frameWidth, frameHeight) {
|
|
65828
|
+
const side = Math.min(Math.max(rect.w, rect.h), Math.min(frameWidth, frameHeight));
|
|
65829
|
+
const cx = rect.x + rect.w / 2;
|
|
65830
|
+
const cy = rect.y + rect.h / 2;
|
|
65831
|
+
return {
|
|
65832
|
+
x: cx - side / 2,
|
|
65833
|
+
y: cy - side / 2,
|
|
65834
|
+
w: side,
|
|
65835
|
+
h: side
|
|
65836
|
+
};
|
|
65837
|
+
}
|
|
65838
|
+
/**
|
|
65839
|
+
* Cut the window at the frame border — the pre-unification live behaviour,
|
|
65840
|
+
* preserved exactly so unsquared crops keep matching the stored index.
|
|
65841
|
+
*/
|
|
65842
|
+
function truncateToFrame(rect, frameWidth, frameHeight) {
|
|
65843
|
+
const x1 = Math.max(0, rect.x);
|
|
65844
|
+
const y1 = Math.max(0, rect.y);
|
|
65845
|
+
const x2 = Math.min(frameWidth, rect.x + rect.w);
|
|
65846
|
+
const y2 = Math.min(frameHeight, rect.y + rect.h);
|
|
65847
|
+
return {
|
|
65848
|
+
x: x1,
|
|
65849
|
+
y: y1,
|
|
65850
|
+
w: Math.max(0, x2 - x1),
|
|
65851
|
+
h: Math.max(0, y2 - y1)
|
|
65852
|
+
};
|
|
65853
|
+
}
|
|
65854
|
+
/**
|
|
65855
|
+
* Move the window inside the frame keeping its extent — used only for squared
|
|
65856
|
+
* windows, where truncating would destroy the squareness that is the point.
|
|
65857
|
+
*/
|
|
65858
|
+
function slideInsideFrame(rect, frameWidth, frameHeight) {
|
|
65859
|
+
const w = Math.max(0, Math.min(rect.w, frameWidth));
|
|
65860
|
+
const h = Math.max(0, Math.min(rect.h, frameHeight));
|
|
65861
|
+
return {
|
|
65862
|
+
x: Math.min(Math.max(0, rect.x), Math.max(0, frameWidth - w)),
|
|
65863
|
+
y: Math.min(Math.max(0, rect.y), Math.max(0, frameHeight - h)),
|
|
65864
|
+
w,
|
|
65865
|
+
h
|
|
65866
|
+
};
|
|
65867
|
+
}
|
|
65868
|
+
/**
|
|
63652
65869
|
* WHICH delivered frames the decode worker retains a native copy of.
|
|
63653
65870
|
*
|
|
63654
65871
|
* - `all` — every frame the worker delivered to the runner. The shipped
|
|
@@ -64563,6 +66780,12 @@ Object.defineProperty(exports, "DEFAULT_CLIP_MODEL", {
|
|
|
64563
66780
|
return DEFAULT_CLIP_MODEL;
|
|
64564
66781
|
}
|
|
64565
66782
|
});
|
|
66783
|
+
Object.defineProperty(exports, "DEFAULT_DETAIL_CROP_CONVENTION", {
|
|
66784
|
+
enumerable: true,
|
|
66785
|
+
get: function() {
|
|
66786
|
+
return DEFAULT_DETAIL_CROP_CONVENTION;
|
|
66787
|
+
}
|
|
66788
|
+
});
|
|
64566
66789
|
Object.defineProperty(exports, "DEFAULT_EVENT_COLOR", {
|
|
64567
66790
|
enumerable: true,
|
|
64568
66791
|
get: function() {
|
|
@@ -65415,6 +67638,12 @@ Object.defineProperty(exports, "deleteAlarmProfile", {
|
|
|
65415
67638
|
return deleteAlarmProfile;
|
|
65416
67639
|
}
|
|
65417
67640
|
});
|
|
67641
|
+
Object.defineProperty(exports, "deriveDetailCropRect", {
|
|
67642
|
+
enumerable: true,
|
|
67643
|
+
get: function() {
|
|
67644
|
+
return deriveDetailCropRect;
|
|
67645
|
+
}
|
|
67646
|
+
});
|
|
65418
67647
|
Object.defineProperty(exports, "derivePostTriggeredAction", {
|
|
65419
67648
|
enumerable: true,
|
|
65420
67649
|
get: function() {
|