@camstack/addon-export-hap 1.2.154 → 1.2.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hap-export.addon.js +1842 -92
- package/dist/hap-export.addon.mjs +1842 -92
- package/package.json +1 -1
package/dist/hap-export.addon.js
CHANGED
|
@@ -48,7 +48,7 @@ node_fs_promises = __toESM(node_fs_promises, 1);
|
|
|
48
48
|
let node_events = require("node:events");
|
|
49
49
|
let node_dgram = require("node:dgram");
|
|
50
50
|
let node_os = require("node:os");
|
|
51
|
-
//#region ../types/dist/event-category-
|
|
51
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
52
52
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
53
53
|
EventCategory["SystemBoot"] = "system.boot";
|
|
54
54
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -127,6 +127,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
127
127
|
*/
|
|
128
128
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
129
129
|
/**
|
|
130
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
131
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
132
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
133
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
134
|
+
*/
|
|
135
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
136
|
+
/**
|
|
130
137
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
131
138
|
* transitions from `failed` back to `healthy` (typically via the
|
|
132
139
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5419,7 +5426,7 @@ var ZodIssueCode = {
|
|
|
5419
5426
|
var ZodFirstPartyTypeKind;
|
|
5420
5427
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5421
5428
|
//#endregion
|
|
5422
|
-
//#region ../types/dist/sleep-
|
|
5429
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5423
5430
|
/**
|
|
5424
5431
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5425
5432
|
* window to float samples (D455).
|
|
@@ -5498,6 +5505,97 @@ function buildAlawTable() {
|
|
|
5498
5505
|
}
|
|
5499
5506
|
buildUlawTable();
|
|
5500
5507
|
buildAlawTable();
|
|
5508
|
+
/** Is this field's stored value a credential? */
|
|
5509
|
+
function isSecretConfigField(field) {
|
|
5510
|
+
if (field.type === "password") return true;
|
|
5511
|
+
return "secret" in field && field.secret === true;
|
|
5512
|
+
}
|
|
5513
|
+
/**
|
|
5514
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5515
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5516
|
+
*/
|
|
5517
|
+
function isKeychainStoredField(field) {
|
|
5518
|
+
if (!isSecretConfigField(field)) return false;
|
|
5519
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5520
|
+
return !("storage" in field && field.storage === "inline");
|
|
5521
|
+
}
|
|
5522
|
+
/**
|
|
5523
|
+
* What a settings blob holds where a secret used to be.
|
|
5524
|
+
*
|
|
5525
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5526
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5527
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5528
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5529
|
+
*
|
|
5530
|
+
* The same shapes travel to and from the admin UI:
|
|
5531
|
+
*
|
|
5532
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5533
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5534
|
+
* value is set, never the value.
|
|
5535
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5536
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5537
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5538
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5539
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5540
|
+
*
|
|
5541
|
+
* Pure and browser-safe.
|
|
5542
|
+
*/
|
|
5543
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5544
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5545
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5546
|
+
function isRecord$1$1(value) {
|
|
5547
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5548
|
+
}
|
|
5549
|
+
function makeSecretMarker(ref) {
|
|
5550
|
+
return {
|
|
5551
|
+
$secret: ref,
|
|
5552
|
+
v: 1
|
|
5553
|
+
};
|
|
5554
|
+
}
|
|
5555
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5556
|
+
function isSecretMarker(value) {
|
|
5557
|
+
if (!isRecord$1$1(value)) return false;
|
|
5558
|
+
const ref = value["$secret"];
|
|
5559
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5560
|
+
}
|
|
5561
|
+
function isSecretClear(value) {
|
|
5562
|
+
return isRecord$1$1(value) && value["$secretClear"] === true;
|
|
5563
|
+
}
|
|
5564
|
+
/**
|
|
5565
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5566
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5567
|
+
* survives this function.
|
|
5568
|
+
*/
|
|
5569
|
+
function toSecretFieldView(stored) {
|
|
5570
|
+
if (isSecretMarker(stored)) return {
|
|
5571
|
+
$secret: stored.$secret,
|
|
5572
|
+
v: 1,
|
|
5573
|
+
set: true
|
|
5574
|
+
};
|
|
5575
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5576
|
+
$secret: null,
|
|
5577
|
+
v: 1,
|
|
5578
|
+
set: true,
|
|
5579
|
+
inline: true
|
|
5580
|
+
};
|
|
5581
|
+
return null;
|
|
5582
|
+
}
|
|
5583
|
+
/**
|
|
5584
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5585
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5586
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5587
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5588
|
+
*/
|
|
5589
|
+
function classifySecretWrite(incoming) {
|
|
5590
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5591
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5592
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5593
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5594
|
+
return {
|
|
5595
|
+
kind: "set",
|
|
5596
|
+
value: incoming
|
|
5597
|
+
};
|
|
5598
|
+
}
|
|
5501
5599
|
Object.fromEntries([
|
|
5502
5600
|
{
|
|
5503
5601
|
id: "overview",
|
|
@@ -5669,33 +5767,19 @@ Object.fromEntries([
|
|
|
5669
5767
|
function isValuelessField(field) {
|
|
5670
5768
|
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";
|
|
5671
5769
|
}
|
|
5672
|
-
|
|
5673
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5674
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5675
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5676
|
-
*
|
|
5677
|
-
* For each leaf field:
|
|
5678
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5679
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5680
|
-
*
|
|
5681
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5682
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5683
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5684
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5685
|
-
*/
|
|
5686
|
-
function hydrateSchema(schema, values) {
|
|
5770
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5687
5771
|
return {
|
|
5688
5772
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5689
5773
|
sections: schema.sections.map((section) => ({
|
|
5690
5774
|
...section,
|
|
5691
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5775
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5692
5776
|
}))
|
|
5693
5777
|
};
|
|
5694
5778
|
}
|
|
5695
|
-
function hydrateField(field, values) {
|
|
5779
|
+
function hydrateField(field, values, options) {
|
|
5696
5780
|
if (isValuelessField(field)) return field;
|
|
5697
5781
|
if (field.type === "group") {
|
|
5698
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5782
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5699
5783
|
return {
|
|
5700
5784
|
...field,
|
|
5701
5785
|
fields: hydratedChildren
|
|
@@ -5704,7 +5788,7 @@ function hydrateField(field, values) {
|
|
|
5704
5788
|
if (field.type === "sub-tabs") {
|
|
5705
5789
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5706
5790
|
...tab,
|
|
5707
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5791
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5708
5792
|
}));
|
|
5709
5793
|
return {
|
|
5710
5794
|
...field,
|
|
@@ -5714,6 +5798,33 @@ function hydrateField(field, values) {
|
|
|
5714
5798
|
const key = field.key;
|
|
5715
5799
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5716
5800
|
const defaultValue = field.default;
|
|
5801
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5802
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5803
|
+
...field,
|
|
5804
|
+
value: toSecretFieldView(storedValue)
|
|
5805
|
+
};
|
|
5806
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5807
|
+
...field,
|
|
5808
|
+
value: null
|
|
5809
|
+
};
|
|
5810
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5811
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5812
|
+
if (secretItemKeys.length > 0) {
|
|
5813
|
+
const rows = storedValue.map((row) => {
|
|
5814
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5815
|
+
const out = { ...row };
|
|
5816
|
+
for (const k of secretItemKeys) {
|
|
5817
|
+
const v = Reflect.get(row, k);
|
|
5818
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5819
|
+
}
|
|
5820
|
+
return out;
|
|
5821
|
+
});
|
|
5822
|
+
return {
|
|
5823
|
+
...field,
|
|
5824
|
+
value: rows
|
|
5825
|
+
};
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5717
5828
|
if (field.multiple) {
|
|
5718
5829
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5719
5830
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5956,6 +6067,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5956
6067
|
}
|
|
5957
6068
|
return out;
|
|
5958
6069
|
}
|
|
6070
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6071
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6072
|
+
function globalSecretScope() {
|
|
6073
|
+
return GLOBAL_SCOPE;
|
|
6074
|
+
}
|
|
6075
|
+
function encodeSegment(value) {
|
|
6076
|
+
return encodeURIComponent(value);
|
|
6077
|
+
}
|
|
6078
|
+
/**
|
|
6079
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6080
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6081
|
+
* `providers[authentik].clientSecret`.
|
|
6082
|
+
*/
|
|
6083
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6084
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6085
|
+
}
|
|
6086
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6087
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6088
|
+
fieldPath;
|
|
6089
|
+
constructor(fieldPath, cause) {
|
|
6090
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6091
|
+
this.fieldPath = fieldPath;
|
|
6092
|
+
this.name = "KeychainWriteRefusedError";
|
|
6093
|
+
}
|
|
6094
|
+
};
|
|
6095
|
+
var KEEP = { kind: "keep" };
|
|
6096
|
+
function isRecord$2(value) {
|
|
6097
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6098
|
+
}
|
|
6099
|
+
function defaultMintId() {
|
|
6100
|
+
return globalThis.crypto.randomUUID();
|
|
6101
|
+
}
|
|
6102
|
+
/** Every marker ref anywhere under `value`. */
|
|
6103
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6104
|
+
if (isSecretMarker(value)) {
|
|
6105
|
+
out.push(value.$secret);
|
|
6106
|
+
return out;
|
|
6107
|
+
}
|
|
6108
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6109
|
+
else if (isRecord$2(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6110
|
+
return out;
|
|
6111
|
+
}
|
|
6112
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6113
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6114
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6115
|
+
}
|
|
6116
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6117
|
+
const intent = classifySecretWrite(incoming);
|
|
6118
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6119
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6120
|
+
if (intent.kind === "keep") return KEEP;
|
|
6121
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6122
|
+
if (intent.kind === "clear") {
|
|
6123
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6124
|
+
return {
|
|
6125
|
+
kind: "value",
|
|
6126
|
+
value: null
|
|
6127
|
+
};
|
|
6128
|
+
}
|
|
6129
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6130
|
+
kind: "value",
|
|
6131
|
+
value: stored
|
|
6132
|
+
};
|
|
6133
|
+
try {
|
|
6134
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6135
|
+
} catch (err) {
|
|
6136
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6137
|
+
}
|
|
6138
|
+
return {
|
|
6139
|
+
kind: "value",
|
|
6140
|
+
value: makeSecretMarker(ref)
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6144
|
+
function applyMember(out, key, result, storedParent) {
|
|
6145
|
+
if (result.kind === "value") {
|
|
6146
|
+
out[key] = result.value;
|
|
6147
|
+
return;
|
|
6148
|
+
}
|
|
6149
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6150
|
+
else delete out[key];
|
|
6151
|
+
}
|
|
6152
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6153
|
+
const out = { ...incoming };
|
|
6154
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6155
|
+
return out;
|
|
6156
|
+
}
|
|
6157
|
+
function rowId(row, idKey) {
|
|
6158
|
+
const raw = row[idKey];
|
|
6159
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6160
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6161
|
+
return null;
|
|
6162
|
+
}
|
|
6163
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6164
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$2) : [];
|
|
6165
|
+
if (!Array.isArray(incoming)) {
|
|
6166
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6167
|
+
return {
|
|
6168
|
+
kind: "value",
|
|
6169
|
+
value: incoming
|
|
6170
|
+
};
|
|
6171
|
+
}
|
|
6172
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6173
|
+
for (const row of storedRows) {
|
|
6174
|
+
const id = rowId(row, node.idKey);
|
|
6175
|
+
if (id !== null) storedById.set(id, row);
|
|
6176
|
+
}
|
|
6177
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6178
|
+
const rows = [];
|
|
6179
|
+
for (const row of incoming) {
|
|
6180
|
+
if (!isRecord$2(row)) {
|
|
6181
|
+
rows.push(row);
|
|
6182
|
+
continue;
|
|
6183
|
+
}
|
|
6184
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6185
|
+
kept.add(id);
|
|
6186
|
+
const withId = {
|
|
6187
|
+
...row,
|
|
6188
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6189
|
+
};
|
|
6190
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6191
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6192
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6193
|
+
}
|
|
6194
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6195
|
+
return {
|
|
6196
|
+
kind: "value",
|
|
6197
|
+
value: rows
|
|
6198
|
+
};
|
|
6199
|
+
}
|
|
6200
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6201
|
+
switch (node.kind) {
|
|
6202
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6203
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6204
|
+
case "object": {
|
|
6205
|
+
if (!isRecord$2(incoming)) {
|
|
6206
|
+
if (incoming === void 0) return KEEP;
|
|
6207
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6208
|
+
return {
|
|
6209
|
+
kind: "value",
|
|
6210
|
+
value: incoming
|
|
6211
|
+
};
|
|
6212
|
+
}
|
|
6213
|
+
const storedObj = isRecord$2(stored) ? stored : {};
|
|
6214
|
+
return {
|
|
6215
|
+
kind: "value",
|
|
6216
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6217
|
+
};
|
|
6218
|
+
}
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6222
|
+
function splitNodeKey(key) {
|
|
6223
|
+
const at = key.indexOf("@");
|
|
6224
|
+
return at <= 0 ? {
|
|
6225
|
+
base: key,
|
|
6226
|
+
nodeId: null
|
|
6227
|
+
} : {
|
|
6228
|
+
base: key.slice(0, at),
|
|
6229
|
+
nodeId: key.slice(at + 1)
|
|
6230
|
+
};
|
|
6231
|
+
}
|
|
6232
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6233
|
+
async function transformSecretWrite(input) {
|
|
6234
|
+
const deletes = [];
|
|
6235
|
+
const base = {
|
|
6236
|
+
secrets: input.secrets,
|
|
6237
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6238
|
+
deletes,
|
|
6239
|
+
operatorWrite: input.operatorWrite === true
|
|
6240
|
+
};
|
|
6241
|
+
const out = {};
|
|
6242
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6243
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6244
|
+
const node = input.tree.get(baseKey);
|
|
6245
|
+
if (node === void 0) {
|
|
6246
|
+
out[key] = incoming;
|
|
6247
|
+
continue;
|
|
6248
|
+
}
|
|
6249
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6250
|
+
kind: "node",
|
|
6251
|
+
nodeId
|
|
6252
|
+
} : input.scope ?? globalSecretScope();
|
|
6253
|
+
const result = await writeNode({
|
|
6254
|
+
...base,
|
|
6255
|
+
scope
|
|
6256
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6257
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6258
|
+
}
|
|
6259
|
+
return {
|
|
6260
|
+
patch: out,
|
|
6261
|
+
afterWrite: async () => {
|
|
6262
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6263
|
+
try {
|
|
6264
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6265
|
+
return { orphaned: [] };
|
|
6266
|
+
} catch {
|
|
6267
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6268
|
+
}
|
|
6269
|
+
}
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
/**
|
|
6273
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6274
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6275
|
+
*/
|
|
6276
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6277
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6278
|
+
if (refs.length === 0) return {
|
|
6279
|
+
value,
|
|
6280
|
+
unresolved: []
|
|
6281
|
+
};
|
|
6282
|
+
const answers = await secrets.resolve(refs);
|
|
6283
|
+
const unresolved = [];
|
|
6284
|
+
for (const ref of new Set(refs)) {
|
|
6285
|
+
const answer = answers[ref];
|
|
6286
|
+
if (answer === void 0) unresolved.push({
|
|
6287
|
+
ref,
|
|
6288
|
+
reason: "not-initialized"
|
|
6289
|
+
});
|
|
6290
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6291
|
+
ref,
|
|
6292
|
+
reason: answer.reason
|
|
6293
|
+
});
|
|
6294
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6295
|
+
ref,
|
|
6296
|
+
reason: answer.kind
|
|
6297
|
+
});
|
|
6298
|
+
}
|
|
6299
|
+
const substitute = (v) => {
|
|
6300
|
+
if (isSecretMarker(v)) {
|
|
6301
|
+
const answer = answers[v.$secret];
|
|
6302
|
+
return answer?.kind === "value" ? {
|
|
6303
|
+
keep: true,
|
|
6304
|
+
value: answer.value
|
|
6305
|
+
} : {
|
|
6306
|
+
keep: false,
|
|
6307
|
+
value: void 0
|
|
6308
|
+
};
|
|
6309
|
+
}
|
|
6310
|
+
if (Array.isArray(v)) {
|
|
6311
|
+
const items = [];
|
|
6312
|
+
for (const item of v) {
|
|
6313
|
+
const s = substitute(item);
|
|
6314
|
+
if (s.keep) items.push(s.value);
|
|
6315
|
+
}
|
|
6316
|
+
return {
|
|
6317
|
+
keep: true,
|
|
6318
|
+
value: items
|
|
6319
|
+
};
|
|
6320
|
+
}
|
|
6321
|
+
if (isRecord$2(v)) {
|
|
6322
|
+
const out = {};
|
|
6323
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6324
|
+
const s = substitute(child);
|
|
6325
|
+
if (s.keep) out[k] = s.value;
|
|
6326
|
+
}
|
|
6327
|
+
return {
|
|
6328
|
+
keep: true,
|
|
6329
|
+
value: out
|
|
6330
|
+
};
|
|
6331
|
+
}
|
|
6332
|
+
return {
|
|
6333
|
+
keep: true,
|
|
6334
|
+
value: v
|
|
6335
|
+
};
|
|
6336
|
+
};
|
|
6337
|
+
return {
|
|
6338
|
+
value: substitute(value).value,
|
|
6339
|
+
unresolved
|
|
6340
|
+
};
|
|
6341
|
+
}
|
|
6342
|
+
function touchesTree(tree, patch) {
|
|
6343
|
+
if (tree.size === 0) return false;
|
|
6344
|
+
for (const key of Object.keys(patch)) {
|
|
6345
|
+
const at = key.indexOf("@");
|
|
6346
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6347
|
+
}
|
|
6348
|
+
return false;
|
|
6349
|
+
}
|
|
6350
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6351
|
+
async function readStoredAddonBlob(raw) {
|
|
6352
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6353
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6354
|
+
const result = await threeWay.call(raw);
|
|
6355
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6356
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6357
|
+
}
|
|
6358
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6359
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6360
|
+
const serialize = (key, fn) => {
|
|
6361
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6362
|
+
const tail = next.catch(() => void 0);
|
|
6363
|
+
chains.set(key, tail);
|
|
6364
|
+
tail.then(() => {
|
|
6365
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6366
|
+
});
|
|
6367
|
+
return next;
|
|
6368
|
+
};
|
|
6369
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6370
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6371
|
+
return serialize(chainKey, async () => {
|
|
6372
|
+
const stored = await readStored();
|
|
6373
|
+
const result = await transformSecretWrite({
|
|
6374
|
+
tree,
|
|
6375
|
+
secrets: opts.secrets,
|
|
6376
|
+
patch,
|
|
6377
|
+
stored,
|
|
6378
|
+
...scope !== void 0 ? { scope } : {},
|
|
6379
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6380
|
+
});
|
|
6381
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6382
|
+
const { orphaned } = await result.afterWrite();
|
|
6383
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6384
|
+
});
|
|
6385
|
+
};
|
|
6386
|
+
const wrapped = {
|
|
6387
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6388
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6389
|
+
kind: "device",
|
|
6390
|
+
deviceId
|
|
6391
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6392
|
+
};
|
|
6393
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6394
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6395
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6396
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6397
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6398
|
+
} });
|
|
6399
|
+
}
|
|
6400
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6401
|
+
function withSecretAwareSettings(context, opts) {
|
|
6402
|
+
const raw = context.settings;
|
|
6403
|
+
if (raw === void 0) return context;
|
|
6404
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6405
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6406
|
+
if (prop === "settings") return settings;
|
|
6407
|
+
return Reflect.get(target, prop, receiver);
|
|
6408
|
+
} });
|
|
6409
|
+
}
|
|
6410
|
+
var LEAF = { kind: "leaf" };
|
|
6411
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6412
|
+
function collectFields(fields, out) {
|
|
6413
|
+
for (const field of fields) {
|
|
6414
|
+
if (field.type === "group") {
|
|
6415
|
+
collectFields(field.fields, out);
|
|
6416
|
+
continue;
|
|
6417
|
+
}
|
|
6418
|
+
if (field.type === "sub-tabs") {
|
|
6419
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6420
|
+
continue;
|
|
6421
|
+
}
|
|
6422
|
+
if (field.type === "editable-array") {
|
|
6423
|
+
const item = /* @__PURE__ */ new Map();
|
|
6424
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6425
|
+
if (item.size > 0) out.set(field.key, {
|
|
6426
|
+
kind: "array",
|
|
6427
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6428
|
+
item
|
|
6429
|
+
});
|
|
6430
|
+
continue;
|
|
6431
|
+
}
|
|
6432
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6433
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6434
|
+
}
|
|
6435
|
+
}
|
|
6436
|
+
/** The secret tree a settings schema declares. */
|
|
6437
|
+
function secretTreeFromSchema(schema) {
|
|
6438
|
+
const out = /* @__PURE__ */ new Map();
|
|
6439
|
+
if (schema === null) return out;
|
|
6440
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6441
|
+
return out;
|
|
6442
|
+
}
|
|
6443
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6444
|
+
function parseSecretStatePath(path) {
|
|
6445
|
+
const segments = [];
|
|
6446
|
+
for (const raw of path.split(".")) {
|
|
6447
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6448
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6449
|
+
segments.push(m[2] !== void 0 ? {
|
|
6450
|
+
key: m[1],
|
|
6451
|
+
idKey: m[2]
|
|
6452
|
+
} : { key: m[1] });
|
|
6453
|
+
}
|
|
6454
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6455
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6456
|
+
return segments;
|
|
6457
|
+
}
|
|
6458
|
+
function insert(into, segments) {
|
|
6459
|
+
const [head, ...rest] = segments;
|
|
6460
|
+
if (head === void 0) return;
|
|
6461
|
+
if (rest.length === 0) {
|
|
6462
|
+
into.set(head.key, LEAF);
|
|
6463
|
+
return;
|
|
6464
|
+
}
|
|
6465
|
+
const existing = into.get(head.key);
|
|
6466
|
+
if (head.idKey !== void 0) {
|
|
6467
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6468
|
+
insert(item, rest);
|
|
6469
|
+
into.set(head.key, {
|
|
6470
|
+
kind: "array",
|
|
6471
|
+
idKey: head.idKey,
|
|
6472
|
+
item
|
|
6473
|
+
});
|
|
6474
|
+
return;
|
|
6475
|
+
}
|
|
6476
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6477
|
+
insert(children, rest);
|
|
6478
|
+
into.set(head.key, {
|
|
6479
|
+
kind: "object",
|
|
6480
|
+
children
|
|
6481
|
+
});
|
|
6482
|
+
}
|
|
6483
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6484
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6485
|
+
if (paths.length === 0) return tree;
|
|
6486
|
+
const out = new Map(tree);
|
|
6487
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6488
|
+
return out;
|
|
6489
|
+
}
|
|
6490
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6491
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6492
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6493
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6494
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5959
6495
|
/**
|
|
5960
6496
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5961
6497
|
*
|
|
@@ -6025,6 +6561,25 @@ var BaseAddon = class {
|
|
|
6025
6561
|
settingsStoreReady = false;
|
|
6026
6562
|
/** Default config values. Provided via constructor. */
|
|
6027
6563
|
defaults;
|
|
6564
|
+
/**
|
|
6565
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6566
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6567
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6568
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6569
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6570
|
+
*/
|
|
6571
|
+
secretStatePaths = [];
|
|
6572
|
+
_addonSecretTree = null;
|
|
6573
|
+
_deviceSecretTree = null;
|
|
6574
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6575
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6576
|
+
_unresolvedSecrets = [];
|
|
6577
|
+
_secretRetryTimer = null;
|
|
6578
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6579
|
+
_secretChangeTimer = null;
|
|
6580
|
+
_secretChangeUnsub = null;
|
|
6581
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6582
|
+
_operatorWriteDepth = 0;
|
|
6028
6583
|
constructor(defaults) {
|
|
6029
6584
|
this.defaults = defaults;
|
|
6030
6585
|
this._config = { ...defaults };
|
|
@@ -6060,8 +6615,18 @@ var BaseAddon = class {
|
|
|
6060
6615
|
return this._config;
|
|
6061
6616
|
}
|
|
6062
6617
|
async initialize(context) {
|
|
6063
|
-
|
|
6618
|
+
const secrets = context.secrets;
|
|
6619
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6620
|
+
secrets,
|
|
6621
|
+
addonTree: () => this.addonSecretTree(),
|
|
6622
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6623
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6624
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6625
|
+
}) : context;
|
|
6064
6626
|
await this.resolveConfig();
|
|
6627
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6628
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6629
|
+
});
|
|
6065
6630
|
const result = await this.onInitialize();
|
|
6066
6631
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6067
6632
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6094,6 +6659,12 @@ var BaseAddon = class {
|
|
|
6094
6659
|
*/
|
|
6095
6660
|
async onHubReachable() {}
|
|
6096
6661
|
async shutdown() {
|
|
6662
|
+
this._secretChangeUnsub?.();
|
|
6663
|
+
this._secretChangeUnsub = null;
|
|
6664
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6665
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6666
|
+
this._secretRetryTimer = null;
|
|
6667
|
+
this._secretChangeTimer = null;
|
|
6097
6668
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6098
6669
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6099
6670
|
await this.onShutdown();
|
|
@@ -6172,7 +6743,7 @@ var BaseAddon = class {
|
|
|
6172
6743
|
return hydrateSchema(schema, overlay ? {
|
|
6173
6744
|
...projected,
|
|
6174
6745
|
...overlay
|
|
6175
|
-
} : projected);
|
|
6746
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6176
6747
|
}
|
|
6177
6748
|
/**
|
|
6178
6749
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6221,7 +6792,7 @@ var BaseAddon = class {
|
|
|
6221
6792
|
return hydrateSchema({
|
|
6222
6793
|
...schema,
|
|
6223
6794
|
sections
|
|
6224
|
-
}, projected);
|
|
6795
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6225
6796
|
}
|
|
6226
6797
|
/**
|
|
6227
6798
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6275,18 +6846,50 @@ var BaseAddon = class {
|
|
|
6275
6846
|
value: result.value[key]
|
|
6276
6847
|
};
|
|
6277
6848
|
}
|
|
6849
|
+
/**
|
|
6850
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6851
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6852
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6853
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6854
|
+
* writing back what it read is not (D787).
|
|
6855
|
+
*/
|
|
6856
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6857
|
+
this._operatorWriteDepth++;
|
|
6858
|
+
try {
|
|
6859
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6860
|
+
} finally {
|
|
6861
|
+
this._operatorWriteDepth--;
|
|
6862
|
+
}
|
|
6863
|
+
}
|
|
6278
6864
|
async updateGlobalSettings(patch, nodeId) {
|
|
6865
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6866
|
+
}
|
|
6867
|
+
/**
|
|
6868
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6869
|
+
*
|
|
6870
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6871
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6872
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6873
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6874
|
+
*/
|
|
6875
|
+
async clearSecrets(keys, nodeId) {
|
|
6876
|
+
const tree = this.addonSecretTree();
|
|
6877
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6878
|
+
const patch = {};
|
|
6879
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6880
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6881
|
+
}
|
|
6882
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6279
6883
|
const keys = this.perNodeKeys();
|
|
6280
6884
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6281
6885
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6282
|
-
const barePatch = patch;
|
|
6283
6886
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6284
6887
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6285
6888
|
if (target !== localNode) return;
|
|
6286
6889
|
await this.resolveConfig();
|
|
6287
6890
|
await this.onConfigChanged();
|
|
6288
6891
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6289
|
-
this.maybeAutoRestart(
|
|
6892
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6290
6893
|
}
|
|
6291
6894
|
/**
|
|
6292
6895
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6311,7 +6914,7 @@ var BaseAddon = class {
|
|
|
6311
6914
|
* time to return its response before the addon is torn down and
|
|
6312
6915
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6313
6916
|
*/
|
|
6314
|
-
maybeAutoRestart(
|
|
6917
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6315
6918
|
if (!schema) return;
|
|
6316
6919
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6317
6920
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6319,13 +6922,13 @@ var BaseAddon = class {
|
|
|
6319
6922
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6320
6923
|
}
|
|
6321
6924
|
if (restartKeys.size === 0) return;
|
|
6322
|
-
if (!
|
|
6925
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6323
6926
|
const ctx = this._ctx;
|
|
6324
6927
|
if (!ctx) return;
|
|
6325
6928
|
const addonId = ctx.id;
|
|
6326
6929
|
setImmediate(() => {
|
|
6327
6930
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6328
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6931
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6329
6932
|
}).catch((err) => {
|
|
6330
6933
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6331
6934
|
});
|
|
@@ -6334,7 +6937,7 @@ var BaseAddon = class {
|
|
|
6334
6937
|
async getDeviceSettings(deviceId) {
|
|
6335
6938
|
const schema = this.deviceSettingsSchema();
|
|
6336
6939
|
if (!schema) return { sections: [] };
|
|
6337
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6940
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6338
6941
|
}
|
|
6339
6942
|
async updateDeviceSettings(deviceId, patch) {
|
|
6340
6943
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6464,7 +7067,7 @@ var BaseAddon = class {
|
|
|
6464
7067
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6465
7068
|
*/
|
|
6466
7069
|
async resolveConfig() {
|
|
6467
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7070
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6468
7071
|
const perNode = this.perNodeKeys();
|
|
6469
7072
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6470
7073
|
const resolved = { ...this.defaults };
|
|
@@ -6489,7 +7092,7 @@ var BaseAddon = class {
|
|
|
6489
7092
|
key,
|
|
6490
7093
|
schema,
|
|
6491
7094
|
fallback,
|
|
6492
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7095
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6493
7096
|
write: async (patch) => {
|
|
6494
7097
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6495
7098
|
},
|
|
@@ -6506,7 +7109,7 @@ var BaseAddon = class {
|
|
|
6506
7109
|
key,
|
|
6507
7110
|
schema,
|
|
6508
7111
|
fallback,
|
|
6509
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7112
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6510
7113
|
write: async (patch) => {
|
|
6511
7114
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6512
7115
|
},
|
|
@@ -6518,6 +7121,70 @@ var BaseAddon = class {
|
|
|
6518
7121
|
} })
|
|
6519
7122
|
});
|
|
6520
7123
|
}
|
|
7124
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7125
|
+
addonSecretTree() {
|
|
7126
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7127
|
+
return this._addonSecretTree;
|
|
7128
|
+
}
|
|
7129
|
+
deviceSecretTree() {
|
|
7130
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7131
|
+
return this._deviceSecretTree;
|
|
7132
|
+
}
|
|
7133
|
+
/**
|
|
7134
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7135
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7136
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7137
|
+
* than start on an empty credential.
|
|
7138
|
+
*/
|
|
7139
|
+
get unresolvedSecrets() {
|
|
7140
|
+
return this._unresolvedSecrets;
|
|
7141
|
+
}
|
|
7142
|
+
/**
|
|
7143
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7144
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7145
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7146
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7147
|
+
* ever written back from here.
|
|
7148
|
+
*/
|
|
7149
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7150
|
+
const secrets = this._ctx?.secrets;
|
|
7151
|
+
if (secrets === void 0) return blob;
|
|
7152
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7153
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7154
|
+
if (refs.length === 0) {
|
|
7155
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7156
|
+
return blob;
|
|
7157
|
+
}
|
|
7158
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7159
|
+
if (trackForConfig) {
|
|
7160
|
+
this._unresolvedSecrets = unresolved;
|
|
7161
|
+
if (unresolved.length > 0) {
|
|
7162
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7163
|
+
ref: u.ref,
|
|
7164
|
+
reason: u.reason
|
|
7165
|
+
})) } });
|
|
7166
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7167
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7168
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7169
|
+
}
|
|
7170
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7171
|
+
}
|
|
7172
|
+
return value;
|
|
7173
|
+
}
|
|
7174
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7175
|
+
scheduleSecretReresolve(delayMs) {
|
|
7176
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7177
|
+
if (this[timerOf] !== null) return;
|
|
7178
|
+
const timer = setTimeout(() => {
|
|
7179
|
+
this[timerOf] = null;
|
|
7180
|
+
if (this._ctx === null) return;
|
|
7181
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7182
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7183
|
+
});
|
|
7184
|
+
}, delayMs);
|
|
7185
|
+
timer.unref?.();
|
|
7186
|
+
this[timerOf] = timer;
|
|
7187
|
+
}
|
|
6521
7188
|
/**
|
|
6522
7189
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6523
7190
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -14896,6 +15563,196 @@ id: union([string(), number()]) }), {
|
|
|
14896
15563
|
auth: "admin"
|
|
14897
15564
|
});
|
|
14898
15565
|
/**
|
|
15566
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15567
|
+
*
|
|
15568
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15569
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15570
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15571
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15572
|
+
* against the CALLER, never against anything the caller claims.
|
|
15573
|
+
*
|
|
15574
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15575
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15576
|
+
* connection, the agent from its child's connection carried in
|
|
15577
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15578
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15579
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15580
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15581
|
+
* runner is the same OS user): see the threat model in
|
|
15582
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15583
|
+
*
|
|
15584
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15585
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15586
|
+
* floors every method to admin anyway (D240).
|
|
15587
|
+
*
|
|
15588
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15589
|
+
*/
|
|
15590
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15591
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15592
|
+
"key-missing",
|
|
15593
|
+
"wrong-key",
|
|
15594
|
+
"key-file-unreadable",
|
|
15595
|
+
"store-unavailable",
|
|
15596
|
+
"not-initialized",
|
|
15597
|
+
"decrypt-failed"
|
|
15598
|
+
]);
|
|
15599
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15600
|
+
state: literal("locked"),
|
|
15601
|
+
reason: KeychainUnavailableReasonSchema
|
|
15602
|
+
})]);
|
|
15603
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15604
|
+
object({
|
|
15605
|
+
kind: literal("value"),
|
|
15606
|
+
value: string(),
|
|
15607
|
+
version: number().int()
|
|
15608
|
+
}),
|
|
15609
|
+
object({ kind: literal("missing") }),
|
|
15610
|
+
object({
|
|
15611
|
+
kind: literal("unavailable"),
|
|
15612
|
+
reason: KeychainUnavailableReasonSchema
|
|
15613
|
+
}),
|
|
15614
|
+
object({ kind: literal("forbidden") })
|
|
15615
|
+
]);
|
|
15616
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15617
|
+
/** Metadata of one stored value — never the value. */
|
|
15618
|
+
var KeychainSecretMetaSchema = object({
|
|
15619
|
+
ref: string(),
|
|
15620
|
+
owner: string(),
|
|
15621
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15622
|
+
scope: string(),
|
|
15623
|
+
fieldPath: string(),
|
|
15624
|
+
version: number().int(),
|
|
15625
|
+
createdAt: number(),
|
|
15626
|
+
updatedAt: number(),
|
|
15627
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15628
|
+
updatedBy: string(),
|
|
15629
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15630
|
+
lastReadAt: number().nullable()
|
|
15631
|
+
});
|
|
15632
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15633
|
+
method(object({
|
|
15634
|
+
ref: string().min(1),
|
|
15635
|
+
value: string().min(1)
|
|
15636
|
+
}), object({
|
|
15637
|
+
ref: string(),
|
|
15638
|
+
version: number().int()
|
|
15639
|
+
}), {
|
|
15640
|
+
kind: "mutation",
|
|
15641
|
+
auth: "admin"
|
|
15642
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15643
|
+
kind: "mutation",
|
|
15644
|
+
auth: "admin"
|
|
15645
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15646
|
+
var KeychainKeySourceSchema = object({
|
|
15647
|
+
kind: _enum([
|
|
15648
|
+
"config-file",
|
|
15649
|
+
"previous-config-file",
|
|
15650
|
+
"platform",
|
|
15651
|
+
"default-file"
|
|
15652
|
+
]),
|
|
15653
|
+
/** File sources only — a path is not a secret. */
|
|
15654
|
+
path: string().optional(),
|
|
15655
|
+
/**
|
|
15656
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15657
|
+
* next to the database it protects (the default file). The page warns.
|
|
15658
|
+
*/
|
|
15659
|
+
sharesBackupWithDatabase: boolean()
|
|
15660
|
+
});
|
|
15661
|
+
var KeychainStatusSchema = object({
|
|
15662
|
+
keychain: KeychainStateSchema,
|
|
15663
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15664
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15665
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15666
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15667
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15668
|
+
fingerprint: string().nullable(),
|
|
15669
|
+
activeKeyId: string().nullable(),
|
|
15670
|
+
/**
|
|
15671
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15672
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15673
|
+
*/
|
|
15674
|
+
rotationPending: boolean(),
|
|
15675
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15676
|
+
retiredWraps: number().int(),
|
|
15677
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15678
|
+
secretCount: number().int()
|
|
15679
|
+
});
|
|
15680
|
+
/**
|
|
15681
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15682
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15683
|
+
* never reported as an orphan (and never deleted as one).
|
|
15684
|
+
*/
|
|
15685
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15686
|
+
"in-use",
|
|
15687
|
+
"orphan",
|
|
15688
|
+
"unknown"
|
|
15689
|
+
]);
|
|
15690
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15691
|
+
var KeychainAuditActionSchema = _enum([
|
|
15692
|
+
"put",
|
|
15693
|
+
"delete",
|
|
15694
|
+
"reveal",
|
|
15695
|
+
"rotate-master-key",
|
|
15696
|
+
"purge-retired-keys",
|
|
15697
|
+
"download-recovery-key",
|
|
15698
|
+
"delete-orphans",
|
|
15699
|
+
"reset",
|
|
15700
|
+
"initialize"
|
|
15701
|
+
]);
|
|
15702
|
+
var KeychainAuditEntrySchema = object({
|
|
15703
|
+
id: string(),
|
|
15704
|
+
at: number(),
|
|
15705
|
+
action: KeychainAuditActionSchema,
|
|
15706
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15707
|
+
actor: string(),
|
|
15708
|
+
ref: string().nullable(),
|
|
15709
|
+
detail: string().nullable()
|
|
15710
|
+
});
|
|
15711
|
+
method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
|
|
15712
|
+
value: string(),
|
|
15713
|
+
version: number().int()
|
|
15714
|
+
}), {
|
|
15715
|
+
kind: "mutation",
|
|
15716
|
+
auth: "admin",
|
|
15717
|
+
caller: "required"
|
|
15718
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15719
|
+
deleted: array(string()).readonly(),
|
|
15720
|
+
kept: array(object({
|
|
15721
|
+
ref: string(),
|
|
15722
|
+
usage: KeychainSecretUsageSchema
|
|
15723
|
+
})).readonly()
|
|
15724
|
+
}), {
|
|
15725
|
+
kind: "mutation",
|
|
15726
|
+
auth: "admin",
|
|
15727
|
+
caller: "required"
|
|
15728
|
+
}), method(object({}), object({
|
|
15729
|
+
fingerprint: string(),
|
|
15730
|
+
keySource: KeychainKeySourceSchema
|
|
15731
|
+
}), {
|
|
15732
|
+
kind: "mutation",
|
|
15733
|
+
auth: "admin",
|
|
15734
|
+
caller: "required"
|
|
15735
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15736
|
+
kind: "mutation",
|
|
15737
|
+
auth: "admin",
|
|
15738
|
+
caller: "required"
|
|
15739
|
+
}), method(object({}), object({
|
|
15740
|
+
key: string(),
|
|
15741
|
+
fingerprint: string(),
|
|
15742
|
+
keySource: KeychainKeySourceSchema
|
|
15743
|
+
}), {
|
|
15744
|
+
kind: "mutation",
|
|
15745
|
+
auth: "admin",
|
|
15746
|
+
caller: "required"
|
|
15747
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15748
|
+
archivedCollection: string().nullable(),
|
|
15749
|
+
archived: number().int()
|
|
15750
|
+
}), {
|
|
15751
|
+
kind: "mutation",
|
|
15752
|
+
auth: "admin",
|
|
15753
|
+
caller: "required"
|
|
15754
|
+
});
|
|
15755
|
+
/**
|
|
14899
15756
|
* Stable UI option list for the `hwaccel` setting. Decoder addons
|
|
14900
15757
|
* reuse this for `globalSettingsSchema()` so the dropdown is
|
|
14901
15758
|
* identical everywhere. Order: auto → off → common backends by
|
|
@@ -16013,7 +16870,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
16013
16870
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16014
16871
|
var DevicePersistConfigPayloadSchema = object({
|
|
16015
16872
|
deviceId: number(),
|
|
16016
|
-
data: record(string(), unknown())
|
|
16873
|
+
data: record(string(), unknown()),
|
|
16874
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16875
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16876
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16877
|
+
secretConfigPaths: array(string()).optional()
|
|
16017
16878
|
});
|
|
16018
16879
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
16019
16880
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -22992,8 +23853,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22992
23853
|
]);
|
|
22993
23854
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22994
23855
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22995
|
-
/**
|
|
22996
|
-
|
|
23856
|
+
/**
|
|
23857
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23858
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23859
|
+
*
|
|
23860
|
+
* - `operator` — drawn by hand.
|
|
23861
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23862
|
+
* model, or a larger teacher model).
|
|
23863
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23864
|
+
* back from the track store (never a re-run).
|
|
23865
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23866
|
+
*/
|
|
23867
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23868
|
+
"operator",
|
|
23869
|
+
"assist",
|
|
23870
|
+
"pipeline",
|
|
23871
|
+
"llm"
|
|
23872
|
+
]);
|
|
22997
23873
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22998
23874
|
var RetrainBboxSchema = object({
|
|
22999
23875
|
x: number(),
|
|
@@ -23011,7 +23887,8 @@ var RetrainBboxSchema = object({
|
|
|
23011
23887
|
*/
|
|
23012
23888
|
var RetrainAnnotationSchema = object({
|
|
23013
23889
|
id: string(),
|
|
23014
|
-
|
|
23890
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23891
|
+
trackId: string().optional(),
|
|
23015
23892
|
deviceId: number(),
|
|
23016
23893
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
23017
23894
|
mediaKey: string(),
|
|
@@ -23060,13 +23937,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23060
23937
|
* fail, whatever became of the original. */
|
|
23061
23938
|
copied: boolean()
|
|
23062
23939
|
});
|
|
23940
|
+
/**
|
|
23941
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23942
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23943
|
+
* box recorded on the source media row when there is one, else the track
|
|
23944
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23945
|
+
* until the operator confirms it.
|
|
23946
|
+
*/
|
|
23947
|
+
var RetrainPipelineBoxSchema = object({
|
|
23948
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23949
|
+
bbox: RetrainBboxSchema,
|
|
23950
|
+
macroClass: RetrainMacroClassSchema,
|
|
23951
|
+
label: string().optional(),
|
|
23952
|
+
subLabel: string().optional(),
|
|
23953
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23954
|
+
score: number().optional(),
|
|
23955
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23956
|
+
modelId: string().optional(),
|
|
23957
|
+
trackId: string(),
|
|
23958
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23959
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23960
|
+
basis: _enum(["subject-box", "position"]),
|
|
23961
|
+
deltaMs: number()
|
|
23962
|
+
});
|
|
23963
|
+
/**
|
|
23964
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23965
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23966
|
+
* track at all.
|
|
23967
|
+
*/
|
|
23968
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23063
23969
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23064
23970
|
var RetrainFrameSchema = object({
|
|
23065
23971
|
frameId: string(),
|
|
23066
23972
|
deviceId: number(),
|
|
23067
|
-
|
|
23068
|
-
/**
|
|
23069
|
-
|
|
23973
|
+
origin: RetrainFrameOriginSchema,
|
|
23974
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23975
|
+
trackId: string().optional(),
|
|
23976
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23977
|
+
* Absent on a recording still. */
|
|
23978
|
+
sourceMediaId: number().int().optional(),
|
|
23979
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23980
|
+
epochMs: number().optional(),
|
|
23070
23981
|
sourceKind: MediaFileKindEnum,
|
|
23071
23982
|
sizeBytes: number().int(),
|
|
23072
23983
|
width: number().int(),
|
|
@@ -23077,7 +23988,12 @@ var RetrainFrameSchema = object({
|
|
|
23077
23988
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
23078
23989
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23079
23990
|
* a false positive. */
|
|
23080
|
-
complete: boolean()
|
|
23991
|
+
complete: boolean(),
|
|
23992
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23993
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23994
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23995
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23996
|
+
collectionIds: array(string()).readonly().optional()
|
|
23081
23997
|
});
|
|
23082
23998
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23083
23999
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23108,6 +24024,8 @@ var RetrainFrameListSchema = object({
|
|
|
23108
24024
|
var RetrainExportFilterSchema = object({
|
|
23109
24025
|
deviceIds: array(number()).optional(),
|
|
23110
24026
|
frameIds: array(string()).max(2e4).optional(),
|
|
24027
|
+
/** Only frames in at least one of these named collections. */
|
|
24028
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23111
24029
|
batchId: string().optional(),
|
|
23112
24030
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23113
24031
|
completeOnly: boolean().optional()
|
|
@@ -23172,6 +24090,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23172
24090
|
reason: string(),
|
|
23173
24091
|
detail: string().optional()
|
|
23174
24092
|
})]);
|
|
24093
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24094
|
+
var RetrainCollectionSchema = object({
|
|
24095
|
+
id: string(),
|
|
24096
|
+
name: string(),
|
|
24097
|
+
createdAt: number(),
|
|
24098
|
+
frameCount: number().int()
|
|
24099
|
+
});
|
|
24100
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24101
|
+
kind: literal("created"),
|
|
24102
|
+
collection: RetrainCollectionSchema
|
|
24103
|
+
}), object({
|
|
24104
|
+
kind: literal("refused"),
|
|
24105
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24106
|
+
})]);
|
|
24107
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24108
|
+
kind: literal("renamed"),
|
|
24109
|
+
collection: RetrainCollectionSchema
|
|
24110
|
+
}), object({
|
|
24111
|
+
kind: literal("refused"),
|
|
24112
|
+
reason: _enum([
|
|
24113
|
+
"empty-name",
|
|
24114
|
+
"duplicate-name",
|
|
24115
|
+
"unknown-collection"
|
|
24116
|
+
])
|
|
24117
|
+
})]);
|
|
24118
|
+
/**
|
|
24119
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24120
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24121
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24122
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24123
|
+
*/
|
|
24124
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24125
|
+
kind: literal("added"),
|
|
24126
|
+
collectionId: string(),
|
|
24127
|
+
frame: RetrainFrameSchema,
|
|
24128
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24129
|
+
reused: boolean()
|
|
24130
|
+
}), object({
|
|
24131
|
+
kind: literal("refused"),
|
|
24132
|
+
reason: _enum([
|
|
24133
|
+
"unknown-collection",
|
|
24134
|
+
"still-unavailable",
|
|
24135
|
+
"still-busy",
|
|
24136
|
+
"unreadable-image",
|
|
24137
|
+
"write-failed"
|
|
24138
|
+
]),
|
|
24139
|
+
detail: string().optional()
|
|
24140
|
+
})]);
|
|
24141
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24142
|
+
var RetrainAssistProfileSchema = object({
|
|
24143
|
+
id: string(),
|
|
24144
|
+
name: string(),
|
|
24145
|
+
model: string(),
|
|
24146
|
+
kind: string(),
|
|
24147
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24148
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24149
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24150
|
+
leavesHouse: boolean()
|
|
24151
|
+
});
|
|
24152
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24153
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24154
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24155
|
+
var RetrainLlmReviewSchema = object({
|
|
24156
|
+
/** The `ref` the page sent the box under. */
|
|
24157
|
+
ref: string(),
|
|
24158
|
+
verdict: _enum([
|
|
24159
|
+
"confirmed",
|
|
24160
|
+
"wrong-class",
|
|
24161
|
+
"not-an-object",
|
|
24162
|
+
"uncertain"
|
|
24163
|
+
]),
|
|
24164
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24165
|
+
reason: string()
|
|
24166
|
+
});
|
|
24167
|
+
/**
|
|
24168
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24169
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24170
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24171
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24172
|
+
*/
|
|
24173
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24174
|
+
kind: literal("proposed"),
|
|
24175
|
+
profileId: string(),
|
|
24176
|
+
model: string(),
|
|
24177
|
+
/** The frame was sent outside the house for this answer. */
|
|
24178
|
+
leftHouse: boolean(),
|
|
24179
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24180
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24181
|
+
rejected: number().int()
|
|
24182
|
+
}), object({
|
|
24183
|
+
kind: literal("refused"),
|
|
24184
|
+
reason: _enum([
|
|
24185
|
+
"unknown-frame",
|
|
24186
|
+
"unreadable-frame",
|
|
24187
|
+
"unknown-profile",
|
|
24188
|
+
"profile-disabled",
|
|
24189
|
+
"no-vision",
|
|
24190
|
+
"cloud-not-confirmed",
|
|
24191
|
+
"llm-error",
|
|
24192
|
+
"malformed-answer"
|
|
24193
|
+
]),
|
|
24194
|
+
detail: string().optional()
|
|
24195
|
+
})]);
|
|
23175
24196
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23176
24197
|
var RetrainTransitionResultSchema = object({
|
|
23177
24198
|
trackId: string(),
|
|
@@ -23889,7 +24910,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23889
24910
|
auth: "admin"
|
|
23890
24911
|
}), method(object({
|
|
23891
24912
|
deviceId: number(),
|
|
23892
|
-
trackId: string(),
|
|
24913
|
+
trackId: string().optional(),
|
|
23893
24914
|
frameId: string()
|
|
23894
24915
|
}), object({
|
|
23895
24916
|
removed: boolean(),
|
|
@@ -23906,7 +24927,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23906
24927
|
auth: "admin"
|
|
23907
24928
|
}), method(object({
|
|
23908
24929
|
deviceId: number(),
|
|
23909
|
-
|
|
24930
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24931
|
+
trackId: string().optional(),
|
|
23910
24932
|
frameId: string(),
|
|
23911
24933
|
subject: RetrainAssistSubjectSchema,
|
|
23912
24934
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23914,12 +24936,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23914
24936
|
}), RetrainAssistResultSchema, {
|
|
23915
24937
|
kind: "mutation",
|
|
23916
24938
|
auth: "admin"
|
|
23917
|
-
}), method(object({
|
|
24939
|
+
}), method(object({
|
|
24940
|
+
trackId: string().optional(),
|
|
24941
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24942
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23918
24943
|
kind: "query",
|
|
23919
24944
|
auth: "admin"
|
|
23920
24945
|
}), method(object({
|
|
23921
24946
|
deviceId: number(),
|
|
23922
|
-
|
|
24947
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24948
|
+
trackId: string().optional(),
|
|
23923
24949
|
frameId: string(),
|
|
23924
24950
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23925
24951
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23942,7 +24968,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23942
24968
|
auth: "admin"
|
|
23943
24969
|
}), method(object({
|
|
23944
24970
|
deviceId: number(),
|
|
23945
|
-
trackId: string(),
|
|
24971
|
+
trackId: string().optional(),
|
|
23946
24972
|
frameId: string(),
|
|
23947
24973
|
complete: boolean()
|
|
23948
24974
|
}), RetrainFrameSchema, {
|
|
@@ -23956,6 +24982,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23956
24982
|
kind: "mutation",
|
|
23957
24983
|
auth: "admin",
|
|
23958
24984
|
timeoutMs: 60 * 6e4
|
|
24985
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24986
|
+
kind: "query",
|
|
24987
|
+
auth: "admin"
|
|
24988
|
+
}), method(object({
|
|
24989
|
+
deviceId: number(),
|
|
24990
|
+
trackId: string().optional(),
|
|
24991
|
+
frameId: string(),
|
|
24992
|
+
profileId: string(),
|
|
24993
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24994
|
+
boxes: array(object({
|
|
24995
|
+
ref: string(),
|
|
24996
|
+
bbox: RetrainBboxSchema,
|
|
24997
|
+
macroClass: RetrainMacroClassSchema,
|
|
24998
|
+
label: string().optional()
|
|
24999
|
+
})).max(50),
|
|
25000
|
+
allowCloud: boolean()
|
|
25001
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25002
|
+
kind: "mutation",
|
|
25003
|
+
auth: "admin",
|
|
25004
|
+
timeoutMs: 18e4
|
|
25005
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25006
|
+
kind: "mutation",
|
|
25007
|
+
auth: "admin"
|
|
25008
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25009
|
+
kind: "query",
|
|
25010
|
+
auth: "admin"
|
|
25011
|
+
}), method(object({
|
|
25012
|
+
id: string(),
|
|
25013
|
+
name: string().max(120)
|
|
25014
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25015
|
+
kind: "mutation",
|
|
25016
|
+
auth: "admin"
|
|
25017
|
+
}), method(object({ id: string() }), object({
|
|
25018
|
+
deleted: boolean(),
|
|
25019
|
+
removedFrames: number().int()
|
|
25020
|
+
}), {
|
|
25021
|
+
kind: "mutation",
|
|
25022
|
+
auth: "admin"
|
|
25023
|
+
}), method(object({
|
|
25024
|
+
collectionId: string(),
|
|
25025
|
+
deviceId: number(),
|
|
25026
|
+
epochMs: number()
|
|
25027
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25028
|
+
kind: "mutation",
|
|
25029
|
+
auth: "admin",
|
|
25030
|
+
timeoutMs: 6e4
|
|
25031
|
+
}), method(object({
|
|
25032
|
+
collectionId: string(),
|
|
25033
|
+
frameIds: array(string()).min(1).max(500)
|
|
25034
|
+
}), object({
|
|
25035
|
+
added: number().int(),
|
|
25036
|
+
alreadyMember: number().int(),
|
|
25037
|
+
unknownFrameIds: array(string()).readonly()
|
|
25038
|
+
}), {
|
|
25039
|
+
kind: "mutation",
|
|
25040
|
+
auth: "admin"
|
|
25041
|
+
}), method(object({
|
|
25042
|
+
collectionId: string(),
|
|
25043
|
+
frameId: string()
|
|
25044
|
+
}), object({
|
|
25045
|
+
removed: boolean(),
|
|
25046
|
+
deletedFrame: boolean()
|
|
25047
|
+
}), {
|
|
25048
|
+
kind: "mutation",
|
|
25049
|
+
auth: "admin"
|
|
25050
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25051
|
+
kind: "query",
|
|
25052
|
+
auth: "admin"
|
|
23959
25053
|
}), method(object({
|
|
23960
25054
|
/** Which of the three event tables owns the row. */
|
|
23961
25055
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24579,13 +25673,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24579
25673
|
object({
|
|
24580
25674
|
kind: literal("no-family-build"),
|
|
24581
25675
|
format: ModelFormatSchema$1
|
|
25676
|
+
}),
|
|
25677
|
+
object({
|
|
25678
|
+
kind: literal("kept-custom-pin"),
|
|
25679
|
+
modelId: string(),
|
|
25680
|
+
deviceKey: string()
|
|
24582
25681
|
})
|
|
24583
25682
|
]);
|
|
25683
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25684
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25685
|
+
/**
|
|
25686
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25687
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25688
|
+
*/
|
|
25689
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25690
|
+
kind: literal("node-benchmark"),
|
|
25691
|
+
resultId: string(),
|
|
25692
|
+
measuredAtMs: number()
|
|
25693
|
+
})]);
|
|
24584
25694
|
var DeviceModelChoiceSchema = object({
|
|
24585
25695
|
modelId: string(),
|
|
24586
25696
|
p50Ms: number(),
|
|
24587
25697
|
fps: number(),
|
|
24588
25698
|
measured: boolean(),
|
|
25699
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25700
|
+
source: LatencySourceSchema.optional(),
|
|
24589
25701
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24590
25702
|
capacitySessions: number(),
|
|
24591
25703
|
personRecall: number()
|
|
@@ -24596,6 +25708,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24596
25708
|
enabled: boolean(),
|
|
24597
25709
|
available: boolean(),
|
|
24598
25710
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25711
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25712
|
+
kept: KeptReasonSchema.optional(),
|
|
24599
25713
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24600
25714
|
});
|
|
24601
25715
|
var NodeRecommendationSchema = object({
|
|
@@ -24649,6 +25763,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24649
25763
|
kind: literal("coral-enabled"),
|
|
24650
25764
|
nodeId: string(),
|
|
24651
25765
|
deviceKey: string()
|
|
25766
|
+
}),
|
|
25767
|
+
object({
|
|
25768
|
+
kind: literal("custom-pin-kept"),
|
|
25769
|
+
nodeId: string(),
|
|
25770
|
+
deviceKey: string().nullable(),
|
|
25771
|
+
deviceId: number().nullable(),
|
|
25772
|
+
modelId: string()
|
|
25773
|
+
}),
|
|
25774
|
+
object({
|
|
25775
|
+
kind: literal("custom-registry-unreadable"),
|
|
25776
|
+
error: string()
|
|
24652
25777
|
})
|
|
24653
25778
|
]);
|
|
24654
25779
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24827,13 +25952,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24827
25952
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24828
25953
|
});
|
|
24829
25954
|
/**
|
|
24830
|
-
* Where the node and device shares come from (D750, D755).
|
|
24831
|
-
* - `
|
|
24832
|
-
*
|
|
24833
|
-
*
|
|
24834
|
-
*
|
|
24835
|
-
*
|
|
24836
|
-
*
|
|
25955
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25956
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25957
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25958
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25959
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25960
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25961
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25962
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24837
25963
|
* - `manual` — the operator's stored sliders.
|
|
24838
25964
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24839
25965
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24882,6 +26008,362 @@ var EffectiveSharesSchema = object({
|
|
|
24882
26008
|
nodeWeights: record(string(), number()),
|
|
24883
26009
|
deviceWeights: record(string(), record(string(), number()))
|
|
24884
26010
|
});
|
|
26011
|
+
/**
|
|
26012
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26013
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26014
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26015
|
+
* shares read.
|
|
26016
|
+
*
|
|
26017
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26018
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26019
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26020
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26021
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26022
|
+
*
|
|
26023
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26024
|
+
* cross a process at frame rate, D9):
|
|
26025
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26026
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26027
|
+
* interval;
|
|
26028
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26029
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26030
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26031
|
+
* CPU, RAM or the event loop give out.
|
|
26032
|
+
*/
|
|
26033
|
+
/** Defaults and bounds, one place. */
|
|
26034
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26035
|
+
fpsPerStream: 10,
|
|
26036
|
+
budgetMinutes: 45,
|
|
26037
|
+
minBudgetMinutes: 10,
|
|
26038
|
+
maxBudgetMinutes: 120,
|
|
26039
|
+
/** A result older than this no longer beats the table. */
|
|
26040
|
+
staleAfterDays: 30,
|
|
26041
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26042
|
+
settleSec: 5,
|
|
26043
|
+
/** Accounted window per ramp step. */
|
|
26044
|
+
measureSec: 20,
|
|
26045
|
+
/** Longest the drain may take before the run is refused. */
|
|
26046
|
+
drainTimeoutSec: 120,
|
|
26047
|
+
/** Candidate models per device in one run. */
|
|
26048
|
+
maxModelsPerDevice: 6
|
|
26049
|
+
};
|
|
26050
|
+
/** The two measurements a run can make. */
|
|
26051
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26052
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26053
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26054
|
+
deviceKey: string().min(1),
|
|
26055
|
+
/**
|
|
26056
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26057
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26058
|
+
*/
|
|
26059
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26060
|
+
});
|
|
26061
|
+
/** What the operator confirmed. */
|
|
26062
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26063
|
+
nodeId: string().min(1),
|
|
26064
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26065
|
+
/** Which measurements run. At least one. */
|
|
26066
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26067
|
+
/**
|
|
26068
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26069
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26070
|
+
* detector always runs.
|
|
26071
|
+
*/
|
|
26072
|
+
steps: array(string().min(1)).default([]),
|
|
26073
|
+
/** Offered rate of one stream / session. */
|
|
26074
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26075
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26076
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26077
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26078
|
+
keepDownloadedModels: boolean().default(false),
|
|
26079
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26080
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26081
|
+
});
|
|
26082
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26083
|
+
kind: _enum([
|
|
26084
|
+
"benchmark-active",
|
|
26085
|
+
"node-offline",
|
|
26086
|
+
"unknown-device",
|
|
26087
|
+
"no-phase",
|
|
26088
|
+
"insufficient-headroom"
|
|
26089
|
+
]),
|
|
26090
|
+
detail: string(),
|
|
26091
|
+
overridable: boolean()
|
|
26092
|
+
});
|
|
26093
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26094
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26095
|
+
deviceId: number(),
|
|
26096
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26097
|
+
placedOnNode: boolean(),
|
|
26098
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26099
|
+
pinnedToNode: boolean()
|
|
26100
|
+
});
|
|
26101
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26102
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26103
|
+
deviceId: number(),
|
|
26104
|
+
reason: literal("only-frame-source")
|
|
26105
|
+
});
|
|
26106
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26107
|
+
nodeId: string(),
|
|
26108
|
+
online: boolean(),
|
|
26109
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26110
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26111
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26112
|
+
estimatedDurationMs: number(),
|
|
26113
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26114
|
+
budgetMs: number(),
|
|
26115
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26116
|
+
steps: array(string()).readonly(),
|
|
26117
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26118
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26119
|
+
headroom: object({
|
|
26120
|
+
sessionsNow: number(),
|
|
26121
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26122
|
+
}),
|
|
26123
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26124
|
+
canStart: boolean()
|
|
26125
|
+
});
|
|
26126
|
+
/** Where the measuring runner is. */
|
|
26127
|
+
var NodeBenchProgressSchema = object({
|
|
26128
|
+
phase: _enum([
|
|
26129
|
+
"preparing",
|
|
26130
|
+
"device",
|
|
26131
|
+
"pipeline",
|
|
26132
|
+
"cleanup"
|
|
26133
|
+
]),
|
|
26134
|
+
deviceKey: string().nullable(),
|
|
26135
|
+
modelId: string().nullable(),
|
|
26136
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26137
|
+
load: number().nullable(),
|
|
26138
|
+
cellsDone: number(),
|
|
26139
|
+
cellsTotal: number(),
|
|
26140
|
+
message: string()
|
|
26141
|
+
});
|
|
26142
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26143
|
+
var NodeBenchLimitSchema = _enum([
|
|
26144
|
+
"p95",
|
|
26145
|
+
"drops",
|
|
26146
|
+
"errors",
|
|
26147
|
+
"stall",
|
|
26148
|
+
"cpu",
|
|
26149
|
+
"ram",
|
|
26150
|
+
"none"
|
|
26151
|
+
]);
|
|
26152
|
+
var NodeBenchRampStepSchema = object({
|
|
26153
|
+
load: number(),
|
|
26154
|
+
pass: boolean(),
|
|
26155
|
+
p95Ms: number(),
|
|
26156
|
+
dropRatio: number(),
|
|
26157
|
+
/** Completed frames per second over the accounted window. */
|
|
26158
|
+
fps: number(),
|
|
26159
|
+
cpuPct: number().nullable(),
|
|
26160
|
+
ramFreePct: number().nullable(),
|
|
26161
|
+
failReasons: array(string()).readonly()
|
|
26162
|
+
});
|
|
26163
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26164
|
+
phase: literal("device"),
|
|
26165
|
+
deviceKey: string(),
|
|
26166
|
+
modelId: string(),
|
|
26167
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26168
|
+
p50Ms: number(),
|
|
26169
|
+
p95Ms: number(),
|
|
26170
|
+
p99Ms: number(),
|
|
26171
|
+
/** Frames per second sustained at the last passing step. */
|
|
26172
|
+
fps: number(),
|
|
26173
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26174
|
+
kMax: number(),
|
|
26175
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26176
|
+
/** First call (model load + warm-up). */
|
|
26177
|
+
warmupMs: number(),
|
|
26178
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26179
|
+
}), object({
|
|
26180
|
+
phase: literal("pipeline"),
|
|
26181
|
+
deviceKey: string(),
|
|
26182
|
+
modelId: string(),
|
|
26183
|
+
steps: array(string()).readonly(),
|
|
26184
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26185
|
+
maxSessions: number(),
|
|
26186
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26187
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26188
|
+
stepsFired: array(string()).readonly(),
|
|
26189
|
+
warmupMs: number(),
|
|
26190
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26191
|
+
})]);
|
|
26192
|
+
/**
|
|
26193
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26194
|
+
* the node no longer beats the table.
|
|
26195
|
+
*/
|
|
26196
|
+
var NodeBenchFingerprintSchema = object({
|
|
26197
|
+
pipelineVersion: string().nullable(),
|
|
26198
|
+
cpuModel: string().nullable(),
|
|
26199
|
+
ramGb: number().nullable(),
|
|
26200
|
+
os: string().nullable(),
|
|
26201
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26202
|
+
pools: record(string(), object({
|
|
26203
|
+
runtime: string(),
|
|
26204
|
+
numWorkers: number(),
|
|
26205
|
+
concurrency: number(),
|
|
26206
|
+
batchMode: string()
|
|
26207
|
+
})).default({})
|
|
26208
|
+
});
|
|
26209
|
+
/** The frames the run used. */
|
|
26210
|
+
var NodeBenchClipSchema = object({
|
|
26211
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26212
|
+
id: string(),
|
|
26213
|
+
revision: string().nullable(),
|
|
26214
|
+
frames: number(),
|
|
26215
|
+
width: number(),
|
|
26216
|
+
height: number()
|
|
26217
|
+
});
|
|
26218
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26219
|
+
runId: string().min(1),
|
|
26220
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26221
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26222
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26223
|
+
steps: array(string()).default([]),
|
|
26224
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26225
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26226
|
+
deadlineAtMs: number(),
|
|
26227
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26228
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26229
|
+
keepDownloadedModels: boolean().default(false)
|
|
26230
|
+
});
|
|
26231
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26232
|
+
"running",
|
|
26233
|
+
"done",
|
|
26234
|
+
"failed",
|
|
26235
|
+
"aborted"
|
|
26236
|
+
]);
|
|
26237
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26238
|
+
runId: string(),
|
|
26239
|
+
nodeId: string(),
|
|
26240
|
+
state: NodeBenchRunnerStateSchema,
|
|
26241
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26242
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26243
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26244
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26245
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26246
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26247
|
+
activeCameraIds: array(number()).readonly(),
|
|
26248
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26249
|
+
deletedModels: array(string()).readonly(),
|
|
26250
|
+
error: string().nullable(),
|
|
26251
|
+
startedAtMs: number(),
|
|
26252
|
+
finishedAtMs: number().nullable()
|
|
26253
|
+
});
|
|
26254
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26255
|
+
"draining",
|
|
26256
|
+
"measuring",
|
|
26257
|
+
"restoring",
|
|
26258
|
+
"done",
|
|
26259
|
+
"failed",
|
|
26260
|
+
"aborted"
|
|
26261
|
+
]);
|
|
26262
|
+
/** Why a run ended. */
|
|
26263
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26264
|
+
"completed",
|
|
26265
|
+
"operator-abort",
|
|
26266
|
+
"deadline",
|
|
26267
|
+
"node-lost",
|
|
26268
|
+
"runner-lost",
|
|
26269
|
+
"hub-restart",
|
|
26270
|
+
"drain-timeout",
|
|
26271
|
+
"failed"
|
|
26272
|
+
]);
|
|
26273
|
+
var NodeBenchmarkRunSchema = object({
|
|
26274
|
+
runId: string(),
|
|
26275
|
+
nodeId: string(),
|
|
26276
|
+
state: NodeBenchmarkStateSchema,
|
|
26277
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26278
|
+
startedAtMs: number(),
|
|
26279
|
+
deadlineAtMs: number(),
|
|
26280
|
+
finishedAtMs: number().nullable(),
|
|
26281
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26282
|
+
error: string().nullable(),
|
|
26283
|
+
/** Cameras moved off the node for the run. */
|
|
26284
|
+
moved: array(number()).readonly(),
|
|
26285
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26286
|
+
staying: array(number()).readonly(),
|
|
26287
|
+
/** Something else ran on the node's pools during the run. */
|
|
26288
|
+
contaminated: boolean(),
|
|
26289
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26290
|
+
resultIds: array(string()).readonly()
|
|
26291
|
+
});
|
|
26292
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26293
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26294
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26295
|
+
modeNodeId: string().nullable(),
|
|
26296
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26297
|
+
});
|
|
26298
|
+
/**
|
|
26299
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26300
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26301
|
+
* ends, never by anyone else.
|
|
26302
|
+
*/
|
|
26303
|
+
var NodeBenchmarkResultSchema = object({
|
|
26304
|
+
id: string(),
|
|
26305
|
+
runId: string(),
|
|
26306
|
+
nodeId: string(),
|
|
26307
|
+
cell: NodeBenchCellSchema,
|
|
26308
|
+
fpsPerStream: number(),
|
|
26309
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26310
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26311
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26312
|
+
contaminated: boolean(),
|
|
26313
|
+
stayingCameras: array(number()).readonly(),
|
|
26314
|
+
/** The run ended early; the cell itself completed. */
|
|
26315
|
+
partialRun: boolean(),
|
|
26316
|
+
measuredAtMs: number()
|
|
26317
|
+
});
|
|
26318
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26319
|
+
nodeId: string().optional(),
|
|
26320
|
+
deviceKey: string().optional()
|
|
26321
|
+
});
|
|
26322
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26323
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26324
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26325
|
+
standing: _enum([
|
|
26326
|
+
"fresh",
|
|
26327
|
+
"stale",
|
|
26328
|
+
"superseded"
|
|
26329
|
+
]),
|
|
26330
|
+
staleWhy: _enum([
|
|
26331
|
+
"age",
|
|
26332
|
+
"runtime",
|
|
26333
|
+
"pool-tuning"
|
|
26334
|
+
]).nullable()
|
|
26335
|
+
});
|
|
26336
|
+
object({
|
|
26337
|
+
runId: string(),
|
|
26338
|
+
nodeId: string(),
|
|
26339
|
+
startedAtMs: number(),
|
|
26340
|
+
deadlineAtMs: number(),
|
|
26341
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26342
|
+
moved: array(number()).readonly(),
|
|
26343
|
+
staying: array(number()).readonly()
|
|
26344
|
+
});
|
|
26345
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26346
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26347
|
+
nodeId: string(),
|
|
26348
|
+
reachable: boolean(),
|
|
26349
|
+
devices: array(object({
|
|
26350
|
+
deviceKey: string(),
|
|
26351
|
+
enabled: boolean(),
|
|
26352
|
+
available: boolean(),
|
|
26353
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26354
|
+
suggested: array(string()).readonly(),
|
|
26355
|
+
/** Every root detector the device has a build for. */
|
|
26356
|
+
all: array(string()).readonly(),
|
|
26357
|
+
/** The model the device runs now, when pinned. */
|
|
26358
|
+
currentModelId: string().nullable()
|
|
26359
|
+
})).readonly(),
|
|
26360
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26361
|
+
steps: array(object({
|
|
26362
|
+
id: string(),
|
|
26363
|
+
name: string(),
|
|
26364
|
+
slot: string()
|
|
26365
|
+
})).readonly()
|
|
26366
|
+
});
|
|
24885
26367
|
object({
|
|
24886
26368
|
activeCameras: number(),
|
|
24887
26369
|
throttledCameras: number(),
|
|
@@ -25970,7 +27452,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25970
27452
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25971
27453
|
deviceId: number(),
|
|
25972
27454
|
trackId: string()
|
|
25973
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27455
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27456
|
+
accepted: literal(true),
|
|
27457
|
+
runId: string()
|
|
27458
|
+
}), {
|
|
27459
|
+
kind: "mutation",
|
|
27460
|
+
auth: "admin"
|
|
27461
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27462
|
+
kind: "mutation",
|
|
27463
|
+
auth: "admin"
|
|
27464
|
+
});
|
|
25974
27465
|
var CameraPipelineConfigSchema = object({
|
|
25975
27466
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25976
27467
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26609,6 +28100,21 @@ method(object({
|
|
|
26609
28100
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26610
28101
|
kind: "mutation",
|
|
26611
28102
|
auth: "admin"
|
|
28103
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28104
|
+
kind: literal("started"),
|
|
28105
|
+
runId: string()
|
|
28106
|
+
}), object({
|
|
28107
|
+
kind: literal("refused"),
|
|
28108
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28109
|
+
})]), {
|
|
28110
|
+
kind: "mutation",
|
|
28111
|
+
auth: "admin"
|
|
28112
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28113
|
+
kind: "mutation",
|
|
28114
|
+
auth: "admin"
|
|
28115
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28116
|
+
kind: "mutation",
|
|
28117
|
+
auth: "admin"
|
|
26612
28118
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26613
28119
|
deviceId: number(),
|
|
26614
28120
|
addonId: string(),
|
|
@@ -31919,6 +33425,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
31919
33425
|
enabled: boolean().optional(),
|
|
31920
33426
|
info: record(string(), unknown()).optional(),
|
|
31921
33427
|
settings: record(string(), unknown()).optional(),
|
|
33428
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33429
|
+
* the keychain, not the table (D787). */
|
|
33430
|
+
secretKeys: array(string()).optional(),
|
|
31922
33431
|
skipRestart: boolean().optional()
|
|
31923
33432
|
});
|
|
31924
33433
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -31942,7 +33451,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
31942
33451
|
auth: "admin"
|
|
31943
33452
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
31944
33453
|
id: string(),
|
|
31945
|
-
settings: record(string(), unknown())
|
|
33454
|
+
settings: record(string(), unknown()),
|
|
33455
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33456
|
+
secretKeys: array(string()).optional()
|
|
31946
33457
|
}), object({ success: boolean() }), {
|
|
31947
33458
|
kind: "mutation",
|
|
31948
33459
|
auth: "admin"
|
|
@@ -40672,6 +42183,90 @@ Object.freeze({
|
|
|
40672
42183
|
addonId: null,
|
|
40673
42184
|
access: "create"
|
|
40674
42185
|
},
|
|
42186
|
+
"keychain.delete": {
|
|
42187
|
+
capName: "keychain",
|
|
42188
|
+
capScope: "system",
|
|
42189
|
+
addonId: null,
|
|
42190
|
+
access: "delete"
|
|
42191
|
+
},
|
|
42192
|
+
"keychain.getState": {
|
|
42193
|
+
capName: "keychain",
|
|
42194
|
+
capScope: "system",
|
|
42195
|
+
addonId: null,
|
|
42196
|
+
access: "view"
|
|
42197
|
+
},
|
|
42198
|
+
"keychain.listMeta": {
|
|
42199
|
+
capName: "keychain",
|
|
42200
|
+
capScope: "system",
|
|
42201
|
+
addonId: null,
|
|
42202
|
+
access: "view"
|
|
42203
|
+
},
|
|
42204
|
+
"keychain.put": {
|
|
42205
|
+
capName: "keychain",
|
|
42206
|
+
capScope: "system",
|
|
42207
|
+
addonId: null,
|
|
42208
|
+
access: "create"
|
|
42209
|
+
},
|
|
42210
|
+
"keychain.resolve": {
|
|
42211
|
+
capName: "keychain",
|
|
42212
|
+
capScope: "system",
|
|
42213
|
+
addonId: null,
|
|
42214
|
+
access: "view"
|
|
42215
|
+
},
|
|
42216
|
+
"keychainAdmin.deleteOrphans": {
|
|
42217
|
+
capName: "keychain-admin",
|
|
42218
|
+
capScope: "system",
|
|
42219
|
+
addonId: null,
|
|
42220
|
+
access: "delete"
|
|
42221
|
+
},
|
|
42222
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
42223
|
+
capName: "keychain-admin",
|
|
42224
|
+
capScope: "system",
|
|
42225
|
+
addonId: null,
|
|
42226
|
+
access: "create"
|
|
42227
|
+
},
|
|
42228
|
+
"keychainAdmin.listAudit": {
|
|
42229
|
+
capName: "keychain-admin",
|
|
42230
|
+
capScope: "system",
|
|
42231
|
+
addonId: null,
|
|
42232
|
+
access: "view"
|
|
42233
|
+
},
|
|
42234
|
+
"keychainAdmin.listSecrets": {
|
|
42235
|
+
capName: "keychain-admin",
|
|
42236
|
+
capScope: "system",
|
|
42237
|
+
addonId: null,
|
|
42238
|
+
access: "view"
|
|
42239
|
+
},
|
|
42240
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
42241
|
+
capName: "keychain-admin",
|
|
42242
|
+
capScope: "system",
|
|
42243
|
+
addonId: null,
|
|
42244
|
+
access: "delete"
|
|
42245
|
+
},
|
|
42246
|
+
"keychainAdmin.resetKeychain": {
|
|
42247
|
+
capName: "keychain-admin",
|
|
42248
|
+
capScope: "system",
|
|
42249
|
+
addonId: null,
|
|
42250
|
+
access: "delete"
|
|
42251
|
+
},
|
|
42252
|
+
"keychainAdmin.reveal": {
|
|
42253
|
+
capName: "keychain-admin",
|
|
42254
|
+
capScope: "system",
|
|
42255
|
+
addonId: null,
|
|
42256
|
+
access: "create"
|
|
42257
|
+
},
|
|
42258
|
+
"keychainAdmin.rotateMasterKey": {
|
|
42259
|
+
capName: "keychain-admin",
|
|
42260
|
+
capScope: "system",
|
|
42261
|
+
addonId: null,
|
|
42262
|
+
access: "create"
|
|
42263
|
+
},
|
|
42264
|
+
"keychainAdmin.status": {
|
|
42265
|
+
capName: "keychain-admin",
|
|
42266
|
+
capScope: "system",
|
|
42267
|
+
addonId: null,
|
|
42268
|
+
access: "view"
|
|
42269
|
+
},
|
|
40675
42270
|
"lawnMowerControl.dock": {
|
|
40676
42271
|
capName: "lawn-mower-control",
|
|
40677
42272
|
capScope: "device",
|
|
@@ -42046,6 +43641,18 @@ Object.freeze({
|
|
|
42046
43641
|
addonId: null,
|
|
42047
43642
|
access: "create"
|
|
42048
43643
|
},
|
|
43644
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
43645
|
+
capName: "pipeline-analytics",
|
|
43646
|
+
capScope: "device",
|
|
43647
|
+
addonId: null,
|
|
43648
|
+
access: "create"
|
|
43649
|
+
},
|
|
43650
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
43651
|
+
capName: "pipeline-analytics",
|
|
43652
|
+
capScope: "device",
|
|
43653
|
+
addonId: null,
|
|
43654
|
+
access: "create"
|
|
43655
|
+
},
|
|
42049
43656
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
42050
43657
|
capName: "pipeline-analytics",
|
|
42051
43658
|
capScope: "device",
|
|
@@ -42094,12 +43701,24 @@ Object.freeze({
|
|
|
42094
43701
|
addonId: null,
|
|
42095
43702
|
access: "view"
|
|
42096
43703
|
},
|
|
43704
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
43705
|
+
capName: "pipeline-analytics",
|
|
43706
|
+
capScope: "device",
|
|
43707
|
+
addonId: null,
|
|
43708
|
+
access: "create"
|
|
43709
|
+
},
|
|
42097
43710
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
42098
43711
|
capName: "pipeline-analytics",
|
|
42099
43712
|
capScope: "device",
|
|
42100
43713
|
addonId: null,
|
|
42101
43714
|
access: "delete"
|
|
42102
43715
|
},
|
|
43716
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
43717
|
+
capName: "pipeline-analytics",
|
|
43718
|
+
capScope: "device",
|
|
43719
|
+
addonId: null,
|
|
43720
|
+
access: "delete"
|
|
43721
|
+
},
|
|
42103
43722
|
"pipelineAnalytics.deleteTracks": {
|
|
42104
43723
|
capName: "pipeline-analytics",
|
|
42105
43724
|
capScope: "device",
|
|
@@ -42304,6 +43923,24 @@ Object.freeze({
|
|
|
42304
43923
|
addonId: null,
|
|
42305
43924
|
access: "view"
|
|
42306
43925
|
},
|
|
43926
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
43927
|
+
capName: "pipeline-analytics",
|
|
43928
|
+
capScope: "device",
|
|
43929
|
+
addonId: null,
|
|
43930
|
+
access: "view"
|
|
43931
|
+
},
|
|
43932
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
43933
|
+
capName: "pipeline-analytics",
|
|
43934
|
+
capScope: "device",
|
|
43935
|
+
addonId: null,
|
|
43936
|
+
access: "view"
|
|
43937
|
+
},
|
|
43938
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
43939
|
+
capName: "pipeline-analytics",
|
|
43940
|
+
capScope: "device",
|
|
43941
|
+
addonId: null,
|
|
43942
|
+
access: "view"
|
|
43943
|
+
},
|
|
42307
43944
|
"pipelineAnalytics.listRetrainFrames": {
|
|
42308
43945
|
capName: "pipeline-analytics",
|
|
42309
43946
|
capScope: "device",
|
|
@@ -42352,6 +43989,12 @@ Object.freeze({
|
|
|
42352
43989
|
addonId: null,
|
|
42353
43990
|
access: "create"
|
|
42354
43991
|
},
|
|
43992
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
43993
|
+
capName: "pipeline-analytics",
|
|
43994
|
+
capScope: "device",
|
|
43995
|
+
addonId: null,
|
|
43996
|
+
access: "create"
|
|
43997
|
+
},
|
|
42355
43998
|
"pipelineAnalytics.pruneEvents": {
|
|
42356
43999
|
capName: "pipeline-analytics",
|
|
42357
44000
|
capScope: "device",
|
|
@@ -42406,6 +44049,18 @@ Object.freeze({
|
|
|
42406
44049
|
addonId: null,
|
|
42407
44050
|
access: "create"
|
|
42408
44051
|
},
|
|
44052
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
44053
|
+
capName: "pipeline-analytics",
|
|
44054
|
+
capScope: "device",
|
|
44055
|
+
addonId: null,
|
|
44056
|
+
access: "delete"
|
|
44057
|
+
},
|
|
44058
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
44059
|
+
capName: "pipeline-analytics",
|
|
44060
|
+
capScope: "device",
|
|
44061
|
+
addonId: null,
|
|
44062
|
+
access: "create"
|
|
44063
|
+
},
|
|
42409
44064
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
42410
44065
|
capName: "pipeline-analytics",
|
|
42411
44066
|
capScope: "device",
|
|
@@ -42694,6 +44349,12 @@ Object.freeze({
|
|
|
42694
44349
|
addonId: null,
|
|
42695
44350
|
access: "view"
|
|
42696
44351
|
},
|
|
44352
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
44353
|
+
capName: "pipeline-orchestrator",
|
|
44354
|
+
capScope: "system",
|
|
44355
|
+
addonId: null,
|
|
44356
|
+
access: "create"
|
|
44357
|
+
},
|
|
42697
44358
|
"pipelineOrchestrator.applyAutoTune": {
|
|
42698
44359
|
capName: "pipeline-orchestrator",
|
|
42699
44360
|
capScope: "system",
|
|
@@ -42718,6 +44379,12 @@ Object.freeze({
|
|
|
42718
44379
|
addonId: null,
|
|
42719
44380
|
access: "create"
|
|
42720
44381
|
},
|
|
44382
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
44383
|
+
capName: "pipeline-orchestrator",
|
|
44384
|
+
capScope: "system",
|
|
44385
|
+
addonId: null,
|
|
44386
|
+
access: "delete"
|
|
44387
|
+
},
|
|
42721
44388
|
"pipelineOrchestrator.getAgentLoad": {
|
|
42722
44389
|
capName: "pipeline-orchestrator",
|
|
42723
44390
|
capScope: "system",
|
|
@@ -42826,6 +44493,24 @@ Object.freeze({
|
|
|
42826
44493
|
addonId: null,
|
|
42827
44494
|
access: "view"
|
|
42828
44495
|
},
|
|
44496
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
44497
|
+
capName: "pipeline-orchestrator",
|
|
44498
|
+
capScope: "system",
|
|
44499
|
+
addonId: null,
|
|
44500
|
+
access: "view"
|
|
44501
|
+
},
|
|
44502
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
44503
|
+
capName: "pipeline-orchestrator",
|
|
44504
|
+
capScope: "system",
|
|
44505
|
+
addonId: null,
|
|
44506
|
+
access: "view"
|
|
44507
|
+
},
|
|
44508
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
44509
|
+
capName: "pipeline-orchestrator",
|
|
44510
|
+
capScope: "system",
|
|
44511
|
+
addonId: null,
|
|
44512
|
+
access: "view"
|
|
44513
|
+
},
|
|
42829
44514
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
42830
44515
|
capName: "pipeline-orchestrator",
|
|
42831
44516
|
capScope: "system",
|
|
@@ -42868,6 +44553,12 @@ Object.freeze({
|
|
|
42868
44553
|
addonId: null,
|
|
42869
44554
|
access: "view"
|
|
42870
44555
|
},
|
|
44556
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
44557
|
+
capName: "pipeline-orchestrator",
|
|
44558
|
+
capScope: "system",
|
|
44559
|
+
addonId: null,
|
|
44560
|
+
access: "view"
|
|
44561
|
+
},
|
|
42871
44562
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
42872
44563
|
capName: "pipeline-orchestrator",
|
|
42873
44564
|
capScope: "system",
|
|
@@ -43012,6 +44703,12 @@ Object.freeze({
|
|
|
43012
44703
|
addonId: null,
|
|
43013
44704
|
access: "create"
|
|
43014
44705
|
},
|
|
44706
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
44707
|
+
capName: "pipeline-orchestrator",
|
|
44708
|
+
capScope: "system",
|
|
44709
|
+
addonId: null,
|
|
44710
|
+
access: "create"
|
|
44711
|
+
},
|
|
43015
44712
|
"pipelineOrchestrator.suggestShares": {
|
|
43016
44713
|
capName: "pipeline-orchestrator",
|
|
43017
44714
|
capScope: "system",
|
|
@@ -43030,6 +44727,12 @@ Object.freeze({
|
|
|
43030
44727
|
addonId: null,
|
|
43031
44728
|
access: "create"
|
|
43032
44729
|
},
|
|
44730
|
+
"pipelineRunner.abortNodeBench": {
|
|
44731
|
+
capName: "pipeline-runner",
|
|
44732
|
+
capScope: "system",
|
|
44733
|
+
addonId: null,
|
|
44734
|
+
access: "create"
|
|
44735
|
+
},
|
|
43033
44736
|
"pipelineRunner.attachCamera": {
|
|
43034
44737
|
capName: "pipeline-runner",
|
|
43035
44738
|
capScope: "system",
|
|
@@ -43078,6 +44781,12 @@ Object.freeze({
|
|
|
43078
44781
|
addonId: null,
|
|
43079
44782
|
access: "view"
|
|
43080
44783
|
},
|
|
44784
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
44785
|
+
capName: "pipeline-runner",
|
|
44786
|
+
capScope: "system",
|
|
44787
|
+
addonId: null,
|
|
44788
|
+
access: "view"
|
|
44789
|
+
},
|
|
43081
44790
|
"pipelineRunner.getParkedTrackFrame": {
|
|
43082
44791
|
capName: "pipeline-runner",
|
|
43083
44792
|
capScope: "system",
|
|
@@ -43120,6 +44829,12 @@ Object.freeze({
|
|
|
43120
44829
|
addonId: null,
|
|
43121
44830
|
access: "create"
|
|
43122
44831
|
},
|
|
44832
|
+
"pipelineRunner.startNodeBench": {
|
|
44833
|
+
capName: "pipeline-runner",
|
|
44834
|
+
capScope: "system",
|
|
44835
|
+
addonId: null,
|
|
44836
|
+
access: "create"
|
|
44837
|
+
},
|
|
43123
44838
|
"plateGallery.assignPlate": {
|
|
43124
44839
|
capName: "plate-gallery",
|
|
43125
44840
|
capScope: "system",
|
|
@@ -48049,6 +49764,11 @@ Object.freeze({
|
|
|
48049
49764
|
form: "single",
|
|
48050
49765
|
optional: false
|
|
48051
49766
|
}],
|
|
49767
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
49768
|
+
name: "deviceId",
|
|
49769
|
+
form: "single",
|
|
49770
|
+
optional: false
|
|
49771
|
+
}],
|
|
48052
49772
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
48053
49773
|
name: "deviceId",
|
|
48054
49774
|
form: "single",
|
|
@@ -48239,6 +49959,11 @@ Object.freeze({
|
|
|
48239
49959
|
form: "single",
|
|
48240
49960
|
optional: false
|
|
48241
49961
|
}],
|
|
49962
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
49963
|
+
name: "deviceId",
|
|
49964
|
+
form: "single",
|
|
49965
|
+
optional: false
|
|
49966
|
+
}],
|
|
48242
49967
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
48243
49968
|
name: "deviceId",
|
|
48244
49969
|
form: "single",
|
|
@@ -113918,8 +115643,10 @@ function ptzPresetLabel(presetName) {
|
|
|
113918
115643
|
* `proxy.ptz.getPresets({})`. Toggling ON calls
|
|
113919
115644
|
* `proxy.ptz.goToPreset({presetId})` and auto-resets to OFF after 1s.
|
|
113920
115645
|
* - Four directional momentary switches ("Pan Left", "Pan Right",
|
|
113921
|
-
* "Tilt Up", "Tilt Down") that issue
|
|
113922
|
-
*
|
|
115646
|
+
* "Tilt Up", "Tilt Down") that issue ONE `ptz.move` — the PTZ cap's
|
|
115647
|
+
* self-terminating burst, whose duration the DRIVER owns and reports as
|
|
115648
|
+
* `getOptions().moveImpulseMs` (ptz.cap.ts). The exporter carries no
|
|
115649
|
+
* duration of its own. Auto-reset to OFF once the pulse is over.
|
|
113923
115650
|
* - One stateful switch "Autotrack" when the proxy has the
|
|
113924
115651
|
* `ptz-autotrack` cap bound. Toggling sets
|
|
113925
115652
|
* `proxy.ptzAutotrack.setEnabled({enabled})`. Initial value is
|
|
@@ -113935,7 +115662,7 @@ function ptzPresetLabel(presetName) {
|
|
|
113935
115662
|
*/
|
|
113936
115663
|
var MOMENTARY_RESET_MS = 1e3;
|
|
113937
115664
|
async function buildPtz(bctx) {
|
|
113938
|
-
const { ctx, accessory, proxy, numericDeviceId
|
|
115665
|
+
const { ctx, accessory, proxy, numericDeviceId } = bctx;
|
|
113939
115666
|
const log = ctx.logger.withTags({ deviceId: numericDeviceId });
|
|
113940
115667
|
const timers = /* @__PURE__ */ new Set();
|
|
113941
115668
|
const armReset = (cb, delay) => {
|
|
@@ -113964,30 +115691,29 @@ async function buildPtz(bctx) {
|
|
|
113964
115691
|
armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
|
|
113965
115692
|
});
|
|
113966
115693
|
}
|
|
113967
|
-
if (proxy.ptz)
|
|
113968
|
-
const
|
|
113969
|
-
const
|
|
113970
|
-
|
|
113971
|
-
|
|
113972
|
-
|
|
113973
|
-
|
|
113974
|
-
|
|
113975
|
-
|
|
113976
|
-
|
|
113977
|
-
|
|
113978
|
-
|
|
113979
|
-
|
|
113980
|
-
|
|
113981
|
-
|
|
113982
|
-
|
|
113983
|
-
|
|
113984
|
-
|
|
113985
|
-
|
|
113986
|
-
|
|
113987
|
-
|
|
113988
|
-
|
|
113989
|
-
|
|
113990
|
-
});
|
|
115694
|
+
if (proxy.ptz) {
|
|
115695
|
+
const impulse = createImpulseReader(bctx);
|
|
115696
|
+
for (const dir of PTZ_DIRECTIONS) {
|
|
115697
|
+
const label = ptzServiceName(dir.label);
|
|
115698
|
+
const service = accessory.addService(import_dist.Service.Switch, label, dir.subtype);
|
|
115699
|
+
applyServiceLabel(service, label);
|
|
115700
|
+
const reset = (delayMs) => armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), delayMs);
|
|
115701
|
+
service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
|
|
115702
|
+
if (value !== true) return;
|
|
115703
|
+
const startedAt = Date.now();
|
|
115704
|
+
try {
|
|
115705
|
+
await proxy.ptz?.move({ ...dir.cmd });
|
|
115706
|
+
} catch (err) {
|
|
115707
|
+
log.warn("export-hap: ptz.move failed", { meta: {
|
|
115708
|
+
dir: dir.label,
|
|
115709
|
+
error: errMsg$4(err)
|
|
115710
|
+
} });
|
|
115711
|
+
reset(0);
|
|
115712
|
+
return;
|
|
115713
|
+
}
|
|
115714
|
+
reset(remainingPulseMs(await impulse.read(), Date.now() - startedAt));
|
|
115715
|
+
});
|
|
115716
|
+
}
|
|
113991
115717
|
}
|
|
113992
115718
|
const autotrackHandle = await tryBuildAutotrack(bctx);
|
|
113993
115719
|
return { async dispose() {
|
|
@@ -114045,6 +115771,38 @@ async function tryBuildAutotrack(bctx) {
|
|
|
114045
115771
|
});
|
|
114046
115772
|
return { async dispose() {} };
|
|
114047
115773
|
}
|
|
115774
|
+
/**
|
|
115775
|
+
* How long the switch should still read ON after `move` resolved.
|
|
115776
|
+
*
|
|
115777
|
+
* Drivers differ in WHEN `move` returns: hikvision awaits its own pulse before
|
|
115778
|
+
* resolving, while reolink (`autoStopMs`), amcrest (background stop) and onvif
|
|
115779
|
+
* (`timeout`) return as soon as the burst has started. Subtracting the time the
|
|
115780
|
+
* call took covers both: the switch stays ON for the pulse, never longer. An
|
|
115781
|
+
* unknown impulse (`null`) resets at once — the head still stops on its own.
|
|
115782
|
+
*/
|
|
115783
|
+
function remainingPulseMs(moveImpulseMs, elapsedMs) {
|
|
115784
|
+
if (moveImpulseMs === null) return 0;
|
|
115785
|
+
return Math.max(0, moveImpulseMs - elapsedMs);
|
|
115786
|
+
}
|
|
115787
|
+
/**
|
|
115788
|
+
* Reads `ptz.getOptions().moveImpulseMs` once and keeps it. A failed or
|
|
115789
|
+
* unreported read is NOT cached, so a camera that was offline at the first
|
|
115790
|
+
* press answers on a later one.
|
|
115791
|
+
*/
|
|
115792
|
+
function createImpulseReader(bctx) {
|
|
115793
|
+
const { ctx, proxy, numericDeviceId } = bctx;
|
|
115794
|
+
let known = null;
|
|
115795
|
+
return { async read() {
|
|
115796
|
+
if (known !== null) return known;
|
|
115797
|
+
try {
|
|
115798
|
+
const ms = (await proxy.ptz?.getOptions({}))?.moveImpulseMs;
|
|
115799
|
+
known = typeof ms === "number" && ms > 0 ? ms : null;
|
|
115800
|
+
} catch (err) {
|
|
115801
|
+
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getOptions failed (non-fatal)", { meta: { error: errMsg$4(err) } });
|
|
115802
|
+
}
|
|
115803
|
+
return known;
|
|
115804
|
+
} };
|
|
115805
|
+
}
|
|
114048
115806
|
function errMsg$4(err) {
|
|
114049
115807
|
return err instanceof Error ? err.message : String(err);
|
|
114050
115808
|
}
|
|
@@ -116682,7 +118440,6 @@ var DEFAULT_CONFIG = {
|
|
|
116682
118440
|
bridgeName: "CamStack Bridge",
|
|
116683
118441
|
fixedPin: "",
|
|
116684
118442
|
interfaceName: "",
|
|
116685
|
-
ptzPulseMs: 400,
|
|
116686
118443
|
clipRetentionDays: 14,
|
|
116687
118444
|
identity: {
|
|
116688
118445
|
username: "",
|
|
@@ -116728,6 +118485,8 @@ function buildBridgeUuid(bridgeName) {
|
|
|
116728
118485
|
return import_dist.uuid.generate(`camstack:bridge:${bridgeName}:${Date.now()}`);
|
|
116729
118486
|
}
|
|
116730
118487
|
var ExportHapAddon = class extends BaseAddon {
|
|
118488
|
+
/** The bridge setup code pairs a controller: a credential, kept in the keychain (D787). */
|
|
118489
|
+
secretStatePaths = ["identity.pincode"];
|
|
116731
118490
|
exposed = /* @__PURE__ */ new Map();
|
|
116732
118491
|
lastError;
|
|
116733
118492
|
/** Shared HAP setup code applied to every published accessory. */
|
|
@@ -117027,7 +118786,6 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
117027
118786
|
deviceId: entry.deviceId,
|
|
117028
118787
|
displayName: entry.displayName,
|
|
117029
118788
|
options: {
|
|
117030
|
-
ptzPulseMs: this.config.ptzPulseMs,
|
|
117031
118789
|
decodeMemos: this.decodeMemos,
|
|
117032
118790
|
resolveFfmpeg: this.pinnedFfmpeg,
|
|
117033
118791
|
hksvClipStore: this.hksvClipStore,
|
|
@@ -117387,14 +119145,6 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
117387
119145
|
description: "CamStack keeps its own copy of every clip it sends to HomeKit Secure Video — HomeKit itself never gives one back. This is the fleet default; each camera can override it, and each can switch the copies off entirely. Clips are also capped at 200 per camera, 512 MB per camera and 4 GB overall — whichever limit is reached first wins, and the log names which one.",
|
|
117388
119146
|
default: DEFAULT_CONFIG.clipRetentionDays,
|
|
117389
119147
|
placement: { tab: "advanced" }
|
|
117390
|
-
}),
|
|
117391
|
-
this.field({
|
|
117392
|
-
type: "number",
|
|
117393
|
-
key: "ptzPulseMs",
|
|
117394
|
-
label: "PTZ pulse duration (ms)",
|
|
117395
|
-
description: "Duration of a single pan/tilt momentary command issued by the PTZ direction switches in Apple Home. Lower = finer steps; higher = bigger sweeps per tap. Defaults to 400ms.",
|
|
117396
|
-
default: DEFAULT_CONFIG.ptzPulseMs,
|
|
117397
|
-
placement: { tab: "advanced" }
|
|
117398
119148
|
})
|
|
117399
119149
|
]
|
|
117400
119150
|
}] });
|