@camstack/addon-provider-ecowitt 0.2.122 → 0.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +2044 -62
- package/dist/addon.mjs +2044 -62
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServer } from "http";
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
3
|
import { createSocket } from "dgram";
|
|
4
|
-
//#region ../types/dist/event-category-
|
|
4
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
5
5
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
6
6
|
EventCategory["SystemBoot"] = "system.boot";
|
|
7
7
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -80,6 +80,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
80
80
|
*/
|
|
81
81
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
82
82
|
/**
|
|
83
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
84
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
85
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
86
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
87
|
+
*/
|
|
88
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
89
|
+
/**
|
|
83
90
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
84
91
|
* transitions from `failed` back to `healthy` (typically via the
|
|
85
92
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5372,7 +5379,7 @@ var ZodIssueCode$1 = {
|
|
|
5372
5379
|
var ZodFirstPartyTypeKind$1;
|
|
5373
5380
|
ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {});
|
|
5374
5381
|
//#endregion
|
|
5375
|
-
//#region ../types/dist/sleep-
|
|
5382
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5376
5383
|
/**
|
|
5377
5384
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5378
5385
|
* window to float samples (D455).
|
|
@@ -5451,6 +5458,97 @@ function buildAlawTable() {
|
|
|
5451
5458
|
}
|
|
5452
5459
|
buildUlawTable();
|
|
5453
5460
|
buildAlawTable();
|
|
5461
|
+
/** Is this field's stored value a credential? */
|
|
5462
|
+
function isSecretConfigField(field) {
|
|
5463
|
+
if (field.type === "password") return true;
|
|
5464
|
+
return "secret" in field && field.secret === true;
|
|
5465
|
+
}
|
|
5466
|
+
/**
|
|
5467
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5468
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5469
|
+
*/
|
|
5470
|
+
function isKeychainStoredField(field) {
|
|
5471
|
+
if (!isSecretConfigField(field)) return false;
|
|
5472
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5473
|
+
return !("storage" in field && field.storage === "inline");
|
|
5474
|
+
}
|
|
5475
|
+
/**
|
|
5476
|
+
* What a settings blob holds where a secret used to be.
|
|
5477
|
+
*
|
|
5478
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5479
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5480
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5481
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5482
|
+
*
|
|
5483
|
+
* The same shapes travel to and from the admin UI:
|
|
5484
|
+
*
|
|
5485
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5486
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5487
|
+
* value is set, never the value.
|
|
5488
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5489
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5490
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5491
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5492
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5493
|
+
*
|
|
5494
|
+
* Pure and browser-safe.
|
|
5495
|
+
*/
|
|
5496
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5497
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5498
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5499
|
+
function isRecord$1(value) {
|
|
5500
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5501
|
+
}
|
|
5502
|
+
function makeSecretMarker(ref) {
|
|
5503
|
+
return {
|
|
5504
|
+
$secret: ref,
|
|
5505
|
+
v: 1
|
|
5506
|
+
};
|
|
5507
|
+
}
|
|
5508
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5509
|
+
function isSecretMarker(value) {
|
|
5510
|
+
if (!isRecord$1(value)) return false;
|
|
5511
|
+
const ref = value["$secret"];
|
|
5512
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5513
|
+
}
|
|
5514
|
+
function isSecretClear(value) {
|
|
5515
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5516
|
+
}
|
|
5517
|
+
/**
|
|
5518
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5519
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5520
|
+
* survives this function.
|
|
5521
|
+
*/
|
|
5522
|
+
function toSecretFieldView(stored) {
|
|
5523
|
+
if (isSecretMarker(stored)) return {
|
|
5524
|
+
$secret: stored.$secret,
|
|
5525
|
+
v: 1,
|
|
5526
|
+
set: true
|
|
5527
|
+
};
|
|
5528
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5529
|
+
$secret: null,
|
|
5530
|
+
v: 1,
|
|
5531
|
+
set: true,
|
|
5532
|
+
inline: true
|
|
5533
|
+
};
|
|
5534
|
+
return null;
|
|
5535
|
+
}
|
|
5536
|
+
/**
|
|
5537
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5538
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5539
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5540
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5541
|
+
*/
|
|
5542
|
+
function classifySecretWrite(incoming) {
|
|
5543
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5544
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5545
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5546
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5547
|
+
return {
|
|
5548
|
+
kind: "set",
|
|
5549
|
+
value: incoming
|
|
5550
|
+
};
|
|
5551
|
+
}
|
|
5454
5552
|
Object.fromEntries([
|
|
5455
5553
|
{
|
|
5456
5554
|
id: "overview",
|
|
@@ -5622,33 +5720,19 @@ Object.fromEntries([
|
|
|
5622
5720
|
function isValuelessField(field) {
|
|
5623
5721
|
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";
|
|
5624
5722
|
}
|
|
5625
|
-
|
|
5626
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5627
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5628
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5629
|
-
*
|
|
5630
|
-
* For each leaf field:
|
|
5631
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5632
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5633
|
-
*
|
|
5634
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5635
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5636
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5637
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5638
|
-
*/
|
|
5639
|
-
function hydrateSchema(schema, values) {
|
|
5723
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5640
5724
|
return {
|
|
5641
5725
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5642
5726
|
sections: schema.sections.map((section) => ({
|
|
5643
5727
|
...section,
|
|
5644
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5728
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5645
5729
|
}))
|
|
5646
5730
|
};
|
|
5647
5731
|
}
|
|
5648
|
-
function hydrateField(field, values) {
|
|
5732
|
+
function hydrateField(field, values, options) {
|
|
5649
5733
|
if (isValuelessField(field)) return field;
|
|
5650
5734
|
if (field.type === "group") {
|
|
5651
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5735
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5652
5736
|
return {
|
|
5653
5737
|
...field,
|
|
5654
5738
|
fields: hydratedChildren
|
|
@@ -5657,7 +5741,7 @@ function hydrateField(field, values) {
|
|
|
5657
5741
|
if (field.type === "sub-tabs") {
|
|
5658
5742
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5659
5743
|
...tab,
|
|
5660
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5744
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5661
5745
|
}));
|
|
5662
5746
|
return {
|
|
5663
5747
|
...field,
|
|
@@ -5667,6 +5751,33 @@ function hydrateField(field, values) {
|
|
|
5667
5751
|
const key = field.key;
|
|
5668
5752
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5669
5753
|
const defaultValue = field.default;
|
|
5754
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5755
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5756
|
+
...field,
|
|
5757
|
+
value: toSecretFieldView(storedValue)
|
|
5758
|
+
};
|
|
5759
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5760
|
+
...field,
|
|
5761
|
+
value: null
|
|
5762
|
+
};
|
|
5763
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5764
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5765
|
+
if (secretItemKeys.length > 0) {
|
|
5766
|
+
const rows = storedValue.map((row) => {
|
|
5767
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5768
|
+
const out = { ...row };
|
|
5769
|
+
for (const k of secretItemKeys) {
|
|
5770
|
+
const v = Reflect.get(row, k);
|
|
5771
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5772
|
+
}
|
|
5773
|
+
return out;
|
|
5774
|
+
});
|
|
5775
|
+
return {
|
|
5776
|
+
...field,
|
|
5777
|
+
value: rows
|
|
5778
|
+
};
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5670
5781
|
if (field.multiple) {
|
|
5671
5782
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5672
5783
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5909,6 +6020,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5909
6020
|
}
|
|
5910
6021
|
return out;
|
|
5911
6022
|
}
|
|
6023
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6024
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6025
|
+
function globalSecretScope() {
|
|
6026
|
+
return GLOBAL_SCOPE;
|
|
6027
|
+
}
|
|
6028
|
+
function encodeSegment(value) {
|
|
6029
|
+
return encodeURIComponent(value);
|
|
6030
|
+
}
|
|
6031
|
+
/**
|
|
6032
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6033
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6034
|
+
* `providers[authentik].clientSecret`.
|
|
6035
|
+
*/
|
|
6036
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6037
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6038
|
+
}
|
|
6039
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6040
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6041
|
+
fieldPath;
|
|
6042
|
+
constructor(fieldPath, cause) {
|
|
6043
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6044
|
+
this.fieldPath = fieldPath;
|
|
6045
|
+
this.name = "KeychainWriteRefusedError";
|
|
6046
|
+
}
|
|
6047
|
+
};
|
|
6048
|
+
var KEEP = { kind: "keep" };
|
|
6049
|
+
function isRecord(value) {
|
|
6050
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6051
|
+
}
|
|
6052
|
+
function defaultMintId() {
|
|
6053
|
+
return globalThis.crypto.randomUUID();
|
|
6054
|
+
}
|
|
6055
|
+
/** Every marker ref anywhere under `value`. */
|
|
6056
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6057
|
+
if (isSecretMarker(value)) {
|
|
6058
|
+
out.push(value.$secret);
|
|
6059
|
+
return out;
|
|
6060
|
+
}
|
|
6061
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6062
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6063
|
+
return out;
|
|
6064
|
+
}
|
|
6065
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6066
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6067
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6068
|
+
}
|
|
6069
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6070
|
+
const intent = classifySecretWrite(incoming);
|
|
6071
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6072
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6073
|
+
if (intent.kind === "keep") return KEEP;
|
|
6074
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6075
|
+
if (intent.kind === "clear") {
|
|
6076
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6077
|
+
return {
|
|
6078
|
+
kind: "value",
|
|
6079
|
+
value: null
|
|
6080
|
+
};
|
|
6081
|
+
}
|
|
6082
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6083
|
+
kind: "value",
|
|
6084
|
+
value: stored
|
|
6085
|
+
};
|
|
6086
|
+
try {
|
|
6087
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6088
|
+
} catch (err) {
|
|
6089
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6090
|
+
}
|
|
6091
|
+
return {
|
|
6092
|
+
kind: "value",
|
|
6093
|
+
value: makeSecretMarker(ref)
|
|
6094
|
+
};
|
|
6095
|
+
}
|
|
6096
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6097
|
+
function applyMember(out, key, result, storedParent) {
|
|
6098
|
+
if (result.kind === "value") {
|
|
6099
|
+
out[key] = result.value;
|
|
6100
|
+
return;
|
|
6101
|
+
}
|
|
6102
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6103
|
+
else delete out[key];
|
|
6104
|
+
}
|
|
6105
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6106
|
+
const out = { ...incoming };
|
|
6107
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6108
|
+
return out;
|
|
6109
|
+
}
|
|
6110
|
+
function rowId(row, idKey) {
|
|
6111
|
+
const raw = row[idKey];
|
|
6112
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6113
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6114
|
+
return null;
|
|
6115
|
+
}
|
|
6116
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6117
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6118
|
+
if (!Array.isArray(incoming)) {
|
|
6119
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6120
|
+
return {
|
|
6121
|
+
kind: "value",
|
|
6122
|
+
value: incoming
|
|
6123
|
+
};
|
|
6124
|
+
}
|
|
6125
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6126
|
+
for (const row of storedRows) {
|
|
6127
|
+
const id = rowId(row, node.idKey);
|
|
6128
|
+
if (id !== null) storedById.set(id, row);
|
|
6129
|
+
}
|
|
6130
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6131
|
+
const rows = [];
|
|
6132
|
+
for (const row of incoming) {
|
|
6133
|
+
if (!isRecord(row)) {
|
|
6134
|
+
rows.push(row);
|
|
6135
|
+
continue;
|
|
6136
|
+
}
|
|
6137
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6138
|
+
kept.add(id);
|
|
6139
|
+
const withId = {
|
|
6140
|
+
...row,
|
|
6141
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6142
|
+
};
|
|
6143
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6144
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6145
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6146
|
+
}
|
|
6147
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6148
|
+
return {
|
|
6149
|
+
kind: "value",
|
|
6150
|
+
value: rows
|
|
6151
|
+
};
|
|
6152
|
+
}
|
|
6153
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6154
|
+
switch (node.kind) {
|
|
6155
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6156
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6157
|
+
case "object": {
|
|
6158
|
+
if (!isRecord(incoming)) {
|
|
6159
|
+
if (incoming === void 0) return KEEP;
|
|
6160
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6161
|
+
return {
|
|
6162
|
+
kind: "value",
|
|
6163
|
+
value: incoming
|
|
6164
|
+
};
|
|
6165
|
+
}
|
|
6166
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6167
|
+
return {
|
|
6168
|
+
kind: "value",
|
|
6169
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6170
|
+
};
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6175
|
+
function splitNodeKey(key) {
|
|
6176
|
+
const at = key.indexOf("@");
|
|
6177
|
+
return at <= 0 ? {
|
|
6178
|
+
base: key,
|
|
6179
|
+
nodeId: null
|
|
6180
|
+
} : {
|
|
6181
|
+
base: key.slice(0, at),
|
|
6182
|
+
nodeId: key.slice(at + 1)
|
|
6183
|
+
};
|
|
6184
|
+
}
|
|
6185
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6186
|
+
async function transformSecretWrite(input) {
|
|
6187
|
+
const deletes = [];
|
|
6188
|
+
const base = {
|
|
6189
|
+
secrets: input.secrets,
|
|
6190
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6191
|
+
deletes,
|
|
6192
|
+
operatorWrite: input.operatorWrite === true
|
|
6193
|
+
};
|
|
6194
|
+
const out = {};
|
|
6195
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6196
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6197
|
+
const node = input.tree.get(baseKey);
|
|
6198
|
+
if (node === void 0) {
|
|
6199
|
+
out[key] = incoming;
|
|
6200
|
+
continue;
|
|
6201
|
+
}
|
|
6202
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6203
|
+
kind: "node",
|
|
6204
|
+
nodeId
|
|
6205
|
+
} : input.scope ?? globalSecretScope();
|
|
6206
|
+
const result = await writeNode({
|
|
6207
|
+
...base,
|
|
6208
|
+
scope
|
|
6209
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6210
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6211
|
+
}
|
|
6212
|
+
return {
|
|
6213
|
+
patch: out,
|
|
6214
|
+
afterWrite: async () => {
|
|
6215
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6216
|
+
try {
|
|
6217
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6218
|
+
return { orphaned: [] };
|
|
6219
|
+
} catch {
|
|
6220
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
/**
|
|
6226
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6227
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6228
|
+
*/
|
|
6229
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6230
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6231
|
+
if (refs.length === 0) return {
|
|
6232
|
+
value,
|
|
6233
|
+
unresolved: []
|
|
6234
|
+
};
|
|
6235
|
+
const answers = await secrets.resolve(refs);
|
|
6236
|
+
const unresolved = [];
|
|
6237
|
+
for (const ref of new Set(refs)) {
|
|
6238
|
+
const answer = answers[ref];
|
|
6239
|
+
if (answer === void 0) unresolved.push({
|
|
6240
|
+
ref,
|
|
6241
|
+
reason: "not-initialized"
|
|
6242
|
+
});
|
|
6243
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6244
|
+
ref,
|
|
6245
|
+
reason: answer.reason
|
|
6246
|
+
});
|
|
6247
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6248
|
+
ref,
|
|
6249
|
+
reason: answer.kind
|
|
6250
|
+
});
|
|
6251
|
+
}
|
|
6252
|
+
const substitute = (v) => {
|
|
6253
|
+
if (isSecretMarker(v)) {
|
|
6254
|
+
const answer = answers[v.$secret];
|
|
6255
|
+
return answer?.kind === "value" ? {
|
|
6256
|
+
keep: true,
|
|
6257
|
+
value: answer.value
|
|
6258
|
+
} : {
|
|
6259
|
+
keep: false,
|
|
6260
|
+
value: void 0
|
|
6261
|
+
};
|
|
6262
|
+
}
|
|
6263
|
+
if (Array.isArray(v)) {
|
|
6264
|
+
const items = [];
|
|
6265
|
+
for (const item of v) {
|
|
6266
|
+
const s = substitute(item);
|
|
6267
|
+
if (s.keep) items.push(s.value);
|
|
6268
|
+
}
|
|
6269
|
+
return {
|
|
6270
|
+
keep: true,
|
|
6271
|
+
value: items
|
|
6272
|
+
};
|
|
6273
|
+
}
|
|
6274
|
+
if (isRecord(v)) {
|
|
6275
|
+
const out = {};
|
|
6276
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6277
|
+
const s = substitute(child);
|
|
6278
|
+
if (s.keep) out[k] = s.value;
|
|
6279
|
+
}
|
|
6280
|
+
return {
|
|
6281
|
+
keep: true,
|
|
6282
|
+
value: out
|
|
6283
|
+
};
|
|
6284
|
+
}
|
|
6285
|
+
return {
|
|
6286
|
+
keep: true,
|
|
6287
|
+
value: v
|
|
6288
|
+
};
|
|
6289
|
+
};
|
|
6290
|
+
return {
|
|
6291
|
+
value: substitute(value).value,
|
|
6292
|
+
unresolved
|
|
6293
|
+
};
|
|
6294
|
+
}
|
|
6295
|
+
function touchesTree(tree, patch) {
|
|
6296
|
+
if (tree.size === 0) return false;
|
|
6297
|
+
for (const key of Object.keys(patch)) {
|
|
6298
|
+
const at = key.indexOf("@");
|
|
6299
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6300
|
+
}
|
|
6301
|
+
return false;
|
|
6302
|
+
}
|
|
6303
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6304
|
+
async function readStoredAddonBlob(raw) {
|
|
6305
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6306
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6307
|
+
const result = await threeWay.call(raw);
|
|
6308
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6309
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6310
|
+
}
|
|
6311
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6312
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6313
|
+
const serialize = (key, fn) => {
|
|
6314
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6315
|
+
const tail = next.catch(() => void 0);
|
|
6316
|
+
chains.set(key, tail);
|
|
6317
|
+
tail.then(() => {
|
|
6318
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6319
|
+
});
|
|
6320
|
+
return next;
|
|
6321
|
+
};
|
|
6322
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6323
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6324
|
+
return serialize(chainKey, async () => {
|
|
6325
|
+
const stored = await readStored();
|
|
6326
|
+
const result = await transformSecretWrite({
|
|
6327
|
+
tree,
|
|
6328
|
+
secrets: opts.secrets,
|
|
6329
|
+
patch,
|
|
6330
|
+
stored,
|
|
6331
|
+
...scope !== void 0 ? { scope } : {},
|
|
6332
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6333
|
+
});
|
|
6334
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6335
|
+
const { orphaned } = await result.afterWrite();
|
|
6336
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6337
|
+
});
|
|
6338
|
+
};
|
|
6339
|
+
const wrapped = {
|
|
6340
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6341
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6342
|
+
kind: "device",
|
|
6343
|
+
deviceId
|
|
6344
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6345
|
+
};
|
|
6346
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6347
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6348
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6349
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6350
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6351
|
+
} });
|
|
6352
|
+
}
|
|
6353
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6354
|
+
function withSecretAwareSettings(context, opts) {
|
|
6355
|
+
const raw = context.settings;
|
|
6356
|
+
if (raw === void 0) return context;
|
|
6357
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6358
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6359
|
+
if (prop === "settings") return settings;
|
|
6360
|
+
return Reflect.get(target, prop, receiver);
|
|
6361
|
+
} });
|
|
6362
|
+
}
|
|
6363
|
+
var LEAF = { kind: "leaf" };
|
|
6364
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6365
|
+
function collectFields(fields, out) {
|
|
6366
|
+
for (const field of fields) {
|
|
6367
|
+
if (field.type === "group") {
|
|
6368
|
+
collectFields(field.fields, out);
|
|
6369
|
+
continue;
|
|
6370
|
+
}
|
|
6371
|
+
if (field.type === "sub-tabs") {
|
|
6372
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6373
|
+
continue;
|
|
6374
|
+
}
|
|
6375
|
+
if (field.type === "editable-array") {
|
|
6376
|
+
const item = /* @__PURE__ */ new Map();
|
|
6377
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6378
|
+
if (item.size > 0) out.set(field.key, {
|
|
6379
|
+
kind: "array",
|
|
6380
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6381
|
+
item
|
|
6382
|
+
});
|
|
6383
|
+
continue;
|
|
6384
|
+
}
|
|
6385
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6386
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6387
|
+
}
|
|
6388
|
+
}
|
|
6389
|
+
/** The secret tree a settings schema declares. */
|
|
6390
|
+
function secretTreeFromSchema(schema) {
|
|
6391
|
+
const out = /* @__PURE__ */ new Map();
|
|
6392
|
+
if (schema === null) return out;
|
|
6393
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6394
|
+
return out;
|
|
6395
|
+
}
|
|
6396
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6397
|
+
function parseSecretStatePath(path) {
|
|
6398
|
+
const segments = [];
|
|
6399
|
+
for (const raw of path.split(".")) {
|
|
6400
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6401
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6402
|
+
segments.push(m[2] !== void 0 ? {
|
|
6403
|
+
key: m[1],
|
|
6404
|
+
idKey: m[2]
|
|
6405
|
+
} : { key: m[1] });
|
|
6406
|
+
}
|
|
6407
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6408
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6409
|
+
return segments;
|
|
6410
|
+
}
|
|
6411
|
+
function insert(into, segments) {
|
|
6412
|
+
const [head, ...rest] = segments;
|
|
6413
|
+
if (head === void 0) return;
|
|
6414
|
+
if (rest.length === 0) {
|
|
6415
|
+
into.set(head.key, LEAF);
|
|
6416
|
+
return;
|
|
6417
|
+
}
|
|
6418
|
+
const existing = into.get(head.key);
|
|
6419
|
+
if (head.idKey !== void 0) {
|
|
6420
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6421
|
+
insert(item, rest);
|
|
6422
|
+
into.set(head.key, {
|
|
6423
|
+
kind: "array",
|
|
6424
|
+
idKey: head.idKey,
|
|
6425
|
+
item
|
|
6426
|
+
});
|
|
6427
|
+
return;
|
|
6428
|
+
}
|
|
6429
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6430
|
+
insert(children, rest);
|
|
6431
|
+
into.set(head.key, {
|
|
6432
|
+
kind: "object",
|
|
6433
|
+
children
|
|
6434
|
+
});
|
|
6435
|
+
}
|
|
6436
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6437
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6438
|
+
if (paths.length === 0) return tree;
|
|
6439
|
+
const out = new Map(tree);
|
|
6440
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6441
|
+
return out;
|
|
6442
|
+
}
|
|
6443
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6444
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6445
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6446
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6447
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5912
6448
|
/**
|
|
5913
6449
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5914
6450
|
*
|
|
@@ -5978,6 +6514,25 @@ var BaseAddon = class {
|
|
|
5978
6514
|
settingsStoreReady = false;
|
|
5979
6515
|
/** Default config values. Provided via constructor. */
|
|
5980
6516
|
defaults;
|
|
6517
|
+
/**
|
|
6518
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6519
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6520
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6521
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6522
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6523
|
+
*/
|
|
6524
|
+
secretStatePaths = [];
|
|
6525
|
+
_addonSecretTree = null;
|
|
6526
|
+
_deviceSecretTree = null;
|
|
6527
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6528
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6529
|
+
_unresolvedSecrets = [];
|
|
6530
|
+
_secretRetryTimer = null;
|
|
6531
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6532
|
+
_secretChangeTimer = null;
|
|
6533
|
+
_secretChangeUnsub = null;
|
|
6534
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6535
|
+
_operatorWriteDepth = 0;
|
|
5981
6536
|
constructor(defaults) {
|
|
5982
6537
|
this.defaults = defaults;
|
|
5983
6538
|
this._config = { ...defaults };
|
|
@@ -6013,8 +6568,18 @@ var BaseAddon = class {
|
|
|
6013
6568
|
return this._config;
|
|
6014
6569
|
}
|
|
6015
6570
|
async initialize(context) {
|
|
6016
|
-
|
|
6571
|
+
const secrets = context.secrets;
|
|
6572
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6573
|
+
secrets,
|
|
6574
|
+
addonTree: () => this.addonSecretTree(),
|
|
6575
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6576
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6577
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6578
|
+
}) : context;
|
|
6017
6579
|
await this.resolveConfig();
|
|
6580
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6581
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6582
|
+
});
|
|
6018
6583
|
const result = await this.onInitialize();
|
|
6019
6584
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6020
6585
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6047,6 +6612,12 @@ var BaseAddon = class {
|
|
|
6047
6612
|
*/
|
|
6048
6613
|
async onHubReachable() {}
|
|
6049
6614
|
async shutdown() {
|
|
6615
|
+
this._secretChangeUnsub?.();
|
|
6616
|
+
this._secretChangeUnsub = null;
|
|
6617
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6618
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6619
|
+
this._secretRetryTimer = null;
|
|
6620
|
+
this._secretChangeTimer = null;
|
|
6050
6621
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6051
6622
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6052
6623
|
await this.onShutdown();
|
|
@@ -6125,7 +6696,7 @@ var BaseAddon = class {
|
|
|
6125
6696
|
return hydrateSchema(schema, overlay ? {
|
|
6126
6697
|
...projected,
|
|
6127
6698
|
...overlay
|
|
6128
|
-
} : projected);
|
|
6699
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6129
6700
|
}
|
|
6130
6701
|
/**
|
|
6131
6702
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6174,7 +6745,7 @@ var BaseAddon = class {
|
|
|
6174
6745
|
return hydrateSchema({
|
|
6175
6746
|
...schema,
|
|
6176
6747
|
sections
|
|
6177
|
-
}, projected);
|
|
6748
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6178
6749
|
}
|
|
6179
6750
|
/**
|
|
6180
6751
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6228,18 +6799,50 @@ var BaseAddon = class {
|
|
|
6228
6799
|
value: result.value[key]
|
|
6229
6800
|
};
|
|
6230
6801
|
}
|
|
6802
|
+
/**
|
|
6803
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6804
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6805
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6806
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6807
|
+
* writing back what it read is not (D787).
|
|
6808
|
+
*/
|
|
6809
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6810
|
+
this._operatorWriteDepth++;
|
|
6811
|
+
try {
|
|
6812
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6813
|
+
} finally {
|
|
6814
|
+
this._operatorWriteDepth--;
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6231
6817
|
async updateGlobalSettings(patch, nodeId) {
|
|
6818
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6819
|
+
}
|
|
6820
|
+
/**
|
|
6821
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6822
|
+
*
|
|
6823
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6824
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6825
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6826
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6827
|
+
*/
|
|
6828
|
+
async clearSecrets(keys, nodeId) {
|
|
6829
|
+
const tree = this.addonSecretTree();
|
|
6830
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6831
|
+
const patch = {};
|
|
6832
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6833
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6834
|
+
}
|
|
6835
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6232
6836
|
const keys = this.perNodeKeys();
|
|
6233
6837
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6234
6838
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6235
|
-
const barePatch = patch;
|
|
6236
6839
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6237
6840
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6238
6841
|
if (target !== localNode) return;
|
|
6239
6842
|
await this.resolveConfig();
|
|
6240
6843
|
await this.onConfigChanged();
|
|
6241
6844
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6242
|
-
this.maybeAutoRestart(
|
|
6845
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6243
6846
|
}
|
|
6244
6847
|
/**
|
|
6245
6848
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6264,7 +6867,7 @@ var BaseAddon = class {
|
|
|
6264
6867
|
* time to return its response before the addon is torn down and
|
|
6265
6868
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6266
6869
|
*/
|
|
6267
|
-
maybeAutoRestart(
|
|
6870
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6268
6871
|
if (!schema) return;
|
|
6269
6872
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6270
6873
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6272,13 +6875,13 @@ var BaseAddon = class {
|
|
|
6272
6875
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6273
6876
|
}
|
|
6274
6877
|
if (restartKeys.size === 0) return;
|
|
6275
|
-
if (!
|
|
6878
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6276
6879
|
const ctx = this._ctx;
|
|
6277
6880
|
if (!ctx) return;
|
|
6278
6881
|
const addonId = ctx.id;
|
|
6279
6882
|
setImmediate(() => {
|
|
6280
6883
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6281
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6884
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6282
6885
|
}).catch((err) => {
|
|
6283
6886
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6284
6887
|
});
|
|
@@ -6287,7 +6890,7 @@ var BaseAddon = class {
|
|
|
6287
6890
|
async getDeviceSettings(deviceId) {
|
|
6288
6891
|
const schema = this.deviceSettingsSchema();
|
|
6289
6892
|
if (!schema) return { sections: [] };
|
|
6290
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6893
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6291
6894
|
}
|
|
6292
6895
|
async updateDeviceSettings(deviceId, patch) {
|
|
6293
6896
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6417,7 +7020,7 @@ var BaseAddon = class {
|
|
|
6417
7020
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6418
7021
|
*/
|
|
6419
7022
|
async resolveConfig() {
|
|
6420
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7023
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6421
7024
|
const perNode = this.perNodeKeys();
|
|
6422
7025
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6423
7026
|
const resolved = { ...this.defaults };
|
|
@@ -6442,7 +7045,7 @@ var BaseAddon = class {
|
|
|
6442
7045
|
key,
|
|
6443
7046
|
schema,
|
|
6444
7047
|
fallback,
|
|
6445
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7048
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6446
7049
|
write: async (patch) => {
|
|
6447
7050
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6448
7051
|
},
|
|
@@ -6459,7 +7062,7 @@ var BaseAddon = class {
|
|
|
6459
7062
|
key,
|
|
6460
7063
|
schema,
|
|
6461
7064
|
fallback,
|
|
6462
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7065
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6463
7066
|
write: async (patch) => {
|
|
6464
7067
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6465
7068
|
},
|
|
@@ -6471,6 +7074,70 @@ var BaseAddon = class {
|
|
|
6471
7074
|
} })
|
|
6472
7075
|
});
|
|
6473
7076
|
}
|
|
7077
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7078
|
+
addonSecretTree() {
|
|
7079
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7080
|
+
return this._addonSecretTree;
|
|
7081
|
+
}
|
|
7082
|
+
deviceSecretTree() {
|
|
7083
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7084
|
+
return this._deviceSecretTree;
|
|
7085
|
+
}
|
|
7086
|
+
/**
|
|
7087
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7088
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7089
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7090
|
+
* than start on an empty credential.
|
|
7091
|
+
*/
|
|
7092
|
+
get unresolvedSecrets() {
|
|
7093
|
+
return this._unresolvedSecrets;
|
|
7094
|
+
}
|
|
7095
|
+
/**
|
|
7096
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7097
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7098
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7099
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7100
|
+
* ever written back from here.
|
|
7101
|
+
*/
|
|
7102
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7103
|
+
const secrets = this._ctx?.secrets;
|
|
7104
|
+
if (secrets === void 0) return blob;
|
|
7105
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7106
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7107
|
+
if (refs.length === 0) {
|
|
7108
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7109
|
+
return blob;
|
|
7110
|
+
}
|
|
7111
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7112
|
+
if (trackForConfig) {
|
|
7113
|
+
this._unresolvedSecrets = unresolved;
|
|
7114
|
+
if (unresolved.length > 0) {
|
|
7115
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7116
|
+
ref: u.ref,
|
|
7117
|
+
reason: u.reason
|
|
7118
|
+
})) } });
|
|
7119
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7120
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7121
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7122
|
+
}
|
|
7123
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7124
|
+
}
|
|
7125
|
+
return value;
|
|
7126
|
+
}
|
|
7127
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7128
|
+
scheduleSecretReresolve(delayMs) {
|
|
7129
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7130
|
+
if (this[timerOf] !== null) return;
|
|
7131
|
+
const timer = setTimeout(() => {
|
|
7132
|
+
this[timerOf] = null;
|
|
7133
|
+
if (this._ctx === null) return;
|
|
7134
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7135
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7136
|
+
});
|
|
7137
|
+
}, delayMs);
|
|
7138
|
+
timer.unref?.();
|
|
7139
|
+
this[timerOf] = timer;
|
|
7140
|
+
}
|
|
6474
7141
|
/**
|
|
6475
7142
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6476
7143
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7046,6 +7713,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7046
7713
|
kind: "mutation",
|
|
7047
7714
|
auth: "admin"
|
|
7048
7715
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
7716
|
+
function defOf(schema) {
|
|
7717
|
+
return schema._zod?.def ?? {};
|
|
7718
|
+
}
|
|
7719
|
+
function declaredHere(schema) {
|
|
7720
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7721
|
+
}
|
|
7722
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7723
|
+
var WRAPPERS = new Set([
|
|
7724
|
+
"optional",
|
|
7725
|
+
"nullable",
|
|
7726
|
+
"default",
|
|
7727
|
+
"prefault",
|
|
7728
|
+
"catch",
|
|
7729
|
+
"readonly",
|
|
7730
|
+
"nonoptional"
|
|
7731
|
+
]);
|
|
7732
|
+
/**
|
|
7733
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7734
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7735
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7736
|
+
* `.transform` on `in`).
|
|
7737
|
+
*/
|
|
7738
|
+
function layersOf(schema) {
|
|
7739
|
+
const out = [];
|
|
7740
|
+
const queue = [schema];
|
|
7741
|
+
while (queue.length > 0) {
|
|
7742
|
+
const s = queue.shift();
|
|
7743
|
+
if (!s || out.includes(s)) continue;
|
|
7744
|
+
out.push(s);
|
|
7745
|
+
const def = defOf(s);
|
|
7746
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7747
|
+
if (def.type === "pipe") {
|
|
7748
|
+
if (def.in) queue.push(def.in);
|
|
7749
|
+
if (def.out) queue.push(def.out);
|
|
7750
|
+
}
|
|
7751
|
+
}
|
|
7752
|
+
return out;
|
|
7753
|
+
}
|
|
7754
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7755
|
+
function isZodSecret(schema) {
|
|
7756
|
+
return layersOf(schema).some(declaredHere);
|
|
7757
|
+
}
|
|
7758
|
+
/**
|
|
7759
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7760
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7761
|
+
* object or array is reported as one path and not descended into — everything
|
|
7762
|
+
* under it is secret.
|
|
7763
|
+
*/
|
|
7764
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7765
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7766
|
+
const paths = [];
|
|
7767
|
+
for (const layer of layersOf(schema)) {
|
|
7768
|
+
const def = defOf(layer);
|
|
7769
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7770
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7771
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7772
|
+
else if (def.type === "intersection") {
|
|
7773
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7774
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7777
|
+
return [...new Set(paths)];
|
|
7778
|
+
}
|
|
7049
7779
|
//#endregion
|
|
7050
7780
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7051
7781
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -14076,6 +14806,196 @@ id: union([string(), number()]) }), {
|
|
|
14076
14806
|
kind: "mutation",
|
|
14077
14807
|
auth: "admin"
|
|
14078
14808
|
});
|
|
14809
|
+
/**
|
|
14810
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14811
|
+
*
|
|
14812
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14813
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14814
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14815
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14816
|
+
* against the CALLER, never against anything the caller claims.
|
|
14817
|
+
*
|
|
14818
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14819
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14820
|
+
* connection, the agent from its child's connection carried in
|
|
14821
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14822
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14823
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14824
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14825
|
+
* runner is the same OS user): see the threat model in
|
|
14826
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14827
|
+
*
|
|
14828
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14829
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14830
|
+
* floors every method to admin anyway (D240).
|
|
14831
|
+
*
|
|
14832
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14833
|
+
*/
|
|
14834
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14835
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14836
|
+
"key-missing",
|
|
14837
|
+
"wrong-key",
|
|
14838
|
+
"key-file-unreadable",
|
|
14839
|
+
"store-unavailable",
|
|
14840
|
+
"not-initialized",
|
|
14841
|
+
"decrypt-failed"
|
|
14842
|
+
]);
|
|
14843
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14844
|
+
state: literal("locked"),
|
|
14845
|
+
reason: KeychainUnavailableReasonSchema
|
|
14846
|
+
})]);
|
|
14847
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14848
|
+
object({
|
|
14849
|
+
kind: literal("value"),
|
|
14850
|
+
value: string(),
|
|
14851
|
+
version: number().int()
|
|
14852
|
+
}),
|
|
14853
|
+
object({ kind: literal("missing") }),
|
|
14854
|
+
object({
|
|
14855
|
+
kind: literal("unavailable"),
|
|
14856
|
+
reason: KeychainUnavailableReasonSchema
|
|
14857
|
+
}),
|
|
14858
|
+
object({ kind: literal("forbidden") })
|
|
14859
|
+
]);
|
|
14860
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14861
|
+
/** Metadata of one stored value — never the value. */
|
|
14862
|
+
var KeychainSecretMetaSchema = object({
|
|
14863
|
+
ref: string(),
|
|
14864
|
+
owner: string(),
|
|
14865
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14866
|
+
scope: string(),
|
|
14867
|
+
fieldPath: string(),
|
|
14868
|
+
version: number().int(),
|
|
14869
|
+
createdAt: number(),
|
|
14870
|
+
updatedAt: number(),
|
|
14871
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14872
|
+
updatedBy: string(),
|
|
14873
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14874
|
+
lastReadAt: number().nullable()
|
|
14875
|
+
});
|
|
14876
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14877
|
+
method(object({
|
|
14878
|
+
ref: string().min(1),
|
|
14879
|
+
value: string().min(1)
|
|
14880
|
+
}), object({
|
|
14881
|
+
ref: string(),
|
|
14882
|
+
version: number().int()
|
|
14883
|
+
}), {
|
|
14884
|
+
kind: "mutation",
|
|
14885
|
+
auth: "admin"
|
|
14886
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14887
|
+
kind: "mutation",
|
|
14888
|
+
auth: "admin"
|
|
14889
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14890
|
+
var KeychainKeySourceSchema = object({
|
|
14891
|
+
kind: _enum([
|
|
14892
|
+
"config-file",
|
|
14893
|
+
"previous-config-file",
|
|
14894
|
+
"platform",
|
|
14895
|
+
"default-file"
|
|
14896
|
+
]),
|
|
14897
|
+
/** File sources only — a path is not a secret. */
|
|
14898
|
+
path: string().optional(),
|
|
14899
|
+
/**
|
|
14900
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14901
|
+
* next to the database it protects (the default file). The page warns.
|
|
14902
|
+
*/
|
|
14903
|
+
sharesBackupWithDatabase: boolean()
|
|
14904
|
+
});
|
|
14905
|
+
var KeychainStatusSchema = object({
|
|
14906
|
+
keychain: KeychainStateSchema,
|
|
14907
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14908
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14909
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14910
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14911
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14912
|
+
fingerprint: string().nullable(),
|
|
14913
|
+
activeKeyId: string().nullable(),
|
|
14914
|
+
/**
|
|
14915
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14916
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14917
|
+
*/
|
|
14918
|
+
rotationPending: boolean(),
|
|
14919
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14920
|
+
retiredWraps: number().int(),
|
|
14921
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14922
|
+
secretCount: number().int()
|
|
14923
|
+
});
|
|
14924
|
+
/**
|
|
14925
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14926
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14927
|
+
* never reported as an orphan (and never deleted as one).
|
|
14928
|
+
*/
|
|
14929
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14930
|
+
"in-use",
|
|
14931
|
+
"orphan",
|
|
14932
|
+
"unknown"
|
|
14933
|
+
]);
|
|
14934
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14935
|
+
var KeychainAuditActionSchema = _enum([
|
|
14936
|
+
"put",
|
|
14937
|
+
"delete",
|
|
14938
|
+
"reveal",
|
|
14939
|
+
"rotate-master-key",
|
|
14940
|
+
"purge-retired-keys",
|
|
14941
|
+
"download-recovery-key",
|
|
14942
|
+
"delete-orphans",
|
|
14943
|
+
"reset",
|
|
14944
|
+
"initialize"
|
|
14945
|
+
]);
|
|
14946
|
+
var KeychainAuditEntrySchema = object({
|
|
14947
|
+
id: string(),
|
|
14948
|
+
at: number(),
|
|
14949
|
+
action: KeychainAuditActionSchema,
|
|
14950
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14951
|
+
actor: string(),
|
|
14952
|
+
ref: string().nullable(),
|
|
14953
|
+
detail: string().nullable()
|
|
14954
|
+
});
|
|
14955
|
+
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({
|
|
14956
|
+
value: string(),
|
|
14957
|
+
version: number().int()
|
|
14958
|
+
}), {
|
|
14959
|
+
kind: "mutation",
|
|
14960
|
+
auth: "admin",
|
|
14961
|
+
caller: "required"
|
|
14962
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14963
|
+
deleted: array(string()).readonly(),
|
|
14964
|
+
kept: array(object({
|
|
14965
|
+
ref: string(),
|
|
14966
|
+
usage: KeychainSecretUsageSchema
|
|
14967
|
+
})).readonly()
|
|
14968
|
+
}), {
|
|
14969
|
+
kind: "mutation",
|
|
14970
|
+
auth: "admin",
|
|
14971
|
+
caller: "required"
|
|
14972
|
+
}), method(object({}), object({
|
|
14973
|
+
fingerprint: string(),
|
|
14974
|
+
keySource: KeychainKeySourceSchema
|
|
14975
|
+
}), {
|
|
14976
|
+
kind: "mutation",
|
|
14977
|
+
auth: "admin",
|
|
14978
|
+
caller: "required"
|
|
14979
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
14980
|
+
kind: "mutation",
|
|
14981
|
+
auth: "admin",
|
|
14982
|
+
caller: "required"
|
|
14983
|
+
}), method(object({}), object({
|
|
14984
|
+
key: string(),
|
|
14985
|
+
fingerprint: string(),
|
|
14986
|
+
keySource: KeychainKeySourceSchema
|
|
14987
|
+
}), {
|
|
14988
|
+
kind: "mutation",
|
|
14989
|
+
auth: "admin",
|
|
14990
|
+
caller: "required"
|
|
14991
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
14992
|
+
archivedCollection: string().nullable(),
|
|
14993
|
+
archived: number().int()
|
|
14994
|
+
}), {
|
|
14995
|
+
kind: "mutation",
|
|
14996
|
+
auth: "admin",
|
|
14997
|
+
caller: "required"
|
|
14998
|
+
});
|
|
14079
14999
|
method(_void(), object({
|
|
14080
15000
|
id: string(),
|
|
14081
15001
|
name: string(),
|
|
@@ -15194,6 +16114,10 @@ var DeviceInfoSchema = object({
|
|
|
15194
16114
|
isCamera: boolean(),
|
|
15195
16115
|
/** Current config values — serializable snapshot */
|
|
15196
16116
|
config: record(string(), unknown()),
|
|
16117
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16118
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16119
|
+
* when the owning runner has not reported them. */
|
|
16120
|
+
secretConfigPaths: array(string()).optional(),
|
|
15197
16121
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15198
16122
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15199
16123
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -15399,12 +16323,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15399
16323
|
* call (workers re-register on init), so probe-driven updates
|
|
15400
16324
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15401
16325
|
features: array(string()).optional(),
|
|
15402
|
-
config: record(string(), unknown())
|
|
16326
|
+
config: record(string(), unknown()),
|
|
16327
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16328
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16329
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16330
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16331
|
+
* omits it and the keyword backstop applies. */
|
|
16332
|
+
secretConfigPaths: array(string()).optional()
|
|
15403
16333
|
});
|
|
15404
16334
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15405
16335
|
var DevicePersistConfigPayloadSchema = object({
|
|
15406
16336
|
deviceId: number(),
|
|
15407
|
-
data: record(string(), unknown())
|
|
16337
|
+
data: record(string(), unknown()),
|
|
16338
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16339
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16340
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16341
|
+
secretConfigPaths: array(string()).optional()
|
|
15408
16342
|
});
|
|
15409
16343
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15410
16344
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17058,7 +17992,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17058
17992
|
icon: string().optional(),
|
|
17059
17993
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17060
17994
|
startUrl: string(),
|
|
17061
|
-
stage: LoginStageEnum
|
|
17995
|
+
stage: LoginStageEnum,
|
|
17996
|
+
/**
|
|
17997
|
+
* The provider names an external identity a signed-in user can link to
|
|
17998
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
17999
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18000
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
18001
|
+
*/
|
|
18002
|
+
linkable: boolean().optional()
|
|
17062
18003
|
}),
|
|
17063
18004
|
object({
|
|
17064
18005
|
kind: literal("widget"),
|
|
@@ -22414,8 +23355,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22414
23355
|
]);
|
|
22415
23356
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22416
23357
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22417
|
-
/**
|
|
22418
|
-
|
|
23358
|
+
/**
|
|
23359
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23360
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23361
|
+
*
|
|
23362
|
+
* - `operator` — drawn by hand.
|
|
23363
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23364
|
+
* model, or a larger teacher model).
|
|
23365
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23366
|
+
* back from the track store (never a re-run).
|
|
23367
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23368
|
+
*/
|
|
23369
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23370
|
+
"operator",
|
|
23371
|
+
"assist",
|
|
23372
|
+
"pipeline",
|
|
23373
|
+
"llm"
|
|
23374
|
+
]);
|
|
22419
23375
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22420
23376
|
var RetrainBboxSchema = object({
|
|
22421
23377
|
x: number(),
|
|
@@ -22433,7 +23389,8 @@ var RetrainBboxSchema = object({
|
|
|
22433
23389
|
*/
|
|
22434
23390
|
var RetrainAnnotationSchema = object({
|
|
22435
23391
|
id: string(),
|
|
22436
|
-
|
|
23392
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23393
|
+
trackId: string().optional(),
|
|
22437
23394
|
deviceId: number(),
|
|
22438
23395
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22439
23396
|
mediaKey: string(),
|
|
@@ -22482,18 +23439,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22482
23439
|
* fail, whatever became of the original. */
|
|
22483
23440
|
copied: boolean()
|
|
22484
23441
|
});
|
|
23442
|
+
/**
|
|
23443
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23444
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23445
|
+
* box recorded on the source media row when there is one, else the track
|
|
23446
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23447
|
+
* until the operator confirms it.
|
|
23448
|
+
*/
|
|
23449
|
+
var RetrainPipelineBoxSchema = object({
|
|
23450
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23451
|
+
bbox: RetrainBboxSchema,
|
|
23452
|
+
macroClass: RetrainMacroClassSchema,
|
|
23453
|
+
label: string().optional(),
|
|
23454
|
+
subLabel: string().optional(),
|
|
23455
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23456
|
+
score: number().optional(),
|
|
23457
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23458
|
+
modelId: string().optional(),
|
|
23459
|
+
trackId: string(),
|
|
23460
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23461
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23462
|
+
basis: _enum(["subject-box", "position"]),
|
|
23463
|
+
deltaMs: number()
|
|
23464
|
+
});
|
|
23465
|
+
/**
|
|
23466
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23467
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23468
|
+
* track at all.
|
|
23469
|
+
*/
|
|
23470
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22485
23471
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22486
23472
|
var RetrainFrameSchema = object({
|
|
22487
23473
|
frameId: string(),
|
|
22488
23474
|
deviceId: number(),
|
|
22489
|
-
|
|
22490
|
-
/**
|
|
22491
|
-
|
|
23475
|
+
origin: RetrainFrameOriginSchema,
|
|
23476
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23477
|
+
trackId: string().optional(),
|
|
23478
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23479
|
+
* Absent on a recording still. */
|
|
23480
|
+
sourceMediaId: number().int().optional(),
|
|
23481
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23482
|
+
epochMs: number().optional(),
|
|
22492
23483
|
sourceKind: MediaFileKindEnum,
|
|
22493
23484
|
sizeBytes: number().int(),
|
|
22494
23485
|
width: number().int(),
|
|
22495
23486
|
height: number().int(),
|
|
22496
|
-
copiedAt: number()
|
|
23487
|
+
copiedAt: number(),
|
|
23488
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
23489
|
+
capturedAt: number().optional(),
|
|
23490
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
23491
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23492
|
+
* a false positive. */
|
|
23493
|
+
complete: boolean(),
|
|
23494
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23495
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23496
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23497
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23498
|
+
collectionIds: array(string()).readonly().optional()
|
|
22497
23499
|
});
|
|
22498
23500
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22499
23501
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22514,6 +23516,53 @@ var RetrainFrameListSchema = object({
|
|
|
22514
23516
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
22515
23517
|
autoPickMediaId: number().int().optional()
|
|
22516
23518
|
});
|
|
23519
|
+
/**
|
|
23520
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
23521
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
23522
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
23523
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
23524
|
+
* export carried (`exportedInBatch`).
|
|
23525
|
+
*/
|
|
23526
|
+
var RetrainExportFilterSchema = object({
|
|
23527
|
+
deviceIds: array(number()).optional(),
|
|
23528
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
23529
|
+
/** Only frames in at least one of these named collections. */
|
|
23530
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23531
|
+
batchId: string().optional(),
|
|
23532
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23533
|
+
completeOnly: boolean().optional()
|
|
23534
|
+
});
|
|
23535
|
+
/**
|
|
23536
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
23537
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
23538
|
+
* convention — the classifier layout.
|
|
23539
|
+
*/
|
|
23540
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
23541
|
+
/**
|
|
23542
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
23543
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
23544
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
23545
|
+
* logged.
|
|
23546
|
+
*/
|
|
23547
|
+
var RetrainArchiveTargetSchema = object({
|
|
23548
|
+
kind: literal("http"),
|
|
23549
|
+
method: _enum(["PUT", "POST"]),
|
|
23550
|
+
url: string().url(),
|
|
23551
|
+
headers: record(string(), string()).optional()
|
|
23552
|
+
});
|
|
23553
|
+
var RetrainArchiveResultSchema = object({
|
|
23554
|
+
batchId: string(),
|
|
23555
|
+
frames: number().int(),
|
|
23556
|
+
crops: number().int(),
|
|
23557
|
+
annotations: number().int(),
|
|
23558
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
23559
|
+
missing: number().int(),
|
|
23560
|
+
bytes: number().int(),
|
|
23561
|
+
/** sha256 of the exact bytes sent. */
|
|
23562
|
+
sha256: string(),
|
|
23563
|
+
/** The target's HTTP status. */
|
|
23564
|
+
status: number().int()
|
|
23565
|
+
});
|
|
22517
23566
|
/** What the operator asked the assist to look for. */
|
|
22518
23567
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
22519
23568
|
kind: literal("package"),
|
|
@@ -22543,6 +23592,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22543
23592
|
reason: string(),
|
|
22544
23593
|
detail: string().optional()
|
|
22545
23594
|
})]);
|
|
23595
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23596
|
+
var RetrainCollectionSchema = object({
|
|
23597
|
+
id: string(),
|
|
23598
|
+
name: string(),
|
|
23599
|
+
createdAt: number(),
|
|
23600
|
+
frameCount: number().int()
|
|
23601
|
+
});
|
|
23602
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23603
|
+
kind: literal("created"),
|
|
23604
|
+
collection: RetrainCollectionSchema
|
|
23605
|
+
}), object({
|
|
23606
|
+
kind: literal("refused"),
|
|
23607
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23608
|
+
})]);
|
|
23609
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23610
|
+
kind: literal("renamed"),
|
|
23611
|
+
collection: RetrainCollectionSchema
|
|
23612
|
+
}), object({
|
|
23613
|
+
kind: literal("refused"),
|
|
23614
|
+
reason: _enum([
|
|
23615
|
+
"empty-name",
|
|
23616
|
+
"duplicate-name",
|
|
23617
|
+
"unknown-collection"
|
|
23618
|
+
])
|
|
23619
|
+
})]);
|
|
23620
|
+
/**
|
|
23621
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23622
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23623
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23624
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23625
|
+
*/
|
|
23626
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23627
|
+
kind: literal("added"),
|
|
23628
|
+
collectionId: string(),
|
|
23629
|
+
frame: RetrainFrameSchema,
|
|
23630
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23631
|
+
reused: boolean()
|
|
23632
|
+
}), object({
|
|
23633
|
+
kind: literal("refused"),
|
|
23634
|
+
reason: _enum([
|
|
23635
|
+
"unknown-collection",
|
|
23636
|
+
"still-unavailable",
|
|
23637
|
+
"still-busy",
|
|
23638
|
+
"unreadable-image",
|
|
23639
|
+
"write-failed"
|
|
23640
|
+
]),
|
|
23641
|
+
detail: string().optional()
|
|
23642
|
+
})]);
|
|
23643
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23644
|
+
var RetrainAssistProfileSchema = object({
|
|
23645
|
+
id: string(),
|
|
23646
|
+
name: string(),
|
|
23647
|
+
model: string(),
|
|
23648
|
+
kind: string(),
|
|
23649
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23650
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23651
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23652
|
+
leavesHouse: boolean()
|
|
23653
|
+
});
|
|
23654
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23655
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23656
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23657
|
+
var RetrainLlmReviewSchema = object({
|
|
23658
|
+
/** The `ref` the page sent the box under. */
|
|
23659
|
+
ref: string(),
|
|
23660
|
+
verdict: _enum([
|
|
23661
|
+
"confirmed",
|
|
23662
|
+
"wrong-class",
|
|
23663
|
+
"not-an-object",
|
|
23664
|
+
"uncertain"
|
|
23665
|
+
]),
|
|
23666
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23667
|
+
reason: string()
|
|
23668
|
+
});
|
|
23669
|
+
/**
|
|
23670
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23671
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23672
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23673
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23674
|
+
*/
|
|
23675
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23676
|
+
kind: literal("proposed"),
|
|
23677
|
+
profileId: string(),
|
|
23678
|
+
model: string(),
|
|
23679
|
+
/** The frame was sent outside the house for this answer. */
|
|
23680
|
+
leftHouse: boolean(),
|
|
23681
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23682
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23683
|
+
rejected: number().int()
|
|
23684
|
+
}), object({
|
|
23685
|
+
kind: literal("refused"),
|
|
23686
|
+
reason: _enum([
|
|
23687
|
+
"unknown-frame",
|
|
23688
|
+
"unreadable-frame",
|
|
23689
|
+
"unknown-profile",
|
|
23690
|
+
"profile-disabled",
|
|
23691
|
+
"no-vision",
|
|
23692
|
+
"cloud-not-confirmed",
|
|
23693
|
+
"llm-error",
|
|
23694
|
+
"malformed-answer"
|
|
23695
|
+
]),
|
|
23696
|
+
detail: string().optional()
|
|
23697
|
+
})]);
|
|
22546
23698
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22547
23699
|
var RetrainTransitionResultSchema = object({
|
|
22548
23700
|
trackId: string(),
|
|
@@ -23260,7 +24412,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23260
24412
|
auth: "admin"
|
|
23261
24413
|
}), method(object({
|
|
23262
24414
|
deviceId: number(),
|
|
23263
|
-
trackId: string(),
|
|
24415
|
+
trackId: string().optional(),
|
|
23264
24416
|
frameId: string()
|
|
23265
24417
|
}), object({
|
|
23266
24418
|
removed: boolean(),
|
|
@@ -23277,7 +24429,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23277
24429
|
auth: "admin"
|
|
23278
24430
|
}), method(object({
|
|
23279
24431
|
deviceId: number(),
|
|
23280
|
-
|
|
24432
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24433
|
+
trackId: string().optional(),
|
|
23281
24434
|
frameId: string(),
|
|
23282
24435
|
subject: RetrainAssistSubjectSchema,
|
|
23283
24436
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23285,12 +24438,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23285
24438
|
}), RetrainAssistResultSchema, {
|
|
23286
24439
|
kind: "mutation",
|
|
23287
24440
|
auth: "admin"
|
|
23288
|
-
}), method(object({
|
|
24441
|
+
}), method(object({
|
|
24442
|
+
trackId: string().optional(),
|
|
24443
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24444
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23289
24445
|
kind: "query",
|
|
23290
24446
|
auth: "admin"
|
|
23291
24447
|
}), method(object({
|
|
23292
24448
|
deviceId: number(),
|
|
23293
|
-
|
|
24449
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24450
|
+
trackId: string().optional(),
|
|
23294
24451
|
frameId: string(),
|
|
23295
24452
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23296
24453
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23308,7 +24465,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23308
24465
|
}), RetrainTransitionResultSchema, {
|
|
23309
24466
|
kind: "mutation",
|
|
23310
24467
|
auth: "admin"
|
|
23311
|
-
}), method(
|
|
24468
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
24469
|
+
kind: "query",
|
|
24470
|
+
auth: "admin"
|
|
24471
|
+
}), method(object({
|
|
24472
|
+
deviceId: number(),
|
|
24473
|
+
trackId: string().optional(),
|
|
24474
|
+
frameId: string(),
|
|
24475
|
+
complete: boolean()
|
|
24476
|
+
}), RetrainFrameSchema, {
|
|
24477
|
+
kind: "mutation",
|
|
24478
|
+
auth: "admin"
|
|
24479
|
+
}), method(object({
|
|
24480
|
+
filter: RetrainExportFilterSchema,
|
|
24481
|
+
layout: RetrainExportLayoutSchema,
|
|
24482
|
+
target: RetrainArchiveTargetSchema
|
|
24483
|
+
}), RetrainArchiveResultSchema, {
|
|
24484
|
+
kind: "mutation",
|
|
24485
|
+
auth: "admin",
|
|
24486
|
+
timeoutMs: 60 * 6e4
|
|
24487
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24488
|
+
kind: "query",
|
|
24489
|
+
auth: "admin"
|
|
24490
|
+
}), method(object({
|
|
24491
|
+
deviceId: number(),
|
|
24492
|
+
trackId: string().optional(),
|
|
24493
|
+
frameId: string(),
|
|
24494
|
+
profileId: string(),
|
|
24495
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24496
|
+
boxes: array(object({
|
|
24497
|
+
ref: string(),
|
|
24498
|
+
bbox: RetrainBboxSchema,
|
|
24499
|
+
macroClass: RetrainMacroClassSchema,
|
|
24500
|
+
label: string().optional()
|
|
24501
|
+
})).max(50),
|
|
24502
|
+
allowCloud: boolean()
|
|
24503
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24504
|
+
kind: "mutation",
|
|
24505
|
+
auth: "admin",
|
|
24506
|
+
timeoutMs: 18e4
|
|
24507
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24508
|
+
kind: "mutation",
|
|
24509
|
+
auth: "admin"
|
|
24510
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24511
|
+
kind: "query",
|
|
24512
|
+
auth: "admin"
|
|
24513
|
+
}), method(object({
|
|
24514
|
+
id: string(),
|
|
24515
|
+
name: string().max(120)
|
|
24516
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24517
|
+
kind: "mutation",
|
|
24518
|
+
auth: "admin"
|
|
24519
|
+
}), method(object({ id: string() }), object({
|
|
24520
|
+
deleted: boolean(),
|
|
24521
|
+
removedFrames: number().int()
|
|
24522
|
+
}), {
|
|
24523
|
+
kind: "mutation",
|
|
24524
|
+
auth: "admin"
|
|
24525
|
+
}), method(object({
|
|
24526
|
+
collectionId: string(),
|
|
24527
|
+
deviceId: number(),
|
|
24528
|
+
epochMs: number()
|
|
24529
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24530
|
+
kind: "mutation",
|
|
24531
|
+
auth: "admin",
|
|
24532
|
+
timeoutMs: 6e4
|
|
24533
|
+
}), method(object({
|
|
24534
|
+
collectionId: string(),
|
|
24535
|
+
frameIds: array(string()).min(1).max(500)
|
|
24536
|
+
}), object({
|
|
24537
|
+
added: number().int(),
|
|
24538
|
+
alreadyMember: number().int(),
|
|
24539
|
+
unknownFrameIds: array(string()).readonly()
|
|
24540
|
+
}), {
|
|
24541
|
+
kind: "mutation",
|
|
24542
|
+
auth: "admin"
|
|
24543
|
+
}), method(object({
|
|
24544
|
+
collectionId: string(),
|
|
24545
|
+
frameId: string()
|
|
24546
|
+
}), object({
|
|
24547
|
+
removed: boolean(),
|
|
24548
|
+
deletedFrame: boolean()
|
|
24549
|
+
}), {
|
|
24550
|
+
kind: "mutation",
|
|
24551
|
+
auth: "admin"
|
|
24552
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
23312
24553
|
kind: "query",
|
|
23313
24554
|
auth: "admin"
|
|
23314
24555
|
}), method(object({
|
|
@@ -23934,13 +25175,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23934
25175
|
object({
|
|
23935
25176
|
kind: literal("no-family-build"),
|
|
23936
25177
|
format: ModelFormatSchema$1
|
|
25178
|
+
}),
|
|
25179
|
+
object({
|
|
25180
|
+
kind: literal("kept-custom-pin"),
|
|
25181
|
+
modelId: string(),
|
|
25182
|
+
deviceKey: string()
|
|
23937
25183
|
})
|
|
23938
25184
|
]);
|
|
25185
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25186
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25187
|
+
/**
|
|
25188
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25189
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25190
|
+
*/
|
|
25191
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25192
|
+
kind: literal("node-benchmark"),
|
|
25193
|
+
resultId: string(),
|
|
25194
|
+
measuredAtMs: number()
|
|
25195
|
+
})]);
|
|
23939
25196
|
var DeviceModelChoiceSchema = object({
|
|
23940
25197
|
modelId: string(),
|
|
23941
25198
|
p50Ms: number(),
|
|
23942
25199
|
fps: number(),
|
|
23943
25200
|
measured: boolean(),
|
|
25201
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25202
|
+
source: LatencySourceSchema.optional(),
|
|
23944
25203
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23945
25204
|
capacitySessions: number(),
|
|
23946
25205
|
personRecall: number()
|
|
@@ -23951,6 +25210,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23951
25210
|
enabled: boolean(),
|
|
23952
25211
|
available: boolean(),
|
|
23953
25212
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25213
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25214
|
+
kept: KeptReasonSchema.optional(),
|
|
23954
25215
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23955
25216
|
});
|
|
23956
25217
|
var NodeRecommendationSchema = object({
|
|
@@ -24004,6 +25265,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24004
25265
|
kind: literal("coral-enabled"),
|
|
24005
25266
|
nodeId: string(),
|
|
24006
25267
|
deviceKey: string()
|
|
25268
|
+
}),
|
|
25269
|
+
object({
|
|
25270
|
+
kind: literal("custom-pin-kept"),
|
|
25271
|
+
nodeId: string(),
|
|
25272
|
+
deviceKey: string().nullable(),
|
|
25273
|
+
deviceId: number().nullable(),
|
|
25274
|
+
modelId: string()
|
|
25275
|
+
}),
|
|
25276
|
+
object({
|
|
25277
|
+
kind: literal("custom-registry-unreadable"),
|
|
25278
|
+
error: string()
|
|
24007
25279
|
})
|
|
24008
25280
|
]);
|
|
24009
25281
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24182,13 +25454,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24182
25454
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24183
25455
|
});
|
|
24184
25456
|
/**
|
|
24185
|
-
* Where the node and device shares come from (D750, D755).
|
|
24186
|
-
* - `
|
|
24187
|
-
*
|
|
24188
|
-
*
|
|
24189
|
-
*
|
|
24190
|
-
*
|
|
24191
|
-
*
|
|
25457
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25458
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25459
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25460
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25461
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25462
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25463
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25464
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24192
25465
|
* - `manual` — the operator's stored sliders.
|
|
24193
25466
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24194
25467
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24237,6 +25510,362 @@ var EffectiveSharesSchema = object({
|
|
|
24237
25510
|
nodeWeights: record(string(), number()),
|
|
24238
25511
|
deviceWeights: record(string(), record(string(), number()))
|
|
24239
25512
|
});
|
|
25513
|
+
/**
|
|
25514
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25515
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25516
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25517
|
+
* shares read.
|
|
25518
|
+
*
|
|
25519
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25520
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25521
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25522
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25523
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25524
|
+
*
|
|
25525
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25526
|
+
* cross a process at frame rate, D9):
|
|
25527
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25528
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25529
|
+
* interval;
|
|
25530
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25531
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25532
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25533
|
+
* CPU, RAM or the event loop give out.
|
|
25534
|
+
*/
|
|
25535
|
+
/** Defaults and bounds, one place. */
|
|
25536
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25537
|
+
fpsPerStream: 10,
|
|
25538
|
+
budgetMinutes: 45,
|
|
25539
|
+
minBudgetMinutes: 10,
|
|
25540
|
+
maxBudgetMinutes: 120,
|
|
25541
|
+
/** A result older than this no longer beats the table. */
|
|
25542
|
+
staleAfterDays: 30,
|
|
25543
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25544
|
+
settleSec: 5,
|
|
25545
|
+
/** Accounted window per ramp step. */
|
|
25546
|
+
measureSec: 20,
|
|
25547
|
+
/** Longest the drain may take before the run is refused. */
|
|
25548
|
+
drainTimeoutSec: 120,
|
|
25549
|
+
/** Candidate models per device in one run. */
|
|
25550
|
+
maxModelsPerDevice: 6
|
|
25551
|
+
};
|
|
25552
|
+
/** The two measurements a run can make. */
|
|
25553
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25554
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25555
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25556
|
+
deviceKey: string().min(1),
|
|
25557
|
+
/**
|
|
25558
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25559
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25560
|
+
*/
|
|
25561
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25562
|
+
});
|
|
25563
|
+
/** What the operator confirmed. */
|
|
25564
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25565
|
+
nodeId: string().min(1),
|
|
25566
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25567
|
+
/** Which measurements run. At least one. */
|
|
25568
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25569
|
+
/**
|
|
25570
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25571
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25572
|
+
* detector always runs.
|
|
25573
|
+
*/
|
|
25574
|
+
steps: array(string().min(1)).default([]),
|
|
25575
|
+
/** Offered rate of one stream / session. */
|
|
25576
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25577
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25578
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25579
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25580
|
+
keepDownloadedModels: boolean().default(false),
|
|
25581
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25582
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25583
|
+
});
|
|
25584
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25585
|
+
kind: _enum([
|
|
25586
|
+
"benchmark-active",
|
|
25587
|
+
"node-offline",
|
|
25588
|
+
"unknown-device",
|
|
25589
|
+
"no-phase",
|
|
25590
|
+
"insufficient-headroom"
|
|
25591
|
+
]),
|
|
25592
|
+
detail: string(),
|
|
25593
|
+
overridable: boolean()
|
|
25594
|
+
});
|
|
25595
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25596
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25597
|
+
deviceId: number(),
|
|
25598
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25599
|
+
placedOnNode: boolean(),
|
|
25600
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25601
|
+
pinnedToNode: boolean()
|
|
25602
|
+
});
|
|
25603
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25604
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25605
|
+
deviceId: number(),
|
|
25606
|
+
reason: literal("only-frame-source")
|
|
25607
|
+
});
|
|
25608
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25609
|
+
nodeId: string(),
|
|
25610
|
+
online: boolean(),
|
|
25611
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25612
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25613
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25614
|
+
estimatedDurationMs: number(),
|
|
25615
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25616
|
+
budgetMs: number(),
|
|
25617
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25618
|
+
steps: array(string()).readonly(),
|
|
25619
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25620
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25621
|
+
headroom: object({
|
|
25622
|
+
sessionsNow: number(),
|
|
25623
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25624
|
+
}),
|
|
25625
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25626
|
+
canStart: boolean()
|
|
25627
|
+
});
|
|
25628
|
+
/** Where the measuring runner is. */
|
|
25629
|
+
var NodeBenchProgressSchema = object({
|
|
25630
|
+
phase: _enum([
|
|
25631
|
+
"preparing",
|
|
25632
|
+
"device",
|
|
25633
|
+
"pipeline",
|
|
25634
|
+
"cleanup"
|
|
25635
|
+
]),
|
|
25636
|
+
deviceKey: string().nullable(),
|
|
25637
|
+
modelId: string().nullable(),
|
|
25638
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25639
|
+
load: number().nullable(),
|
|
25640
|
+
cellsDone: number(),
|
|
25641
|
+
cellsTotal: number(),
|
|
25642
|
+
message: string()
|
|
25643
|
+
});
|
|
25644
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25645
|
+
var NodeBenchLimitSchema = _enum([
|
|
25646
|
+
"p95",
|
|
25647
|
+
"drops",
|
|
25648
|
+
"errors",
|
|
25649
|
+
"stall",
|
|
25650
|
+
"cpu",
|
|
25651
|
+
"ram",
|
|
25652
|
+
"none"
|
|
25653
|
+
]);
|
|
25654
|
+
var NodeBenchRampStepSchema = object({
|
|
25655
|
+
load: number(),
|
|
25656
|
+
pass: boolean(),
|
|
25657
|
+
p95Ms: number(),
|
|
25658
|
+
dropRatio: number(),
|
|
25659
|
+
/** Completed frames per second over the accounted window. */
|
|
25660
|
+
fps: number(),
|
|
25661
|
+
cpuPct: number().nullable(),
|
|
25662
|
+
ramFreePct: number().nullable(),
|
|
25663
|
+
failReasons: array(string()).readonly()
|
|
25664
|
+
});
|
|
25665
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25666
|
+
phase: literal("device"),
|
|
25667
|
+
deviceKey: string(),
|
|
25668
|
+
modelId: string(),
|
|
25669
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25670
|
+
p50Ms: number(),
|
|
25671
|
+
p95Ms: number(),
|
|
25672
|
+
p99Ms: number(),
|
|
25673
|
+
/** Frames per second sustained at the last passing step. */
|
|
25674
|
+
fps: number(),
|
|
25675
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25676
|
+
kMax: number(),
|
|
25677
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25678
|
+
/** First call (model load + warm-up). */
|
|
25679
|
+
warmupMs: number(),
|
|
25680
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25681
|
+
}), object({
|
|
25682
|
+
phase: literal("pipeline"),
|
|
25683
|
+
deviceKey: string(),
|
|
25684
|
+
modelId: string(),
|
|
25685
|
+
steps: array(string()).readonly(),
|
|
25686
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25687
|
+
maxSessions: number(),
|
|
25688
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25689
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25690
|
+
stepsFired: array(string()).readonly(),
|
|
25691
|
+
warmupMs: number(),
|
|
25692
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25693
|
+
})]);
|
|
25694
|
+
/**
|
|
25695
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25696
|
+
* the node no longer beats the table.
|
|
25697
|
+
*/
|
|
25698
|
+
var NodeBenchFingerprintSchema = object({
|
|
25699
|
+
pipelineVersion: string().nullable(),
|
|
25700
|
+
cpuModel: string().nullable(),
|
|
25701
|
+
ramGb: number().nullable(),
|
|
25702
|
+
os: string().nullable(),
|
|
25703
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25704
|
+
pools: record(string(), object({
|
|
25705
|
+
runtime: string(),
|
|
25706
|
+
numWorkers: number(),
|
|
25707
|
+
concurrency: number(),
|
|
25708
|
+
batchMode: string()
|
|
25709
|
+
})).default({})
|
|
25710
|
+
});
|
|
25711
|
+
/** The frames the run used. */
|
|
25712
|
+
var NodeBenchClipSchema = object({
|
|
25713
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25714
|
+
id: string(),
|
|
25715
|
+
revision: string().nullable(),
|
|
25716
|
+
frames: number(),
|
|
25717
|
+
width: number(),
|
|
25718
|
+
height: number()
|
|
25719
|
+
});
|
|
25720
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25721
|
+
runId: string().min(1),
|
|
25722
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25723
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25724
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25725
|
+
steps: array(string()).default([]),
|
|
25726
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25727
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25728
|
+
deadlineAtMs: number(),
|
|
25729
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25730
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25731
|
+
keepDownloadedModels: boolean().default(false)
|
|
25732
|
+
});
|
|
25733
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25734
|
+
"running",
|
|
25735
|
+
"done",
|
|
25736
|
+
"failed",
|
|
25737
|
+
"aborted"
|
|
25738
|
+
]);
|
|
25739
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25740
|
+
runId: string(),
|
|
25741
|
+
nodeId: string(),
|
|
25742
|
+
state: NodeBenchRunnerStateSchema,
|
|
25743
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25744
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25745
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25746
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25747
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25748
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25749
|
+
activeCameraIds: array(number()).readonly(),
|
|
25750
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25751
|
+
deletedModels: array(string()).readonly(),
|
|
25752
|
+
error: string().nullable(),
|
|
25753
|
+
startedAtMs: number(),
|
|
25754
|
+
finishedAtMs: number().nullable()
|
|
25755
|
+
});
|
|
25756
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25757
|
+
"draining",
|
|
25758
|
+
"measuring",
|
|
25759
|
+
"restoring",
|
|
25760
|
+
"done",
|
|
25761
|
+
"failed",
|
|
25762
|
+
"aborted"
|
|
25763
|
+
]);
|
|
25764
|
+
/** Why a run ended. */
|
|
25765
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25766
|
+
"completed",
|
|
25767
|
+
"operator-abort",
|
|
25768
|
+
"deadline",
|
|
25769
|
+
"node-lost",
|
|
25770
|
+
"runner-lost",
|
|
25771
|
+
"hub-restart",
|
|
25772
|
+
"drain-timeout",
|
|
25773
|
+
"failed"
|
|
25774
|
+
]);
|
|
25775
|
+
var NodeBenchmarkRunSchema = object({
|
|
25776
|
+
runId: string(),
|
|
25777
|
+
nodeId: string(),
|
|
25778
|
+
state: NodeBenchmarkStateSchema,
|
|
25779
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25780
|
+
startedAtMs: number(),
|
|
25781
|
+
deadlineAtMs: number(),
|
|
25782
|
+
finishedAtMs: number().nullable(),
|
|
25783
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25784
|
+
error: string().nullable(),
|
|
25785
|
+
/** Cameras moved off the node for the run. */
|
|
25786
|
+
moved: array(number()).readonly(),
|
|
25787
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25788
|
+
staying: array(number()).readonly(),
|
|
25789
|
+
/** Something else ran on the node's pools during the run. */
|
|
25790
|
+
contaminated: boolean(),
|
|
25791
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25792
|
+
resultIds: array(string()).readonly()
|
|
25793
|
+
});
|
|
25794
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25795
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25796
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25797
|
+
modeNodeId: string().nullable(),
|
|
25798
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25799
|
+
});
|
|
25800
|
+
/**
|
|
25801
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25802
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25803
|
+
* ends, never by anyone else.
|
|
25804
|
+
*/
|
|
25805
|
+
var NodeBenchmarkResultSchema = object({
|
|
25806
|
+
id: string(),
|
|
25807
|
+
runId: string(),
|
|
25808
|
+
nodeId: string(),
|
|
25809
|
+
cell: NodeBenchCellSchema,
|
|
25810
|
+
fpsPerStream: number(),
|
|
25811
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25812
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25813
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25814
|
+
contaminated: boolean(),
|
|
25815
|
+
stayingCameras: array(number()).readonly(),
|
|
25816
|
+
/** The run ended early; the cell itself completed. */
|
|
25817
|
+
partialRun: boolean(),
|
|
25818
|
+
measuredAtMs: number()
|
|
25819
|
+
});
|
|
25820
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25821
|
+
nodeId: string().optional(),
|
|
25822
|
+
deviceKey: string().optional()
|
|
25823
|
+
});
|
|
25824
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25825
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25826
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25827
|
+
standing: _enum([
|
|
25828
|
+
"fresh",
|
|
25829
|
+
"stale",
|
|
25830
|
+
"superseded"
|
|
25831
|
+
]),
|
|
25832
|
+
staleWhy: _enum([
|
|
25833
|
+
"age",
|
|
25834
|
+
"runtime",
|
|
25835
|
+
"pool-tuning"
|
|
25836
|
+
]).nullable()
|
|
25837
|
+
});
|
|
25838
|
+
object({
|
|
25839
|
+
runId: string(),
|
|
25840
|
+
nodeId: string(),
|
|
25841
|
+
startedAtMs: number(),
|
|
25842
|
+
deadlineAtMs: number(),
|
|
25843
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25844
|
+
moved: array(number()).readonly(),
|
|
25845
|
+
staying: array(number()).readonly()
|
|
25846
|
+
});
|
|
25847
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25848
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25849
|
+
nodeId: string(),
|
|
25850
|
+
reachable: boolean(),
|
|
25851
|
+
devices: array(object({
|
|
25852
|
+
deviceKey: string(),
|
|
25853
|
+
enabled: boolean(),
|
|
25854
|
+
available: boolean(),
|
|
25855
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25856
|
+
suggested: array(string()).readonly(),
|
|
25857
|
+
/** Every root detector the device has a build for. */
|
|
25858
|
+
all: array(string()).readonly(),
|
|
25859
|
+
/** The model the device runs now, when pinned. */
|
|
25860
|
+
currentModelId: string().nullable()
|
|
25861
|
+
})).readonly(),
|
|
25862
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25863
|
+
steps: array(object({
|
|
25864
|
+
id: string(),
|
|
25865
|
+
name: string(),
|
|
25866
|
+
slot: string()
|
|
25867
|
+
})).readonly()
|
|
25868
|
+
});
|
|
24240
25869
|
object({
|
|
24241
25870
|
activeCameras: number(),
|
|
24242
25871
|
throttledCameras: number(),
|
|
@@ -25365,7 +26994,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25365
26994
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25366
26995
|
deviceId: number(),
|
|
25367
26996
|
trackId: string()
|
|
25368
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26997
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26998
|
+
accepted: literal(true),
|
|
26999
|
+
runId: string()
|
|
27000
|
+
}), {
|
|
27001
|
+
kind: "mutation",
|
|
27002
|
+
auth: "admin"
|
|
27003
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27004
|
+
kind: "mutation",
|
|
27005
|
+
auth: "admin"
|
|
27006
|
+
});
|
|
25369
27007
|
var CameraPipelineConfigSchema = object({
|
|
25370
27008
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25371
27009
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26004,6 +27642,21 @@ method(object({
|
|
|
26004
27642
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26005
27643
|
kind: "mutation",
|
|
26006
27644
|
auth: "admin"
|
|
27645
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27646
|
+
kind: literal("started"),
|
|
27647
|
+
runId: string()
|
|
27648
|
+
}), object({
|
|
27649
|
+
kind: literal("refused"),
|
|
27650
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27651
|
+
})]), {
|
|
27652
|
+
kind: "mutation",
|
|
27653
|
+
auth: "admin"
|
|
27654
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27655
|
+
kind: "mutation",
|
|
27656
|
+
auth: "admin"
|
|
27657
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27658
|
+
kind: "mutation",
|
|
27659
|
+
auth: "admin"
|
|
26007
27660
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26008
27661
|
deviceId: number(),
|
|
26009
27662
|
addonId: string(),
|
|
@@ -26640,7 +28293,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26640
28293
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
26641
28294
|
* operator already consented to.
|
|
26642
28295
|
*/
|
|
26643
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
28296
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
28297
|
+
/**
|
|
28298
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
28299
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
28300
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
28301
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
28302
|
+
*/
|
|
28303
|
+
linkIntent: string().optional(),
|
|
28304
|
+
/**
|
|
28305
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28306
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
28307
|
+
*/
|
|
28308
|
+
issuer: string().optional()
|
|
26644
28309
|
});
|
|
26645
28310
|
method(object({
|
|
26646
28311
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -28575,7 +30240,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
28575
30240
|
* field their hints were silently stripped by the schema and the
|
|
28576
30241
|
* adaptive ladder started blind on the client's display size.
|
|
28577
30242
|
*/
|
|
28578
|
-
hints: webrtcClientHintsSchema.optional()
|
|
30243
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
30244
|
+
/**
|
|
30245
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
30246
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
30247
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
30248
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
30249
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
30250
|
+
*
|
|
30251
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
30252
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
30253
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
30254
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
30255
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
30256
|
+
* flag must not become a second door to the camera's speaker.
|
|
30257
|
+
*/
|
|
30258
|
+
talkback: boolean().optional()
|
|
28579
30259
|
}), object({
|
|
28580
30260
|
sessionId: string(),
|
|
28581
30261
|
sdpAnswer: string()
|
|
@@ -32084,6 +33764,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32084
33764
|
enabled: boolean().optional(),
|
|
32085
33765
|
info: record(string(), unknown()).optional(),
|
|
32086
33766
|
settings: record(string(), unknown()).optional(),
|
|
33767
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33768
|
+
* the keychain, not the table (D787). */
|
|
33769
|
+
secretKeys: array(string()).optional(),
|
|
32087
33770
|
skipRestart: boolean().optional()
|
|
32088
33771
|
});
|
|
32089
33772
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32107,7 +33790,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32107
33790
|
auth: "admin"
|
|
32108
33791
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32109
33792
|
id: string(),
|
|
32110
|
-
settings: record(string(), unknown())
|
|
33793
|
+
settings: record(string(), unknown()),
|
|
33794
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33795
|
+
secretKeys: array(string()).optional()
|
|
32111
33796
|
}), object({ success: boolean() }), {
|
|
32112
33797
|
kind: "mutation",
|
|
32113
33798
|
auth: "admin"
|
|
@@ -38929,6 +40614,32 @@ var TotpStatusSchema = object({
|
|
|
38929
40614
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
38930
40615
|
confirmedAt: number().nullable()
|
|
38931
40616
|
});
|
|
40617
|
+
/**
|
|
40618
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
40619
|
+
* and scoped tokens.
|
|
40620
|
+
*
|
|
40621
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
40622
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
40623
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
40624
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
40625
|
+
* provider.
|
|
40626
|
+
*/
|
|
40627
|
+
var ExternalIdentitySchema = object({
|
|
40628
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
40629
|
+
provider: string(),
|
|
40630
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
40631
|
+
subject: string(),
|
|
40632
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
40633
|
+
issuer: string(),
|
|
40634
|
+
userId: string(),
|
|
40635
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
40636
|
+
label: string().optional(),
|
|
40637
|
+
linkedAt: number()
|
|
40638
|
+
});
|
|
40639
|
+
var ExternalIdentityKeySchema = object({
|
|
40640
|
+
provider: string().min(1),
|
|
40641
|
+
subject: string().min(1)
|
|
40642
|
+
});
|
|
38932
40643
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
38933
40644
|
kind: "mutation",
|
|
38934
40645
|
auth: "admin",
|
|
@@ -39042,7 +40753,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39042
40753
|
userId: string(),
|
|
39043
40754
|
username: string(),
|
|
39044
40755
|
scopes: array(TokenScopeSchema)
|
|
39045
|
-
}).nullable(), { access: "view" }), method(
|
|
40756
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40757
|
+
userId: string(),
|
|
40758
|
+
issuer: string()
|
|
40759
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40760
|
+
userId: string(),
|
|
40761
|
+
issuer: string().min(1),
|
|
40762
|
+
label: string().optional()
|
|
40763
|
+
}), object({ success: literal(true) }), {
|
|
40764
|
+
kind: "mutation",
|
|
40765
|
+
auth: "admin",
|
|
40766
|
+
access: "create"
|
|
40767
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40768
|
+
kind: "mutation",
|
|
40769
|
+
auth: "admin",
|
|
40770
|
+
access: "delete"
|
|
40771
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
39046
40772
|
kind: "mutation",
|
|
39047
40773
|
auth: "admin",
|
|
39048
40774
|
access: "delete"
|
|
@@ -40229,7 +41955,8 @@ var BaseDevice = class {
|
|
|
40229
41955
|
this.role = options.role;
|
|
40230
41956
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40231
41957
|
const seedData = ctx.persistedConfig ?? {};
|
|
40232
|
-
|
|
41958
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
41959
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40233
41960
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40234
41961
|
tags: {
|
|
40235
41962
|
deviceId: ctx.id,
|
|
@@ -43918,6 +45645,90 @@ Object.freeze({
|
|
|
43918
45645
|
addonId: null,
|
|
43919
45646
|
access: "create"
|
|
43920
45647
|
},
|
|
45648
|
+
"keychain.delete": {
|
|
45649
|
+
capName: "keychain",
|
|
45650
|
+
capScope: "system",
|
|
45651
|
+
addonId: null,
|
|
45652
|
+
access: "delete"
|
|
45653
|
+
},
|
|
45654
|
+
"keychain.getState": {
|
|
45655
|
+
capName: "keychain",
|
|
45656
|
+
capScope: "system",
|
|
45657
|
+
addonId: null,
|
|
45658
|
+
access: "view"
|
|
45659
|
+
},
|
|
45660
|
+
"keychain.listMeta": {
|
|
45661
|
+
capName: "keychain",
|
|
45662
|
+
capScope: "system",
|
|
45663
|
+
addonId: null,
|
|
45664
|
+
access: "view"
|
|
45665
|
+
},
|
|
45666
|
+
"keychain.put": {
|
|
45667
|
+
capName: "keychain",
|
|
45668
|
+
capScope: "system",
|
|
45669
|
+
addonId: null,
|
|
45670
|
+
access: "create"
|
|
45671
|
+
},
|
|
45672
|
+
"keychain.resolve": {
|
|
45673
|
+
capName: "keychain",
|
|
45674
|
+
capScope: "system",
|
|
45675
|
+
addonId: null,
|
|
45676
|
+
access: "view"
|
|
45677
|
+
},
|
|
45678
|
+
"keychainAdmin.deleteOrphans": {
|
|
45679
|
+
capName: "keychain-admin",
|
|
45680
|
+
capScope: "system",
|
|
45681
|
+
addonId: null,
|
|
45682
|
+
access: "delete"
|
|
45683
|
+
},
|
|
45684
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
45685
|
+
capName: "keychain-admin",
|
|
45686
|
+
capScope: "system",
|
|
45687
|
+
addonId: null,
|
|
45688
|
+
access: "create"
|
|
45689
|
+
},
|
|
45690
|
+
"keychainAdmin.listAudit": {
|
|
45691
|
+
capName: "keychain-admin",
|
|
45692
|
+
capScope: "system",
|
|
45693
|
+
addonId: null,
|
|
45694
|
+
access: "view"
|
|
45695
|
+
},
|
|
45696
|
+
"keychainAdmin.listSecrets": {
|
|
45697
|
+
capName: "keychain-admin",
|
|
45698
|
+
capScope: "system",
|
|
45699
|
+
addonId: null,
|
|
45700
|
+
access: "view"
|
|
45701
|
+
},
|
|
45702
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
45703
|
+
capName: "keychain-admin",
|
|
45704
|
+
capScope: "system",
|
|
45705
|
+
addonId: null,
|
|
45706
|
+
access: "delete"
|
|
45707
|
+
},
|
|
45708
|
+
"keychainAdmin.resetKeychain": {
|
|
45709
|
+
capName: "keychain-admin",
|
|
45710
|
+
capScope: "system",
|
|
45711
|
+
addonId: null,
|
|
45712
|
+
access: "delete"
|
|
45713
|
+
},
|
|
45714
|
+
"keychainAdmin.reveal": {
|
|
45715
|
+
capName: "keychain-admin",
|
|
45716
|
+
capScope: "system",
|
|
45717
|
+
addonId: null,
|
|
45718
|
+
access: "create"
|
|
45719
|
+
},
|
|
45720
|
+
"keychainAdmin.rotateMasterKey": {
|
|
45721
|
+
capName: "keychain-admin",
|
|
45722
|
+
capScope: "system",
|
|
45723
|
+
addonId: null,
|
|
45724
|
+
access: "create"
|
|
45725
|
+
},
|
|
45726
|
+
"keychainAdmin.status": {
|
|
45727
|
+
capName: "keychain-admin",
|
|
45728
|
+
capScope: "system",
|
|
45729
|
+
addonId: null,
|
|
45730
|
+
access: "view"
|
|
45731
|
+
},
|
|
43921
45732
|
"lawnMowerControl.dock": {
|
|
43922
45733
|
capName: "lawn-mower-control",
|
|
43923
45734
|
capScope: "device",
|
|
@@ -45292,6 +47103,18 @@ Object.freeze({
|
|
|
45292
47103
|
addonId: null,
|
|
45293
47104
|
access: "create"
|
|
45294
47105
|
},
|
|
47106
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
47107
|
+
capName: "pipeline-analytics",
|
|
47108
|
+
capScope: "device",
|
|
47109
|
+
addonId: null,
|
|
47110
|
+
access: "create"
|
|
47111
|
+
},
|
|
47112
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
47113
|
+
capName: "pipeline-analytics",
|
|
47114
|
+
capScope: "device",
|
|
47115
|
+
addonId: null,
|
|
47116
|
+
access: "create"
|
|
47117
|
+
},
|
|
45295
47118
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45296
47119
|
capName: "pipeline-analytics",
|
|
45297
47120
|
capScope: "device",
|
|
@@ -45340,12 +47163,24 @@ Object.freeze({
|
|
|
45340
47163
|
addonId: null,
|
|
45341
47164
|
access: "view"
|
|
45342
47165
|
},
|
|
47166
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
47167
|
+
capName: "pipeline-analytics",
|
|
47168
|
+
capScope: "device",
|
|
47169
|
+
addonId: null,
|
|
47170
|
+
access: "create"
|
|
47171
|
+
},
|
|
45343
47172
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45344
47173
|
capName: "pipeline-analytics",
|
|
45345
47174
|
capScope: "device",
|
|
45346
47175
|
addonId: null,
|
|
45347
47176
|
access: "delete"
|
|
45348
47177
|
},
|
|
47178
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
47179
|
+
capName: "pipeline-analytics",
|
|
47180
|
+
capScope: "device",
|
|
47181
|
+
addonId: null,
|
|
47182
|
+
access: "delete"
|
|
47183
|
+
},
|
|
45349
47184
|
"pipelineAnalytics.deleteTracks": {
|
|
45350
47185
|
capName: "pipeline-analytics",
|
|
45351
47186
|
capScope: "device",
|
|
@@ -45550,6 +47385,24 @@ Object.freeze({
|
|
|
45550
47385
|
addonId: null,
|
|
45551
47386
|
access: "view"
|
|
45552
47387
|
},
|
|
47388
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
47389
|
+
capName: "pipeline-analytics",
|
|
47390
|
+
capScope: "device",
|
|
47391
|
+
addonId: null,
|
|
47392
|
+
access: "view"
|
|
47393
|
+
},
|
|
47394
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
47395
|
+
capName: "pipeline-analytics",
|
|
47396
|
+
capScope: "device",
|
|
47397
|
+
addonId: null,
|
|
47398
|
+
access: "view"
|
|
47399
|
+
},
|
|
47400
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
47401
|
+
capName: "pipeline-analytics",
|
|
47402
|
+
capScope: "device",
|
|
47403
|
+
addonId: null,
|
|
47404
|
+
access: "view"
|
|
47405
|
+
},
|
|
45553
47406
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45554
47407
|
capName: "pipeline-analytics",
|
|
45555
47408
|
capScope: "device",
|
|
@@ -45598,6 +47451,12 @@ Object.freeze({
|
|
|
45598
47451
|
addonId: null,
|
|
45599
47452
|
access: "create"
|
|
45600
47453
|
},
|
|
47454
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
47455
|
+
capName: "pipeline-analytics",
|
|
47456
|
+
capScope: "device",
|
|
47457
|
+
addonId: null,
|
|
47458
|
+
access: "create"
|
|
47459
|
+
},
|
|
45601
47460
|
"pipelineAnalytics.pruneEvents": {
|
|
45602
47461
|
capName: "pipeline-analytics",
|
|
45603
47462
|
capScope: "device",
|
|
@@ -45652,6 +47511,18 @@ Object.freeze({
|
|
|
45652
47511
|
addonId: null,
|
|
45653
47512
|
access: "create"
|
|
45654
47513
|
},
|
|
47514
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
47515
|
+
capName: "pipeline-analytics",
|
|
47516
|
+
capScope: "device",
|
|
47517
|
+
addonId: null,
|
|
47518
|
+
access: "delete"
|
|
47519
|
+
},
|
|
47520
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
47521
|
+
capName: "pipeline-analytics",
|
|
47522
|
+
capScope: "device",
|
|
47523
|
+
addonId: null,
|
|
47524
|
+
access: "create"
|
|
47525
|
+
},
|
|
45655
47526
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45656
47527
|
capName: "pipeline-analytics",
|
|
45657
47528
|
capScope: "device",
|
|
@@ -45682,6 +47553,12 @@ Object.freeze({
|
|
|
45682
47553
|
addonId: null,
|
|
45683
47554
|
access: "create"
|
|
45684
47555
|
},
|
|
47556
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
47557
|
+
capName: "pipeline-analytics",
|
|
47558
|
+
capScope: "device",
|
|
47559
|
+
addonId: null,
|
|
47560
|
+
access: "create"
|
|
47561
|
+
},
|
|
45685
47562
|
"pipelineAnalytics.setTrackFlags": {
|
|
45686
47563
|
capName: "pipeline-analytics",
|
|
45687
47564
|
capScope: "device",
|
|
@@ -45718,6 +47595,12 @@ Object.freeze({
|
|
|
45718
47595
|
addonId: null,
|
|
45719
47596
|
access: "delete"
|
|
45720
47597
|
},
|
|
47598
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
47599
|
+
capName: "pipeline-analytics",
|
|
47600
|
+
capScope: "device",
|
|
47601
|
+
addonId: null,
|
|
47602
|
+
access: "create"
|
|
47603
|
+
},
|
|
45721
47604
|
"pipelineExecutor.cacheFrameInPool": {
|
|
45722
47605
|
capName: "pipeline-executor",
|
|
45723
47606
|
capScope: "system",
|
|
@@ -45928,6 +47811,12 @@ Object.freeze({
|
|
|
45928
47811
|
addonId: null,
|
|
45929
47812
|
access: "view"
|
|
45930
47813
|
},
|
|
47814
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
47815
|
+
capName: "pipeline-orchestrator",
|
|
47816
|
+
capScope: "system",
|
|
47817
|
+
addonId: null,
|
|
47818
|
+
access: "create"
|
|
47819
|
+
},
|
|
45931
47820
|
"pipelineOrchestrator.applyAutoTune": {
|
|
45932
47821
|
capName: "pipeline-orchestrator",
|
|
45933
47822
|
capScope: "system",
|
|
@@ -45952,6 +47841,12 @@ Object.freeze({
|
|
|
45952
47841
|
addonId: null,
|
|
45953
47842
|
access: "create"
|
|
45954
47843
|
},
|
|
47844
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
47845
|
+
capName: "pipeline-orchestrator",
|
|
47846
|
+
capScope: "system",
|
|
47847
|
+
addonId: null,
|
|
47848
|
+
access: "delete"
|
|
47849
|
+
},
|
|
45955
47850
|
"pipelineOrchestrator.getAgentLoad": {
|
|
45956
47851
|
capName: "pipeline-orchestrator",
|
|
45957
47852
|
capScope: "system",
|
|
@@ -46060,6 +47955,24 @@ Object.freeze({
|
|
|
46060
47955
|
addonId: null,
|
|
46061
47956
|
access: "view"
|
|
46062
47957
|
},
|
|
47958
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
47959
|
+
capName: "pipeline-orchestrator",
|
|
47960
|
+
capScope: "system",
|
|
47961
|
+
addonId: null,
|
|
47962
|
+
access: "view"
|
|
47963
|
+
},
|
|
47964
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
47965
|
+
capName: "pipeline-orchestrator",
|
|
47966
|
+
capScope: "system",
|
|
47967
|
+
addonId: null,
|
|
47968
|
+
access: "view"
|
|
47969
|
+
},
|
|
47970
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
47971
|
+
capName: "pipeline-orchestrator",
|
|
47972
|
+
capScope: "system",
|
|
47973
|
+
addonId: null,
|
|
47974
|
+
access: "view"
|
|
47975
|
+
},
|
|
46063
47976
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46064
47977
|
capName: "pipeline-orchestrator",
|
|
46065
47978
|
capScope: "system",
|
|
@@ -46102,6 +48015,12 @@ Object.freeze({
|
|
|
46102
48015
|
addonId: null,
|
|
46103
48016
|
access: "view"
|
|
46104
48017
|
},
|
|
48018
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
48019
|
+
capName: "pipeline-orchestrator",
|
|
48020
|
+
capScope: "system",
|
|
48021
|
+
addonId: null,
|
|
48022
|
+
access: "view"
|
|
48023
|
+
},
|
|
46105
48024
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46106
48025
|
capName: "pipeline-orchestrator",
|
|
46107
48026
|
capScope: "system",
|
|
@@ -46246,6 +48165,12 @@ Object.freeze({
|
|
|
46246
48165
|
addonId: null,
|
|
46247
48166
|
access: "create"
|
|
46248
48167
|
},
|
|
48168
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
48169
|
+
capName: "pipeline-orchestrator",
|
|
48170
|
+
capScope: "system",
|
|
48171
|
+
addonId: null,
|
|
48172
|
+
access: "create"
|
|
48173
|
+
},
|
|
46249
48174
|
"pipelineOrchestrator.suggestShares": {
|
|
46250
48175
|
capName: "pipeline-orchestrator",
|
|
46251
48176
|
capScope: "system",
|
|
@@ -46264,6 +48189,12 @@ Object.freeze({
|
|
|
46264
48189
|
addonId: null,
|
|
46265
48190
|
access: "create"
|
|
46266
48191
|
},
|
|
48192
|
+
"pipelineRunner.abortNodeBench": {
|
|
48193
|
+
capName: "pipeline-runner",
|
|
48194
|
+
capScope: "system",
|
|
48195
|
+
addonId: null,
|
|
48196
|
+
access: "create"
|
|
48197
|
+
},
|
|
46267
48198
|
"pipelineRunner.attachCamera": {
|
|
46268
48199
|
capName: "pipeline-runner",
|
|
46269
48200
|
capScope: "system",
|
|
@@ -46312,6 +48243,12 @@ Object.freeze({
|
|
|
46312
48243
|
addonId: null,
|
|
46313
48244
|
access: "view"
|
|
46314
48245
|
},
|
|
48246
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
48247
|
+
capName: "pipeline-runner",
|
|
48248
|
+
capScope: "system",
|
|
48249
|
+
addonId: null,
|
|
48250
|
+
access: "view"
|
|
48251
|
+
},
|
|
46315
48252
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46316
48253
|
capName: "pipeline-runner",
|
|
46317
48254
|
capScope: "system",
|
|
@@ -46354,6 +48291,12 @@ Object.freeze({
|
|
|
46354
48291
|
addonId: null,
|
|
46355
48292
|
access: "create"
|
|
46356
48293
|
},
|
|
48294
|
+
"pipelineRunner.startNodeBench": {
|
|
48295
|
+
capName: "pipeline-runner",
|
|
48296
|
+
capScope: "system",
|
|
48297
|
+
addonId: null,
|
|
48298
|
+
access: "create"
|
|
48299
|
+
},
|
|
46357
48300
|
"plateGallery.assignPlate": {
|
|
46358
48301
|
capName: "plate-gallery",
|
|
46359
48302
|
capScope: "system",
|
|
@@ -48070,18 +50013,36 @@ Object.freeze({
|
|
|
48070
50013
|
addonId: null,
|
|
48071
50014
|
access: "delete"
|
|
48072
50015
|
},
|
|
50016
|
+
"userManagement.findUserByExternalIdentity": {
|
|
50017
|
+
capName: "user-management",
|
|
50018
|
+
capScope: "system",
|
|
50019
|
+
addonId: null,
|
|
50020
|
+
access: "view"
|
|
50021
|
+
},
|
|
48073
50022
|
"userManagement.getTotpStatus": {
|
|
48074
50023
|
capName: "user-management",
|
|
48075
50024
|
capScope: "system",
|
|
48076
50025
|
addonId: null,
|
|
48077
50026
|
access: "view"
|
|
48078
50027
|
},
|
|
50028
|
+
"userManagement.linkExternalIdentity": {
|
|
50029
|
+
capName: "user-management",
|
|
50030
|
+
capScope: "system",
|
|
50031
|
+
addonId: null,
|
|
50032
|
+
access: "create"
|
|
50033
|
+
},
|
|
48079
50034
|
"userManagement.listApiKeys": {
|
|
48080
50035
|
capName: "user-management",
|
|
48081
50036
|
capScope: "system",
|
|
48082
50037
|
addonId: null,
|
|
48083
50038
|
access: "view"
|
|
48084
50039
|
},
|
|
50040
|
+
"userManagement.listExternalIdentities": {
|
|
50041
|
+
capName: "user-management",
|
|
50042
|
+
capScope: "system",
|
|
50043
|
+
addonId: null,
|
|
50044
|
+
access: "view"
|
|
50045
|
+
},
|
|
48085
50046
|
"userManagement.listOauthSessions": {
|
|
48086
50047
|
capName: "user-management",
|
|
48087
50048
|
capScope: "system",
|
|
@@ -48160,6 +50121,12 @@ Object.freeze({
|
|
|
48160
50121
|
addonId: null,
|
|
48161
50122
|
access: "create"
|
|
48162
50123
|
},
|
|
50124
|
+
"userManagement.unlinkExternalIdentity": {
|
|
50125
|
+
capName: "user-management",
|
|
50126
|
+
capScope: "system",
|
|
50127
|
+
addonId: null,
|
|
50128
|
+
access: "delete"
|
|
50129
|
+
},
|
|
48163
50130
|
"userManagement.updateUser": {
|
|
48164
50131
|
capName: "user-management",
|
|
48165
50132
|
capScope: "system",
|
|
@@ -51259,6 +53226,11 @@ Object.freeze({
|
|
|
51259
53226
|
form: "single",
|
|
51260
53227
|
optional: false
|
|
51261
53228
|
}],
|
|
53229
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
53230
|
+
name: "deviceId",
|
|
53231
|
+
form: "single",
|
|
53232
|
+
optional: false
|
|
53233
|
+
}],
|
|
51262
53234
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51263
53235
|
name: "deviceId",
|
|
51264
53236
|
form: "single",
|
|
@@ -51449,6 +53421,11 @@ Object.freeze({
|
|
|
51449
53421
|
form: "single",
|
|
51450
53422
|
optional: false
|
|
51451
53423
|
}],
|
|
53424
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
53425
|
+
name: "deviceId",
|
|
53426
|
+
form: "single",
|
|
53427
|
+
optional: false
|
|
53428
|
+
}],
|
|
51452
53429
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51453
53430
|
name: "deviceId",
|
|
51454
53431
|
form: "single",
|
|
@@ -51499,6 +53476,11 @@ Object.freeze({
|
|
|
51499
53476
|
form: "single",
|
|
51500
53477
|
optional: false
|
|
51501
53478
|
}],
|
|
53479
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
53480
|
+
name: "deviceId",
|
|
53481
|
+
form: "single",
|
|
53482
|
+
optional: false
|
|
53483
|
+
}],
|
|
51502
53484
|
"pipelineAnalytics.setTrackFlags": [{
|
|
51503
53485
|
name: "deviceId",
|
|
51504
53486
|
form: "single",
|
|
@@ -59370,7 +61352,7 @@ var ecowittConfigSchema = discriminatedUnion("transport", [object({
|
|
|
59370
61352
|
transport: literal("local"),
|
|
59371
61353
|
host: string().min(1).describe("Ecowitt gateway host name or IP address"),
|
|
59372
61354
|
port: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1).max(65535).default(80)).describe("Gateway HTTP port"),
|
|
59373
|
-
password: string().default("").describe("Gateway password (optional — newer firmware)"),
|
|
61355
|
+
password: string().default("").describe("Gateway password (optional — newer firmware)").meta({ secret: true }),
|
|
59374
61356
|
pollIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1e3).max(36e5).default(6e4)).describe("Live-data poll interval (ms)"),
|
|
59375
61357
|
mappingIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1e4).max(864e5).default(6e5)).describe("Sensor-map refresh interval (ms)"),
|
|
59376
61358
|
...baseFields
|