@camstack/addon-post-analysis 1.2.343 → 1.2.345
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-Cd_y9S4U.js → clip-model-registry-Bd8rsIjt.js} +2133 -57
- package/dist/{clip-model-registry-DZz3e781.mjs → clip-model-registry-CIbZ6YOF.mjs} +2133 -57
- 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-DrdO3Pxp.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DTenVWiv.mjs} +2 -2
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTOF9hbS.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-DUrhEd38.mjs +26 -0
- package/dist/pipeline-analytics/{hostInit-DPNnWr-m.mjs → hostInit-BO3gbCue.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +2391 -405
- package/dist/pipeline-analytics/index.mjs +2391 -405
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DEq-B6oq.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-CiTUMvVf.mjs +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -78,6 +78,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
78
78
|
*/
|
|
79
79
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
80
80
|
/**
|
|
81
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
82
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
83
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
84
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
85
|
+
*/
|
|
86
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
87
|
+
/**
|
|
81
88
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
82
89
|
* transitions from `failed` back to `healthy` (typically via the
|
|
83
90
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5442,7 +5449,7 @@ var ZodIssueCode = {
|
|
|
5442
5449
|
var ZodFirstPartyTypeKind;
|
|
5443
5450
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5444
5451
|
//#endregion
|
|
5445
|
-
//#region ../types/dist/sleep-
|
|
5452
|
+
//#region ../types/dist/sleep-DujUvOcb.mjs
|
|
5446
5453
|
/**
|
|
5447
5454
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5448
5455
|
* window to float samples (D455).
|
|
@@ -5521,6 +5528,97 @@ function buildAlawTable() {
|
|
|
5521
5528
|
}
|
|
5522
5529
|
buildUlawTable();
|
|
5523
5530
|
buildAlawTable();
|
|
5531
|
+
/** Is this field's stored value a credential? */
|
|
5532
|
+
function isSecretConfigField(field) {
|
|
5533
|
+
if (field.type === "password") return true;
|
|
5534
|
+
return "secret" in field && field.secret === true;
|
|
5535
|
+
}
|
|
5536
|
+
/**
|
|
5537
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5538
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5539
|
+
*/
|
|
5540
|
+
function isKeychainStoredField(field) {
|
|
5541
|
+
if (!isSecretConfigField(field)) return false;
|
|
5542
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5543
|
+
return !("storage" in field && field.storage === "inline");
|
|
5544
|
+
}
|
|
5545
|
+
/**
|
|
5546
|
+
* What a settings blob holds where a secret used to be.
|
|
5547
|
+
*
|
|
5548
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5549
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5550
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5551
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5552
|
+
*
|
|
5553
|
+
* The same shapes travel to and from the admin UI:
|
|
5554
|
+
*
|
|
5555
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5556
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5557
|
+
* value is set, never the value.
|
|
5558
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5559
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5560
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5561
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5562
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5563
|
+
*
|
|
5564
|
+
* Pure and browser-safe.
|
|
5565
|
+
*/
|
|
5566
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5567
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5568
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5569
|
+
function isRecord$1(value) {
|
|
5570
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5571
|
+
}
|
|
5572
|
+
function makeSecretMarker(ref) {
|
|
5573
|
+
return {
|
|
5574
|
+
$secret: ref,
|
|
5575
|
+
v: 1
|
|
5576
|
+
};
|
|
5577
|
+
}
|
|
5578
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5579
|
+
function isSecretMarker(value) {
|
|
5580
|
+
if (!isRecord$1(value)) return false;
|
|
5581
|
+
const ref = value["$secret"];
|
|
5582
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5583
|
+
}
|
|
5584
|
+
function isSecretClear(value) {
|
|
5585
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5586
|
+
}
|
|
5587
|
+
/**
|
|
5588
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5589
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5590
|
+
* survives this function.
|
|
5591
|
+
*/
|
|
5592
|
+
function toSecretFieldView(stored) {
|
|
5593
|
+
if (isSecretMarker(stored)) return {
|
|
5594
|
+
$secret: stored.$secret,
|
|
5595
|
+
v: 1,
|
|
5596
|
+
set: true
|
|
5597
|
+
};
|
|
5598
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5599
|
+
$secret: null,
|
|
5600
|
+
v: 1,
|
|
5601
|
+
set: true,
|
|
5602
|
+
inline: true
|
|
5603
|
+
};
|
|
5604
|
+
return null;
|
|
5605
|
+
}
|
|
5606
|
+
/**
|
|
5607
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5608
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5609
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5610
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5611
|
+
*/
|
|
5612
|
+
function classifySecretWrite(incoming) {
|
|
5613
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5614
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5615
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5616
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5617
|
+
return {
|
|
5618
|
+
kind: "set",
|
|
5619
|
+
value: incoming
|
|
5620
|
+
};
|
|
5621
|
+
}
|
|
5524
5622
|
Object.fromEntries([
|
|
5525
5623
|
{
|
|
5526
5624
|
id: "overview",
|
|
@@ -5692,33 +5790,19 @@ Object.fromEntries([
|
|
|
5692
5790
|
function isValuelessField(field) {
|
|
5693
5791
|
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";
|
|
5694
5792
|
}
|
|
5695
|
-
|
|
5696
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5697
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5698
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5699
|
-
*
|
|
5700
|
-
* For each leaf field:
|
|
5701
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5702
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5703
|
-
*
|
|
5704
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5705
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5706
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5707
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5708
|
-
*/
|
|
5709
|
-
function hydrateSchema(schema, values) {
|
|
5793
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5710
5794
|
return {
|
|
5711
5795
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5712
5796
|
sections: schema.sections.map((section) => ({
|
|
5713
5797
|
...section,
|
|
5714
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5798
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5715
5799
|
}))
|
|
5716
5800
|
};
|
|
5717
5801
|
}
|
|
5718
|
-
function hydrateField(field, values) {
|
|
5802
|
+
function hydrateField(field, values, options) {
|
|
5719
5803
|
if (isValuelessField(field)) return field;
|
|
5720
5804
|
if (field.type === "group") {
|
|
5721
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5805
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5722
5806
|
return {
|
|
5723
5807
|
...field,
|
|
5724
5808
|
fields: hydratedChildren
|
|
@@ -5727,7 +5811,7 @@ function hydrateField(field, values) {
|
|
|
5727
5811
|
if (field.type === "sub-tabs") {
|
|
5728
5812
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5729
5813
|
...tab,
|
|
5730
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5814
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5731
5815
|
}));
|
|
5732
5816
|
return {
|
|
5733
5817
|
...field,
|
|
@@ -5737,6 +5821,33 @@ function hydrateField(field, values) {
|
|
|
5737
5821
|
const key = field.key;
|
|
5738
5822
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5739
5823
|
const defaultValue = field.default;
|
|
5824
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5825
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5826
|
+
...field,
|
|
5827
|
+
value: toSecretFieldView(storedValue)
|
|
5828
|
+
};
|
|
5829
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5830
|
+
...field,
|
|
5831
|
+
value: null
|
|
5832
|
+
};
|
|
5833
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5834
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5835
|
+
if (secretItemKeys.length > 0) {
|
|
5836
|
+
const rows = storedValue.map((row) => {
|
|
5837
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5838
|
+
const out = { ...row };
|
|
5839
|
+
for (const k of secretItemKeys) {
|
|
5840
|
+
const v = Reflect.get(row, k);
|
|
5841
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5842
|
+
}
|
|
5843
|
+
return out;
|
|
5844
|
+
});
|
|
5845
|
+
return {
|
|
5846
|
+
...field,
|
|
5847
|
+
value: rows
|
|
5848
|
+
};
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5740
5851
|
if (field.multiple) {
|
|
5741
5852
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5742
5853
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5979,6 +6090,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5979
6090
|
}
|
|
5980
6091
|
return out;
|
|
5981
6092
|
}
|
|
6093
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6094
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6095
|
+
function globalSecretScope() {
|
|
6096
|
+
return GLOBAL_SCOPE;
|
|
6097
|
+
}
|
|
6098
|
+
function encodeSegment(value) {
|
|
6099
|
+
return encodeURIComponent(value);
|
|
6100
|
+
}
|
|
6101
|
+
/**
|
|
6102
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6103
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6104
|
+
* `providers[authentik].clientSecret`.
|
|
6105
|
+
*/
|
|
6106
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6107
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6108
|
+
}
|
|
6109
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6110
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6111
|
+
fieldPath;
|
|
6112
|
+
constructor(fieldPath, cause) {
|
|
6113
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6114
|
+
this.fieldPath = fieldPath;
|
|
6115
|
+
this.name = "KeychainWriteRefusedError";
|
|
6116
|
+
}
|
|
6117
|
+
};
|
|
6118
|
+
var KEEP = { kind: "keep" };
|
|
6119
|
+
function isRecord(value) {
|
|
6120
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6121
|
+
}
|
|
6122
|
+
function defaultMintId() {
|
|
6123
|
+
return globalThis.crypto.randomUUID();
|
|
6124
|
+
}
|
|
6125
|
+
/** Every marker ref anywhere under `value`. */
|
|
6126
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6127
|
+
if (isSecretMarker(value)) {
|
|
6128
|
+
out.push(value.$secret);
|
|
6129
|
+
return out;
|
|
6130
|
+
}
|
|
6131
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6132
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6133
|
+
return out;
|
|
6134
|
+
}
|
|
6135
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6136
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6137
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6138
|
+
}
|
|
6139
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6140
|
+
const intent = classifySecretWrite(incoming);
|
|
6141
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6142
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6143
|
+
if (intent.kind === "keep") return KEEP;
|
|
6144
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6145
|
+
if (intent.kind === "clear") {
|
|
6146
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6147
|
+
return {
|
|
6148
|
+
kind: "value",
|
|
6149
|
+
value: null
|
|
6150
|
+
};
|
|
6151
|
+
}
|
|
6152
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6153
|
+
kind: "value",
|
|
6154
|
+
value: stored
|
|
6155
|
+
};
|
|
6156
|
+
try {
|
|
6157
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6158
|
+
} catch (err) {
|
|
6159
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6160
|
+
}
|
|
6161
|
+
return {
|
|
6162
|
+
kind: "value",
|
|
6163
|
+
value: makeSecretMarker(ref)
|
|
6164
|
+
};
|
|
6165
|
+
}
|
|
6166
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6167
|
+
function applyMember(out, key, result, storedParent) {
|
|
6168
|
+
if (result.kind === "value") {
|
|
6169
|
+
out[key] = result.value;
|
|
6170
|
+
return;
|
|
6171
|
+
}
|
|
6172
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6173
|
+
else delete out[key];
|
|
6174
|
+
}
|
|
6175
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6176
|
+
const out = { ...incoming };
|
|
6177
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6178
|
+
return out;
|
|
6179
|
+
}
|
|
6180
|
+
function rowId(row, idKey) {
|
|
6181
|
+
const raw = row[idKey];
|
|
6182
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6183
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6184
|
+
return null;
|
|
6185
|
+
}
|
|
6186
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6187
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6188
|
+
if (!Array.isArray(incoming)) {
|
|
6189
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6190
|
+
return {
|
|
6191
|
+
kind: "value",
|
|
6192
|
+
value: incoming
|
|
6193
|
+
};
|
|
6194
|
+
}
|
|
6195
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6196
|
+
for (const row of storedRows) {
|
|
6197
|
+
const id = rowId(row, node.idKey);
|
|
6198
|
+
if (id !== null) storedById.set(id, row);
|
|
6199
|
+
}
|
|
6200
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6201
|
+
const rows = [];
|
|
6202
|
+
for (const row of incoming) {
|
|
6203
|
+
if (!isRecord(row)) {
|
|
6204
|
+
rows.push(row);
|
|
6205
|
+
continue;
|
|
6206
|
+
}
|
|
6207
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6208
|
+
kept.add(id);
|
|
6209
|
+
const withId = {
|
|
6210
|
+
...row,
|
|
6211
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6212
|
+
};
|
|
6213
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6214
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6215
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6216
|
+
}
|
|
6217
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6218
|
+
return {
|
|
6219
|
+
kind: "value",
|
|
6220
|
+
value: rows
|
|
6221
|
+
};
|
|
6222
|
+
}
|
|
6223
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6224
|
+
switch (node.kind) {
|
|
6225
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6226
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6227
|
+
case "object": {
|
|
6228
|
+
if (!isRecord(incoming)) {
|
|
6229
|
+
if (incoming === void 0) return KEEP;
|
|
6230
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6231
|
+
return {
|
|
6232
|
+
kind: "value",
|
|
6233
|
+
value: incoming
|
|
6234
|
+
};
|
|
6235
|
+
}
|
|
6236
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6237
|
+
return {
|
|
6238
|
+
kind: "value",
|
|
6239
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6240
|
+
};
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6244
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6245
|
+
function splitNodeKey(key) {
|
|
6246
|
+
const at = key.indexOf("@");
|
|
6247
|
+
return at <= 0 ? {
|
|
6248
|
+
base: key,
|
|
6249
|
+
nodeId: null
|
|
6250
|
+
} : {
|
|
6251
|
+
base: key.slice(0, at),
|
|
6252
|
+
nodeId: key.slice(at + 1)
|
|
6253
|
+
};
|
|
6254
|
+
}
|
|
6255
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6256
|
+
async function transformSecretWrite(input) {
|
|
6257
|
+
const deletes = [];
|
|
6258
|
+
const base = {
|
|
6259
|
+
secrets: input.secrets,
|
|
6260
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6261
|
+
deletes,
|
|
6262
|
+
operatorWrite: input.operatorWrite === true
|
|
6263
|
+
};
|
|
6264
|
+
const out = {};
|
|
6265
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6266
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6267
|
+
const node = input.tree.get(baseKey);
|
|
6268
|
+
if (node === void 0) {
|
|
6269
|
+
out[key] = incoming;
|
|
6270
|
+
continue;
|
|
6271
|
+
}
|
|
6272
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6273
|
+
kind: "node",
|
|
6274
|
+
nodeId
|
|
6275
|
+
} : input.scope ?? globalSecretScope();
|
|
6276
|
+
const result = await writeNode({
|
|
6277
|
+
...base,
|
|
6278
|
+
scope
|
|
6279
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6280
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6281
|
+
}
|
|
6282
|
+
return {
|
|
6283
|
+
patch: out,
|
|
6284
|
+
afterWrite: async () => {
|
|
6285
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6286
|
+
try {
|
|
6287
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6288
|
+
return { orphaned: [] };
|
|
6289
|
+
} catch {
|
|
6290
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
};
|
|
6294
|
+
}
|
|
6295
|
+
/**
|
|
6296
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6297
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6298
|
+
*/
|
|
6299
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6300
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6301
|
+
if (refs.length === 0) return {
|
|
6302
|
+
value,
|
|
6303
|
+
unresolved: []
|
|
6304
|
+
};
|
|
6305
|
+
const answers = await secrets.resolve(refs);
|
|
6306
|
+
const unresolved = [];
|
|
6307
|
+
for (const ref of new Set(refs)) {
|
|
6308
|
+
const answer = answers[ref];
|
|
6309
|
+
if (answer === void 0) unresolved.push({
|
|
6310
|
+
ref,
|
|
6311
|
+
reason: "not-initialized"
|
|
6312
|
+
});
|
|
6313
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6314
|
+
ref,
|
|
6315
|
+
reason: answer.reason
|
|
6316
|
+
});
|
|
6317
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6318
|
+
ref,
|
|
6319
|
+
reason: answer.kind
|
|
6320
|
+
});
|
|
6321
|
+
}
|
|
6322
|
+
const substitute = (v) => {
|
|
6323
|
+
if (isSecretMarker(v)) {
|
|
6324
|
+
const answer = answers[v.$secret];
|
|
6325
|
+
return answer?.kind === "value" ? {
|
|
6326
|
+
keep: true,
|
|
6327
|
+
value: answer.value
|
|
6328
|
+
} : {
|
|
6329
|
+
keep: false,
|
|
6330
|
+
value: void 0
|
|
6331
|
+
};
|
|
6332
|
+
}
|
|
6333
|
+
if (Array.isArray(v)) {
|
|
6334
|
+
const items = [];
|
|
6335
|
+
for (const item of v) {
|
|
6336
|
+
const s = substitute(item);
|
|
6337
|
+
if (s.keep) items.push(s.value);
|
|
6338
|
+
}
|
|
6339
|
+
return {
|
|
6340
|
+
keep: true,
|
|
6341
|
+
value: items
|
|
6342
|
+
};
|
|
6343
|
+
}
|
|
6344
|
+
if (isRecord(v)) {
|
|
6345
|
+
const out = {};
|
|
6346
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6347
|
+
const s = substitute(child);
|
|
6348
|
+
if (s.keep) out[k] = s.value;
|
|
6349
|
+
}
|
|
6350
|
+
return {
|
|
6351
|
+
keep: true,
|
|
6352
|
+
value: out
|
|
6353
|
+
};
|
|
6354
|
+
}
|
|
6355
|
+
return {
|
|
6356
|
+
keep: true,
|
|
6357
|
+
value: v
|
|
6358
|
+
};
|
|
6359
|
+
};
|
|
6360
|
+
return {
|
|
6361
|
+
value: substitute(value).value,
|
|
6362
|
+
unresolved
|
|
6363
|
+
};
|
|
6364
|
+
}
|
|
6365
|
+
function touchesTree(tree, patch) {
|
|
6366
|
+
if (tree.size === 0) return false;
|
|
6367
|
+
for (const key of Object.keys(patch)) {
|
|
6368
|
+
const at = key.indexOf("@");
|
|
6369
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6370
|
+
}
|
|
6371
|
+
return false;
|
|
6372
|
+
}
|
|
6373
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6374
|
+
async function readStoredAddonBlob(raw) {
|
|
6375
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6376
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6377
|
+
const result = await threeWay.call(raw);
|
|
6378
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6379
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6380
|
+
}
|
|
6381
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6382
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6383
|
+
const serialize = (key, fn) => {
|
|
6384
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6385
|
+
const tail = next.catch(() => void 0);
|
|
6386
|
+
chains.set(key, tail);
|
|
6387
|
+
tail.then(() => {
|
|
6388
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6389
|
+
});
|
|
6390
|
+
return next;
|
|
6391
|
+
};
|
|
6392
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6393
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6394
|
+
return serialize(chainKey, async () => {
|
|
6395
|
+
const stored = await readStored();
|
|
6396
|
+
const result = await transformSecretWrite({
|
|
6397
|
+
tree,
|
|
6398
|
+
secrets: opts.secrets,
|
|
6399
|
+
patch,
|
|
6400
|
+
stored,
|
|
6401
|
+
...scope !== void 0 ? { scope } : {},
|
|
6402
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6403
|
+
});
|
|
6404
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6405
|
+
const { orphaned } = await result.afterWrite();
|
|
6406
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6407
|
+
});
|
|
6408
|
+
};
|
|
6409
|
+
const wrapped = {
|
|
6410
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6411
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6412
|
+
kind: "device",
|
|
6413
|
+
deviceId
|
|
6414
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6415
|
+
};
|
|
6416
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6417
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6418
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6419
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6420
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6421
|
+
} });
|
|
6422
|
+
}
|
|
6423
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6424
|
+
function withSecretAwareSettings(context, opts) {
|
|
6425
|
+
const raw = context.settings;
|
|
6426
|
+
if (raw === void 0) return context;
|
|
6427
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6428
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6429
|
+
if (prop === "settings") return settings;
|
|
6430
|
+
return Reflect.get(target, prop, receiver);
|
|
6431
|
+
} });
|
|
6432
|
+
}
|
|
6433
|
+
var LEAF = { kind: "leaf" };
|
|
6434
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6435
|
+
function collectFields(fields, out) {
|
|
6436
|
+
for (const field of fields) {
|
|
6437
|
+
if (field.type === "group") {
|
|
6438
|
+
collectFields(field.fields, out);
|
|
6439
|
+
continue;
|
|
6440
|
+
}
|
|
6441
|
+
if (field.type === "sub-tabs") {
|
|
6442
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6443
|
+
continue;
|
|
6444
|
+
}
|
|
6445
|
+
if (field.type === "editable-array") {
|
|
6446
|
+
const item = /* @__PURE__ */ new Map();
|
|
6447
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6448
|
+
if (item.size > 0) out.set(field.key, {
|
|
6449
|
+
kind: "array",
|
|
6450
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6451
|
+
item
|
|
6452
|
+
});
|
|
6453
|
+
continue;
|
|
6454
|
+
}
|
|
6455
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6456
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
/** The secret tree a settings schema declares. */
|
|
6460
|
+
function secretTreeFromSchema(schema) {
|
|
6461
|
+
const out = /* @__PURE__ */ new Map();
|
|
6462
|
+
if (schema === null) return out;
|
|
6463
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6464
|
+
return out;
|
|
6465
|
+
}
|
|
6466
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6467
|
+
function parseSecretStatePath(path) {
|
|
6468
|
+
const segments = [];
|
|
6469
|
+
for (const raw of path.split(".")) {
|
|
6470
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6471
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6472
|
+
segments.push(m[2] !== void 0 ? {
|
|
6473
|
+
key: m[1],
|
|
6474
|
+
idKey: m[2]
|
|
6475
|
+
} : { key: m[1] });
|
|
6476
|
+
}
|
|
6477
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6478
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6479
|
+
return segments;
|
|
6480
|
+
}
|
|
6481
|
+
function insert(into, segments) {
|
|
6482
|
+
const [head, ...rest] = segments;
|
|
6483
|
+
if (head === void 0) return;
|
|
6484
|
+
if (rest.length === 0) {
|
|
6485
|
+
into.set(head.key, LEAF);
|
|
6486
|
+
return;
|
|
6487
|
+
}
|
|
6488
|
+
const existing = into.get(head.key);
|
|
6489
|
+
if (head.idKey !== void 0) {
|
|
6490
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6491
|
+
insert(item, rest);
|
|
6492
|
+
into.set(head.key, {
|
|
6493
|
+
kind: "array",
|
|
6494
|
+
idKey: head.idKey,
|
|
6495
|
+
item
|
|
6496
|
+
});
|
|
6497
|
+
return;
|
|
6498
|
+
}
|
|
6499
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6500
|
+
insert(children, rest);
|
|
6501
|
+
into.set(head.key, {
|
|
6502
|
+
kind: "object",
|
|
6503
|
+
children
|
|
6504
|
+
});
|
|
6505
|
+
}
|
|
6506
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6507
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6508
|
+
if (paths.length === 0) return tree;
|
|
6509
|
+
const out = new Map(tree);
|
|
6510
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6511
|
+
return out;
|
|
6512
|
+
}
|
|
6513
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6514
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6515
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6516
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6517
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5982
6518
|
/**
|
|
5983
6519
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5984
6520
|
*
|
|
@@ -6048,6 +6584,25 @@ var BaseAddon = class {
|
|
|
6048
6584
|
settingsStoreReady = false;
|
|
6049
6585
|
/** Default config values. Provided via constructor. */
|
|
6050
6586
|
defaults;
|
|
6587
|
+
/**
|
|
6588
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6589
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6590
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6591
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6592
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6593
|
+
*/
|
|
6594
|
+
secretStatePaths = [];
|
|
6595
|
+
_addonSecretTree = null;
|
|
6596
|
+
_deviceSecretTree = null;
|
|
6597
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6598
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6599
|
+
_unresolvedSecrets = [];
|
|
6600
|
+
_secretRetryTimer = null;
|
|
6601
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6602
|
+
_secretChangeTimer = null;
|
|
6603
|
+
_secretChangeUnsub = null;
|
|
6604
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6605
|
+
_operatorWriteDepth = 0;
|
|
6051
6606
|
constructor(defaults) {
|
|
6052
6607
|
this.defaults = defaults;
|
|
6053
6608
|
this._config = { ...defaults };
|
|
@@ -6083,8 +6638,18 @@ var BaseAddon = class {
|
|
|
6083
6638
|
return this._config;
|
|
6084
6639
|
}
|
|
6085
6640
|
async initialize(context) {
|
|
6086
|
-
|
|
6641
|
+
const secrets = context.secrets;
|
|
6642
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6643
|
+
secrets,
|
|
6644
|
+
addonTree: () => this.addonSecretTree(),
|
|
6645
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6646
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6647
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6648
|
+
}) : context;
|
|
6087
6649
|
await this.resolveConfig();
|
|
6650
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6651
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6652
|
+
});
|
|
6088
6653
|
const result = await this.onInitialize();
|
|
6089
6654
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6090
6655
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6117,6 +6682,12 @@ var BaseAddon = class {
|
|
|
6117
6682
|
*/
|
|
6118
6683
|
async onHubReachable() {}
|
|
6119
6684
|
async shutdown() {
|
|
6685
|
+
this._secretChangeUnsub?.();
|
|
6686
|
+
this._secretChangeUnsub = null;
|
|
6687
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6688
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6689
|
+
this._secretRetryTimer = null;
|
|
6690
|
+
this._secretChangeTimer = null;
|
|
6120
6691
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6121
6692
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6122
6693
|
await this.onShutdown();
|
|
@@ -6195,7 +6766,7 @@ var BaseAddon = class {
|
|
|
6195
6766
|
return hydrateSchema(schema, overlay ? {
|
|
6196
6767
|
...projected,
|
|
6197
6768
|
...overlay
|
|
6198
|
-
} : projected);
|
|
6769
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6199
6770
|
}
|
|
6200
6771
|
/**
|
|
6201
6772
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6244,7 +6815,7 @@ var BaseAddon = class {
|
|
|
6244
6815
|
return hydrateSchema({
|
|
6245
6816
|
...schema,
|
|
6246
6817
|
sections
|
|
6247
|
-
}, projected);
|
|
6818
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6248
6819
|
}
|
|
6249
6820
|
/**
|
|
6250
6821
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6298,18 +6869,50 @@ var BaseAddon = class {
|
|
|
6298
6869
|
value: result.value[key]
|
|
6299
6870
|
};
|
|
6300
6871
|
}
|
|
6872
|
+
/**
|
|
6873
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6874
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6875
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6876
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6877
|
+
* writing back what it read is not (D787).
|
|
6878
|
+
*/
|
|
6879
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6880
|
+
this._operatorWriteDepth++;
|
|
6881
|
+
try {
|
|
6882
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6883
|
+
} finally {
|
|
6884
|
+
this._operatorWriteDepth--;
|
|
6885
|
+
}
|
|
6886
|
+
}
|
|
6301
6887
|
async updateGlobalSettings(patch, nodeId) {
|
|
6888
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6889
|
+
}
|
|
6890
|
+
/**
|
|
6891
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6892
|
+
*
|
|
6893
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6894
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6895
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6896
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6897
|
+
*/
|
|
6898
|
+
async clearSecrets(keys, nodeId) {
|
|
6899
|
+
const tree = this.addonSecretTree();
|
|
6900
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6901
|
+
const patch = {};
|
|
6902
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6903
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6904
|
+
}
|
|
6905
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6302
6906
|
const keys = this.perNodeKeys();
|
|
6303
6907
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6304
6908
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6305
|
-
const barePatch = patch;
|
|
6306
6909
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6307
6910
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6308
6911
|
if (target !== localNode) return;
|
|
6309
6912
|
await this.resolveConfig();
|
|
6310
6913
|
await this.onConfigChanged();
|
|
6311
6914
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6312
|
-
this.maybeAutoRestart(
|
|
6915
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6313
6916
|
}
|
|
6314
6917
|
/**
|
|
6315
6918
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6334,7 +6937,7 @@ var BaseAddon = class {
|
|
|
6334
6937
|
* time to return its response before the addon is torn down and
|
|
6335
6938
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6336
6939
|
*/
|
|
6337
|
-
maybeAutoRestart(
|
|
6940
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6338
6941
|
if (!schema) return;
|
|
6339
6942
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6340
6943
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6342,13 +6945,13 @@ var BaseAddon = class {
|
|
|
6342
6945
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6343
6946
|
}
|
|
6344
6947
|
if (restartKeys.size === 0) return;
|
|
6345
|
-
if (!
|
|
6948
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6346
6949
|
const ctx = this._ctx;
|
|
6347
6950
|
if (!ctx) return;
|
|
6348
6951
|
const addonId = ctx.id;
|
|
6349
6952
|
setImmediate(() => {
|
|
6350
6953
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6351
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6954
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6352
6955
|
}).catch((err) => {
|
|
6353
6956
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6354
6957
|
});
|
|
@@ -6357,7 +6960,7 @@ var BaseAddon = class {
|
|
|
6357
6960
|
async getDeviceSettings(deviceId) {
|
|
6358
6961
|
const schema = this.deviceSettingsSchema();
|
|
6359
6962
|
if (!schema) return { sections: [] };
|
|
6360
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6963
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6361
6964
|
}
|
|
6362
6965
|
async updateDeviceSettings(deviceId, patch) {
|
|
6363
6966
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6487,7 +7090,7 @@ var BaseAddon = class {
|
|
|
6487
7090
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6488
7091
|
*/
|
|
6489
7092
|
async resolveConfig() {
|
|
6490
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7093
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6491
7094
|
const perNode = this.perNodeKeys();
|
|
6492
7095
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6493
7096
|
const resolved = { ...this.defaults };
|
|
@@ -6512,7 +7115,7 @@ var BaseAddon = class {
|
|
|
6512
7115
|
key,
|
|
6513
7116
|
schema,
|
|
6514
7117
|
fallback,
|
|
6515
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7118
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6516
7119
|
write: async (patch) => {
|
|
6517
7120
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6518
7121
|
},
|
|
@@ -6529,7 +7132,7 @@ var BaseAddon = class {
|
|
|
6529
7132
|
key,
|
|
6530
7133
|
schema,
|
|
6531
7134
|
fallback,
|
|
6532
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7135
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6533
7136
|
write: async (patch) => {
|
|
6534
7137
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6535
7138
|
},
|
|
@@ -6541,6 +7144,70 @@ var BaseAddon = class {
|
|
|
6541
7144
|
} })
|
|
6542
7145
|
});
|
|
6543
7146
|
}
|
|
7147
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7148
|
+
addonSecretTree() {
|
|
7149
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7150
|
+
return this._addonSecretTree;
|
|
7151
|
+
}
|
|
7152
|
+
deviceSecretTree() {
|
|
7153
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7154
|
+
return this._deviceSecretTree;
|
|
7155
|
+
}
|
|
7156
|
+
/**
|
|
7157
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7158
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7159
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7160
|
+
* than start on an empty credential.
|
|
7161
|
+
*/
|
|
7162
|
+
get unresolvedSecrets() {
|
|
7163
|
+
return this._unresolvedSecrets;
|
|
7164
|
+
}
|
|
7165
|
+
/**
|
|
7166
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7167
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7168
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7169
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7170
|
+
* ever written back from here.
|
|
7171
|
+
*/
|
|
7172
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7173
|
+
const secrets = this._ctx?.secrets;
|
|
7174
|
+
if (secrets === void 0) return blob;
|
|
7175
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7176
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7177
|
+
if (refs.length === 0) {
|
|
7178
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7179
|
+
return blob;
|
|
7180
|
+
}
|
|
7181
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7182
|
+
if (trackForConfig) {
|
|
7183
|
+
this._unresolvedSecrets = unresolved;
|
|
7184
|
+
if (unresolved.length > 0) {
|
|
7185
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7186
|
+
ref: u.ref,
|
|
7187
|
+
reason: u.reason
|
|
7188
|
+
})) } });
|
|
7189
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7190
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7191
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7192
|
+
}
|
|
7193
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7194
|
+
}
|
|
7195
|
+
return value;
|
|
7196
|
+
}
|
|
7197
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7198
|
+
scheduleSecretReresolve(delayMs) {
|
|
7199
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7200
|
+
if (this[timerOf] !== null) return;
|
|
7201
|
+
const timer = setTimeout(() => {
|
|
7202
|
+
this[timerOf] = null;
|
|
7203
|
+
if (this._ctx === null) return;
|
|
7204
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7205
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7206
|
+
});
|
|
7207
|
+
}, delayMs);
|
|
7208
|
+
timer.unref?.();
|
|
7209
|
+
this[timerOf] = timer;
|
|
7210
|
+
}
|
|
6544
7211
|
/**
|
|
6545
7212
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6546
7213
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7305,6 +7972,69 @@ var deviceOpsCapability = {
|
|
|
7305
7972
|
getRawState: method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" })
|
|
7306
7973
|
}
|
|
7307
7974
|
};
|
|
7975
|
+
function defOf(schema) {
|
|
7976
|
+
return schema._zod?.def ?? {};
|
|
7977
|
+
}
|
|
7978
|
+
function declaredHere(schema) {
|
|
7979
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7980
|
+
}
|
|
7981
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7982
|
+
var WRAPPERS = new Set([
|
|
7983
|
+
"optional",
|
|
7984
|
+
"nullable",
|
|
7985
|
+
"default",
|
|
7986
|
+
"prefault",
|
|
7987
|
+
"catch",
|
|
7988
|
+
"readonly",
|
|
7989
|
+
"nonoptional"
|
|
7990
|
+
]);
|
|
7991
|
+
/**
|
|
7992
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7993
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7994
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7995
|
+
* `.transform` on `in`).
|
|
7996
|
+
*/
|
|
7997
|
+
function layersOf(schema) {
|
|
7998
|
+
const out = [];
|
|
7999
|
+
const queue = [schema];
|
|
8000
|
+
while (queue.length > 0) {
|
|
8001
|
+
const s = queue.shift();
|
|
8002
|
+
if (!s || out.includes(s)) continue;
|
|
8003
|
+
out.push(s);
|
|
8004
|
+
const def = defOf(s);
|
|
8005
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8006
|
+
if (def.type === "pipe") {
|
|
8007
|
+
if (def.in) queue.push(def.in);
|
|
8008
|
+
if (def.out) queue.push(def.out);
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
return out;
|
|
8012
|
+
}
|
|
8013
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8014
|
+
function isZodSecret(schema) {
|
|
8015
|
+
return layersOf(schema).some(declaredHere);
|
|
8016
|
+
}
|
|
8017
|
+
/**
|
|
8018
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8019
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8020
|
+
* object or array is reported as one path and not descended into — everything
|
|
8021
|
+
* under it is secret.
|
|
8022
|
+
*/
|
|
8023
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8024
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8025
|
+
const paths = [];
|
|
8026
|
+
for (const layer of layersOf(schema)) {
|
|
8027
|
+
const def = defOf(layer);
|
|
8028
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8029
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8030
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8031
|
+
else if (def.type === "intersection") {
|
|
8032
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8033
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8034
|
+
}
|
|
8035
|
+
}
|
|
8036
|
+
return [...new Set(paths)];
|
|
8037
|
+
}
|
|
7308
8038
|
/**
|
|
7309
8039
|
* AUTO-GENERATED by scripts/generate-device-scoped-caps.ts — DO NOT EDIT.
|
|
7310
8040
|
*
|
|
@@ -16286,6 +17016,254 @@ id: union([string(), number()]) }), {
|
|
|
16286
17016
|
})
|
|
16287
17017
|
}
|
|
16288
17018
|
};
|
|
17019
|
+
/**
|
|
17020
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
17021
|
+
*
|
|
17022
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
17023
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
17024
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
17025
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
17026
|
+
* against the CALLER, never against anything the caller claims.
|
|
17027
|
+
*
|
|
17028
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
17029
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
17030
|
+
* connection, the agent from its child's connection carried in
|
|
17031
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
17032
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
17033
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
17034
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
17035
|
+
* runner is the same OS user): see the threat model in
|
|
17036
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
17037
|
+
*
|
|
17038
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
17039
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
17040
|
+
* floors every method to admin anyway (D240).
|
|
17041
|
+
*
|
|
17042
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
17043
|
+
*/
|
|
17044
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
17045
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
17046
|
+
"key-missing",
|
|
17047
|
+
"wrong-key",
|
|
17048
|
+
"key-file-unreadable",
|
|
17049
|
+
"store-unavailable",
|
|
17050
|
+
"not-initialized",
|
|
17051
|
+
"decrypt-failed"
|
|
17052
|
+
]);
|
|
17053
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
17054
|
+
state: literal("locked"),
|
|
17055
|
+
reason: KeychainUnavailableReasonSchema
|
|
17056
|
+
})]);
|
|
17057
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
17058
|
+
object({
|
|
17059
|
+
kind: literal("value"),
|
|
17060
|
+
value: string(),
|
|
17061
|
+
version: number().int()
|
|
17062
|
+
}),
|
|
17063
|
+
object({ kind: literal("missing") }),
|
|
17064
|
+
object({
|
|
17065
|
+
kind: literal("unavailable"),
|
|
17066
|
+
reason: KeychainUnavailableReasonSchema
|
|
17067
|
+
}),
|
|
17068
|
+
object({ kind: literal("forbidden") })
|
|
17069
|
+
]);
|
|
17070
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
17071
|
+
/** Metadata of one stored value — never the value. */
|
|
17072
|
+
var KeychainSecretMetaSchema = object({
|
|
17073
|
+
ref: string(),
|
|
17074
|
+
owner: string(),
|
|
17075
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
17076
|
+
scope: string(),
|
|
17077
|
+
fieldPath: string(),
|
|
17078
|
+
version: number().int(),
|
|
17079
|
+
createdAt: number(),
|
|
17080
|
+
updatedAt: number(),
|
|
17081
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
17082
|
+
updatedBy: string(),
|
|
17083
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
17084
|
+
lastReadAt: number().nullable()
|
|
17085
|
+
});
|
|
17086
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
17087
|
+
var keychainCapability = {
|
|
17088
|
+
name: "keychain",
|
|
17089
|
+
scope: "system",
|
|
17090
|
+
mode: "singleton",
|
|
17091
|
+
internal: true,
|
|
17092
|
+
methods: {
|
|
17093
|
+
/** Store (or replace) the caller's value at `ref`. Refused while locked. */
|
|
17094
|
+
put: method(object({
|
|
17095
|
+
ref: string().min(1),
|
|
17096
|
+
value: string().min(1)
|
|
17097
|
+
}), object({
|
|
17098
|
+
ref: string(),
|
|
17099
|
+
version: number().int()
|
|
17100
|
+
}), {
|
|
17101
|
+
kind: "mutation",
|
|
17102
|
+
auth: "admin"
|
|
17103
|
+
}),
|
|
17104
|
+
/**
|
|
17105
|
+
* Resolve the caller's refs in one round-trip. A locked keychain answers
|
|
17106
|
+
* `unavailable` per ref — never `missing`, never an empty value.
|
|
17107
|
+
*/
|
|
17108
|
+
resolve: method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }),
|
|
17109
|
+
/** Remove the caller's refs. Unknown refs are ignored. */
|
|
17110
|
+
delete: method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
17111
|
+
kind: "mutation",
|
|
17112
|
+
auth: "admin"
|
|
17113
|
+
}),
|
|
17114
|
+
/** The caller's own refs, metadata only. */
|
|
17115
|
+
listMeta: method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }),
|
|
17116
|
+
/** Whether values can be served — the save path refuses a write while locked. */
|
|
17117
|
+
getState: method(object({}), KeychainStateSchema, { auth: "admin" })
|
|
17118
|
+
}
|
|
17119
|
+
};
|
|
17120
|
+
var KeychainKeySourceSchema = object({
|
|
17121
|
+
kind: _enum([
|
|
17122
|
+
"config-file",
|
|
17123
|
+
"previous-config-file",
|
|
17124
|
+
"platform",
|
|
17125
|
+
"default-file"
|
|
17126
|
+
]),
|
|
17127
|
+
/** File sources only — a path is not a secret. */
|
|
17128
|
+
path: string().optional(),
|
|
17129
|
+
/**
|
|
17130
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
17131
|
+
* next to the database it protects (the default file). The page warns.
|
|
17132
|
+
*/
|
|
17133
|
+
sharesBackupWithDatabase: boolean()
|
|
17134
|
+
});
|
|
17135
|
+
var KeychainStatusSchema = object({
|
|
17136
|
+
keychain: KeychainStateSchema,
|
|
17137
|
+
/** The source of the master key in use; `null` while locked. */
|
|
17138
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
17139
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
17140
|
+
configuredSource: KeychainKeySourceSchema,
|
|
17141
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
17142
|
+
fingerprint: string().nullable(),
|
|
17143
|
+
activeKeyId: string().nullable(),
|
|
17144
|
+
/**
|
|
17145
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
17146
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
17147
|
+
*/
|
|
17148
|
+
rotationPending: boolean(),
|
|
17149
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
17150
|
+
retiredWraps: number().int(),
|
|
17151
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
17152
|
+
secretCount: number().int()
|
|
17153
|
+
});
|
|
17154
|
+
/**
|
|
17155
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
17156
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
17157
|
+
* never reported as an orphan (and never deleted as one).
|
|
17158
|
+
*/
|
|
17159
|
+
var KeychainSecretUsageSchema = _enum([
|
|
17160
|
+
"in-use",
|
|
17161
|
+
"orphan",
|
|
17162
|
+
"unknown"
|
|
17163
|
+
]);
|
|
17164
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
17165
|
+
var KeychainAuditActionSchema = _enum([
|
|
17166
|
+
"put",
|
|
17167
|
+
"delete",
|
|
17168
|
+
"reveal",
|
|
17169
|
+
"rotate-master-key",
|
|
17170
|
+
"purge-retired-keys",
|
|
17171
|
+
"download-recovery-key",
|
|
17172
|
+
"delete-orphans",
|
|
17173
|
+
"reset",
|
|
17174
|
+
"initialize"
|
|
17175
|
+
]);
|
|
17176
|
+
var KeychainAuditEntrySchema = object({
|
|
17177
|
+
id: string(),
|
|
17178
|
+
at: number(),
|
|
17179
|
+
action: KeychainAuditActionSchema,
|
|
17180
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
17181
|
+
actor: string(),
|
|
17182
|
+
ref: string().nullable(),
|
|
17183
|
+
detail: string().nullable()
|
|
17184
|
+
});
|
|
17185
|
+
var keychainAdminCapability = {
|
|
17186
|
+
name: "keychain-admin",
|
|
17187
|
+
scope: "system",
|
|
17188
|
+
mode: "singleton",
|
|
17189
|
+
methods: {
|
|
17190
|
+
status: method(object({}), KeychainStatusSchema, { auth: "admin" }),
|
|
17191
|
+
listSecrets: method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }),
|
|
17192
|
+
listAudit: method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }),
|
|
17193
|
+
/**
|
|
17194
|
+
* Show one value to the operator. Audited. The UI hides it again after a
|
|
17195
|
+
* few seconds; nothing caches it.
|
|
17196
|
+
*/
|
|
17197
|
+
reveal: method(object({ ref: string().min(1) }), object({
|
|
17198
|
+
value: string(),
|
|
17199
|
+
version: number().int()
|
|
17200
|
+
}), {
|
|
17201
|
+
kind: "mutation",
|
|
17202
|
+
auth: "admin",
|
|
17203
|
+
caller: "required"
|
|
17204
|
+
}),
|
|
17205
|
+
/** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
|
|
17206
|
+
deleteOrphans: method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
17207
|
+
deleted: array(string()).readonly(),
|
|
17208
|
+
kept: array(object({
|
|
17209
|
+
ref: string(),
|
|
17210
|
+
usage: KeychainSecretUsageSchema
|
|
17211
|
+
})).readonly()
|
|
17212
|
+
}), {
|
|
17213
|
+
kind: "mutation",
|
|
17214
|
+
auth: "admin",
|
|
17215
|
+
caller: "required"
|
|
17216
|
+
}),
|
|
17217
|
+
/**
|
|
17218
|
+
* Wrap the data key under the configured primary master key.
|
|
17219
|
+
*
|
|
17220
|
+
* Pending rotation (the keychain unlocked with a previous source): re-wrap
|
|
17221
|
+
* under the primary. Otherwise, with the default file as primary: generate
|
|
17222
|
+
* a new master key, write it there, re-wrap. A file or OS-keychain primary
|
|
17223
|
+
* that is already in use cannot be replaced from here — put the new key at
|
|
17224
|
+
* the source, keep the old one as `keychain.previousKeyFile`, restart, and
|
|
17225
|
+
* rotate. No value is re-encrypted either way; the previous wrap is kept
|
|
17226
|
+
* (retired) until purged.
|
|
17227
|
+
*/
|
|
17228
|
+
rotateMasterKey: method(object({}), object({
|
|
17229
|
+
fingerprint: string(),
|
|
17230
|
+
keySource: KeychainKeySourceSchema
|
|
17231
|
+
}), {
|
|
17232
|
+
kind: "mutation",
|
|
17233
|
+
auth: "admin",
|
|
17234
|
+
caller: "required"
|
|
17235
|
+
}),
|
|
17236
|
+
purgeRetiredKeys: method(object({}), object({ purged: number().int() }), {
|
|
17237
|
+
kind: "mutation",
|
|
17238
|
+
auth: "admin",
|
|
17239
|
+
caller: "required"
|
|
17240
|
+
}),
|
|
17241
|
+
/** The master key, base64. Audited; marks the recovery copy as taken. */
|
|
17242
|
+
downloadRecoveryKey: method(object({}), object({
|
|
17243
|
+
key: string(),
|
|
17244
|
+
fingerprint: string(),
|
|
17245
|
+
keySource: KeychainKeySourceSchema
|
|
17246
|
+
}), {
|
|
17247
|
+
kind: "mutation",
|
|
17248
|
+
auth: "admin",
|
|
17249
|
+
caller: "required"
|
|
17250
|
+
}),
|
|
17251
|
+
/**
|
|
17252
|
+
* Lost-key recovery: archive every stored value into a
|
|
17253
|
+
* `keychain:secrets-orphaned-<ts>` table and start over with a new data
|
|
17254
|
+
* key. Every secret field then reads "not set". Requires the typed
|
|
17255
|
+
* confirmation {@link KEYCHAIN_RESET_CONFIRMATION}.
|
|
17256
|
+
*/
|
|
17257
|
+
resetKeychain: method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
17258
|
+
archivedCollection: string().nullable(),
|
|
17259
|
+
archived: number().int()
|
|
17260
|
+
}), {
|
|
17261
|
+
kind: "mutation",
|
|
17262
|
+
auth: "admin",
|
|
17263
|
+
caller: "required"
|
|
17264
|
+
})
|
|
17265
|
+
}
|
|
17266
|
+
};
|
|
16289
17267
|
var decoderCapability = {
|
|
16290
17268
|
name: "decoder",
|
|
16291
17269
|
scope: "system",
|
|
@@ -17641,7 +18619,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
17641
18619
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
17642
18620
|
var DevicePersistConfigPayloadSchema = object({
|
|
17643
18621
|
deviceId: number(),
|
|
17644
|
-
data: record(string(), unknown())
|
|
18622
|
+
data: record(string(), unknown()),
|
|
18623
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
18624
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
18625
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
18626
|
+
secretConfigPaths: array(string()).optional()
|
|
17645
18627
|
});
|
|
17646
18628
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
17647
18629
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -26893,8 +27875,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
26893
27875
|
]);
|
|
26894
27876
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
26895
27877
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
26896
|
-
/**
|
|
26897
|
-
|
|
27878
|
+
/**
|
|
27879
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
27880
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
27881
|
+
*
|
|
27882
|
+
* - `operator` — drawn by hand.
|
|
27883
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
27884
|
+
* model, or a larger teacher model).
|
|
27885
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
27886
|
+
* back from the track store (never a re-run).
|
|
27887
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
27888
|
+
*/
|
|
27889
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
27890
|
+
"operator",
|
|
27891
|
+
"assist",
|
|
27892
|
+
"pipeline",
|
|
27893
|
+
"llm"
|
|
27894
|
+
]);
|
|
26898
27895
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
26899
27896
|
var RetrainBboxSchema = object({
|
|
26900
27897
|
x: number(),
|
|
@@ -26912,7 +27909,8 @@ var RetrainBboxSchema = object({
|
|
|
26912
27909
|
*/
|
|
26913
27910
|
var RetrainAnnotationSchema = object({
|
|
26914
27911
|
id: string(),
|
|
26915
|
-
|
|
27912
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
27913
|
+
trackId: string().optional(),
|
|
26916
27914
|
deviceId: number(),
|
|
26917
27915
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
26918
27916
|
mediaKey: string(),
|
|
@@ -26961,13 +27959,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
26961
27959
|
* fail, whatever became of the original. */
|
|
26962
27960
|
copied: boolean()
|
|
26963
27961
|
});
|
|
27962
|
+
/**
|
|
27963
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
27964
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
27965
|
+
* box recorded on the source media row when there is one, else the track
|
|
27966
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
27967
|
+
* until the operator confirms it.
|
|
27968
|
+
*/
|
|
27969
|
+
var RetrainPipelineBoxSchema = object({
|
|
27970
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
27971
|
+
bbox: RetrainBboxSchema,
|
|
27972
|
+
macroClass: RetrainMacroClassSchema,
|
|
27973
|
+
label: string().optional(),
|
|
27974
|
+
subLabel: string().optional(),
|
|
27975
|
+
/** The detection score of the position used, when it was recorded. */
|
|
27976
|
+
score: number().optional(),
|
|
27977
|
+
/** The root model that produced the track, when it was recorded. */
|
|
27978
|
+
modelId: string().optional(),
|
|
27979
|
+
trackId: string(),
|
|
27980
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
27981
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
27982
|
+
basis: _enum(["subject-box", "position"]),
|
|
27983
|
+
deltaMs: number()
|
|
27984
|
+
});
|
|
27985
|
+
/**
|
|
27986
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
27987
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
27988
|
+
* track at all.
|
|
27989
|
+
*/
|
|
27990
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
26964
27991
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
26965
27992
|
var RetrainFrameSchema = object({
|
|
26966
27993
|
frameId: string(),
|
|
26967
27994
|
deviceId: number(),
|
|
26968
|
-
|
|
26969
|
-
/**
|
|
26970
|
-
|
|
27995
|
+
origin: RetrainFrameOriginSchema,
|
|
27996
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
27997
|
+
trackId: string().optional(),
|
|
27998
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
27999
|
+
* Absent on a recording still. */
|
|
28000
|
+
sourceMediaId: number().int().optional(),
|
|
28001
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
28002
|
+
epochMs: number().optional(),
|
|
26971
28003
|
sourceKind: MediaFileKindEnum,
|
|
26972
28004
|
sizeBytes: number().int(),
|
|
26973
28005
|
width: number().int(),
|
|
@@ -26978,7 +28010,12 @@ var RetrainFrameSchema = object({
|
|
|
26978
28010
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
26979
28011
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
26980
28012
|
* a false positive. */
|
|
26981
|
-
complete: boolean()
|
|
28013
|
+
complete: boolean(),
|
|
28014
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
28015
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
28016
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
28017
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
28018
|
+
collectionIds: array(string()).readonly().optional()
|
|
26982
28019
|
});
|
|
26983
28020
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
26984
28021
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -27009,6 +28046,11 @@ var RetrainFrameListSchema = object({
|
|
|
27009
28046
|
var RetrainExportFilterSchema = object({
|
|
27010
28047
|
deviceIds: array(number()).optional(),
|
|
27011
28048
|
frameIds: array(string()).max(2e4).optional(),
|
|
28049
|
+
/** Only frames in at least one of these named collections. */
|
|
28050
|
+
collectionIds: array(string()).max(200).optional(),
|
|
28051
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
28052
|
+
* unknown id selects nothing. */
|
|
28053
|
+
datasetVersionId: string().optional(),
|
|
27012
28054
|
batchId: string().optional(),
|
|
27013
28055
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
27014
28056
|
completeOnly: boolean().optional()
|
|
@@ -27073,6 +28115,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
27073
28115
|
reason: string(),
|
|
27074
28116
|
detail: string().optional()
|
|
27075
28117
|
})]);
|
|
28118
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
28119
|
+
var RetrainCollectionSchema = object({
|
|
28120
|
+
id: string(),
|
|
28121
|
+
name: string(),
|
|
28122
|
+
createdAt: number(),
|
|
28123
|
+
frameCount: number().int()
|
|
28124
|
+
});
|
|
28125
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
28126
|
+
kind: literal("created"),
|
|
28127
|
+
collection: RetrainCollectionSchema
|
|
28128
|
+
}), object({
|
|
28129
|
+
kind: literal("refused"),
|
|
28130
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
28131
|
+
})]);
|
|
28132
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
28133
|
+
kind: literal("renamed"),
|
|
28134
|
+
collection: RetrainCollectionSchema
|
|
28135
|
+
}), object({
|
|
28136
|
+
kind: literal("refused"),
|
|
28137
|
+
reason: _enum([
|
|
28138
|
+
"empty-name",
|
|
28139
|
+
"duplicate-name",
|
|
28140
|
+
"unknown-collection"
|
|
28141
|
+
])
|
|
28142
|
+
})]);
|
|
28143
|
+
/**
|
|
28144
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
28145
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
28146
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
28147
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
28148
|
+
*/
|
|
28149
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
28150
|
+
kind: literal("added"),
|
|
28151
|
+
collectionId: string(),
|
|
28152
|
+
frame: RetrainFrameSchema,
|
|
28153
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
28154
|
+
reused: boolean()
|
|
28155
|
+
}), object({
|
|
28156
|
+
kind: literal("refused"),
|
|
28157
|
+
reason: _enum([
|
|
28158
|
+
"unknown-collection",
|
|
28159
|
+
"still-unavailable",
|
|
28160
|
+
"still-busy",
|
|
28161
|
+
"unreadable-image",
|
|
28162
|
+
"write-failed"
|
|
28163
|
+
]),
|
|
28164
|
+
detail: string().optional()
|
|
28165
|
+
})]);
|
|
28166
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
28167
|
+
var RetrainAssistProfileSchema = object({
|
|
28168
|
+
id: string(),
|
|
28169
|
+
name: string(),
|
|
28170
|
+
model: string(),
|
|
28171
|
+
kind: string(),
|
|
28172
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
28173
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
28174
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
28175
|
+
leavesHouse: boolean()
|
|
28176
|
+
});
|
|
28177
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
28178
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
28179
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
28180
|
+
var RetrainLlmReviewSchema = object({
|
|
28181
|
+
/** The `ref` the page sent the box under. */
|
|
28182
|
+
ref: string(),
|
|
28183
|
+
verdict: _enum([
|
|
28184
|
+
"confirmed",
|
|
28185
|
+
"wrong-class",
|
|
28186
|
+
"not-an-object",
|
|
28187
|
+
"uncertain"
|
|
28188
|
+
]),
|
|
28189
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
28190
|
+
reason: string()
|
|
28191
|
+
});
|
|
28192
|
+
/**
|
|
28193
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
28194
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
28195
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
28196
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
28197
|
+
*/
|
|
28198
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
28199
|
+
kind: literal("proposed"),
|
|
28200
|
+
profileId: string(),
|
|
28201
|
+
model: string(),
|
|
28202
|
+
/** The frame was sent outside the house for this answer. */
|
|
28203
|
+
leftHouse: boolean(),
|
|
28204
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
28205
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
28206
|
+
rejected: number().int()
|
|
28207
|
+
}), object({
|
|
28208
|
+
kind: literal("refused"),
|
|
28209
|
+
reason: _enum([
|
|
28210
|
+
"unknown-frame",
|
|
28211
|
+
"unreadable-frame",
|
|
28212
|
+
"unknown-profile",
|
|
28213
|
+
"profile-disabled",
|
|
28214
|
+
"no-vision",
|
|
28215
|
+
"cloud-not-confirmed",
|
|
28216
|
+
"llm-error",
|
|
28217
|
+
"malformed-answer"
|
|
28218
|
+
]),
|
|
28219
|
+
detail: string().optional()
|
|
28220
|
+
})]);
|
|
28221
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
28222
|
+
var RetrainDatasetSelectionSchema = object({
|
|
28223
|
+
deviceIds: array(number()).readonly().optional(),
|
|
28224
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
28225
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
28226
|
+
});
|
|
28227
|
+
/** The counts a dataset is judged by. */
|
|
28228
|
+
var RetrainDatasetStatsSchema = object({
|
|
28229
|
+
frames: number().int(),
|
|
28230
|
+
completeFrames: number().int(),
|
|
28231
|
+
/** `completeFrames / frames`, 0..1. */
|
|
28232
|
+
completeness: number(),
|
|
28233
|
+
/** Boxes to learn (model errors excluded). */
|
|
28234
|
+
subjects: number().int(),
|
|
28235
|
+
modelErrors: number().int(),
|
|
28236
|
+
/** Complete frames with no subject. */
|
|
28237
|
+
hardNegatives: number().int(),
|
|
28238
|
+
/** Subjects per class × camera × day/night. */
|
|
28239
|
+
cells: array(object({
|
|
28240
|
+
macroClass: string(),
|
|
28241
|
+
deviceId: number(),
|
|
28242
|
+
lighting: _enum([
|
|
28243
|
+
"day",
|
|
28244
|
+
"night",
|
|
28245
|
+
"unknown"
|
|
28246
|
+
]),
|
|
28247
|
+
subjects: number().int(),
|
|
28248
|
+
frames: number().int()
|
|
28249
|
+
})).readonly(),
|
|
28250
|
+
cameras: array(object({
|
|
28251
|
+
deviceId: number(),
|
|
28252
|
+
frames: number().int(),
|
|
28253
|
+
completeFrames: number().int()
|
|
28254
|
+
})).readonly()
|
|
28255
|
+
});
|
|
28256
|
+
/** An immutable dataset version, without its frame list. */
|
|
28257
|
+
var RetrainDatasetVersionSchema = object({
|
|
28258
|
+
id: string(),
|
|
28259
|
+
name: string(),
|
|
28260
|
+
createdAt: number(),
|
|
28261
|
+
selection: RetrainDatasetSelectionSchema,
|
|
28262
|
+
layout: RetrainExportLayoutSchema,
|
|
28263
|
+
completeOnly: boolean(),
|
|
28264
|
+
frameCount: number().int(),
|
|
28265
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
28266
|
+
annotationHash: string(),
|
|
28267
|
+
/** The export manifest schema the version was cut under. */
|
|
28268
|
+
manifestSchema: string(),
|
|
28269
|
+
stats: RetrainDatasetStatsSchema
|
|
28270
|
+
});
|
|
28271
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
28272
|
+
kind: literal("created"),
|
|
28273
|
+
version: RetrainDatasetVersionSchema
|
|
28274
|
+
}), object({
|
|
28275
|
+
kind: literal("refused"),
|
|
28276
|
+
reason: _enum([
|
|
28277
|
+
"empty-name",
|
|
28278
|
+
"duplicate-name",
|
|
28279
|
+
"no-frames"
|
|
28280
|
+
])
|
|
28281
|
+
})]);
|
|
27076
28282
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
27077
28283
|
var RetrainTransitionResultSchema = object({
|
|
27078
28284
|
trackId: string(),
|
|
@@ -28289,7 +29495,7 @@ var pipelineAnalyticsCapability = {
|
|
|
28289
29495
|
* a frame leaves the dataset before export. */
|
|
28290
29496
|
deselectRetrainFrame: method(object({
|
|
28291
29497
|
deviceId: number(),
|
|
28292
|
-
trackId: string(),
|
|
29498
|
+
trackId: string().optional(),
|
|
28293
29499
|
frameId: string()
|
|
28294
29500
|
}), object({
|
|
28295
29501
|
removed: boolean(),
|
|
@@ -28332,7 +29538,8 @@ var pipelineAnalyticsCapability = {
|
|
|
28332
29538
|
*/
|
|
28333
29539
|
proposeRetrainAnnotations: method(object({
|
|
28334
29540
|
deviceId: number(),
|
|
28335
|
-
|
|
29541
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
29542
|
+
trackId: string().optional(),
|
|
28336
29543
|
frameId: string(),
|
|
28337
29544
|
subject: RetrainAssistSubjectSchema,
|
|
28338
29545
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -28341,8 +29548,12 @@ var pipelineAnalyticsCapability = {
|
|
|
28341
29548
|
kind: "mutation",
|
|
28342
29549
|
auth: "admin"
|
|
28343
29550
|
}),
|
|
28344
|
-
/** Every annotation on a track,
|
|
28345
|
-
|
|
29551
|
+
/** Every annotation on a track, or on named frames (a recording still has
|
|
29552
|
+
* no track), oldest first. One of the two is required. */
|
|
29553
|
+
listRetrainAnnotations: method(object({
|
|
29554
|
+
trackId: string().optional(),
|
|
29555
|
+
frameIds: array(string()).max(2e3).optional()
|
|
29556
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
28346
29557
|
kind: "query",
|
|
28347
29558
|
auth: "admin"
|
|
28348
29559
|
}),
|
|
@@ -28361,7 +29572,8 @@ var pipelineAnalyticsCapability = {
|
|
|
28361
29572
|
*/
|
|
28362
29573
|
saveRetrainAnnotations: method(object({
|
|
28363
29574
|
deviceId: number(),
|
|
28364
|
-
|
|
29575
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
29576
|
+
trackId: string().optional(),
|
|
28365
29577
|
frameId: string(),
|
|
28366
29578
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
28367
29579
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -28424,7 +29636,7 @@ var pipelineAnalyticsCapability = {
|
|
|
28424
29636
|
*/
|
|
28425
29637
|
setRetrainFrameComplete: method(object({
|
|
28426
29638
|
deviceId: number(),
|
|
28427
|
-
trackId: string(),
|
|
29639
|
+
trackId: string().optional(),
|
|
28428
29640
|
frameId: string(),
|
|
28429
29641
|
complete: boolean()
|
|
28430
29642
|
}), RetrainFrameSchema, {
|
|
@@ -28447,6 +29659,162 @@ var pipelineAnalyticsCapability = {
|
|
|
28447
29659
|
auth: "admin",
|
|
28448
29660
|
timeoutMs: 60 * 6e4
|
|
28449
29661
|
}),
|
|
29662
|
+
/** The counts a selection would freeze — class × camera × day/night,
|
|
29663
|
+
* completeness — without freezing anything. Index reads only. */
|
|
29664
|
+
previewRetrainDataset: method(object({
|
|
29665
|
+
selection: RetrainDatasetSelectionSchema,
|
|
29666
|
+
completeOnly: boolean().optional()
|
|
29667
|
+
}), RetrainDatasetStatsSchema, {
|
|
29668
|
+
kind: "query",
|
|
29669
|
+
auth: "admin"
|
|
29670
|
+
}),
|
|
29671
|
+
/**
|
|
29672
|
+
* Freeze a dataset version: the frames the selection yields (the same plan
|
|
29673
|
+
* the annotated export builds), the hash of what they teach, the export
|
|
29674
|
+
* parameters and the counts. Immutable — a different selection is a new
|
|
29675
|
+
* version. Export it with `getRetrainExportUrl({ datasetVersionId })`.
|
|
29676
|
+
*/
|
|
29677
|
+
createRetrainDatasetVersion: method(object({
|
|
29678
|
+
name: string().max(120),
|
|
29679
|
+
selection: RetrainDatasetSelectionSchema,
|
|
29680
|
+
layout: RetrainExportLayoutSchema,
|
|
29681
|
+
completeOnly: boolean()
|
|
29682
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
29683
|
+
kind: "mutation",
|
|
29684
|
+
auth: "admin",
|
|
29685
|
+
timeoutMs: 12e4
|
|
29686
|
+
}),
|
|
29687
|
+
/** Every dataset version, newest first. */
|
|
29688
|
+
listRetrainDatasetVersions: method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
29689
|
+
kind: "query",
|
|
29690
|
+
auth: "admin"
|
|
29691
|
+
}),
|
|
29692
|
+
/** Delete a version. Its frames stay in the dataset. */
|
|
29693
|
+
deleteRetrainDatasetVersion: method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
29694
|
+
kind: "mutation",
|
|
29695
|
+
auth: "admin"
|
|
29696
|
+
}),
|
|
29697
|
+
/** Does the corpus still teach what the version froze? `missingFrames`
|
|
29698
|
+
* counts frames that left the dataset (or lost every box and tick). */
|
|
29699
|
+
verifyRetrainDatasetVersion: method(object({ id: string() }), object({
|
|
29700
|
+
found: boolean(),
|
|
29701
|
+
annotationHash: string(),
|
|
29702
|
+
matches: boolean(),
|
|
29703
|
+
missingFrames: number().int()
|
|
29704
|
+
}), {
|
|
29705
|
+
kind: "query",
|
|
29706
|
+
auth: "admin",
|
|
29707
|
+
timeoutMs: 12e4
|
|
29708
|
+
}),
|
|
29709
|
+
/** The enabled, vision-capable LLM profiles, each saying whether a frame
|
|
29710
|
+
* sent to it leaves the house. */
|
|
29711
|
+
listRetrainAssistProfiles: method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
29712
|
+
kind: "query",
|
|
29713
|
+
auth: "admin"
|
|
29714
|
+
}),
|
|
29715
|
+
/**
|
|
29716
|
+
* Ask a vision LLM (the `llm` capability) about ONE copied frame: list the
|
|
29717
|
+
* objects of `classes` with boxes, and review the boxes already on the
|
|
29718
|
+
* canvas (sent by `ref`). Answers drafts (`source: 'llm'`) and reviews —
|
|
29719
|
+
* nothing is stored, nothing is accepted. A profile that sends the frame
|
|
29720
|
+
* outside the house is refused unless `allowCloud` says the operator
|
|
29721
|
+
* confirmed this run.
|
|
29722
|
+
*/
|
|
29723
|
+
proposeRetrainAnnotationsWithLlm: method(object({
|
|
29724
|
+
deviceId: number(),
|
|
29725
|
+
trackId: string().optional(),
|
|
29726
|
+
frameId: string(),
|
|
29727
|
+
profileId: string(),
|
|
29728
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
29729
|
+
boxes: array(object({
|
|
29730
|
+
ref: string(),
|
|
29731
|
+
bbox: RetrainBboxSchema,
|
|
29732
|
+
macroClass: RetrainMacroClassSchema,
|
|
29733
|
+
label: string().optional()
|
|
29734
|
+
})).max(50),
|
|
29735
|
+
allowCloud: boolean()
|
|
29736
|
+
}), RetrainLlmAssistResultSchema, {
|
|
29737
|
+
kind: "mutation",
|
|
29738
|
+
auth: "admin",
|
|
29739
|
+
timeoutMs: 18e4
|
|
29740
|
+
}),
|
|
29741
|
+
/**
|
|
29742
|
+
* Create a named collection — a set over the retrain corpus ("packages
|
|
29743
|
+
* porch night"). Names are unique case-insensitively and never empty;
|
|
29744
|
+
* both refusals are named.
|
|
29745
|
+
*/
|
|
29746
|
+
createRetrainCollection: method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
29747
|
+
kind: "mutation",
|
|
29748
|
+
auth: "admin"
|
|
29749
|
+
}),
|
|
29750
|
+
/** Every collection, newest first, with its frame count. */
|
|
29751
|
+
listRetrainCollections: method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
29752
|
+
kind: "query",
|
|
29753
|
+
auth: "admin"
|
|
29754
|
+
}),
|
|
29755
|
+
renameRetrainCollection: method(object({
|
|
29756
|
+
id: string(),
|
|
29757
|
+
name: string().max(120)
|
|
29758
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
29759
|
+
kind: "mutation",
|
|
29760
|
+
auth: "admin"
|
|
29761
|
+
}),
|
|
29762
|
+
/**
|
|
29763
|
+
* Delete a collection. Its recording stills that no other collection
|
|
29764
|
+
* holds are deleted with their annotations (nothing else reaches them);
|
|
29765
|
+
* frames copied from tracks always stay in the dataset.
|
|
29766
|
+
*/
|
|
29767
|
+
deleteRetrainCollection: method(object({ id: string() }), object({
|
|
29768
|
+
deleted: boolean(),
|
|
29769
|
+
removedFrames: number().int()
|
|
29770
|
+
}), {
|
|
29771
|
+
kind: "mutation",
|
|
29772
|
+
auth: "admin"
|
|
29773
|
+
}),
|
|
29774
|
+
/**
|
|
29775
|
+
* Add the frame at a recording instant to a collection — the frame the
|
|
29776
|
+
* model may have seen NOTHING in. The recorder re-decodes the native
|
|
29777
|
+
* frame at `epochMs`; the dataset copies it (trackless, durable). The same
|
|
29778
|
+
* moment twice is one copy. Every refusal is named.
|
|
29779
|
+
*/
|
|
29780
|
+
addRetrainFrameFromRecording: method(object({
|
|
29781
|
+
collectionId: string(),
|
|
29782
|
+
deviceId: number(),
|
|
29783
|
+
epochMs: number()
|
|
29784
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
29785
|
+
kind: "mutation",
|
|
29786
|
+
auth: "admin",
|
|
29787
|
+
timeoutMs: 6e4
|
|
29788
|
+
}),
|
|
29789
|
+
/** Add frames already in the dataset to a collection. */
|
|
29790
|
+
addRetrainFramesToCollection: method(object({
|
|
29791
|
+
collectionId: string(),
|
|
29792
|
+
frameIds: array(string()).min(1).max(500)
|
|
29793
|
+
}), object({
|
|
29794
|
+
added: number().int(),
|
|
29795
|
+
alreadyMember: number().int(),
|
|
29796
|
+
unknownFrameIds: array(string()).readonly()
|
|
29797
|
+
}), {
|
|
29798
|
+
kind: "mutation",
|
|
29799
|
+
auth: "admin"
|
|
29800
|
+
}),
|
|
29801
|
+
/** Remove a frame from a collection. A recording still left in no
|
|
29802
|
+
* collection is deleted with its annotations (`deletedFrame`). */
|
|
29803
|
+
removeRetrainFrameFromCollection: method(object({
|
|
29804
|
+
collectionId: string(),
|
|
29805
|
+
frameId: string()
|
|
29806
|
+
}), object({
|
|
29807
|
+
removed: boolean(),
|
|
29808
|
+
deletedFrame: boolean()
|
|
29809
|
+
}), {
|
|
29810
|
+
kind: "mutation",
|
|
29811
|
+
auth: "admin"
|
|
29812
|
+
}),
|
|
29813
|
+
/** The frames of a collection, with their pipeline boxes. */
|
|
29814
|
+
listRetrainCollectionFrames: method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
29815
|
+
kind: "query",
|
|
29816
|
+
auth: "admin"
|
|
29817
|
+
}),
|
|
28450
29818
|
/**
|
|
28451
29819
|
* The media an EVENT owns.
|
|
28452
29820
|
*
|
|
@@ -29386,13 +30754,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
29386
30754
|
object({
|
|
29387
30755
|
kind: literal("no-family-build"),
|
|
29388
30756
|
format: ModelFormatSchema$1
|
|
30757
|
+
}),
|
|
30758
|
+
object({
|
|
30759
|
+
kind: literal("kept-custom-pin"),
|
|
30760
|
+
modelId: string(),
|
|
30761
|
+
deviceKey: string()
|
|
29389
30762
|
})
|
|
29390
30763
|
]);
|
|
30764
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
30765
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
30766
|
+
/**
|
|
30767
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
30768
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
30769
|
+
*/
|
|
30770
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
30771
|
+
kind: literal("node-benchmark"),
|
|
30772
|
+
resultId: string(),
|
|
30773
|
+
measuredAtMs: number()
|
|
30774
|
+
})]);
|
|
29391
30775
|
var DeviceModelChoiceSchema = object({
|
|
29392
30776
|
modelId: string(),
|
|
29393
30777
|
p50Ms: number(),
|
|
29394
30778
|
fps: number(),
|
|
29395
30779
|
measured: boolean(),
|
|
30780
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
30781
|
+
source: LatencySourceSchema.optional(),
|
|
29396
30782
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
29397
30783
|
capacitySessions: number(),
|
|
29398
30784
|
personRecall: number()
|
|
@@ -29403,6 +30789,8 @@ var DeviceRecommendationSchema = object({
|
|
|
29403
30789
|
enabled: boolean(),
|
|
29404
30790
|
available: boolean(),
|
|
29405
30791
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
30792
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
30793
|
+
kept: KeptReasonSchema.optional(),
|
|
29406
30794
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
29407
30795
|
});
|
|
29408
30796
|
var NodeRecommendationSchema = object({
|
|
@@ -29456,6 +30844,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
29456
30844
|
kind: literal("coral-enabled"),
|
|
29457
30845
|
nodeId: string(),
|
|
29458
30846
|
deviceKey: string()
|
|
30847
|
+
}),
|
|
30848
|
+
object({
|
|
30849
|
+
kind: literal("custom-pin-kept"),
|
|
30850
|
+
nodeId: string(),
|
|
30851
|
+
deviceKey: string().nullable(),
|
|
30852
|
+
deviceId: number().nullable(),
|
|
30853
|
+
modelId: string()
|
|
30854
|
+
}),
|
|
30855
|
+
object({
|
|
30856
|
+
kind: literal("custom-registry-unreadable"),
|
|
30857
|
+
error: string()
|
|
29459
30858
|
})
|
|
29460
30859
|
]);
|
|
29461
30860
|
var AutoTuneOptionsSchema = object({
|
|
@@ -29634,13 +31033,14 @@ var SuggestSharesResultSchema = object({
|
|
|
29634
31033
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
29635
31034
|
});
|
|
29636
31035
|
/**
|
|
29637
|
-
* Where the node and device shares come from (D750, D755).
|
|
29638
|
-
* - `
|
|
29639
|
-
*
|
|
29640
|
-
*
|
|
29641
|
-
*
|
|
29642
|
-
*
|
|
29643
|
-
*
|
|
31036
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
31037
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
31038
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
31039
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
31040
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
31041
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
31042
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
31043
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
29644
31044
|
* - `manual` — the operator's stored sliders.
|
|
29645
31045
|
* Either way a node or device that cannot take sessions gives its share to
|
|
29646
31046
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -29689,6 +31089,362 @@ var EffectiveSharesSchema = object({
|
|
|
29689
31089
|
nodeWeights: record(string(), number()),
|
|
29690
31090
|
deviceWeights: record(string(), record(string(), number()))
|
|
29691
31091
|
});
|
|
31092
|
+
/**
|
|
31093
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
31094
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
31095
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
31096
|
+
* shares read.
|
|
31097
|
+
*
|
|
31098
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
31099
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
31100
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
31101
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
31102
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
31103
|
+
*
|
|
31104
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
31105
|
+
* cross a process at frame rate, D9):
|
|
31106
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
31107
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
31108
|
+
* interval;
|
|
31109
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
31110
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
31111
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
31112
|
+
* CPU, RAM or the event loop give out.
|
|
31113
|
+
*/
|
|
31114
|
+
/** Defaults and bounds, one place. */
|
|
31115
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
31116
|
+
fpsPerStream: 10,
|
|
31117
|
+
budgetMinutes: 45,
|
|
31118
|
+
minBudgetMinutes: 10,
|
|
31119
|
+
maxBudgetMinutes: 120,
|
|
31120
|
+
/** A result older than this no longer beats the table. */
|
|
31121
|
+
staleAfterDays: 30,
|
|
31122
|
+
/** Warm-in per ramp step (not accounted). */
|
|
31123
|
+
settleSec: 5,
|
|
31124
|
+
/** Accounted window per ramp step. */
|
|
31125
|
+
measureSec: 20,
|
|
31126
|
+
/** Longest the drain may take before the run is refused. */
|
|
31127
|
+
drainTimeoutSec: 120,
|
|
31128
|
+
/** Candidate models per device in one run. */
|
|
31129
|
+
maxModelsPerDevice: 6
|
|
31130
|
+
};
|
|
31131
|
+
/** The two measurements a run can make. */
|
|
31132
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
31133
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
31134
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
31135
|
+
deviceKey: string().min(1),
|
|
31136
|
+
/**
|
|
31137
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
31138
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
31139
|
+
*/
|
|
31140
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
31141
|
+
});
|
|
31142
|
+
/** What the operator confirmed. */
|
|
31143
|
+
var NodeBenchmarkPlanSchema = object({
|
|
31144
|
+
nodeId: string().min(1),
|
|
31145
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
31146
|
+
/** Which measurements run. At least one. */
|
|
31147
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
31148
|
+
/**
|
|
31149
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
31150
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
31151
|
+
* detector always runs.
|
|
31152
|
+
*/
|
|
31153
|
+
steps: array(string().min(1)).default([]),
|
|
31154
|
+
/** Offered rate of one stream / session. */
|
|
31155
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
31156
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
31157
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
31158
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
31159
|
+
keepDownloadedModels: boolean().default(false),
|
|
31160
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
31161
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
31162
|
+
});
|
|
31163
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
31164
|
+
kind: _enum([
|
|
31165
|
+
"benchmark-active",
|
|
31166
|
+
"node-offline",
|
|
31167
|
+
"unknown-device",
|
|
31168
|
+
"no-phase",
|
|
31169
|
+
"insufficient-headroom"
|
|
31170
|
+
]),
|
|
31171
|
+
detail: string(),
|
|
31172
|
+
overridable: boolean()
|
|
31173
|
+
});
|
|
31174
|
+
/** A camera whose detection leaves the node for the run. */
|
|
31175
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
31176
|
+
deviceId: number(),
|
|
31177
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
31178
|
+
placedOnNode: boolean(),
|
|
31179
|
+
/** A node pin naming this node, ignored for the run. */
|
|
31180
|
+
pinnedToNode: boolean()
|
|
31181
|
+
});
|
|
31182
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
31183
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
31184
|
+
deviceId: number(),
|
|
31185
|
+
reason: literal("only-frame-source")
|
|
31186
|
+
});
|
|
31187
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
31188
|
+
nodeId: string(),
|
|
31189
|
+
online: boolean(),
|
|
31190
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
31191
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
31192
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
31193
|
+
estimatedDurationMs: number(),
|
|
31194
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
31195
|
+
budgetMs: number(),
|
|
31196
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
31197
|
+
steps: array(string()).readonly(),
|
|
31198
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
31199
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
31200
|
+
headroom: object({
|
|
31201
|
+
sessionsNow: number(),
|
|
31202
|
+
otherNodesCapacitySessions: number().nullable()
|
|
31203
|
+
}),
|
|
31204
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
31205
|
+
canStart: boolean()
|
|
31206
|
+
});
|
|
31207
|
+
/** Where the measuring runner is. */
|
|
31208
|
+
var NodeBenchProgressSchema = object({
|
|
31209
|
+
phase: _enum([
|
|
31210
|
+
"preparing",
|
|
31211
|
+
"device",
|
|
31212
|
+
"pipeline",
|
|
31213
|
+
"cleanup"
|
|
31214
|
+
]),
|
|
31215
|
+
deviceKey: string().nullable(),
|
|
31216
|
+
modelId: string().nullable(),
|
|
31217
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
31218
|
+
load: number().nullable(),
|
|
31219
|
+
cellsDone: number(),
|
|
31220
|
+
cellsTotal: number(),
|
|
31221
|
+
message: string()
|
|
31222
|
+
});
|
|
31223
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
31224
|
+
var NodeBenchLimitSchema = _enum([
|
|
31225
|
+
"p95",
|
|
31226
|
+
"drops",
|
|
31227
|
+
"errors",
|
|
31228
|
+
"stall",
|
|
31229
|
+
"cpu",
|
|
31230
|
+
"ram",
|
|
31231
|
+
"none"
|
|
31232
|
+
]);
|
|
31233
|
+
var NodeBenchRampStepSchema = object({
|
|
31234
|
+
load: number(),
|
|
31235
|
+
pass: boolean(),
|
|
31236
|
+
p95Ms: number(),
|
|
31237
|
+
dropRatio: number(),
|
|
31238
|
+
/** Completed frames per second over the accounted window. */
|
|
31239
|
+
fps: number(),
|
|
31240
|
+
cpuPct: number().nullable(),
|
|
31241
|
+
ramFreePct: number().nullable(),
|
|
31242
|
+
failReasons: array(string()).readonly()
|
|
31243
|
+
});
|
|
31244
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
31245
|
+
phase: literal("device"),
|
|
31246
|
+
deviceKey: string(),
|
|
31247
|
+
modelId: string(),
|
|
31248
|
+
/** Single-stream latency (the K = 1 step). */
|
|
31249
|
+
p50Ms: number(),
|
|
31250
|
+
p95Ms: number(),
|
|
31251
|
+
p99Ms: number(),
|
|
31252
|
+
/** Frames per second sustained at the last passing step. */
|
|
31253
|
+
fps: number(),
|
|
31254
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
31255
|
+
kMax: number(),
|
|
31256
|
+
limitedBy: NodeBenchLimitSchema,
|
|
31257
|
+
/** First call (model load + warm-up). */
|
|
31258
|
+
warmupMs: number(),
|
|
31259
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
31260
|
+
}), object({
|
|
31261
|
+
phase: literal("pipeline"),
|
|
31262
|
+
deviceKey: string(),
|
|
31263
|
+
modelId: string(),
|
|
31264
|
+
steps: array(string()).readonly(),
|
|
31265
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
31266
|
+
maxSessions: number(),
|
|
31267
|
+
limitedBy: NodeBenchLimitSchema,
|
|
31268
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
31269
|
+
stepsFired: array(string()).readonly(),
|
|
31270
|
+
warmupMs: number(),
|
|
31271
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
31272
|
+
})]);
|
|
31273
|
+
/**
|
|
31274
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
31275
|
+
* the node no longer beats the table.
|
|
31276
|
+
*/
|
|
31277
|
+
var NodeBenchFingerprintSchema = object({
|
|
31278
|
+
pipelineVersion: string().nullable(),
|
|
31279
|
+
cpuModel: string().nullable(),
|
|
31280
|
+
ramGb: number().nullable(),
|
|
31281
|
+
os: string().nullable(),
|
|
31282
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
31283
|
+
pools: record(string(), object({
|
|
31284
|
+
runtime: string(),
|
|
31285
|
+
numWorkers: number(),
|
|
31286
|
+
concurrency: number(),
|
|
31287
|
+
batchMode: string()
|
|
31288
|
+
})).default({})
|
|
31289
|
+
});
|
|
31290
|
+
/** The frames the run used. */
|
|
31291
|
+
var NodeBenchClipSchema = object({
|
|
31292
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
31293
|
+
id: string(),
|
|
31294
|
+
revision: string().nullable(),
|
|
31295
|
+
frames: number(),
|
|
31296
|
+
width: number(),
|
|
31297
|
+
height: number()
|
|
31298
|
+
});
|
|
31299
|
+
var NodeBenchRunnerInputSchema = object({
|
|
31300
|
+
runId: string().min(1),
|
|
31301
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
31302
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
31303
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
31304
|
+
steps: array(string()).default([]),
|
|
31305
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
31306
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
31307
|
+
deadlineAtMs: number(),
|
|
31308
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
31309
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
31310
|
+
keepDownloadedModels: boolean().default(false)
|
|
31311
|
+
});
|
|
31312
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
31313
|
+
"running",
|
|
31314
|
+
"done",
|
|
31315
|
+
"failed",
|
|
31316
|
+
"aborted"
|
|
31317
|
+
]);
|
|
31318
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
31319
|
+
runId: string(),
|
|
31320
|
+
nodeId: string(),
|
|
31321
|
+
state: NodeBenchRunnerStateSchema,
|
|
31322
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
31323
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
31324
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
31325
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
31326
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
31327
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
31328
|
+
activeCameraIds: array(number()).readonly(),
|
|
31329
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
31330
|
+
deletedModels: array(string()).readonly(),
|
|
31331
|
+
error: string().nullable(),
|
|
31332
|
+
startedAtMs: number(),
|
|
31333
|
+
finishedAtMs: number().nullable()
|
|
31334
|
+
});
|
|
31335
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
31336
|
+
"draining",
|
|
31337
|
+
"measuring",
|
|
31338
|
+
"restoring",
|
|
31339
|
+
"done",
|
|
31340
|
+
"failed",
|
|
31341
|
+
"aborted"
|
|
31342
|
+
]);
|
|
31343
|
+
/** Why a run ended. */
|
|
31344
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
31345
|
+
"completed",
|
|
31346
|
+
"operator-abort",
|
|
31347
|
+
"deadline",
|
|
31348
|
+
"node-lost",
|
|
31349
|
+
"runner-lost",
|
|
31350
|
+
"hub-restart",
|
|
31351
|
+
"drain-timeout",
|
|
31352
|
+
"failed"
|
|
31353
|
+
]);
|
|
31354
|
+
var NodeBenchmarkRunSchema = object({
|
|
31355
|
+
runId: string(),
|
|
31356
|
+
nodeId: string(),
|
|
31357
|
+
state: NodeBenchmarkStateSchema,
|
|
31358
|
+
plan: NodeBenchmarkPlanSchema,
|
|
31359
|
+
startedAtMs: number(),
|
|
31360
|
+
deadlineAtMs: number(),
|
|
31361
|
+
finishedAtMs: number().nullable(),
|
|
31362
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
31363
|
+
error: string().nullable(),
|
|
31364
|
+
/** Cameras moved off the node for the run. */
|
|
31365
|
+
moved: array(number()).readonly(),
|
|
31366
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
31367
|
+
staying: array(number()).readonly(),
|
|
31368
|
+
/** Something else ran on the node's pools during the run. */
|
|
31369
|
+
contaminated: boolean(),
|
|
31370
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
31371
|
+
resultIds: array(string()).readonly()
|
|
31372
|
+
});
|
|
31373
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
31374
|
+
var NodeBenchmarkStatusSchema = object({
|
|
31375
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
31376
|
+
modeNodeId: string().nullable(),
|
|
31377
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
31378
|
+
});
|
|
31379
|
+
/**
|
|
31380
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
31381
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
31382
|
+
* ends, never by anyone else.
|
|
31383
|
+
*/
|
|
31384
|
+
var NodeBenchmarkResultSchema = object({
|
|
31385
|
+
id: string(),
|
|
31386
|
+
runId: string(),
|
|
31387
|
+
nodeId: string(),
|
|
31388
|
+
cell: NodeBenchCellSchema,
|
|
31389
|
+
fpsPerStream: number(),
|
|
31390
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
31391
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
31392
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
31393
|
+
contaminated: boolean(),
|
|
31394
|
+
stayingCameras: array(number()).readonly(),
|
|
31395
|
+
/** The run ended early; the cell itself completed. */
|
|
31396
|
+
partialRun: boolean(),
|
|
31397
|
+
measuredAtMs: number()
|
|
31398
|
+
});
|
|
31399
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
31400
|
+
nodeId: string().optional(),
|
|
31401
|
+
deviceKey: string().optional()
|
|
31402
|
+
});
|
|
31403
|
+
/** A result with its standing today: does it still beat the table? */
|
|
31404
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
31405
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
31406
|
+
standing: _enum([
|
|
31407
|
+
"fresh",
|
|
31408
|
+
"stale",
|
|
31409
|
+
"superseded"
|
|
31410
|
+
]),
|
|
31411
|
+
staleWhy: _enum([
|
|
31412
|
+
"age",
|
|
31413
|
+
"runtime",
|
|
31414
|
+
"pool-tuning"
|
|
31415
|
+
]).nullable()
|
|
31416
|
+
});
|
|
31417
|
+
object({
|
|
31418
|
+
runId: string(),
|
|
31419
|
+
nodeId: string(),
|
|
31420
|
+
startedAtMs: number(),
|
|
31421
|
+
deadlineAtMs: number(),
|
|
31422
|
+
plan: NodeBenchmarkPlanSchema,
|
|
31423
|
+
moved: array(number()).readonly(),
|
|
31424
|
+
staying: array(number()).readonly()
|
|
31425
|
+
});
|
|
31426
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
31427
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
31428
|
+
nodeId: string(),
|
|
31429
|
+
reachable: boolean(),
|
|
31430
|
+
devices: array(object({
|
|
31431
|
+
deviceKey: string(),
|
|
31432
|
+
enabled: boolean(),
|
|
31433
|
+
available: boolean(),
|
|
31434
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
31435
|
+
suggested: array(string()).readonly(),
|
|
31436
|
+
/** Every root detector the device has a build for. */
|
|
31437
|
+
all: array(string()).readonly(),
|
|
31438
|
+
/** The model the device runs now, when pinned. */
|
|
31439
|
+
currentModelId: string().nullable()
|
|
31440
|
+
})).readonly(),
|
|
31441
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
31442
|
+
steps: array(object({
|
|
31443
|
+
id: string(),
|
|
31444
|
+
name: string(),
|
|
31445
|
+
slot: string()
|
|
31446
|
+
})).readonly()
|
|
31447
|
+
});
|
|
29692
31448
|
object({
|
|
29693
31449
|
activeCameras: number(),
|
|
29694
31450
|
throttledCameras: number(),
|
|
@@ -31007,7 +32763,30 @@ var pipelineRunnerCapability = {
|
|
|
31007
32763
|
releaseParkedTrackFrames: method(object({
|
|
31008
32764
|
deviceId: number(),
|
|
31009
32765
|
trackId: string()
|
|
31010
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
32766
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }),
|
|
32767
|
+
/**
|
|
32768
|
+
* Start measuring THIS node for the orchestrator's node benchmark: the
|
|
32769
|
+
* bench clip decoded once into RAM, each device × candidate detector on an
|
|
32770
|
+
* open-loop ramp (`device`), then the chosen pipeline with the requested
|
|
32771
|
+
* detail steps (`pipeline`). Everything runs in-process with the executor
|
|
32772
|
+
* — no frame crosses a node (D9) — and writes nothing: no track, event,
|
|
32773
|
+
* media or notification. Reached by `nodePin(nodeId)`. Answers at once;
|
|
32774
|
+
* one run per node; the run stops itself at `deadlineAtMs`.
|
|
32775
|
+
*/
|
|
32776
|
+
startNodeBench: method(NodeBenchRunnerInputSchema, object({
|
|
32777
|
+
accepted: literal(true),
|
|
32778
|
+
runId: string()
|
|
32779
|
+
}), {
|
|
32780
|
+
kind: "mutation",
|
|
32781
|
+
auth: "admin"
|
|
32782
|
+
}),
|
|
32783
|
+
/** The run's progress and every finished cell; null when this runner does not know `runId`. */
|
|
32784
|
+
getNodeBenchStatus: method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }),
|
|
32785
|
+
/** Stop the run; what it finished is kept. */
|
|
32786
|
+
abortNodeBench: method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
32787
|
+
kind: "mutation",
|
|
32788
|
+
auth: "admin"
|
|
32789
|
+
})
|
|
31011
32790
|
}
|
|
31012
32791
|
};
|
|
31013
32792
|
var CameraPipelineConfigSchema = object({
|
|
@@ -31935,6 +33714,51 @@ var pipelineOrchestratorCapability = {
|
|
|
31935
33714
|
kind: "mutation",
|
|
31936
33715
|
auth: "admin"
|
|
31937
33716
|
}),
|
|
33717
|
+
/**
|
|
33718
|
+
* Node benchmark — what a run of this plan would do, without doing it:
|
|
33719
|
+
* the cameras that leave the node, those that cannot (the node is their
|
|
33720
|
+
* only frame source; they stay and flag the run), the estimated duration
|
|
33721
|
+
* and every reason it may not start. The confirmation shows this.
|
|
33722
|
+
*/
|
|
33723
|
+
getNodeBenchmarkPreflight: method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }),
|
|
33724
|
+
/**
|
|
33725
|
+
* Node benchmark — start ONE run (cluster-wide lock). The orchestrator
|
|
33726
|
+
* persists a restore manifest, enters benchmark mode for the node (out of
|
|
33727
|
+
* placement, its camera pins ignored, nothing rewritten), drains it, drives
|
|
33728
|
+
* the node's own runner, then restores — always, including after an
|
|
33729
|
+
* abort, a lost node or a hub restart. Answers at once; poll
|
|
33730
|
+
* `getNodeBenchmarkStatus`. Refused runs carry the preflight.
|
|
33731
|
+
*/
|
|
33732
|
+
startNodeBenchmark: method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
33733
|
+
kind: literal("started"),
|
|
33734
|
+
runId: string()
|
|
33735
|
+
}), object({
|
|
33736
|
+
kind: literal("refused"),
|
|
33737
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
33738
|
+
})]), {
|
|
33739
|
+
kind: "mutation",
|
|
33740
|
+
auth: "admin"
|
|
33741
|
+
}),
|
|
33742
|
+
/** Node benchmark — the active run (or the last one) and the node in benchmark mode. */
|
|
33743
|
+
getNodeBenchmarkStatus: method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }),
|
|
33744
|
+
/** Node benchmark — stop the active run; the cluster is restored as it was. */
|
|
33745
|
+
abortNodeBenchmark: method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
33746
|
+
kind: "mutation",
|
|
33747
|
+
auth: "admin"
|
|
33748
|
+
}),
|
|
33749
|
+
/**
|
|
33750
|
+
* Node benchmark — root detector candidates per device (what Auto tune
|
|
33751
|
+
* would pick first, then the family) and the detail steps the node's
|
|
33752
|
+
* catalog offers, for the plan editor.
|
|
33753
|
+
*/
|
|
33754
|
+
getNodeBenchmarkCandidates: method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }),
|
|
33755
|
+
/** Node benchmark — stored results, newest first, each with its standing today. */
|
|
33756
|
+
listNodeBenchmarkResults: method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }),
|
|
33757
|
+
/** Node benchmark — delete one result; Auto tune and the shares stop reading it. */
|
|
33758
|
+
deleteNodeBenchmarkResult: method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
33759
|
+
kind: "mutation",
|
|
33760
|
+
auth: "admin"
|
|
33761
|
+
}),
|
|
31938
33762
|
/** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
|
|
31939
33763
|
getCameraSettings: method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()),
|
|
31940
33764
|
/** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
|
|
@@ -39415,6 +41239,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
39415
41239
|
enabled: boolean().optional(),
|
|
39416
41240
|
info: record(string(), unknown()).optional(),
|
|
39417
41241
|
settings: record(string(), unknown()).optional(),
|
|
41242
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
41243
|
+
* the keychain, not the table (D787). */
|
|
41244
|
+
secretKeys: array(string()).optional(),
|
|
39418
41245
|
skipRestart: boolean().optional()
|
|
39419
41246
|
});
|
|
39420
41247
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -39450,7 +41277,9 @@ var integrationsCapability = {
|
|
|
39450
41277
|
getSettings: method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }),
|
|
39451
41278
|
setSettings: method(object({
|
|
39452
41279
|
id: string(),
|
|
39453
|
-
settings: record(string(), unknown())
|
|
41280
|
+
settings: record(string(), unknown()),
|
|
41281
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
41282
|
+
secretKeys: array(string()).optional()
|
|
39454
41283
|
}), object({ success: boolean() }), {
|
|
39455
41284
|
kind: "mutation",
|
|
39456
41285
|
auth: "admin"
|
|
@@ -48773,7 +50602,8 @@ var BaseDevice = class {
|
|
|
48773
50602
|
this.role = options.role;
|
|
48774
50603
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
48775
50604
|
const seedData = ctx.persistedConfig ?? {};
|
|
48776
|
-
|
|
50605
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
50606
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
48777
50607
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
48778
50608
|
tags: {
|
|
48779
50609
|
deviceId: ctx.id,
|
|
@@ -51985,6 +53815,90 @@ Object.freeze({
|
|
|
51985
53815
|
addonId: null,
|
|
51986
53816
|
access: "create"
|
|
51987
53817
|
},
|
|
53818
|
+
"keychain.delete": {
|
|
53819
|
+
capName: "keychain",
|
|
53820
|
+
capScope: "system",
|
|
53821
|
+
addonId: null,
|
|
53822
|
+
access: "delete"
|
|
53823
|
+
},
|
|
53824
|
+
"keychain.getState": {
|
|
53825
|
+
capName: "keychain",
|
|
53826
|
+
capScope: "system",
|
|
53827
|
+
addonId: null,
|
|
53828
|
+
access: "view"
|
|
53829
|
+
},
|
|
53830
|
+
"keychain.listMeta": {
|
|
53831
|
+
capName: "keychain",
|
|
53832
|
+
capScope: "system",
|
|
53833
|
+
addonId: null,
|
|
53834
|
+
access: "view"
|
|
53835
|
+
},
|
|
53836
|
+
"keychain.put": {
|
|
53837
|
+
capName: "keychain",
|
|
53838
|
+
capScope: "system",
|
|
53839
|
+
addonId: null,
|
|
53840
|
+
access: "create"
|
|
53841
|
+
},
|
|
53842
|
+
"keychain.resolve": {
|
|
53843
|
+
capName: "keychain",
|
|
53844
|
+
capScope: "system",
|
|
53845
|
+
addonId: null,
|
|
53846
|
+
access: "view"
|
|
53847
|
+
},
|
|
53848
|
+
"keychainAdmin.deleteOrphans": {
|
|
53849
|
+
capName: "keychain-admin",
|
|
53850
|
+
capScope: "system",
|
|
53851
|
+
addonId: null,
|
|
53852
|
+
access: "delete"
|
|
53853
|
+
},
|
|
53854
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
53855
|
+
capName: "keychain-admin",
|
|
53856
|
+
capScope: "system",
|
|
53857
|
+
addonId: null,
|
|
53858
|
+
access: "create"
|
|
53859
|
+
},
|
|
53860
|
+
"keychainAdmin.listAudit": {
|
|
53861
|
+
capName: "keychain-admin",
|
|
53862
|
+
capScope: "system",
|
|
53863
|
+
addonId: null,
|
|
53864
|
+
access: "view"
|
|
53865
|
+
},
|
|
53866
|
+
"keychainAdmin.listSecrets": {
|
|
53867
|
+
capName: "keychain-admin",
|
|
53868
|
+
capScope: "system",
|
|
53869
|
+
addonId: null,
|
|
53870
|
+
access: "view"
|
|
53871
|
+
},
|
|
53872
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
53873
|
+
capName: "keychain-admin",
|
|
53874
|
+
capScope: "system",
|
|
53875
|
+
addonId: null,
|
|
53876
|
+
access: "delete"
|
|
53877
|
+
},
|
|
53878
|
+
"keychainAdmin.resetKeychain": {
|
|
53879
|
+
capName: "keychain-admin",
|
|
53880
|
+
capScope: "system",
|
|
53881
|
+
addonId: null,
|
|
53882
|
+
access: "delete"
|
|
53883
|
+
},
|
|
53884
|
+
"keychainAdmin.reveal": {
|
|
53885
|
+
capName: "keychain-admin",
|
|
53886
|
+
capScope: "system",
|
|
53887
|
+
addonId: null,
|
|
53888
|
+
access: "create"
|
|
53889
|
+
},
|
|
53890
|
+
"keychainAdmin.rotateMasterKey": {
|
|
53891
|
+
capName: "keychain-admin",
|
|
53892
|
+
capScope: "system",
|
|
53893
|
+
addonId: null,
|
|
53894
|
+
access: "create"
|
|
53895
|
+
},
|
|
53896
|
+
"keychainAdmin.status": {
|
|
53897
|
+
capName: "keychain-admin",
|
|
53898
|
+
capScope: "system",
|
|
53899
|
+
addonId: null,
|
|
53900
|
+
access: "view"
|
|
53901
|
+
},
|
|
51988
53902
|
"lawnMowerControl.dock": {
|
|
51989
53903
|
capName: "lawn-mower-control",
|
|
51990
53904
|
capScope: "device",
|
|
@@ -53359,6 +55273,18 @@ Object.freeze({
|
|
|
53359
55273
|
addonId: null,
|
|
53360
55274
|
access: "create"
|
|
53361
55275
|
},
|
|
55276
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
55277
|
+
capName: "pipeline-analytics",
|
|
55278
|
+
capScope: "device",
|
|
55279
|
+
addonId: null,
|
|
55280
|
+
access: "create"
|
|
55281
|
+
},
|
|
55282
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
55283
|
+
capName: "pipeline-analytics",
|
|
55284
|
+
capScope: "device",
|
|
55285
|
+
addonId: null,
|
|
55286
|
+
access: "create"
|
|
55287
|
+
},
|
|
53362
55288
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
53363
55289
|
capName: "pipeline-analytics",
|
|
53364
55290
|
capScope: "device",
|
|
@@ -53407,12 +55333,36 @@ Object.freeze({
|
|
|
53407
55333
|
addonId: null,
|
|
53408
55334
|
access: "view"
|
|
53409
55335
|
},
|
|
55336
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
55337
|
+
capName: "pipeline-analytics",
|
|
55338
|
+
capScope: "device",
|
|
55339
|
+
addonId: null,
|
|
55340
|
+
access: "create"
|
|
55341
|
+
},
|
|
55342
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
55343
|
+
capName: "pipeline-analytics",
|
|
55344
|
+
capScope: "device",
|
|
55345
|
+
addonId: null,
|
|
55346
|
+
access: "create"
|
|
55347
|
+
},
|
|
53410
55348
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
53411
55349
|
capName: "pipeline-analytics",
|
|
53412
55350
|
capScope: "device",
|
|
53413
55351
|
addonId: null,
|
|
53414
55352
|
access: "delete"
|
|
53415
55353
|
},
|
|
55354
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
55355
|
+
capName: "pipeline-analytics",
|
|
55356
|
+
capScope: "device",
|
|
55357
|
+
addonId: null,
|
|
55358
|
+
access: "delete"
|
|
55359
|
+
},
|
|
55360
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
55361
|
+
capName: "pipeline-analytics",
|
|
55362
|
+
capScope: "device",
|
|
55363
|
+
addonId: null,
|
|
55364
|
+
access: "delete"
|
|
55365
|
+
},
|
|
53416
55366
|
"pipelineAnalytics.deleteTracks": {
|
|
53417
55367
|
capName: "pipeline-analytics",
|
|
53418
55368
|
capScope: "device",
|
|
@@ -53617,6 +55567,30 @@ Object.freeze({
|
|
|
53617
55567
|
addonId: null,
|
|
53618
55568
|
access: "view"
|
|
53619
55569
|
},
|
|
55570
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
55571
|
+
capName: "pipeline-analytics",
|
|
55572
|
+
capScope: "device",
|
|
55573
|
+
addonId: null,
|
|
55574
|
+
access: "view"
|
|
55575
|
+
},
|
|
55576
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
55577
|
+
capName: "pipeline-analytics",
|
|
55578
|
+
capScope: "device",
|
|
55579
|
+
addonId: null,
|
|
55580
|
+
access: "view"
|
|
55581
|
+
},
|
|
55582
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
55583
|
+
capName: "pipeline-analytics",
|
|
55584
|
+
capScope: "device",
|
|
55585
|
+
addonId: null,
|
|
55586
|
+
access: "view"
|
|
55587
|
+
},
|
|
55588
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
55589
|
+
capName: "pipeline-analytics",
|
|
55590
|
+
capScope: "device",
|
|
55591
|
+
addonId: null,
|
|
55592
|
+
access: "view"
|
|
55593
|
+
},
|
|
53620
55594
|
"pipelineAnalytics.listRetrainFrames": {
|
|
53621
55595
|
capName: "pipeline-analytics",
|
|
53622
55596
|
capScope: "device",
|
|
@@ -53659,12 +55633,24 @@ Object.freeze({
|
|
|
53659
55633
|
addonId: null,
|
|
53660
55634
|
access: "create"
|
|
53661
55635
|
},
|
|
55636
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
55637
|
+
capName: "pipeline-analytics",
|
|
55638
|
+
capScope: "device",
|
|
55639
|
+
addonId: null,
|
|
55640
|
+
access: "view"
|
|
55641
|
+
},
|
|
53662
55642
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
53663
55643
|
capName: "pipeline-analytics",
|
|
53664
55644
|
capScope: "device",
|
|
53665
55645
|
addonId: null,
|
|
53666
55646
|
access: "create"
|
|
53667
55647
|
},
|
|
55648
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
55649
|
+
capName: "pipeline-analytics",
|
|
55650
|
+
capScope: "device",
|
|
55651
|
+
addonId: null,
|
|
55652
|
+
access: "create"
|
|
55653
|
+
},
|
|
53668
55654
|
"pipelineAnalytics.pruneEvents": {
|
|
53669
55655
|
capName: "pipeline-analytics",
|
|
53670
55656
|
capScope: "device",
|
|
@@ -53719,6 +55705,18 @@ Object.freeze({
|
|
|
53719
55705
|
addonId: null,
|
|
53720
55706
|
access: "create"
|
|
53721
55707
|
},
|
|
55708
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
55709
|
+
capName: "pipeline-analytics",
|
|
55710
|
+
capScope: "device",
|
|
55711
|
+
addonId: null,
|
|
55712
|
+
access: "delete"
|
|
55713
|
+
},
|
|
55714
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
55715
|
+
capName: "pipeline-analytics",
|
|
55716
|
+
capScope: "device",
|
|
55717
|
+
addonId: null,
|
|
55718
|
+
access: "create"
|
|
55719
|
+
},
|
|
53722
55720
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
53723
55721
|
capName: "pipeline-analytics",
|
|
53724
55722
|
capScope: "device",
|
|
@@ -53779,6 +55777,12 @@ Object.freeze({
|
|
|
53779
55777
|
addonId: null,
|
|
53780
55778
|
access: "create"
|
|
53781
55779
|
},
|
|
55780
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
55781
|
+
capName: "pipeline-analytics",
|
|
55782
|
+
capScope: "device",
|
|
55783
|
+
addonId: null,
|
|
55784
|
+
access: "view"
|
|
55785
|
+
},
|
|
53782
55786
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
53783
55787
|
capName: "pipeline-analytics",
|
|
53784
55788
|
capScope: "device",
|
|
@@ -54007,6 +56011,12 @@ Object.freeze({
|
|
|
54007
56011
|
addonId: null,
|
|
54008
56012
|
access: "view"
|
|
54009
56013
|
},
|
|
56014
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
56015
|
+
capName: "pipeline-orchestrator",
|
|
56016
|
+
capScope: "system",
|
|
56017
|
+
addonId: null,
|
|
56018
|
+
access: "create"
|
|
56019
|
+
},
|
|
54010
56020
|
"pipelineOrchestrator.applyAutoTune": {
|
|
54011
56021
|
capName: "pipeline-orchestrator",
|
|
54012
56022
|
capScope: "system",
|
|
@@ -54031,6 +56041,12 @@ Object.freeze({
|
|
|
54031
56041
|
addonId: null,
|
|
54032
56042
|
access: "create"
|
|
54033
56043
|
},
|
|
56044
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
56045
|
+
capName: "pipeline-orchestrator",
|
|
56046
|
+
capScope: "system",
|
|
56047
|
+
addonId: null,
|
|
56048
|
+
access: "delete"
|
|
56049
|
+
},
|
|
54034
56050
|
"pipelineOrchestrator.getAgentLoad": {
|
|
54035
56051
|
capName: "pipeline-orchestrator",
|
|
54036
56052
|
capScope: "system",
|
|
@@ -54139,6 +56155,24 @@ Object.freeze({
|
|
|
54139
56155
|
addonId: null,
|
|
54140
56156
|
access: "view"
|
|
54141
56157
|
},
|
|
56158
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
56159
|
+
capName: "pipeline-orchestrator",
|
|
56160
|
+
capScope: "system",
|
|
56161
|
+
addonId: null,
|
|
56162
|
+
access: "view"
|
|
56163
|
+
},
|
|
56164
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
56165
|
+
capName: "pipeline-orchestrator",
|
|
56166
|
+
capScope: "system",
|
|
56167
|
+
addonId: null,
|
|
56168
|
+
access: "view"
|
|
56169
|
+
},
|
|
56170
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
56171
|
+
capName: "pipeline-orchestrator",
|
|
56172
|
+
capScope: "system",
|
|
56173
|
+
addonId: null,
|
|
56174
|
+
access: "view"
|
|
56175
|
+
},
|
|
54142
56176
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
54143
56177
|
capName: "pipeline-orchestrator",
|
|
54144
56178
|
capScope: "system",
|
|
@@ -54181,6 +56215,12 @@ Object.freeze({
|
|
|
54181
56215
|
addonId: null,
|
|
54182
56216
|
access: "view"
|
|
54183
56217
|
},
|
|
56218
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
56219
|
+
capName: "pipeline-orchestrator",
|
|
56220
|
+
capScope: "system",
|
|
56221
|
+
addonId: null,
|
|
56222
|
+
access: "view"
|
|
56223
|
+
},
|
|
54184
56224
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
54185
56225
|
capName: "pipeline-orchestrator",
|
|
54186
56226
|
capScope: "system",
|
|
@@ -54325,6 +56365,12 @@ Object.freeze({
|
|
|
54325
56365
|
addonId: null,
|
|
54326
56366
|
access: "create"
|
|
54327
56367
|
},
|
|
56368
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
56369
|
+
capName: "pipeline-orchestrator",
|
|
56370
|
+
capScope: "system",
|
|
56371
|
+
addonId: null,
|
|
56372
|
+
access: "create"
|
|
56373
|
+
},
|
|
54328
56374
|
"pipelineOrchestrator.suggestShares": {
|
|
54329
56375
|
capName: "pipeline-orchestrator",
|
|
54330
56376
|
capScope: "system",
|
|
@@ -54343,6 +56389,12 @@ Object.freeze({
|
|
|
54343
56389
|
addonId: null,
|
|
54344
56390
|
access: "create"
|
|
54345
56391
|
},
|
|
56392
|
+
"pipelineRunner.abortNodeBench": {
|
|
56393
|
+
capName: "pipeline-runner",
|
|
56394
|
+
capScope: "system",
|
|
56395
|
+
addonId: null,
|
|
56396
|
+
access: "create"
|
|
56397
|
+
},
|
|
54346
56398
|
"pipelineRunner.attachCamera": {
|
|
54347
56399
|
capName: "pipeline-runner",
|
|
54348
56400
|
capScope: "system",
|
|
@@ -54391,6 +56443,12 @@ Object.freeze({
|
|
|
54391
56443
|
addonId: null,
|
|
54392
56444
|
access: "view"
|
|
54393
56445
|
},
|
|
56446
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
56447
|
+
capName: "pipeline-runner",
|
|
56448
|
+
capScope: "system",
|
|
56449
|
+
addonId: null,
|
|
56450
|
+
access: "view"
|
|
56451
|
+
},
|
|
54394
56452
|
"pipelineRunner.getParkedTrackFrame": {
|
|
54395
56453
|
capName: "pipeline-runner",
|
|
54396
56454
|
capScope: "system",
|
|
@@ -54433,6 +56491,12 @@ Object.freeze({
|
|
|
54433
56491
|
addonId: null,
|
|
54434
56492
|
access: "create"
|
|
54435
56493
|
},
|
|
56494
|
+
"pipelineRunner.startNodeBench": {
|
|
56495
|
+
capName: "pipeline-runner",
|
|
56496
|
+
capScope: "system",
|
|
56497
|
+
addonId: null,
|
|
56498
|
+
access: "create"
|
|
56499
|
+
},
|
|
54436
56500
|
"plateGallery.assignPlate": {
|
|
54437
56501
|
capName: "plate-gallery",
|
|
54438
56502
|
capScope: "system",
|
|
@@ -58112,6 +60176,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
58112
60176
|
imageSettingsCapability,
|
|
58113
60177
|
integrationsCapability,
|
|
58114
60178
|
intercomCapability,
|
|
60179
|
+
keychainCapability,
|
|
60180
|
+
keychainAdminCapability,
|
|
58115
60181
|
lawnMowerControlCapability,
|
|
58116
60182
|
llmCapability,
|
|
58117
60183
|
llmRuntimeCapability,
|
|
@@ -59538,6 +61604,11 @@ Object.freeze({
|
|
|
59538
61604
|
form: "single",
|
|
59539
61605
|
optional: false
|
|
59540
61606
|
}],
|
|
61607
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
61608
|
+
name: "deviceId",
|
|
61609
|
+
form: "single",
|
|
61610
|
+
optional: false
|
|
61611
|
+
}],
|
|
59541
61612
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
59542
61613
|
name: "deviceId",
|
|
59543
61614
|
form: "single",
|
|
@@ -59728,6 +61799,11 @@ Object.freeze({
|
|
|
59728
61799
|
form: "single",
|
|
59729
61800
|
optional: false
|
|
59730
61801
|
}],
|
|
61802
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
61803
|
+
name: "deviceId",
|
|
61804
|
+
form: "single",
|
|
61805
|
+
optional: false
|
|
61806
|
+
}],
|
|
59731
61807
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
59732
61808
|
name: "deviceId",
|
|
59733
61809
|
form: "single",
|