@camstack/addon-provider-rademacher 0.2.123 → 0.2.125
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 +3555 -126
- package/dist/addon.mjs +3555 -126
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -984,7 +984,7 @@ var Rademacher = class {
|
|
|
984
984
|
}
|
|
985
985
|
};
|
|
986
986
|
//#endregion
|
|
987
|
-
//#region ../types/dist/event-category-
|
|
987
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
988
988
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
989
989
|
EventCategory["SystemBoot"] = "system.boot";
|
|
990
990
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -1063,6 +1063,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
1063
1063
|
*/
|
|
1064
1064
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
1065
1065
|
/**
|
|
1066
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
1067
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
1068
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
1069
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
1070
|
+
*/
|
|
1071
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
1072
|
+
/**
|
|
1066
1073
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
1067
1074
|
* transitions from `failed` back to `healthy` (typically via the
|
|
1068
1075
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -6355,7 +6362,7 @@ var ZodIssueCode = {
|
|
|
6355
6362
|
var ZodFirstPartyTypeKind;
|
|
6356
6363
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6357
6364
|
//#endregion
|
|
6358
|
-
//#region ../types/dist/sleep-
|
|
6365
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6359
6366
|
/**
|
|
6360
6367
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6361
6368
|
* window to float samples (D455).
|
|
@@ -6434,6 +6441,97 @@ function buildAlawTable() {
|
|
|
6434
6441
|
}
|
|
6435
6442
|
buildUlawTable();
|
|
6436
6443
|
buildAlawTable();
|
|
6444
|
+
/** Is this field's stored value a credential? */
|
|
6445
|
+
function isSecretConfigField(field) {
|
|
6446
|
+
if (field.type === "password") return true;
|
|
6447
|
+
return "secret" in field && field.secret === true;
|
|
6448
|
+
}
|
|
6449
|
+
/**
|
|
6450
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
6451
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
6452
|
+
*/
|
|
6453
|
+
function isKeychainStoredField(field) {
|
|
6454
|
+
if (!isSecretConfigField(field)) return false;
|
|
6455
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
6456
|
+
return !("storage" in field && field.storage === "inline");
|
|
6457
|
+
}
|
|
6458
|
+
/**
|
|
6459
|
+
* What a settings blob holds where a secret used to be.
|
|
6460
|
+
*
|
|
6461
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
6462
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
6463
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
6464
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
6465
|
+
*
|
|
6466
|
+
* The same shapes travel to and from the admin UI:
|
|
6467
|
+
*
|
|
6468
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
6469
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
6470
|
+
* value is set, never the value.
|
|
6471
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
6472
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
6473
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
6474
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
6475
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
6476
|
+
*
|
|
6477
|
+
* Pure and browser-safe.
|
|
6478
|
+
*/
|
|
6479
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
6480
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6481
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
6482
|
+
function isRecord$2(value) {
|
|
6483
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6484
|
+
}
|
|
6485
|
+
function makeSecretMarker(ref) {
|
|
6486
|
+
return {
|
|
6487
|
+
$secret: ref,
|
|
6488
|
+
v: 1
|
|
6489
|
+
};
|
|
6490
|
+
}
|
|
6491
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6492
|
+
function isSecretMarker(value) {
|
|
6493
|
+
if (!isRecord$2(value)) return false;
|
|
6494
|
+
const ref = value["$secret"];
|
|
6495
|
+
return typeof ref === "string" && ref.length > 0;
|
|
6496
|
+
}
|
|
6497
|
+
function isSecretClear(value) {
|
|
6498
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6499
|
+
}
|
|
6500
|
+
/**
|
|
6501
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
6502
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
6503
|
+
* survives this function.
|
|
6504
|
+
*/
|
|
6505
|
+
function toSecretFieldView(stored) {
|
|
6506
|
+
if (isSecretMarker(stored)) return {
|
|
6507
|
+
$secret: stored.$secret,
|
|
6508
|
+
v: 1,
|
|
6509
|
+
set: true
|
|
6510
|
+
};
|
|
6511
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
6512
|
+
$secret: null,
|
|
6513
|
+
v: 1,
|
|
6514
|
+
set: true,
|
|
6515
|
+
inline: true
|
|
6516
|
+
};
|
|
6517
|
+
return null;
|
|
6518
|
+
}
|
|
6519
|
+
/**
|
|
6520
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
6521
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
6522
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
6523
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
6524
|
+
*/
|
|
6525
|
+
function classifySecretWrite(incoming) {
|
|
6526
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
6527
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
6528
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
6529
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
6530
|
+
return {
|
|
6531
|
+
kind: "set",
|
|
6532
|
+
value: incoming
|
|
6533
|
+
};
|
|
6534
|
+
}
|
|
6437
6535
|
Object.fromEntries([
|
|
6438
6536
|
{
|
|
6439
6537
|
id: "overview",
|
|
@@ -6605,33 +6703,19 @@ Object.fromEntries([
|
|
|
6605
6703
|
function isValuelessField(field) {
|
|
6606
6704
|
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";
|
|
6607
6705
|
}
|
|
6608
|
-
|
|
6609
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
6610
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
6611
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
6612
|
-
*
|
|
6613
|
-
* For each leaf field:
|
|
6614
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
6615
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
6616
|
-
*
|
|
6617
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
6618
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
6619
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
6620
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
6621
|
-
*/
|
|
6622
|
-
function hydrateSchema(schema, values) {
|
|
6706
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
6623
6707
|
return {
|
|
6624
6708
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
6625
6709
|
sections: schema.sections.map((section) => ({
|
|
6626
6710
|
...section,
|
|
6627
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
6711
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
6628
6712
|
}))
|
|
6629
6713
|
};
|
|
6630
6714
|
}
|
|
6631
|
-
function hydrateField(field, values) {
|
|
6715
|
+
function hydrateField(field, values, options) {
|
|
6632
6716
|
if (isValuelessField(field)) return field;
|
|
6633
6717
|
if (field.type === "group") {
|
|
6634
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
6718
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
6635
6719
|
return {
|
|
6636
6720
|
...field,
|
|
6637
6721
|
fields: hydratedChildren
|
|
@@ -6640,7 +6724,7 @@ function hydrateField(field, values) {
|
|
|
6640
6724
|
if (field.type === "sub-tabs") {
|
|
6641
6725
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
6642
6726
|
...tab,
|
|
6643
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
6727
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
6644
6728
|
}));
|
|
6645
6729
|
return {
|
|
6646
6730
|
...field,
|
|
@@ -6650,6 +6734,33 @@ function hydrateField(field, values) {
|
|
|
6650
6734
|
const key = field.key;
|
|
6651
6735
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
6652
6736
|
const defaultValue = field.default;
|
|
6737
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
6738
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
6739
|
+
...field,
|
|
6740
|
+
value: toSecretFieldView(storedValue)
|
|
6741
|
+
};
|
|
6742
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
6743
|
+
...field,
|
|
6744
|
+
value: null
|
|
6745
|
+
};
|
|
6746
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
6747
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
6748
|
+
if (secretItemKeys.length > 0) {
|
|
6749
|
+
const rows = storedValue.map((row) => {
|
|
6750
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
6751
|
+
const out = { ...row };
|
|
6752
|
+
for (const k of secretItemKeys) {
|
|
6753
|
+
const v = Reflect.get(row, k);
|
|
6754
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
6755
|
+
}
|
|
6756
|
+
return out;
|
|
6757
|
+
});
|
|
6758
|
+
return {
|
|
6759
|
+
...field,
|
|
6760
|
+
value: rows
|
|
6761
|
+
};
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6653
6764
|
if (field.multiple) {
|
|
6654
6765
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
6655
6766
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -6892,6 +7003,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
6892
7003
|
}
|
|
6893
7004
|
return out;
|
|
6894
7005
|
}
|
|
7006
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
7007
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
7008
|
+
function globalSecretScope() {
|
|
7009
|
+
return GLOBAL_SCOPE;
|
|
7010
|
+
}
|
|
7011
|
+
function encodeSegment(value) {
|
|
7012
|
+
return encodeURIComponent(value);
|
|
7013
|
+
}
|
|
7014
|
+
function decodeSegment(value) {
|
|
7015
|
+
try {
|
|
7016
|
+
return decodeURIComponent(value);
|
|
7017
|
+
} catch {
|
|
7018
|
+
return null;
|
|
7019
|
+
}
|
|
7020
|
+
}
|
|
7021
|
+
/**
|
|
7022
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
7023
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
7024
|
+
* `providers[authentik].clientSecret`.
|
|
7025
|
+
*/
|
|
7026
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
7027
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
7028
|
+
}
|
|
7029
|
+
function parseScope(segments) {
|
|
7030
|
+
switch (segments[0]) {
|
|
7031
|
+
case "global": return {
|
|
7032
|
+
scope: GLOBAL_SCOPE,
|
|
7033
|
+
used: 1
|
|
7034
|
+
};
|
|
7035
|
+
case "node": {
|
|
7036
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7037
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
7038
|
+
scope: {
|
|
7039
|
+
kind: "node",
|
|
7040
|
+
nodeId
|
|
7041
|
+
},
|
|
7042
|
+
used: 2
|
|
7043
|
+
};
|
|
7044
|
+
}
|
|
7045
|
+
case "device": {
|
|
7046
|
+
const raw = segments[1];
|
|
7047
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
7048
|
+
return {
|
|
7049
|
+
scope: {
|
|
7050
|
+
kind: "device",
|
|
7051
|
+
deviceId: Number(raw)
|
|
7052
|
+
},
|
|
7053
|
+
used: 2
|
|
7054
|
+
};
|
|
7055
|
+
}
|
|
7056
|
+
case "integration": {
|
|
7057
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7058
|
+
return id === null || id.length === 0 ? null : {
|
|
7059
|
+
scope: {
|
|
7060
|
+
kind: "integration",
|
|
7061
|
+
integrationId: id
|
|
7062
|
+
},
|
|
7063
|
+
used: 2
|
|
7064
|
+
};
|
|
7065
|
+
}
|
|
7066
|
+
case "row": {
|
|
7067
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7068
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
7069
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
7070
|
+
return {
|
|
7071
|
+
scope: {
|
|
7072
|
+
kind: "row",
|
|
7073
|
+
collection,
|
|
7074
|
+
rowId
|
|
7075
|
+
},
|
|
7076
|
+
used: 3
|
|
7077
|
+
};
|
|
7078
|
+
}
|
|
7079
|
+
default: return null;
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
7083
|
+
function parseSecretRef(ref) {
|
|
7084
|
+
if (!ref.startsWith("secret://")) return null;
|
|
7085
|
+
const segments = ref.slice(9).split("/");
|
|
7086
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
7087
|
+
if (owner === null || owner.length === 0) return null;
|
|
7088
|
+
const parsed = parseScope(segments.slice(1));
|
|
7089
|
+
if (parsed === null) return null;
|
|
7090
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
7091
|
+
if (fieldPath.length === 0) return null;
|
|
7092
|
+
return {
|
|
7093
|
+
owner,
|
|
7094
|
+
scope: parsed.scope,
|
|
7095
|
+
fieldPath
|
|
7096
|
+
};
|
|
7097
|
+
}
|
|
7098
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7099
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
7100
|
+
fieldPath;
|
|
7101
|
+
constructor(fieldPath, cause) {
|
|
7102
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
7103
|
+
this.fieldPath = fieldPath;
|
|
7104
|
+
this.name = "KeychainWriteRefusedError";
|
|
7105
|
+
}
|
|
7106
|
+
};
|
|
7107
|
+
var KEEP = { kind: "keep" };
|
|
7108
|
+
function isRecord$1(value) {
|
|
7109
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7110
|
+
}
|
|
7111
|
+
function defaultMintId() {
|
|
7112
|
+
return globalThis.crypto.randomUUID();
|
|
7113
|
+
}
|
|
7114
|
+
/** Every marker ref anywhere under `value`. */
|
|
7115
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
7116
|
+
if (isSecretMarker(value)) {
|
|
7117
|
+
out.push(value.$secret);
|
|
7118
|
+
return out;
|
|
7119
|
+
}
|
|
7120
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
7121
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7122
|
+
return out;
|
|
7123
|
+
}
|
|
7124
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
7125
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
7126
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
7127
|
+
}
|
|
7128
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
7129
|
+
const intent = classifySecretWrite(incoming);
|
|
7130
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
7131
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
7132
|
+
if (intent.kind === "keep") return KEEP;
|
|
7133
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
7134
|
+
if (intent.kind === "clear") {
|
|
7135
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
7136
|
+
return {
|
|
7137
|
+
kind: "value",
|
|
7138
|
+
value: null
|
|
7139
|
+
};
|
|
7140
|
+
}
|
|
7141
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
7142
|
+
kind: "value",
|
|
7143
|
+
value: stored
|
|
7144
|
+
};
|
|
7145
|
+
try {
|
|
7146
|
+
await ctx.secrets.put(ref, intent.value);
|
|
7147
|
+
} catch (err) {
|
|
7148
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
7149
|
+
}
|
|
7150
|
+
return {
|
|
7151
|
+
kind: "value",
|
|
7152
|
+
value: makeSecretMarker(ref)
|
|
7153
|
+
};
|
|
7154
|
+
}
|
|
7155
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
7156
|
+
function applyMember(out, key, result, storedParent) {
|
|
7157
|
+
if (result.kind === "value") {
|
|
7158
|
+
out[key] = result.value;
|
|
7159
|
+
return;
|
|
7160
|
+
}
|
|
7161
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
7162
|
+
else delete out[key];
|
|
7163
|
+
}
|
|
7164
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
7165
|
+
const out = { ...incoming };
|
|
7166
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
7167
|
+
return out;
|
|
7168
|
+
}
|
|
7169
|
+
function rowId(row, idKey) {
|
|
7170
|
+
const raw = row[idKey];
|
|
7171
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
7172
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
7173
|
+
return null;
|
|
7174
|
+
}
|
|
7175
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7176
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
7177
|
+
if (!Array.isArray(incoming)) {
|
|
7178
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7179
|
+
return {
|
|
7180
|
+
kind: "value",
|
|
7181
|
+
value: incoming
|
|
7182
|
+
};
|
|
7183
|
+
}
|
|
7184
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
7185
|
+
for (const row of storedRows) {
|
|
7186
|
+
const id = rowId(row, node.idKey);
|
|
7187
|
+
if (id !== null) storedById.set(id, row);
|
|
7188
|
+
}
|
|
7189
|
+
const kept = /* @__PURE__ */ new Set();
|
|
7190
|
+
const rows = [];
|
|
7191
|
+
for (const row of incoming) {
|
|
7192
|
+
if (!isRecord$1(row)) {
|
|
7193
|
+
rows.push(row);
|
|
7194
|
+
continue;
|
|
7195
|
+
}
|
|
7196
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7197
|
+
kept.add(id);
|
|
7198
|
+
const withId = {
|
|
7199
|
+
...row,
|
|
7200
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
7201
|
+
};
|
|
7202
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7203
|
+
const storedRow = storedById.get(id) ?? {};
|
|
7204
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
7205
|
+
}
|
|
7206
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
7207
|
+
return {
|
|
7208
|
+
kind: "value",
|
|
7209
|
+
value: rows
|
|
7210
|
+
};
|
|
7211
|
+
}
|
|
7212
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
7213
|
+
switch (node.kind) {
|
|
7214
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7215
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7216
|
+
case "object": {
|
|
7217
|
+
if (!isRecord$1(incoming)) {
|
|
7218
|
+
if (incoming === void 0) return KEEP;
|
|
7219
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7220
|
+
return {
|
|
7221
|
+
kind: "value",
|
|
7222
|
+
value: incoming
|
|
7223
|
+
};
|
|
7224
|
+
}
|
|
7225
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
7226
|
+
return {
|
|
7227
|
+
kind: "value",
|
|
7228
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
7229
|
+
};
|
|
7230
|
+
}
|
|
7231
|
+
}
|
|
7232
|
+
}
|
|
7233
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
7234
|
+
function splitNodeKey(key) {
|
|
7235
|
+
const at = key.indexOf("@");
|
|
7236
|
+
return at <= 0 ? {
|
|
7237
|
+
base: key,
|
|
7238
|
+
nodeId: null
|
|
7239
|
+
} : {
|
|
7240
|
+
base: key.slice(0, at),
|
|
7241
|
+
nodeId: key.slice(at + 1)
|
|
7242
|
+
};
|
|
7243
|
+
}
|
|
7244
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
7245
|
+
async function transformSecretWrite(input) {
|
|
7246
|
+
const deletes = [];
|
|
7247
|
+
const base = {
|
|
7248
|
+
secrets: input.secrets,
|
|
7249
|
+
mintId: input.mintId ?? defaultMintId,
|
|
7250
|
+
deletes,
|
|
7251
|
+
operatorWrite: input.operatorWrite === true
|
|
7252
|
+
};
|
|
7253
|
+
const out = {};
|
|
7254
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
7255
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
7256
|
+
const node = input.tree.get(baseKey);
|
|
7257
|
+
if (node === void 0) {
|
|
7258
|
+
out[key] = incoming;
|
|
7259
|
+
continue;
|
|
7260
|
+
}
|
|
7261
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
7262
|
+
kind: "node",
|
|
7263
|
+
nodeId
|
|
7264
|
+
} : input.scope ?? globalSecretScope();
|
|
7265
|
+
const result = await writeNode({
|
|
7266
|
+
...base,
|
|
7267
|
+
scope
|
|
7268
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
7269
|
+
if (result.kind === "value") out[key] = result.value;
|
|
7270
|
+
}
|
|
7271
|
+
return {
|
|
7272
|
+
patch: out,
|
|
7273
|
+
afterWrite: async () => {
|
|
7274
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
7275
|
+
try {
|
|
7276
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
7277
|
+
return { orphaned: [] };
|
|
7278
|
+
} catch {
|
|
7279
|
+
return { orphaned: [...new Set(deletes)] };
|
|
7280
|
+
}
|
|
7281
|
+
}
|
|
7282
|
+
};
|
|
7283
|
+
}
|
|
7284
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7285
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7286
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7287
|
+
}
|
|
7288
|
+
/**
|
|
7289
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7290
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
7291
|
+
*/
|
|
7292
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7293
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7294
|
+
const owner = options.ownedBy;
|
|
7295
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7296
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7297
|
+
if (refs.length === 0) return {
|
|
7298
|
+
value,
|
|
7299
|
+
unresolved: []
|
|
7300
|
+
};
|
|
7301
|
+
const answers = await secrets.resolve(refs);
|
|
7302
|
+
const unresolved = [];
|
|
7303
|
+
for (const ref of new Set(refs)) {
|
|
7304
|
+
const answer = answers[ref];
|
|
7305
|
+
if (answer === void 0) unresolved.push({
|
|
7306
|
+
ref,
|
|
7307
|
+
reason: "not-initialized"
|
|
7308
|
+
});
|
|
7309
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
7310
|
+
ref,
|
|
7311
|
+
reason: answer.reason
|
|
7312
|
+
});
|
|
7313
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
7314
|
+
ref,
|
|
7315
|
+
reason: answer.kind
|
|
7316
|
+
});
|
|
7317
|
+
}
|
|
7318
|
+
const substitute = (v) => {
|
|
7319
|
+
if (isSecretMarker(v)) {
|
|
7320
|
+
if (!inScope(v.$secret)) return {
|
|
7321
|
+
keep: true,
|
|
7322
|
+
value: v
|
|
7323
|
+
};
|
|
7324
|
+
const answer = answers[v.$secret];
|
|
7325
|
+
if (answer?.kind === "value") return {
|
|
7326
|
+
keep: true,
|
|
7327
|
+
value: answer.value
|
|
7328
|
+
};
|
|
7329
|
+
return keepMarker ? {
|
|
7330
|
+
keep: true,
|
|
7331
|
+
value: v
|
|
7332
|
+
} : {
|
|
7333
|
+
keep: false,
|
|
7334
|
+
value: void 0
|
|
7335
|
+
};
|
|
7336
|
+
}
|
|
7337
|
+
if (Array.isArray(v)) {
|
|
7338
|
+
const items = [];
|
|
7339
|
+
for (const item of v) {
|
|
7340
|
+
const s = substitute(item);
|
|
7341
|
+
if (s.keep) items.push(s.value);
|
|
7342
|
+
}
|
|
7343
|
+
return {
|
|
7344
|
+
keep: true,
|
|
7345
|
+
value: items
|
|
7346
|
+
};
|
|
7347
|
+
}
|
|
7348
|
+
if (isRecord$1(v)) {
|
|
7349
|
+
const out = {};
|
|
7350
|
+
for (const [k, child] of Object.entries(v)) {
|
|
7351
|
+
const s = substitute(child);
|
|
7352
|
+
if (s.keep) out[k] = s.value;
|
|
7353
|
+
}
|
|
7354
|
+
return {
|
|
7355
|
+
keep: true,
|
|
7356
|
+
value: out
|
|
7357
|
+
};
|
|
7358
|
+
}
|
|
7359
|
+
return {
|
|
7360
|
+
keep: true,
|
|
7361
|
+
value: v
|
|
7362
|
+
};
|
|
7363
|
+
};
|
|
7364
|
+
return {
|
|
7365
|
+
value: substitute(value).value,
|
|
7366
|
+
unresolved
|
|
7367
|
+
};
|
|
7368
|
+
}
|
|
7369
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7370
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7371
|
+
ref;
|
|
7372
|
+
reason;
|
|
7373
|
+
constructor(ref, reason) {
|
|
7374
|
+
super(`secret ${ref} was not replaced: its stored value cannot be read right now (${reason}), and an addon may not overwrite a secret it cannot see. Nothing was written.`);
|
|
7375
|
+
this.ref = ref;
|
|
7376
|
+
this.reason = reason;
|
|
7377
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7378
|
+
}
|
|
7379
|
+
};
|
|
7380
|
+
function isRecord(value) {
|
|
7381
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7382
|
+
}
|
|
7383
|
+
function resolvedValue(pass, marker) {
|
|
7384
|
+
const answer = pass.answers[marker.$secret];
|
|
7385
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7386
|
+
}
|
|
7387
|
+
async function atMarker(pass, incoming, stored) {
|
|
7388
|
+
if (incoming === null) return stored;
|
|
7389
|
+
if (typeof incoming !== "string") return incoming;
|
|
7390
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7391
|
+
const intent = classifySecretWrite(incoming);
|
|
7392
|
+
if (intent.kind !== "set") return stored;
|
|
7393
|
+
const ref = stored.$secret;
|
|
7394
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7395
|
+
const answer = pass.answers[ref];
|
|
7396
|
+
if ((answer === void 0 || answer.kind === "unavailable" || answer.kind === "forbidden") && !pass.operatorWrite) throw new SecretOverwriteRefusedError(ref, answer === void 0 ? "not-initialized" : answer.kind === "unavailable" ? answer.reason : answer.kind);
|
|
7397
|
+
try {
|
|
7398
|
+
await pass.secrets.put(ref, intent.value);
|
|
7399
|
+
} catch (err) {
|
|
7400
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7401
|
+
}
|
|
7402
|
+
pass.changedRefs.push(ref);
|
|
7403
|
+
return stored;
|
|
7404
|
+
}
|
|
7405
|
+
function inArray(pass, incoming, stored) {
|
|
7406
|
+
return incoming.map((item, index) => {
|
|
7407
|
+
const twin = stored[index];
|
|
7408
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7409
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7410
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7411
|
+
return item;
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7414
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7415
|
+
const out = { ...incoming };
|
|
7416
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7417
|
+
const twin = stored[key];
|
|
7418
|
+
if (isSecretMarker(twin)) {
|
|
7419
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7420
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7421
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7422
|
+
}
|
|
7423
|
+
return out;
|
|
7424
|
+
}
|
|
7425
|
+
async function walk(pass, incoming, stored) {
|
|
7426
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7427
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7428
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7429
|
+
const out = { ...incoming };
|
|
7430
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7431
|
+
return out;
|
|
7432
|
+
}
|
|
7433
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7434
|
+
async function restoreUnchangedSecrets(input) {
|
|
7435
|
+
const refs = [];
|
|
7436
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7437
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7438
|
+
if (owned.length === 0) return {
|
|
7439
|
+
patch: input.patch,
|
|
7440
|
+
changedRefs: []
|
|
7441
|
+
};
|
|
7442
|
+
const pass = {
|
|
7443
|
+
secrets: input.secrets,
|
|
7444
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7445
|
+
operatorWrite: input.operatorWrite,
|
|
7446
|
+
changedRefs: []
|
|
7447
|
+
};
|
|
7448
|
+
const out = {};
|
|
7449
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7450
|
+
return {
|
|
7451
|
+
patch: out,
|
|
7452
|
+
changedRefs: pass.changedRefs
|
|
7453
|
+
};
|
|
7454
|
+
}
|
|
7455
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7456
|
+
function isJsonEqual(a, b) {
|
|
7457
|
+
if (Object.is(a, b)) return true;
|
|
7458
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7459
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7460
|
+
const keys = Object.keys(a);
|
|
7461
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7462
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7463
|
+
}
|
|
7464
|
+
return false;
|
|
7465
|
+
}
|
|
7466
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7467
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7468
|
+
const out = {};
|
|
7469
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7470
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7471
|
+
out[key] = value;
|
|
7472
|
+
}
|
|
7473
|
+
return out;
|
|
7474
|
+
}
|
|
7475
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7476
|
+
function markerKeysOf(blob, owner) {
|
|
7477
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7478
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7479
|
+
return keys;
|
|
7480
|
+
}
|
|
7481
|
+
function nodeFromStored(value, owner) {
|
|
7482
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7483
|
+
if (!isRecord(value)) return null;
|
|
7484
|
+
const children = /* @__PURE__ */ new Map();
|
|
7485
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7486
|
+
const node = nodeFromStored(child, owner);
|
|
7487
|
+
if (node !== null) children.set(key, node);
|
|
7488
|
+
}
|
|
7489
|
+
return children.size > 0 ? {
|
|
7490
|
+
kind: "object",
|
|
7491
|
+
children
|
|
7492
|
+
} : null;
|
|
7493
|
+
}
|
|
7494
|
+
/**
|
|
7495
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7496
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7497
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7498
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7499
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7500
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7501
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7502
|
+
* over.
|
|
7503
|
+
*/
|
|
7504
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7505
|
+
const added = /* @__PURE__ */ new Map();
|
|
7506
|
+
for (const key of keys) {
|
|
7507
|
+
const at = key.indexOf("@");
|
|
7508
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7509
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7510
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7511
|
+
if (node !== null) added.set(base, node);
|
|
7512
|
+
}
|
|
7513
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7514
|
+
}
|
|
7515
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7516
|
+
async function readStoredAddonBlob(raw) {
|
|
7517
|
+
const threeWay = raw.readAddonStoreResult;
|
|
7518
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
7519
|
+
const result = await threeWay.call(raw);
|
|
7520
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7521
|
+
return result.kind === "missing" ? {} : result.value;
|
|
7522
|
+
}
|
|
7523
|
+
function touchesTree(tree, patch) {
|
|
7524
|
+
if (tree.size === 0) return false;
|
|
7525
|
+
for (const key of Object.keys(patch)) {
|
|
7526
|
+
const at = key.indexOf("@");
|
|
7527
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7528
|
+
}
|
|
7529
|
+
return false;
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7533
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7534
|
+
*/
|
|
7535
|
+
var MarkerKeyIndex = class {
|
|
7536
|
+
owner;
|
|
7537
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7538
|
+
constructor(owner) {
|
|
7539
|
+
this.owner = owner;
|
|
7540
|
+
}
|
|
7541
|
+
seen(store, blob) {
|
|
7542
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7543
|
+
}
|
|
7544
|
+
wrote(store, patch) {
|
|
7545
|
+
const keys = this.byStore.get(store);
|
|
7546
|
+
if (keys === void 0) return;
|
|
7547
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7548
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7549
|
+
else keys.delete(key);
|
|
7550
|
+
}
|
|
7551
|
+
mayHoldMarkers(store, patch) {
|
|
7552
|
+
const keys = this.byStore.get(store);
|
|
7553
|
+
if (keys === void 0) return true;
|
|
7554
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7555
|
+
}
|
|
7556
|
+
};
|
|
7557
|
+
function createHandle(raw, opts) {
|
|
7558
|
+
const chains = /* @__PURE__ */ new Map();
|
|
7559
|
+
const serialize = (key, fn) => {
|
|
7560
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
7561
|
+
const tail = next.catch(() => void 0);
|
|
7562
|
+
chains.set(key, tail);
|
|
7563
|
+
tail.then(() => {
|
|
7564
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
7565
|
+
});
|
|
7566
|
+
return next;
|
|
7567
|
+
};
|
|
7568
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7569
|
+
const resolveRead = async (store, blob) => {
|
|
7570
|
+
index.seen(store, blob);
|
|
7571
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7572
|
+
unresolved: "keep-marker",
|
|
7573
|
+
ownedBy: opts.secrets.owner
|
|
7574
|
+
});
|
|
7575
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7576
|
+
return value;
|
|
7577
|
+
};
|
|
7578
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7579
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7580
|
+
await rawWrite(patch);
|
|
7581
|
+
index.wrote(store, patch);
|
|
7582
|
+
return { changed: true };
|
|
7583
|
+
}
|
|
7584
|
+
return serialize(store, async () => {
|
|
7585
|
+
const stored = await readStored();
|
|
7586
|
+
index.seen(store, stored);
|
|
7587
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7588
|
+
const restored = await restoreUnchangedSecrets({
|
|
7589
|
+
patch,
|
|
7590
|
+
stored,
|
|
7591
|
+
secrets: opts.secrets,
|
|
7592
|
+
operatorWrite
|
|
7593
|
+
});
|
|
7594
|
+
const result = await transformSecretWrite({
|
|
7595
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7596
|
+
secrets: opts.secrets,
|
|
7597
|
+
patch: restored.patch,
|
|
7598
|
+
stored,
|
|
7599
|
+
...scope !== void 0 ? { scope } : {},
|
|
7600
|
+
operatorWrite
|
|
7601
|
+
});
|
|
7602
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7603
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7604
|
+
if (wroteBlob) {
|
|
7605
|
+
await rawWrite(effective);
|
|
7606
|
+
index.wrote(store, effective);
|
|
7607
|
+
}
|
|
7608
|
+
const { orphaned } = await result.afterWrite();
|
|
7609
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7610
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7611
|
+
});
|
|
7612
|
+
};
|
|
7613
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7614
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7615
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7616
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7617
|
+
const overrides = {
|
|
7618
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7619
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7620
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7621
|
+
return result.kind === "value" ? {
|
|
7622
|
+
kind: "value",
|
|
7623
|
+
value: await resolveRead("addon", result.value)
|
|
7624
|
+
} : result;
|
|
7625
|
+
} } : {},
|
|
7626
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7627
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7628
|
+
if (result.kind !== "present") return result;
|
|
7629
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7630
|
+
unresolved: "keep-marker",
|
|
7631
|
+
ownedBy: opts.secrets.owner
|
|
7632
|
+
});
|
|
7633
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7634
|
+
return {
|
|
7635
|
+
kind: "present",
|
|
7636
|
+
value: value[key]
|
|
7637
|
+
};
|
|
7638
|
+
} } : {},
|
|
7639
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7640
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7641
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7642
|
+
const out = /* @__PURE__ */ new Map();
|
|
7643
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7644
|
+
return out;
|
|
7645
|
+
} } : {},
|
|
7646
|
+
writeAddonStore: async (patch) => {
|
|
7647
|
+
await writeAddon(patch);
|
|
7648
|
+
},
|
|
7649
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7650
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7651
|
+
kind: "device",
|
|
7652
|
+
deviceId
|
|
7653
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7654
|
+
}
|
|
7655
|
+
};
|
|
7656
|
+
return {
|
|
7657
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7658
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7659
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7660
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7661
|
+
} }),
|
|
7662
|
+
raw: {
|
|
7663
|
+
readAddonStore: async () => {
|
|
7664
|
+
const blob = await raw.readAddonStore();
|
|
7665
|
+
index.seen("addon", blob);
|
|
7666
|
+
return blob;
|
|
7667
|
+
},
|
|
7668
|
+
readDeviceStore: async (deviceId) => {
|
|
7669
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7670
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7671
|
+
return blob;
|
|
7672
|
+
}
|
|
7673
|
+
},
|
|
7674
|
+
writeAddonStore: writeAddon
|
|
7675
|
+
};
|
|
7676
|
+
}
|
|
7677
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7678
|
+
function createSecretAwareContext(context, opts) {
|
|
7679
|
+
const raw = context.settings;
|
|
7680
|
+
if (raw === void 0) return {
|
|
7681
|
+
context,
|
|
7682
|
+
handle: null
|
|
7683
|
+
};
|
|
7684
|
+
const handle = createHandle(raw, opts);
|
|
7685
|
+
return {
|
|
7686
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7687
|
+
if (prop === "settings") return handle.settings;
|
|
7688
|
+
return Reflect.get(target, prop, receiver);
|
|
7689
|
+
} }),
|
|
7690
|
+
handle
|
|
7691
|
+
};
|
|
7692
|
+
}
|
|
7693
|
+
var LEAF = { kind: "leaf" };
|
|
7694
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
7695
|
+
function collectFields(fields, out) {
|
|
7696
|
+
for (const field of fields) {
|
|
7697
|
+
if (field.type === "group") {
|
|
7698
|
+
collectFields(field.fields, out);
|
|
7699
|
+
continue;
|
|
7700
|
+
}
|
|
7701
|
+
if (field.type === "sub-tabs") {
|
|
7702
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
7703
|
+
continue;
|
|
7704
|
+
}
|
|
7705
|
+
if (field.type === "editable-array") {
|
|
7706
|
+
const item = /* @__PURE__ */ new Map();
|
|
7707
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
7708
|
+
if (item.size > 0) out.set(field.key, {
|
|
7709
|
+
kind: "array",
|
|
7710
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
7711
|
+
item
|
|
7712
|
+
});
|
|
7713
|
+
continue;
|
|
7714
|
+
}
|
|
7715
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
7716
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
7717
|
+
}
|
|
7718
|
+
}
|
|
7719
|
+
/** The secret tree a settings schema declares. */
|
|
7720
|
+
function secretTreeFromSchema(schema) {
|
|
7721
|
+
const out = /* @__PURE__ */ new Map();
|
|
7722
|
+
if (schema === null) return out;
|
|
7723
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
7724
|
+
return out;
|
|
7725
|
+
}
|
|
7726
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
7727
|
+
function parseSecretStatePath(path) {
|
|
7728
|
+
const segments = [];
|
|
7729
|
+
for (const raw of path.split(".")) {
|
|
7730
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
7731
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
7732
|
+
segments.push(m[2] !== void 0 ? {
|
|
7733
|
+
key: m[1],
|
|
7734
|
+
idKey: m[2]
|
|
7735
|
+
} : { key: m[1] });
|
|
7736
|
+
}
|
|
7737
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
7738
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
7739
|
+
return segments;
|
|
7740
|
+
}
|
|
7741
|
+
function insert(into, segments) {
|
|
7742
|
+
const [head, ...rest] = segments;
|
|
7743
|
+
if (head === void 0) return;
|
|
7744
|
+
if (rest.length === 0) {
|
|
7745
|
+
into.set(head.key, LEAF);
|
|
7746
|
+
return;
|
|
7747
|
+
}
|
|
7748
|
+
const existing = into.get(head.key);
|
|
7749
|
+
if (head.idKey !== void 0) {
|
|
7750
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
7751
|
+
insert(item, rest);
|
|
7752
|
+
into.set(head.key, {
|
|
7753
|
+
kind: "array",
|
|
7754
|
+
idKey: head.idKey,
|
|
7755
|
+
item
|
|
7756
|
+
});
|
|
7757
|
+
return;
|
|
7758
|
+
}
|
|
7759
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
7760
|
+
insert(children, rest);
|
|
7761
|
+
into.set(head.key, {
|
|
7762
|
+
kind: "object",
|
|
7763
|
+
children
|
|
7764
|
+
});
|
|
7765
|
+
}
|
|
7766
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
7767
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
7768
|
+
if (paths.length === 0) return tree;
|
|
7769
|
+
const out = new Map(tree);
|
|
7770
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
7771
|
+
return out;
|
|
7772
|
+
}
|
|
7773
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
7774
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
7775
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
7776
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7777
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
6895
7778
|
/**
|
|
6896
7779
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
6897
7780
|
*
|
|
@@ -6961,6 +7844,33 @@ var BaseAddon = class {
|
|
|
6961
7844
|
settingsStoreReady = false;
|
|
6962
7845
|
/** Default config values. Provided via constructor. */
|
|
6963
7846
|
defaults;
|
|
7847
|
+
/**
|
|
7848
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
7849
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
7850
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
7851
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
7852
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
7853
|
+
*/
|
|
7854
|
+
secretStatePaths = [];
|
|
7855
|
+
_addonSecretTree = null;
|
|
7856
|
+
_deviceSecretTree = null;
|
|
7857
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7858
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
7859
|
+
_unresolvedSecrets = [];
|
|
7860
|
+
_secretRetryTimer = null;
|
|
7861
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7862
|
+
_secretChangeTimer = null;
|
|
7863
|
+
_secretChangeUnsub = null;
|
|
7864
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7865
|
+
_operatorWriteDepth = 0;
|
|
7866
|
+
/**
|
|
7867
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7868
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7869
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7870
|
+
*/
|
|
7871
|
+
_secretSettings = null;
|
|
7872
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7873
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6964
7874
|
constructor(defaults) {
|
|
6965
7875
|
this.defaults = defaults;
|
|
6966
7876
|
this._config = { ...defaults };
|
|
@@ -6996,8 +7906,26 @@ var BaseAddon = class {
|
|
|
6996
7906
|
return this._config;
|
|
6997
7907
|
}
|
|
6998
7908
|
async initialize(context) {
|
|
6999
|
-
|
|
7909
|
+
const secrets = context.secrets;
|
|
7910
|
+
if (secrets !== void 0) {
|
|
7911
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7912
|
+
secrets,
|
|
7913
|
+
addonTree: () => this.addonSecretTree(),
|
|
7914
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7915
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7916
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7917
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7918
|
+
});
|
|
7919
|
+
this._ctx = wrapped;
|
|
7920
|
+
this._secretSettings = handle;
|
|
7921
|
+
} else {
|
|
7922
|
+
this._ctx = context;
|
|
7923
|
+
this._secretSettings = null;
|
|
7924
|
+
}
|
|
7000
7925
|
await this.resolveConfig();
|
|
7926
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7927
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
7928
|
+
});
|
|
7001
7929
|
const result = await this.onInitialize();
|
|
7002
7930
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
7003
7931
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -7030,6 +7958,12 @@ var BaseAddon = class {
|
|
|
7030
7958
|
*/
|
|
7031
7959
|
async onHubReachable() {}
|
|
7032
7960
|
async shutdown() {
|
|
7961
|
+
this._secretChangeUnsub?.();
|
|
7962
|
+
this._secretChangeUnsub = null;
|
|
7963
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7964
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7965
|
+
this._secretRetryTimer = null;
|
|
7966
|
+
this._secretChangeTimer = null;
|
|
7033
7967
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
7034
7968
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
7035
7969
|
await this.onShutdown();
|
|
@@ -7104,11 +8038,8 @@ var BaseAddon = class {
|
|
|
7104
8038
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7105
8039
|
const schema = this.globalSettingsSchema(cap);
|
|
7106
8040
|
if (!schema) return { sections: [] };
|
|
7107
|
-
const projected = await this.
|
|
7108
|
-
return hydrateSchema(schema, overlay ? {
|
|
7109
|
-
...projected,
|
|
7110
|
-
...overlay
|
|
7111
|
-
} : projected);
|
|
8041
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8042
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7112
8043
|
}
|
|
7113
8044
|
/**
|
|
7114
8045
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7153,11 +8084,11 @@ var BaseAddon = class {
|
|
|
7153
8084
|
});
|
|
7154
8085
|
}
|
|
7155
8086
|
if (sections.length === 0) return null;
|
|
7156
|
-
const projected = await this.
|
|
8087
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7157
8088
|
return hydrateSchema({
|
|
7158
8089
|
...schema,
|
|
7159
8090
|
sections
|
|
7160
|
-
}, projected);
|
|
8091
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
7161
8092
|
}
|
|
7162
8093
|
/**
|
|
7163
8094
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -7170,12 +8101,50 @@ var BaseAddon = class {
|
|
|
7170
8101
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7171
8102
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7172
8103
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8104
|
+
*
|
|
8105
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
8106
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
8107
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
8108
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
8109
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
8110
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7173
8111
|
*/
|
|
7174
8112
|
async resolveGlobalStore(nodeId, cap) {
|
|
7175
8113
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8114
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8115
|
+
}
|
|
8116
|
+
projectForNode(store, nodeId, cap) {
|
|
7176
8117
|
const keys = this.perNodeKeys(cap);
|
|
7177
8118
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7178
|
-
return keys.size > 0 ? projectStore(
|
|
8119
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
8120
|
+
}
|
|
8121
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8122
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
8123
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8124
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8125
|
+
}
|
|
8126
|
+
/**
|
|
8127
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
8128
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
8129
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
8130
|
+
* its value.
|
|
8131
|
+
*/
|
|
8132
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
8133
|
+
const secrets = this._ctx?.secrets;
|
|
8134
|
+
const merged = {
|
|
8135
|
+
...stored,
|
|
8136
|
+
...overlay
|
|
8137
|
+
};
|
|
8138
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
8139
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
8140
|
+
unresolved: "keep-marker",
|
|
8141
|
+
ownedBy: secrets.owner
|
|
8142
|
+
});
|
|
8143
|
+
for (const key of Object.keys(overlay)) {
|
|
8144
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
8145
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
8146
|
+
}
|
|
8147
|
+
return merged;
|
|
7179
8148
|
}
|
|
7180
8149
|
/**
|
|
7181
8150
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7211,18 +8180,58 @@ var BaseAddon = class {
|
|
|
7211
8180
|
value: result.value[key]
|
|
7212
8181
|
};
|
|
7213
8182
|
}
|
|
8183
|
+
/**
|
|
8184
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8185
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
8186
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8187
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
8188
|
+
* writing back what it read is not (D787).
|
|
8189
|
+
*/
|
|
8190
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
8191
|
+
this._operatorWriteDepth++;
|
|
8192
|
+
try {
|
|
8193
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8194
|
+
} finally {
|
|
8195
|
+
this._operatorWriteDepth--;
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
7214
8198
|
async updateGlobalSettings(patch, nodeId) {
|
|
8199
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8200
|
+
}
|
|
8201
|
+
/**
|
|
8202
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8203
|
+
*
|
|
8204
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
8205
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
8206
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
8207
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8208
|
+
*/
|
|
8209
|
+
async clearSecrets(keys, nodeId) {
|
|
8210
|
+
const tree = this.addonSecretTree();
|
|
8211
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
8212
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
8213
|
+
const patch = {};
|
|
8214
|
+
for (const key of keys) {
|
|
8215
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8216
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8217
|
+
}
|
|
8218
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8219
|
+
}
|
|
8220
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
7215
8221
|
const keys = this.perNodeKeys();
|
|
7216
8222
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7217
8223
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7218
|
-
const barePatch = patch;
|
|
7219
8224
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7220
|
-
|
|
8225
|
+
const handle = this._secretSettings;
|
|
8226
|
+
if (handle !== null) {
|
|
8227
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8228
|
+
if (!changed) return;
|
|
8229
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7221
8230
|
if (target !== localNode) return;
|
|
7222
8231
|
await this.resolveConfig();
|
|
7223
8232
|
await this.onConfigChanged();
|
|
7224
8233
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
7225
|
-
this.maybeAutoRestart(
|
|
8234
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
7226
8235
|
}
|
|
7227
8236
|
/**
|
|
7228
8237
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -7247,7 +8256,7 @@ var BaseAddon = class {
|
|
|
7247
8256
|
* time to return its response before the addon is torn down and
|
|
7248
8257
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
7249
8258
|
*/
|
|
7250
|
-
maybeAutoRestart(
|
|
8259
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
7251
8260
|
if (!schema) return;
|
|
7252
8261
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
7253
8262
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -7255,13 +8264,13 @@ var BaseAddon = class {
|
|
|
7255
8264
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
7256
8265
|
}
|
|
7257
8266
|
if (restartKeys.size === 0) return;
|
|
7258
|
-
if (!
|
|
8267
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
7259
8268
|
const ctx = this._ctx;
|
|
7260
8269
|
if (!ctx) return;
|
|
7261
8270
|
const addonId = ctx.id;
|
|
7262
8271
|
setImmediate(() => {
|
|
7263
8272
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
7264
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
8273
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7265
8274
|
}).catch((err) => {
|
|
7266
8275
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7267
8276
|
});
|
|
@@ -7270,7 +8279,7 @@ var BaseAddon = class {
|
|
|
7270
8279
|
async getDeviceSettings(deviceId) {
|
|
7271
8280
|
const schema = this.deviceSettingsSchema();
|
|
7272
8281
|
if (!schema) return { sections: [] };
|
|
7273
|
-
return hydrateSchema(schema, await this.
|
|
8282
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7274
8283
|
}
|
|
7275
8284
|
async updateDeviceSettings(deviceId, patch) {
|
|
7276
8285
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7400,7 +8409,7 @@ var BaseAddon = class {
|
|
|
7400
8409
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
7401
8410
|
*/
|
|
7402
8411
|
async resolveConfig() {
|
|
7403
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
8412
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
7404
8413
|
const perNode = this.perNodeKeys();
|
|
7405
8414
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7406
8415
|
const resolved = { ...this.defaults };
|
|
@@ -7425,7 +8434,7 @@ var BaseAddon = class {
|
|
|
7425
8434
|
key,
|
|
7426
8435
|
schema,
|
|
7427
8436
|
fallback,
|
|
7428
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
8437
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
7429
8438
|
write: async (patch) => {
|
|
7430
8439
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
7431
8440
|
},
|
|
@@ -7442,7 +8451,7 @@ var BaseAddon = class {
|
|
|
7442
8451
|
key,
|
|
7443
8452
|
schema,
|
|
7444
8453
|
fallback,
|
|
7445
|
-
read: async () => await this.
|
|
8454
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7446
8455
|
write: async (patch) => {
|
|
7447
8456
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7448
8457
|
},
|
|
@@ -7454,6 +8463,87 @@ var BaseAddon = class {
|
|
|
7454
8463
|
} })
|
|
7455
8464
|
});
|
|
7456
8465
|
}
|
|
8466
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8467
|
+
addonSecretTree() {
|
|
8468
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
8469
|
+
return this._addonSecretTree;
|
|
8470
|
+
}
|
|
8471
|
+
deviceSecretTree() {
|
|
8472
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
8473
|
+
return this._deviceSecretTree;
|
|
8474
|
+
}
|
|
8475
|
+
/**
|
|
8476
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
8477
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
8478
|
+
* an addon whose function needs one should report itself degraded rather
|
|
8479
|
+
* than start on an empty credential.
|
|
8480
|
+
*/
|
|
8481
|
+
get unresolvedSecrets() {
|
|
8482
|
+
return this._unresolvedSecrets;
|
|
8483
|
+
}
|
|
8484
|
+
/**
|
|
8485
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
8486
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
8487
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
8488
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
8489
|
+
* ever written back from here.
|
|
8490
|
+
*/
|
|
8491
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
8492
|
+
const secrets = this._ctx?.secrets;
|
|
8493
|
+
if (secrets === void 0) return blob;
|
|
8494
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
8495
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
8496
|
+
if (refs.length === 0) {
|
|
8497
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
8498
|
+
return blob;
|
|
8499
|
+
}
|
|
8500
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
8501
|
+
if (trackForConfig) {
|
|
8502
|
+
this._unresolvedSecrets = unresolved;
|
|
8503
|
+
if (unresolved.length > 0) {
|
|
8504
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
8505
|
+
ref: u.ref,
|
|
8506
|
+
reason: u.reason
|
|
8507
|
+
})) } });
|
|
8508
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
8509
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
8510
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
8511
|
+
}
|
|
8512
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
8513
|
+
}
|
|
8514
|
+
return value;
|
|
8515
|
+
}
|
|
8516
|
+
/**
|
|
8517
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8518
|
+
* keychain the context's own view is already raw.
|
|
8519
|
+
*/
|
|
8520
|
+
rawSettings() {
|
|
8521
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8522
|
+
}
|
|
8523
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8524
|
+
logUnresolvedRead(unresolved) {
|
|
8525
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8526
|
+
if (fresh.length === 0) return;
|
|
8527
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8528
|
+
this._ctx?.logger?.warn?.("settings read: a stored secret is unavailable — it reads as its marker, not as a value", { meta: { secrets: fresh.map((u) => ({
|
|
8529
|
+
ref: u.ref,
|
|
8530
|
+
reason: u.reason
|
|
8531
|
+
})) } });
|
|
8532
|
+
}
|
|
8533
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8534
|
+
scheduleSecretReresolve(delayMs) {
|
|
8535
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
8536
|
+
if (this[timerOf] !== null) return;
|
|
8537
|
+
const timer = setTimeout(() => {
|
|
8538
|
+
this[timerOf] = null;
|
|
8539
|
+
if (this._ctx === null) return;
|
|
8540
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
8541
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
8542
|
+
});
|
|
8543
|
+
}, delayMs);
|
|
8544
|
+
timer.unref?.();
|
|
8545
|
+
this[timerOf] = timer;
|
|
8546
|
+
}
|
|
7457
8547
|
/**
|
|
7458
8548
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
7459
8549
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7466,7 +8556,7 @@ var BaseAddon = class {
|
|
|
7466
8556
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7467
8557
|
*/
|
|
7468
8558
|
async readAddonStoreWithRetry() {
|
|
7469
|
-
const settings = this.
|
|
8559
|
+
const settings = this.rawSettings();
|
|
7470
8560
|
if (!settings) return {};
|
|
7471
8561
|
const delaysMs = [
|
|
7472
8562
|
150,
|
|
@@ -8029,6 +9119,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8029
9119
|
kind: "mutation",
|
|
8030
9120
|
auth: "admin"
|
|
8031
9121
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
9122
|
+
function defOf(schema) {
|
|
9123
|
+
return schema._zod?.def ?? {};
|
|
9124
|
+
}
|
|
9125
|
+
function declaredHere(schema) {
|
|
9126
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
9127
|
+
}
|
|
9128
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9129
|
+
var WRAPPERS = new Set([
|
|
9130
|
+
"optional",
|
|
9131
|
+
"nullable",
|
|
9132
|
+
"default",
|
|
9133
|
+
"prefault",
|
|
9134
|
+
"catch",
|
|
9135
|
+
"readonly",
|
|
9136
|
+
"nonoptional"
|
|
9137
|
+
]);
|
|
9138
|
+
/**
|
|
9139
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
9140
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9141
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9142
|
+
* `.transform` on `in`).
|
|
9143
|
+
*/
|
|
9144
|
+
function layersOf(schema) {
|
|
9145
|
+
const out = [];
|
|
9146
|
+
const queue = [schema];
|
|
9147
|
+
while (queue.length > 0) {
|
|
9148
|
+
const s = queue.shift();
|
|
9149
|
+
if (!s || out.includes(s)) continue;
|
|
9150
|
+
out.push(s);
|
|
9151
|
+
const def = defOf(s);
|
|
9152
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9153
|
+
if (def.type === "pipe") {
|
|
9154
|
+
if (def.in) queue.push(def.in);
|
|
9155
|
+
if (def.out) queue.push(def.out);
|
|
9156
|
+
}
|
|
9157
|
+
}
|
|
9158
|
+
return out;
|
|
9159
|
+
}
|
|
9160
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9161
|
+
function isZodSecret(schema) {
|
|
9162
|
+
return layersOf(schema).some(declaredHere);
|
|
9163
|
+
}
|
|
9164
|
+
/**
|
|
9165
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9166
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
9167
|
+
* object or array is reported as one path and not descended into — everything
|
|
9168
|
+
* under it is secret.
|
|
9169
|
+
*/
|
|
9170
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
9171
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9172
|
+
const paths = [];
|
|
9173
|
+
for (const layer of layersOf(schema)) {
|
|
9174
|
+
const def = defOf(layer);
|
|
9175
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9176
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9177
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9178
|
+
else if (def.type === "intersection") {
|
|
9179
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9180
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9181
|
+
}
|
|
9182
|
+
}
|
|
9183
|
+
return [...new Set(paths)];
|
|
9184
|
+
}
|
|
8032
9185
|
//#endregion
|
|
8033
9186
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
8034
9187
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -9706,6 +10859,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9706
10859
|
fetchedAt: number()
|
|
9707
10860
|
});
|
|
9708
10861
|
/**
|
|
10862
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10863
|
+
* gets back (cloud training, D805+).
|
|
10864
|
+
*
|
|
10865
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10866
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10867
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10868
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10869
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10870
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10871
|
+
* change there, in the same piece of work.
|
|
10872
|
+
*
|
|
10873
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10874
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10875
|
+
*/
|
|
10876
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10877
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10878
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10879
|
+
var TrainingExportSchema = _enum([
|
|
10880
|
+
"onnx",
|
|
10881
|
+
"openvino-fp16",
|
|
10882
|
+
"openvino-int8",
|
|
10883
|
+
"coreml-fp16"
|
|
10884
|
+
]);
|
|
10885
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10886
|
+
object({
|
|
10887
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10888
|
+
jobKey: string().uuid(),
|
|
10889
|
+
target: object({
|
|
10890
|
+
kind: literal("detector"),
|
|
10891
|
+
step: literal("object-detection")
|
|
10892
|
+
}),
|
|
10893
|
+
base: object({
|
|
10894
|
+
modelId: string().min(1),
|
|
10895
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10896
|
+
weights: string().min(1),
|
|
10897
|
+
imgsz: number().int().positive()
|
|
10898
|
+
}),
|
|
10899
|
+
baseline: object({
|
|
10900
|
+
modelId: string().min(1),
|
|
10901
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10902
|
+
onnxUrl: string().url(),
|
|
10903
|
+
imgsz: number().int().positive(),
|
|
10904
|
+
floors: FloorsSchema
|
|
10905
|
+
}),
|
|
10906
|
+
dataset: object({
|
|
10907
|
+
versionId: string().min(1),
|
|
10908
|
+
annotationHash: string(),
|
|
10909
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10910
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10911
|
+
}),
|
|
10912
|
+
split: object({
|
|
10913
|
+
holdoutCameras: array(number().int()),
|
|
10914
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10915
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10916
|
+
valFraction: number().min(0).max(.5),
|
|
10917
|
+
seed: number().int()
|
|
10918
|
+
}),
|
|
10919
|
+
hyper: object({
|
|
10920
|
+
epochs: number().int().positive(),
|
|
10921
|
+
batch: number().int().positive(),
|
|
10922
|
+
lr0: number().positive(),
|
|
10923
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10924
|
+
freeze: number().int().nonnegative(),
|
|
10925
|
+
patience: number().int().nonnegative(),
|
|
10926
|
+
seed: number().int()
|
|
10927
|
+
}),
|
|
10928
|
+
replay: object({
|
|
10929
|
+
source: literal("coco2017"),
|
|
10930
|
+
count: number().int().nonnegative()
|
|
10931
|
+
}),
|
|
10932
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10933
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10934
|
+
floors: object({
|
|
10935
|
+
minSupport: number().int().positive(),
|
|
10936
|
+
clamp: number().min(0).max(1)
|
|
10937
|
+
}),
|
|
10938
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10939
|
+
catalog: object({
|
|
10940
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10941
|
+
name: string().min(1).max(160)
|
|
10942
|
+
})
|
|
10943
|
+
});
|
|
10944
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10945
|
+
var TrainingResultFileSchema = object({
|
|
10946
|
+
path: string().min(1),
|
|
10947
|
+
bytes: number().int().nonnegative(),
|
|
10948
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10949
|
+
format: _enum([
|
|
10950
|
+
"onnx",
|
|
10951
|
+
"openvino",
|
|
10952
|
+
"coreml",
|
|
10953
|
+
"pt"
|
|
10954
|
+
]),
|
|
10955
|
+
variant: _enum(["base", "int8"])
|
|
10956
|
+
});
|
|
10957
|
+
var DraftFormatSchema = object({
|
|
10958
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10959
|
+
url: string().min(1),
|
|
10960
|
+
sizeMB: number().nonnegative(),
|
|
10961
|
+
isDirectory: boolean().optional(),
|
|
10962
|
+
files: array(string()).optional(),
|
|
10963
|
+
runtimes: array(literal("python")).optional(),
|
|
10964
|
+
revision: string().min(1)
|
|
10965
|
+
});
|
|
10966
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10967
|
+
var TrainingCatalogDraftSchema = object({
|
|
10968
|
+
id: string().min(1),
|
|
10969
|
+
name: string().min(1),
|
|
10970
|
+
description: string(),
|
|
10971
|
+
labels: array(unknown()),
|
|
10972
|
+
inputSize: object({
|
|
10973
|
+
width: number().int().positive(),
|
|
10974
|
+
height: number().int().positive()
|
|
10975
|
+
}),
|
|
10976
|
+
preprocessMode: literal("letterbox"),
|
|
10977
|
+
defaultClassFloors: FloorsSchema,
|
|
10978
|
+
formats: object({
|
|
10979
|
+
onnx: DraftFormatSchema.optional(),
|
|
10980
|
+
openvino: DraftFormatSchema.optional(),
|
|
10981
|
+
coreml: DraftFormatSchema.optional()
|
|
10982
|
+
})
|
|
10983
|
+
});
|
|
10984
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10985
|
+
var TrainingEvalClassSchema = object({
|
|
10986
|
+
positives: number().int(),
|
|
10987
|
+
floor: number().nullable(),
|
|
10988
|
+
tp: number().int(),
|
|
10989
|
+
fp: number().int(),
|
|
10990
|
+
fn: number().int(),
|
|
10991
|
+
precision: number().nullable(),
|
|
10992
|
+
recall: number().nullable(),
|
|
10993
|
+
ap50: number().nullable(),
|
|
10994
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10995
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10996
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10997
|
+
smallFound: number().int().optional(),
|
|
10998
|
+
smallTotal: number().int().optional()
|
|
10999
|
+
}).passthrough();
|
|
11000
|
+
var TrainingEvalReportSchema = object({
|
|
11001
|
+
frames: number().int(),
|
|
11002
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
11003
|
+
}).passthrough();
|
|
11004
|
+
/**
|
|
11005
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
11006
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
11007
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
11008
|
+
*/
|
|
11009
|
+
var TrainingResultSchema = object({
|
|
11010
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
11011
|
+
jobKey: string(),
|
|
11012
|
+
status: _enum(["succeeded", "failed"]),
|
|
11013
|
+
error: object({
|
|
11014
|
+
stage: string(),
|
|
11015
|
+
code: string(),
|
|
11016
|
+
message: string()
|
|
11017
|
+
}).nullable(),
|
|
11018
|
+
trainer: object({
|
|
11019
|
+
version: string(),
|
|
11020
|
+
revision: string()
|
|
11021
|
+
}),
|
|
11022
|
+
toolchain: record(string(), string().nullable()),
|
|
11023
|
+
dataset: object({
|
|
11024
|
+
versionId: string(),
|
|
11025
|
+
annotationHash: string(),
|
|
11026
|
+
sha256: string(),
|
|
11027
|
+
frames: object({
|
|
11028
|
+
train: number().int(),
|
|
11029
|
+
val: number().int(),
|
|
11030
|
+
holdout: number().int()
|
|
11031
|
+
}),
|
|
11032
|
+
holdoutCameras: array(number().int()),
|
|
11033
|
+
replayImages: number().int()
|
|
11034
|
+
}).optional(),
|
|
11035
|
+
training: object({
|
|
11036
|
+
epochsRun: number().int(),
|
|
11037
|
+
bestEpoch: number().int(),
|
|
11038
|
+
bestMap50: number(),
|
|
11039
|
+
bestMap50_95: number(),
|
|
11040
|
+
seconds: number()
|
|
11041
|
+
}).optional(),
|
|
11042
|
+
evaluation: object({
|
|
11043
|
+
holdoutFrames: number().int(),
|
|
11044
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
11045
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
11046
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
11047
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
11048
|
+
map50: record(string(), number().nullable())
|
|
11049
|
+
}).optional(),
|
|
11050
|
+
floors: object({
|
|
11051
|
+
baseline: FloorsSchema,
|
|
11052
|
+
candidate: FloorsSchema,
|
|
11053
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
11054
|
+
notes: array(string())
|
|
11055
|
+
}).optional(),
|
|
11056
|
+
int8: object({
|
|
11057
|
+
kept: boolean(),
|
|
11058
|
+
map50Fp16: number().nullable(),
|
|
11059
|
+
map50Int8: number().nullable(),
|
|
11060
|
+
reason: string().nullable()
|
|
11061
|
+
}).optional(),
|
|
11062
|
+
exportsDropped: array(object({
|
|
11063
|
+
export: string(),
|
|
11064
|
+
reason: string()
|
|
11065
|
+
})).optional(),
|
|
11066
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
11067
|
+
bundle: object({
|
|
11068
|
+
path: literal("bundle.tar"),
|
|
11069
|
+
bytes: number().int().nonnegative(),
|
|
11070
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11071
|
+
}).nullable().optional(),
|
|
11072
|
+
catalogDraft: object({
|
|
11073
|
+
base: TrainingCatalogDraftSchema,
|
|
11074
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
11075
|
+
}).nullable().optional(),
|
|
11076
|
+
licence: string()
|
|
11077
|
+
});
|
|
11078
|
+
var TrainingStageSchema = _enum([
|
|
11079
|
+
"prepare",
|
|
11080
|
+
"replay",
|
|
11081
|
+
"train",
|
|
11082
|
+
"eval",
|
|
11083
|
+
"export",
|
|
11084
|
+
"package"
|
|
11085
|
+
]);
|
|
11086
|
+
var EventBase = {
|
|
11087
|
+
v: literal(1),
|
|
11088
|
+
ts: number()
|
|
11089
|
+
};
|
|
11090
|
+
discriminatedUnion("type", [
|
|
11091
|
+
object({
|
|
11092
|
+
...EventBase,
|
|
11093
|
+
type: literal("stage"),
|
|
11094
|
+
stage: TrainingStageSchema
|
|
11095
|
+
}),
|
|
11096
|
+
object({
|
|
11097
|
+
...EventBase,
|
|
11098
|
+
type: literal("epoch"),
|
|
11099
|
+
epoch: number().int(),
|
|
11100
|
+
epochs: number().int(),
|
|
11101
|
+
boxLoss: number().nullable().optional(),
|
|
11102
|
+
map50: number().nullable().optional(),
|
|
11103
|
+
map50_95: number().nullable().optional(),
|
|
11104
|
+
etaSec: number().nullable().optional()
|
|
11105
|
+
}),
|
|
11106
|
+
object({
|
|
11107
|
+
...EventBase,
|
|
11108
|
+
type: literal("metric"),
|
|
11109
|
+
name: string(),
|
|
11110
|
+
value: number()
|
|
11111
|
+
}),
|
|
11112
|
+
object({
|
|
11113
|
+
...EventBase,
|
|
11114
|
+
type: literal("artifact"),
|
|
11115
|
+
path: string(),
|
|
11116
|
+
bytes: number(),
|
|
11117
|
+
sha256: string()
|
|
11118
|
+
}),
|
|
11119
|
+
object({
|
|
11120
|
+
...EventBase,
|
|
11121
|
+
type: literal("done"),
|
|
11122
|
+
status: _enum(["succeeded", "failed"]),
|
|
11123
|
+
resultSha256: string().nullable().optional()
|
|
11124
|
+
}),
|
|
11125
|
+
object({
|
|
11126
|
+
...EventBase,
|
|
11127
|
+
type: literal("error"),
|
|
11128
|
+
stage: string(),
|
|
11129
|
+
code: string(),
|
|
11130
|
+
message: string()
|
|
11131
|
+
})
|
|
11132
|
+
]);
|
|
11133
|
+
/**
|
|
9709
11134
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9710
11135
|
*
|
|
9711
11136
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12033,7 +13458,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12033
13458
|
"authenticated",
|
|
12034
13459
|
"admin"
|
|
12035
13460
|
]).optional(),
|
|
12036
|
-
description: string().optional()
|
|
13461
|
+
description: string().optional(),
|
|
13462
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13463
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12037
13464
|
});
|
|
12038
13465
|
/**
|
|
12039
13466
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12738,6 +14165,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12738
14165
|
lastError: string().optional()
|
|
12739
14166
|
});
|
|
12740
14167
|
/**
|
|
14168
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14169
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14170
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14171
|
+
* with it off — which restores without a key.
|
|
14172
|
+
*/
|
|
14173
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14174
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14175
|
+
scheme: string(),
|
|
14176
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14177
|
+
keyId: string()
|
|
14178
|
+
});
|
|
14179
|
+
/**
|
|
14180
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14181
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14182
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14183
|
+
*/
|
|
14184
|
+
var BackupEncryptionStatusSchema = object({
|
|
14185
|
+
enabled: boolean(),
|
|
14186
|
+
active: object({
|
|
14187
|
+
keyId: string(),
|
|
14188
|
+
publicKey: string(),
|
|
14189
|
+
createdAt: number()
|
|
14190
|
+
}).nullable(),
|
|
14191
|
+
/** Every key ever set up, newest first. */
|
|
14192
|
+
keys: array(object({
|
|
14193
|
+
keyId: string(),
|
|
14194
|
+
createdAt: number(),
|
|
14195
|
+
retiredAt: number().nullable()
|
|
14196
|
+
})).readonly()
|
|
14197
|
+
});
|
|
14198
|
+
/**
|
|
12741
14199
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12742
14200
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12743
14201
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12749,7 +14207,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12749
14207
|
sizeBytes: number(),
|
|
12750
14208
|
label: string().optional(),
|
|
12751
14209
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12752
|
-
locations: array(string()).readonly()
|
|
14210
|
+
locations: array(string()).readonly(),
|
|
14211
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14212
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12753
14213
|
});
|
|
12754
14214
|
var BackupEntrySchema = object({
|
|
12755
14215
|
id: string(),
|
|
@@ -12758,7 +14218,8 @@ var BackupEntrySchema = object({
|
|
|
12758
14218
|
label: string().optional(),
|
|
12759
14219
|
createdAt: number(),
|
|
12760
14220
|
sizeBytes: number(),
|
|
12761
|
-
locations: array(string()).optional()
|
|
14221
|
+
locations: array(string()).optional(),
|
|
14222
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12762
14223
|
});
|
|
12763
14224
|
var ArchiveEntrySchema = object({
|
|
12764
14225
|
path: string(),
|
|
@@ -12947,10 +14408,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12947
14408
|
* this list and skips entries whose path doesn't start with
|
|
12948
14409
|
* any of them.
|
|
12949
14410
|
*/
|
|
12950
|
-
locations: array(string()).optional()
|
|
14411
|
+
locations: array(string()).optional(),
|
|
14412
|
+
/**
|
|
14413
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14414
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14415
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14416
|
+
* is refused before the archive is downloaded.
|
|
14417
|
+
*/
|
|
14418
|
+
backupSecretKey: string().optional()
|
|
12951
14419
|
}), _void(), {
|
|
12952
14420
|
kind: "mutation",
|
|
12953
14421
|
auth: "admin"
|
|
14422
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14423
|
+
keyId: string(),
|
|
14424
|
+
secretKey: string(),
|
|
14425
|
+
publicKey: string(),
|
|
14426
|
+
createdAt: number(),
|
|
14427
|
+
replacedKeyId: string().nullable()
|
|
14428
|
+
}), {
|
|
14429
|
+
kind: "mutation",
|
|
14430
|
+
auth: "admin"
|
|
14431
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14432
|
+
kind: "mutation",
|
|
14433
|
+
auth: "admin"
|
|
14434
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14435
|
+
valid: boolean(),
|
|
14436
|
+
keyId: string().nullable(),
|
|
14437
|
+
/** The hub knows this key (active or retired). */
|
|
14438
|
+
known: boolean(),
|
|
14439
|
+
/** It is the key new archives are encrypted to. */
|
|
14440
|
+
active: boolean(),
|
|
14441
|
+
error: string().optional()
|
|
14442
|
+
}), {
|
|
14443
|
+
kind: "mutation",
|
|
14444
|
+
auth: "admin"
|
|
12954
14445
|
}), method(object({
|
|
12955
14446
|
destinationId: string(),
|
|
12956
14447
|
backupId: string()
|
|
@@ -14676,7 +16167,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14676
16167
|
stepId: string(),
|
|
14677
16168
|
entry: ModelCatalogEntrySchema
|
|
14678
16169
|
});
|
|
14679
|
-
|
|
16170
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16171
|
+
var ModelBundleFileSchema = object({
|
|
16172
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16173
|
+
path: string().min(1),
|
|
16174
|
+
bytes: number().int().nonnegative(),
|
|
16175
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16176
|
+
});
|
|
16177
|
+
var ImportModelBundleInputSchema = object({
|
|
16178
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16179
|
+
addonId: string(),
|
|
16180
|
+
stepId: string().min(1),
|
|
16181
|
+
/**
|
|
16182
|
+
* The catalog rows to register, complete, every format URL already
|
|
16183
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16184
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16185
|
+
*/
|
|
16186
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16187
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16188
|
+
bundle: object({
|
|
16189
|
+
ticket: PeerBytesTicketSchema,
|
|
16190
|
+
bytes: number().int().positive(),
|
|
16191
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16192
|
+
}),
|
|
16193
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16194
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16195
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16196
|
+
distribute: boolean()
|
|
16197
|
+
});
|
|
16198
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16199
|
+
kind: literal("imported"),
|
|
16200
|
+
modelIds: array(string()).readonly(),
|
|
16201
|
+
distributed: array(object({
|
|
16202
|
+
modelId: string(),
|
|
16203
|
+
nodeId: string(),
|
|
16204
|
+
format: _enum(MODEL_FORMATS),
|
|
16205
|
+
ok: boolean(),
|
|
16206
|
+
error: string().optional()
|
|
16207
|
+
})).readonly()
|
|
16208
|
+
}), object({
|
|
16209
|
+
kind: literal("refused"),
|
|
16210
|
+
reason: _enum([
|
|
16211
|
+
"transfer-failed",
|
|
16212
|
+
"checksum-mismatch",
|
|
16213
|
+
"bundle-mismatch",
|
|
16214
|
+
"invalid-entry",
|
|
16215
|
+
"id-taken"
|
|
16216
|
+
]),
|
|
16217
|
+
detail: string()
|
|
16218
|
+
})]);
|
|
16219
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16220
|
+
kind: "mutation",
|
|
16221
|
+
auth: "admin",
|
|
16222
|
+
timeoutMs: 30 * 6e4
|
|
16223
|
+
});
|
|
14680
16224
|
/**
|
|
14681
16225
|
* Query filter for settings-store collections.
|
|
14682
16226
|
*/
|
|
@@ -15059,6 +16603,253 @@ id: union([string(), number()]) }), {
|
|
|
15059
16603
|
kind: "mutation",
|
|
15060
16604
|
auth: "admin"
|
|
15061
16605
|
});
|
|
16606
|
+
/**
|
|
16607
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16608
|
+
*
|
|
16609
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
16610
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
16611
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
16612
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
16613
|
+
* against the CALLER, never against anything the caller claims.
|
|
16614
|
+
*
|
|
16615
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
16616
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
16617
|
+
* connection, the agent from its child's connection carried in
|
|
16618
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
16619
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
16620
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
16621
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
16622
|
+
* runner is the same OS user): see the threat model in
|
|
16623
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
16624
|
+
*
|
|
16625
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
16626
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
16627
|
+
* floors every method to admin anyway (D240).
|
|
16628
|
+
*
|
|
16629
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
16630
|
+
*/
|
|
16631
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
16632
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
16633
|
+
"key-missing",
|
|
16634
|
+
"wrong-key",
|
|
16635
|
+
"key-file-unreadable",
|
|
16636
|
+
"store-unavailable",
|
|
16637
|
+
"not-initialized",
|
|
16638
|
+
"decrypt-failed"
|
|
16639
|
+
]);
|
|
16640
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
16641
|
+
state: literal("locked"),
|
|
16642
|
+
reason: KeychainUnavailableReasonSchema
|
|
16643
|
+
})]);
|
|
16644
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
16645
|
+
object({
|
|
16646
|
+
kind: literal("value"),
|
|
16647
|
+
value: string(),
|
|
16648
|
+
version: number().int()
|
|
16649
|
+
}),
|
|
16650
|
+
object({ kind: literal("missing") }),
|
|
16651
|
+
object({
|
|
16652
|
+
kind: literal("unavailable"),
|
|
16653
|
+
reason: KeychainUnavailableReasonSchema
|
|
16654
|
+
}),
|
|
16655
|
+
object({ kind: literal("forbidden") })
|
|
16656
|
+
]);
|
|
16657
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
16658
|
+
/** Metadata of one stored value — never the value. */
|
|
16659
|
+
var KeychainSecretMetaSchema = object({
|
|
16660
|
+
ref: string(),
|
|
16661
|
+
owner: string(),
|
|
16662
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
16663
|
+
scope: string(),
|
|
16664
|
+
fieldPath: string(),
|
|
16665
|
+
version: number().int(),
|
|
16666
|
+
createdAt: number(),
|
|
16667
|
+
updatedAt: number(),
|
|
16668
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16669
|
+
updatedBy: string(),
|
|
16670
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
16671
|
+
lastReadAt: number().nullable()
|
|
16672
|
+
});
|
|
16673
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
16674
|
+
method(object({
|
|
16675
|
+
ref: string().min(1),
|
|
16676
|
+
value: string().min(1)
|
|
16677
|
+
}), object({
|
|
16678
|
+
ref: string(),
|
|
16679
|
+
version: number().int()
|
|
16680
|
+
}), {
|
|
16681
|
+
kind: "mutation",
|
|
16682
|
+
auth: "admin"
|
|
16683
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
16684
|
+
kind: "mutation",
|
|
16685
|
+
auth: "admin"
|
|
16686
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
16687
|
+
var KeychainKeySourceSchema = object({
|
|
16688
|
+
kind: _enum([
|
|
16689
|
+
"config-file",
|
|
16690
|
+
"previous-config-file",
|
|
16691
|
+
"platform",
|
|
16692
|
+
"default-file"
|
|
16693
|
+
]),
|
|
16694
|
+
/** File sources only — a path is not a secret. */
|
|
16695
|
+
path: string().optional(),
|
|
16696
|
+
/**
|
|
16697
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
16698
|
+
* next to the database it protects (the default file). The page warns.
|
|
16699
|
+
*/
|
|
16700
|
+
sharesBackupWithDatabase: boolean()
|
|
16701
|
+
});
|
|
16702
|
+
/**
|
|
16703
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16704
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16705
|
+
*/
|
|
16706
|
+
var KeychainResetRecordSchema = object({
|
|
16707
|
+
id: string(),
|
|
16708
|
+
at: number(),
|
|
16709
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16710
|
+
actor: string(),
|
|
16711
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16712
|
+
lockedReason: string().nullable(),
|
|
16713
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16714
|
+
archived: number().int(),
|
|
16715
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16716
|
+
archivedCollection: string().nullable(),
|
|
16717
|
+
/**
|
|
16718
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16719
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16720
|
+
*/
|
|
16721
|
+
archivedKeysCollection: string().nullable(),
|
|
16722
|
+
/**
|
|
16723
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16724
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16725
|
+
* agent forever (D797).
|
|
16726
|
+
*/
|
|
16727
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16728
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16729
|
+
acknowledgedAt: number().nullable()
|
|
16730
|
+
});
|
|
16731
|
+
var KeychainStatusSchema = object({
|
|
16732
|
+
keychain: KeychainStateSchema,
|
|
16733
|
+
/** The source of the master key in use; `null` while locked. */
|
|
16734
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
16735
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
16736
|
+
configuredSource: KeychainKeySourceSchema,
|
|
16737
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
16738
|
+
fingerprint: string().nullable(),
|
|
16739
|
+
activeKeyId: string().nullable(),
|
|
16740
|
+
/**
|
|
16741
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
16742
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
16743
|
+
*/
|
|
16744
|
+
rotationPending: boolean(),
|
|
16745
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
16746
|
+
retiredWraps: number().int(),
|
|
16747
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
16748
|
+
secretCount: number().int(),
|
|
16749
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16750
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
16751
|
+
});
|
|
16752
|
+
/**
|
|
16753
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
16754
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
16755
|
+
* never reported as an orphan (and never deleted as one).
|
|
16756
|
+
*/
|
|
16757
|
+
var KeychainSecretUsageSchema = _enum([
|
|
16758
|
+
"in-use",
|
|
16759
|
+
"orphan",
|
|
16760
|
+
"unknown"
|
|
16761
|
+
]);
|
|
16762
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
16763
|
+
var KeychainAuditActionSchema = _enum([
|
|
16764
|
+
"put",
|
|
16765
|
+
"delete",
|
|
16766
|
+
"reveal",
|
|
16767
|
+
"rotate-master-key",
|
|
16768
|
+
"purge-retired-keys",
|
|
16769
|
+
"download-recovery-key",
|
|
16770
|
+
"delete-orphans",
|
|
16771
|
+
"reset",
|
|
16772
|
+
"acknowledge-reset",
|
|
16773
|
+
"initialize"
|
|
16774
|
+
]);
|
|
16775
|
+
var KeychainAuditEntrySchema = object({
|
|
16776
|
+
id: string(),
|
|
16777
|
+
at: number(),
|
|
16778
|
+
action: KeychainAuditActionSchema,
|
|
16779
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
16780
|
+
actor: string(),
|
|
16781
|
+
ref: string().nullable(),
|
|
16782
|
+
detail: string().nullable()
|
|
16783
|
+
});
|
|
16784
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16785
|
+
/**
|
|
16786
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16787
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16788
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16789
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16790
|
+
*/
|
|
16791
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
16792
|
+
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({
|
|
16793
|
+
value: string(),
|
|
16794
|
+
version: number().int()
|
|
16795
|
+
}), {
|
|
16796
|
+
kind: "mutation",
|
|
16797
|
+
auth: "admin",
|
|
16798
|
+
caller: "required"
|
|
16799
|
+
}), method(object({
|
|
16800
|
+
name: SystemHeldSecretNameSchema,
|
|
16801
|
+
value: string().min(16)
|
|
16802
|
+
}), object({
|
|
16803
|
+
ref: string(),
|
|
16804
|
+
version: number().int()
|
|
16805
|
+
}), {
|
|
16806
|
+
kind: "mutation",
|
|
16807
|
+
auth: "admin",
|
|
16808
|
+
caller: "required"
|
|
16809
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16810
|
+
deleted: array(string()).readonly(),
|
|
16811
|
+
kept: array(object({
|
|
16812
|
+
ref: string(),
|
|
16813
|
+
usage: KeychainSecretUsageSchema
|
|
16814
|
+
})).readonly()
|
|
16815
|
+
}), {
|
|
16816
|
+
kind: "mutation",
|
|
16817
|
+
auth: "admin",
|
|
16818
|
+
caller: "required"
|
|
16819
|
+
}), method(object({}), object({
|
|
16820
|
+
fingerprint: string(),
|
|
16821
|
+
keySource: KeychainKeySourceSchema
|
|
16822
|
+
}), {
|
|
16823
|
+
kind: "mutation",
|
|
16824
|
+
auth: "admin",
|
|
16825
|
+
caller: "required"
|
|
16826
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
16827
|
+
kind: "mutation",
|
|
16828
|
+
auth: "admin",
|
|
16829
|
+
caller: "required"
|
|
16830
|
+
}), method(object({}), object({
|
|
16831
|
+
key: string(),
|
|
16832
|
+
fingerprint: string(),
|
|
16833
|
+
keySource: KeychainKeySourceSchema
|
|
16834
|
+
}), {
|
|
16835
|
+
kind: "mutation",
|
|
16836
|
+
auth: "admin",
|
|
16837
|
+
caller: "required"
|
|
16838
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
16839
|
+
archivedCollection: string().nullable(),
|
|
16840
|
+
archived: number().int()
|
|
16841
|
+
}), {
|
|
16842
|
+
kind: "mutation",
|
|
16843
|
+
auth: "admin",
|
|
16844
|
+
caller: "required"
|
|
16845
|
+
}), method(object({}), object({
|
|
16846
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16847
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16848
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16849
|
+
kind: "mutation",
|
|
16850
|
+
auth: "admin",
|
|
16851
|
+
caller: "required"
|
|
16852
|
+
});
|
|
15062
16853
|
method(_void(), object({
|
|
15063
16854
|
id: string(),
|
|
15064
16855
|
name: string(),
|
|
@@ -16397,7 +18188,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
16397
18188
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16398
18189
|
var DevicePersistConfigPayloadSchema = object({
|
|
16399
18190
|
deviceId: number(),
|
|
16400
|
-
data: record(string(), unknown())
|
|
18191
|
+
data: record(string(), unknown()),
|
|
18192
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
18193
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
18194
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
18195
|
+
secretConfigPaths: array(string()).optional()
|
|
16401
18196
|
});
|
|
16402
18197
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
16403
18198
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -18000,7 +19795,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18000
19795
|
* `login-method` — collection cap through which auth addons contribute
|
|
18001
19796
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18002
19797
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18003
|
-
* every auth addon (OIDC,
|
|
19798
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18004
19799
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18005
19800
|
* procedure aggregates them for the unauthenticated login page.
|
|
18006
19801
|
*
|
|
@@ -18008,8 +19803,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18008
19803
|
*
|
|
18009
19804
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18010
19805
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18011
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18012
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19806
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18013
19807
|
* login page needs NO change.
|
|
18014
19808
|
*
|
|
18015
19809
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18028,8 +19822,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18028
19822
|
* decision.
|
|
18029
19823
|
*
|
|
18030
19824
|
* Every contribution carries a `stage`:
|
|
18031
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18032
|
-
*
|
|
19825
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19826
|
+
* buttons; a usernameless passkey).
|
|
18033
19827
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18034
19828
|
* returned `factors` (passkey-as-2FA today).
|
|
18035
19829
|
*
|
|
@@ -18056,7 +19850,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18056
19850
|
* The provider names an external identity a signed-in user can link to
|
|
18057
19851
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18058
19852
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18059
|
-
* whatever their id. Absent / false — a login button only
|
|
19853
|
+
* whatever their id. Absent / false — a login button only.
|
|
18060
19854
|
*/
|
|
18061
19855
|
linkable: boolean().optional()
|
|
18062
19856
|
}),
|
|
@@ -21911,8 +23705,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21911
23705
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21912
23706
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21913
23707
|
* distinction was only ever used to route role-specific procedures
|
|
21914
|
-
* which we no longer have.
|
|
21915
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23708
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21916
23709
|
* with `isAdmin: false` + an explicit scope list.
|
|
21917
23710
|
*/
|
|
21918
23711
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23414,8 +25207,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
23414
25207
|
]);
|
|
23415
25208
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
23416
25209
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
23417
|
-
/**
|
|
23418
|
-
|
|
25210
|
+
/**
|
|
25211
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
25212
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
25213
|
+
*
|
|
25214
|
+
* - `operator` — drawn by hand.
|
|
25215
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
25216
|
+
* model, or a larger teacher model).
|
|
25217
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
25218
|
+
* back from the track store (never a re-run).
|
|
25219
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
25220
|
+
*/
|
|
25221
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
25222
|
+
"operator",
|
|
25223
|
+
"assist",
|
|
25224
|
+
"pipeline",
|
|
25225
|
+
"llm"
|
|
25226
|
+
]);
|
|
23419
25227
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
23420
25228
|
var RetrainBboxSchema = object({
|
|
23421
25229
|
x: number(),
|
|
@@ -23433,7 +25241,8 @@ var RetrainBboxSchema = object({
|
|
|
23433
25241
|
*/
|
|
23434
25242
|
var RetrainAnnotationSchema = object({
|
|
23435
25243
|
id: string(),
|
|
23436
|
-
|
|
25244
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
25245
|
+
trackId: string().optional(),
|
|
23437
25246
|
deviceId: number(),
|
|
23438
25247
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
23439
25248
|
mediaKey: string(),
|
|
@@ -23482,13 +25291,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23482
25291
|
* fail, whatever became of the original. */
|
|
23483
25292
|
copied: boolean()
|
|
23484
25293
|
});
|
|
25294
|
+
/**
|
|
25295
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
25296
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
25297
|
+
* box recorded on the source media row when there is one, else the track
|
|
25298
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
25299
|
+
* until the operator confirms it.
|
|
25300
|
+
*/
|
|
25301
|
+
var RetrainPipelineBoxSchema = object({
|
|
25302
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
25303
|
+
bbox: RetrainBboxSchema,
|
|
25304
|
+
macroClass: RetrainMacroClassSchema,
|
|
25305
|
+
label: string().optional(),
|
|
25306
|
+
subLabel: string().optional(),
|
|
25307
|
+
/** The detection score of the position used, when it was recorded. */
|
|
25308
|
+
score: number().optional(),
|
|
25309
|
+
/** The root model that produced the track, when it was recorded. */
|
|
25310
|
+
modelId: string().optional(),
|
|
25311
|
+
trackId: string(),
|
|
25312
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
25313
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
25314
|
+
basis: _enum(["subject-box", "position"]),
|
|
25315
|
+
deltaMs: number()
|
|
25316
|
+
});
|
|
25317
|
+
/**
|
|
25318
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
25319
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
25320
|
+
* track at all.
|
|
25321
|
+
*/
|
|
25322
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23485
25323
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23486
25324
|
var RetrainFrameSchema = object({
|
|
23487
25325
|
frameId: string(),
|
|
23488
25326
|
deviceId: number(),
|
|
23489
|
-
|
|
23490
|
-
/**
|
|
23491
|
-
|
|
25327
|
+
origin: RetrainFrameOriginSchema,
|
|
25328
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
25329
|
+
trackId: string().optional(),
|
|
25330
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
25331
|
+
* Absent on a recording still. */
|
|
25332
|
+
sourceMediaId: number().int().optional(),
|
|
25333
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
25334
|
+
epochMs: number().optional(),
|
|
23492
25335
|
sourceKind: MediaFileKindEnum,
|
|
23493
25336
|
sizeBytes: number().int(),
|
|
23494
25337
|
width: number().int(),
|
|
@@ -23499,7 +25342,12 @@ var RetrainFrameSchema = object({
|
|
|
23499
25342
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
23500
25343
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23501
25344
|
* a false positive. */
|
|
23502
|
-
complete: boolean()
|
|
25345
|
+
complete: boolean(),
|
|
25346
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
25347
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
25348
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
25349
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
25350
|
+
collectionIds: array(string()).readonly().optional()
|
|
23503
25351
|
});
|
|
23504
25352
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23505
25353
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23530,6 +25378,11 @@ var RetrainFrameListSchema = object({
|
|
|
23530
25378
|
var RetrainExportFilterSchema = object({
|
|
23531
25379
|
deviceIds: array(number()).optional(),
|
|
23532
25380
|
frameIds: array(string()).max(2e4).optional(),
|
|
25381
|
+
/** Only frames in at least one of these named collections. */
|
|
25382
|
+
collectionIds: array(string()).max(200).optional(),
|
|
25383
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25384
|
+
* unknown id selects nothing. */
|
|
25385
|
+
datasetVersionId: string().optional(),
|
|
23533
25386
|
batchId: string().optional(),
|
|
23534
25387
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23535
25388
|
completeOnly: boolean().optional()
|
|
@@ -23594,6 +25447,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23594
25447
|
reason: string(),
|
|
23595
25448
|
detail: string().optional()
|
|
23596
25449
|
})]);
|
|
25450
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
25451
|
+
var RetrainCollectionSchema = object({
|
|
25452
|
+
id: string(),
|
|
25453
|
+
name: string(),
|
|
25454
|
+
createdAt: number(),
|
|
25455
|
+
frameCount: number().int()
|
|
25456
|
+
});
|
|
25457
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
25458
|
+
kind: literal("created"),
|
|
25459
|
+
collection: RetrainCollectionSchema
|
|
25460
|
+
}), object({
|
|
25461
|
+
kind: literal("refused"),
|
|
25462
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
25463
|
+
})]);
|
|
25464
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
25465
|
+
kind: literal("renamed"),
|
|
25466
|
+
collection: RetrainCollectionSchema
|
|
25467
|
+
}), object({
|
|
25468
|
+
kind: literal("refused"),
|
|
25469
|
+
reason: _enum([
|
|
25470
|
+
"empty-name",
|
|
25471
|
+
"duplicate-name",
|
|
25472
|
+
"unknown-collection"
|
|
25473
|
+
])
|
|
25474
|
+
})]);
|
|
25475
|
+
/**
|
|
25476
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
25477
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
25478
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
25479
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
25480
|
+
*/
|
|
25481
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
25482
|
+
kind: literal("added"),
|
|
25483
|
+
collectionId: string(),
|
|
25484
|
+
frame: RetrainFrameSchema,
|
|
25485
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
25486
|
+
reused: boolean()
|
|
25487
|
+
}), object({
|
|
25488
|
+
kind: literal("refused"),
|
|
25489
|
+
reason: _enum([
|
|
25490
|
+
"unknown-collection",
|
|
25491
|
+
"still-unavailable",
|
|
25492
|
+
"still-busy",
|
|
25493
|
+
"unreadable-image",
|
|
25494
|
+
"write-failed"
|
|
25495
|
+
]),
|
|
25496
|
+
detail: string().optional()
|
|
25497
|
+
})]);
|
|
25498
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
25499
|
+
var RetrainAssistProfileSchema = object({
|
|
25500
|
+
id: string(),
|
|
25501
|
+
name: string(),
|
|
25502
|
+
model: string(),
|
|
25503
|
+
kind: string(),
|
|
25504
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
25505
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
25506
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
25507
|
+
leavesHouse: boolean()
|
|
25508
|
+
});
|
|
25509
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
25510
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
25511
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
25512
|
+
var RetrainLlmReviewSchema = object({
|
|
25513
|
+
/** The `ref` the page sent the box under. */
|
|
25514
|
+
ref: string(),
|
|
25515
|
+
verdict: _enum([
|
|
25516
|
+
"confirmed",
|
|
25517
|
+
"wrong-class",
|
|
25518
|
+
"not-an-object",
|
|
25519
|
+
"uncertain"
|
|
25520
|
+
]),
|
|
25521
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
25522
|
+
reason: string()
|
|
25523
|
+
});
|
|
25524
|
+
/**
|
|
25525
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
25526
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
25527
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
25528
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
25529
|
+
*/
|
|
25530
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
25531
|
+
kind: literal("proposed"),
|
|
25532
|
+
profileId: string(),
|
|
25533
|
+
model: string(),
|
|
25534
|
+
/** The frame was sent outside the house for this answer. */
|
|
25535
|
+
leftHouse: boolean(),
|
|
25536
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
25537
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
25538
|
+
rejected: number().int()
|
|
25539
|
+
}), object({
|
|
25540
|
+
kind: literal("refused"),
|
|
25541
|
+
reason: _enum([
|
|
25542
|
+
"unknown-frame",
|
|
25543
|
+
"unreadable-frame",
|
|
25544
|
+
"unknown-profile",
|
|
25545
|
+
"profile-disabled",
|
|
25546
|
+
"no-vision",
|
|
25547
|
+
"cloud-not-confirmed",
|
|
25548
|
+
"llm-error",
|
|
25549
|
+
"malformed-answer"
|
|
25550
|
+
]),
|
|
25551
|
+
detail: string().optional()
|
|
25552
|
+
})]);
|
|
25553
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25554
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25555
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25556
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25557
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25558
|
+
});
|
|
25559
|
+
/** The counts a dataset is judged by. */
|
|
25560
|
+
var RetrainDatasetStatsSchema = object({
|
|
25561
|
+
frames: number().int(),
|
|
25562
|
+
completeFrames: number().int(),
|
|
25563
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25564
|
+
completeness: number(),
|
|
25565
|
+
/** Boxes to learn (model errors excluded). */
|
|
25566
|
+
subjects: number().int(),
|
|
25567
|
+
modelErrors: number().int(),
|
|
25568
|
+
/** Complete frames with no subject. */
|
|
25569
|
+
hardNegatives: number().int(),
|
|
25570
|
+
/** Subjects per class × camera × day/night. */
|
|
25571
|
+
cells: array(object({
|
|
25572
|
+
macroClass: string(),
|
|
25573
|
+
deviceId: number(),
|
|
25574
|
+
lighting: _enum([
|
|
25575
|
+
"day",
|
|
25576
|
+
"night",
|
|
25577
|
+
"unknown"
|
|
25578
|
+
]),
|
|
25579
|
+
subjects: number().int(),
|
|
25580
|
+
frames: number().int()
|
|
25581
|
+
})).readonly(),
|
|
25582
|
+
cameras: array(object({
|
|
25583
|
+
deviceId: number(),
|
|
25584
|
+
frames: number().int(),
|
|
25585
|
+
completeFrames: number().int()
|
|
25586
|
+
})).readonly()
|
|
25587
|
+
});
|
|
25588
|
+
/** An immutable dataset version, without its frame list. */
|
|
25589
|
+
var RetrainDatasetVersionSchema = object({
|
|
25590
|
+
id: string(),
|
|
25591
|
+
name: string(),
|
|
25592
|
+
createdAt: number(),
|
|
25593
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25594
|
+
layout: RetrainExportLayoutSchema,
|
|
25595
|
+
completeOnly: boolean(),
|
|
25596
|
+
frameCount: number().int(),
|
|
25597
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25598
|
+
annotationHash: string(),
|
|
25599
|
+
/** The export manifest schema the version was cut under. */
|
|
25600
|
+
manifestSchema: string(),
|
|
25601
|
+
stats: RetrainDatasetStatsSchema
|
|
25602
|
+
});
|
|
25603
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25604
|
+
kind: literal("created"),
|
|
25605
|
+
version: RetrainDatasetVersionSchema
|
|
25606
|
+
}), object({
|
|
25607
|
+
kind: literal("refused"),
|
|
25608
|
+
reason: _enum([
|
|
25609
|
+
"empty-name",
|
|
25610
|
+
"duplicate-name",
|
|
25611
|
+
"no-frames"
|
|
25612
|
+
])
|
|
25613
|
+
})]);
|
|
23597
25614
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23598
25615
|
var RetrainTransitionResultSchema = object({
|
|
23599
25616
|
trackId: string(),
|
|
@@ -24311,7 +26328,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24311
26328
|
auth: "admin"
|
|
24312
26329
|
}), method(object({
|
|
24313
26330
|
deviceId: number(),
|
|
24314
|
-
trackId: string(),
|
|
26331
|
+
trackId: string().optional(),
|
|
24315
26332
|
frameId: string()
|
|
24316
26333
|
}), object({
|
|
24317
26334
|
removed: boolean(),
|
|
@@ -24328,7 +26345,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24328
26345
|
auth: "admin"
|
|
24329
26346
|
}), method(object({
|
|
24330
26347
|
deviceId: number(),
|
|
24331
|
-
|
|
26348
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26349
|
+
trackId: string().optional(),
|
|
24332
26350
|
frameId: string(),
|
|
24333
26351
|
subject: RetrainAssistSubjectSchema,
|
|
24334
26352
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -24336,12 +26354,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24336
26354
|
}), RetrainAssistResultSchema, {
|
|
24337
26355
|
kind: "mutation",
|
|
24338
26356
|
auth: "admin"
|
|
24339
|
-
}), method(object({
|
|
26357
|
+
}), method(object({
|
|
26358
|
+
trackId: string().optional(),
|
|
26359
|
+
frameIds: array(string()).max(2e3).optional()
|
|
26360
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
24340
26361
|
kind: "query",
|
|
24341
26362
|
auth: "admin"
|
|
24342
26363
|
}), method(object({
|
|
24343
26364
|
deviceId: number(),
|
|
24344
|
-
|
|
26365
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26366
|
+
trackId: string().optional(),
|
|
24345
26367
|
frameId: string(),
|
|
24346
26368
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
24347
26369
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -24364,7 +26386,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24364
26386
|
auth: "admin"
|
|
24365
26387
|
}), method(object({
|
|
24366
26388
|
deviceId: number(),
|
|
24367
|
-
trackId: string(),
|
|
26389
|
+
trackId: string().optional(),
|
|
24368
26390
|
frameId: string(),
|
|
24369
26391
|
complete: boolean()
|
|
24370
26392
|
}), RetrainFrameSchema, {
|
|
@@ -24378,6 +26400,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24378
26400
|
kind: "mutation",
|
|
24379
26401
|
auth: "admin",
|
|
24380
26402
|
timeoutMs: 60 * 6e4
|
|
26403
|
+
}), method(object({
|
|
26404
|
+
filter: RetrainExportFilterSchema,
|
|
26405
|
+
layout: RetrainExportLayoutSchema
|
|
26406
|
+
}), object({
|
|
26407
|
+
ticket: PeerBytesTicketSchema,
|
|
26408
|
+
frames: number().int(),
|
|
26409
|
+
annotations: number().int()
|
|
26410
|
+
}), {
|
|
26411
|
+
kind: "mutation",
|
|
26412
|
+
auth: "admin",
|
|
26413
|
+
timeoutMs: 12e4
|
|
26414
|
+
}), method(object({
|
|
26415
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26416
|
+
completeOnly: boolean().optional()
|
|
26417
|
+
}), RetrainDatasetStatsSchema, {
|
|
26418
|
+
kind: "query",
|
|
26419
|
+
auth: "admin"
|
|
26420
|
+
}), method(object({
|
|
26421
|
+
name: string().max(120),
|
|
26422
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26423
|
+
layout: RetrainExportLayoutSchema,
|
|
26424
|
+
completeOnly: boolean()
|
|
26425
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26426
|
+
kind: "mutation",
|
|
26427
|
+
auth: "admin",
|
|
26428
|
+
timeoutMs: 12e4
|
|
26429
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26430
|
+
kind: "query",
|
|
26431
|
+
auth: "admin"
|
|
26432
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26433
|
+
kind: "mutation",
|
|
26434
|
+
auth: "admin"
|
|
26435
|
+
}), method(object({ id: string() }), object({
|
|
26436
|
+
found: boolean(),
|
|
26437
|
+
annotationHash: string(),
|
|
26438
|
+
matches: boolean(),
|
|
26439
|
+
missingFrames: number().int()
|
|
26440
|
+
}), {
|
|
26441
|
+
kind: "query",
|
|
26442
|
+
auth: "admin",
|
|
26443
|
+
timeoutMs: 12e4
|
|
26444
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
26445
|
+
kind: "query",
|
|
26446
|
+
auth: "admin"
|
|
26447
|
+
}), method(object({
|
|
26448
|
+
deviceId: number(),
|
|
26449
|
+
trackId: string().optional(),
|
|
26450
|
+
frameId: string(),
|
|
26451
|
+
profileId: string(),
|
|
26452
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
26453
|
+
boxes: array(object({
|
|
26454
|
+
ref: string(),
|
|
26455
|
+
bbox: RetrainBboxSchema,
|
|
26456
|
+
macroClass: RetrainMacroClassSchema,
|
|
26457
|
+
label: string().optional()
|
|
26458
|
+
})).max(50),
|
|
26459
|
+
allowCloud: boolean()
|
|
26460
|
+
}), RetrainLlmAssistResultSchema, {
|
|
26461
|
+
kind: "mutation",
|
|
26462
|
+
auth: "admin",
|
|
26463
|
+
timeoutMs: 18e4
|
|
26464
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
26465
|
+
kind: "mutation",
|
|
26466
|
+
auth: "admin"
|
|
26467
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
26468
|
+
kind: "query",
|
|
26469
|
+
auth: "admin"
|
|
26470
|
+
}), method(object({
|
|
26471
|
+
id: string(),
|
|
26472
|
+
name: string().max(120)
|
|
26473
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
26474
|
+
kind: "mutation",
|
|
26475
|
+
auth: "admin"
|
|
26476
|
+
}), method(object({ id: string() }), object({
|
|
26477
|
+
deleted: boolean(),
|
|
26478
|
+
removedFrames: number().int()
|
|
26479
|
+
}), {
|
|
26480
|
+
kind: "mutation",
|
|
26481
|
+
auth: "admin"
|
|
26482
|
+
}), method(object({
|
|
26483
|
+
collectionId: string(),
|
|
26484
|
+
deviceId: number(),
|
|
26485
|
+
epochMs: number()
|
|
26486
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
26487
|
+
kind: "mutation",
|
|
26488
|
+
auth: "admin",
|
|
26489
|
+
timeoutMs: 6e4
|
|
26490
|
+
}), method(object({
|
|
26491
|
+
collectionId: string(),
|
|
26492
|
+
frameIds: array(string()).min(1).max(500)
|
|
26493
|
+
}), object({
|
|
26494
|
+
added: number().int(),
|
|
26495
|
+
alreadyMember: number().int(),
|
|
26496
|
+
unknownFrameIds: array(string()).readonly()
|
|
26497
|
+
}), {
|
|
26498
|
+
kind: "mutation",
|
|
26499
|
+
auth: "admin"
|
|
26500
|
+
}), method(object({
|
|
26501
|
+
collectionId: string(),
|
|
26502
|
+
frameId: string()
|
|
26503
|
+
}), object({
|
|
26504
|
+
removed: boolean(),
|
|
26505
|
+
deletedFrame: boolean()
|
|
26506
|
+
}), {
|
|
26507
|
+
kind: "mutation",
|
|
26508
|
+
auth: "admin"
|
|
26509
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
26510
|
+
kind: "query",
|
|
26511
|
+
auth: "admin"
|
|
24381
26512
|
}), method(object({
|
|
24382
26513
|
/** Which of the three event tables owns the row. */
|
|
24383
26514
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -25001,13 +27132,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
25001
27132
|
object({
|
|
25002
27133
|
kind: literal("no-family-build"),
|
|
25003
27134
|
format: ModelFormatSchema$1
|
|
27135
|
+
}),
|
|
27136
|
+
object({
|
|
27137
|
+
kind: literal("kept-custom-pin"),
|
|
27138
|
+
modelId: string(),
|
|
27139
|
+
deviceKey: string()
|
|
25004
27140
|
})
|
|
25005
27141
|
]);
|
|
27142
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
27143
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
27144
|
+
/**
|
|
27145
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
27146
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
27147
|
+
*/
|
|
27148
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
27149
|
+
kind: literal("node-benchmark"),
|
|
27150
|
+
resultId: string(),
|
|
27151
|
+
measuredAtMs: number()
|
|
27152
|
+
})]);
|
|
25006
27153
|
var DeviceModelChoiceSchema = object({
|
|
25007
27154
|
modelId: string(),
|
|
25008
27155
|
p50Ms: number(),
|
|
25009
27156
|
fps: number(),
|
|
25010
27157
|
measured: boolean(),
|
|
27158
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
27159
|
+
source: LatencySourceSchema.optional(),
|
|
25011
27160
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
25012
27161
|
capacitySessions: number(),
|
|
25013
27162
|
personRecall: number()
|
|
@@ -25018,6 +27167,8 @@ var DeviceRecommendationSchema = object({
|
|
|
25018
27167
|
enabled: boolean(),
|
|
25019
27168
|
available: boolean(),
|
|
25020
27169
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
27170
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
27171
|
+
kept: KeptReasonSchema.optional(),
|
|
25021
27172
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
25022
27173
|
});
|
|
25023
27174
|
var NodeRecommendationSchema = object({
|
|
@@ -25071,6 +27222,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
25071
27222
|
kind: literal("coral-enabled"),
|
|
25072
27223
|
nodeId: string(),
|
|
25073
27224
|
deviceKey: string()
|
|
27225
|
+
}),
|
|
27226
|
+
object({
|
|
27227
|
+
kind: literal("custom-pin-kept"),
|
|
27228
|
+
nodeId: string(),
|
|
27229
|
+
deviceKey: string().nullable(),
|
|
27230
|
+
deviceId: number().nullable(),
|
|
27231
|
+
modelId: string()
|
|
27232
|
+
}),
|
|
27233
|
+
object({
|
|
27234
|
+
kind: literal("custom-registry-unreadable"),
|
|
27235
|
+
error: string()
|
|
25074
27236
|
})
|
|
25075
27237
|
]);
|
|
25076
27238
|
var AutoTuneOptionsSchema = object({
|
|
@@ -25249,13 +27411,14 @@ var SuggestSharesResultSchema = object({
|
|
|
25249
27411
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
25250
27412
|
});
|
|
25251
27413
|
/**
|
|
25252
|
-
* Where the node and device shares come from (D750, D755).
|
|
25253
|
-
* - `
|
|
25254
|
-
*
|
|
25255
|
-
*
|
|
25256
|
-
*
|
|
25257
|
-
*
|
|
25258
|
-
*
|
|
27414
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
27415
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
27416
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
27417
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
27418
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
27419
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
27420
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
27421
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
25259
27422
|
* - `manual` — the operator's stored sliders.
|
|
25260
27423
|
* Either way a node or device that cannot take sessions gives its share to
|
|
25261
27424
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -25304,6 +27467,362 @@ var EffectiveSharesSchema = object({
|
|
|
25304
27467
|
nodeWeights: record(string(), number()),
|
|
25305
27468
|
deviceWeights: record(string(), record(string(), number()))
|
|
25306
27469
|
});
|
|
27470
|
+
/**
|
|
27471
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
27472
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
27473
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
27474
|
+
* shares read.
|
|
27475
|
+
*
|
|
27476
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
27477
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
27478
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
27479
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
27480
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
27481
|
+
*
|
|
27482
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
27483
|
+
* cross a process at frame rate, D9):
|
|
27484
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
27485
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
27486
|
+
* interval;
|
|
27487
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
27488
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
27489
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
27490
|
+
* CPU, RAM or the event loop give out.
|
|
27491
|
+
*/
|
|
27492
|
+
/** Defaults and bounds, one place. */
|
|
27493
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
27494
|
+
fpsPerStream: 10,
|
|
27495
|
+
budgetMinutes: 45,
|
|
27496
|
+
minBudgetMinutes: 10,
|
|
27497
|
+
maxBudgetMinutes: 120,
|
|
27498
|
+
/** A result older than this no longer beats the table. */
|
|
27499
|
+
staleAfterDays: 30,
|
|
27500
|
+
/** Warm-in per ramp step (not accounted). */
|
|
27501
|
+
settleSec: 5,
|
|
27502
|
+
/** Accounted window per ramp step. */
|
|
27503
|
+
measureSec: 20,
|
|
27504
|
+
/** Longest the drain may take before the run is refused. */
|
|
27505
|
+
drainTimeoutSec: 120,
|
|
27506
|
+
/** Candidate models per device in one run. */
|
|
27507
|
+
maxModelsPerDevice: 6
|
|
27508
|
+
};
|
|
27509
|
+
/** The two measurements a run can make. */
|
|
27510
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
27511
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
27512
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
27513
|
+
deviceKey: string().min(1),
|
|
27514
|
+
/**
|
|
27515
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
27516
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
27517
|
+
*/
|
|
27518
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
27519
|
+
});
|
|
27520
|
+
/** What the operator confirmed. */
|
|
27521
|
+
var NodeBenchmarkPlanSchema = object({
|
|
27522
|
+
nodeId: string().min(1),
|
|
27523
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27524
|
+
/** Which measurements run. At least one. */
|
|
27525
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
27526
|
+
/**
|
|
27527
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
27528
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
27529
|
+
* detector always runs.
|
|
27530
|
+
*/
|
|
27531
|
+
steps: array(string().min(1)).default([]),
|
|
27532
|
+
/** Offered rate of one stream / session. */
|
|
27533
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
27534
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
27535
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
27536
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
27537
|
+
keepDownloadedModels: boolean().default(false),
|
|
27538
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
27539
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
27540
|
+
});
|
|
27541
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
27542
|
+
kind: _enum([
|
|
27543
|
+
"benchmark-active",
|
|
27544
|
+
"node-offline",
|
|
27545
|
+
"unknown-device",
|
|
27546
|
+
"no-phase",
|
|
27547
|
+
"insufficient-headroom"
|
|
27548
|
+
]),
|
|
27549
|
+
detail: string(),
|
|
27550
|
+
overridable: boolean()
|
|
27551
|
+
});
|
|
27552
|
+
/** A camera whose detection leaves the node for the run. */
|
|
27553
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
27554
|
+
deviceId: number(),
|
|
27555
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
27556
|
+
placedOnNode: boolean(),
|
|
27557
|
+
/** A node pin naming this node, ignored for the run. */
|
|
27558
|
+
pinnedToNode: boolean()
|
|
27559
|
+
});
|
|
27560
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
27561
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
27562
|
+
deviceId: number(),
|
|
27563
|
+
reason: literal("only-frame-source")
|
|
27564
|
+
});
|
|
27565
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
27566
|
+
nodeId: string(),
|
|
27567
|
+
online: boolean(),
|
|
27568
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
27569
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
27570
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
27571
|
+
estimatedDurationMs: number(),
|
|
27572
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
27573
|
+
budgetMs: number(),
|
|
27574
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
27575
|
+
steps: array(string()).readonly(),
|
|
27576
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
27577
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
27578
|
+
headroom: object({
|
|
27579
|
+
sessionsNow: number(),
|
|
27580
|
+
otherNodesCapacitySessions: number().nullable()
|
|
27581
|
+
}),
|
|
27582
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
27583
|
+
canStart: boolean()
|
|
27584
|
+
});
|
|
27585
|
+
/** Where the measuring runner is. */
|
|
27586
|
+
var NodeBenchProgressSchema = object({
|
|
27587
|
+
phase: _enum([
|
|
27588
|
+
"preparing",
|
|
27589
|
+
"device",
|
|
27590
|
+
"pipeline",
|
|
27591
|
+
"cleanup"
|
|
27592
|
+
]),
|
|
27593
|
+
deviceKey: string().nullable(),
|
|
27594
|
+
modelId: string().nullable(),
|
|
27595
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
27596
|
+
load: number().nullable(),
|
|
27597
|
+
cellsDone: number(),
|
|
27598
|
+
cellsTotal: number(),
|
|
27599
|
+
message: string()
|
|
27600
|
+
});
|
|
27601
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
27602
|
+
var NodeBenchLimitSchema = _enum([
|
|
27603
|
+
"p95",
|
|
27604
|
+
"drops",
|
|
27605
|
+
"errors",
|
|
27606
|
+
"stall",
|
|
27607
|
+
"cpu",
|
|
27608
|
+
"ram",
|
|
27609
|
+
"none"
|
|
27610
|
+
]);
|
|
27611
|
+
var NodeBenchRampStepSchema = object({
|
|
27612
|
+
load: number(),
|
|
27613
|
+
pass: boolean(),
|
|
27614
|
+
p95Ms: number(),
|
|
27615
|
+
dropRatio: number(),
|
|
27616
|
+
/** Completed frames per second over the accounted window. */
|
|
27617
|
+
fps: number(),
|
|
27618
|
+
cpuPct: number().nullable(),
|
|
27619
|
+
ramFreePct: number().nullable(),
|
|
27620
|
+
failReasons: array(string()).readonly()
|
|
27621
|
+
});
|
|
27622
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
27623
|
+
phase: literal("device"),
|
|
27624
|
+
deviceKey: string(),
|
|
27625
|
+
modelId: string(),
|
|
27626
|
+
/** Single-stream latency (the K = 1 step). */
|
|
27627
|
+
p50Ms: number(),
|
|
27628
|
+
p95Ms: number(),
|
|
27629
|
+
p99Ms: number(),
|
|
27630
|
+
/** Frames per second sustained at the last passing step. */
|
|
27631
|
+
fps: number(),
|
|
27632
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
27633
|
+
kMax: number(),
|
|
27634
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27635
|
+
/** First call (model load + warm-up). */
|
|
27636
|
+
warmupMs: number(),
|
|
27637
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27638
|
+
}), object({
|
|
27639
|
+
phase: literal("pipeline"),
|
|
27640
|
+
deviceKey: string(),
|
|
27641
|
+
modelId: string(),
|
|
27642
|
+
steps: array(string()).readonly(),
|
|
27643
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
27644
|
+
maxSessions: number(),
|
|
27645
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27646
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
27647
|
+
stepsFired: array(string()).readonly(),
|
|
27648
|
+
warmupMs: number(),
|
|
27649
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27650
|
+
})]);
|
|
27651
|
+
/**
|
|
27652
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
27653
|
+
* the node no longer beats the table.
|
|
27654
|
+
*/
|
|
27655
|
+
var NodeBenchFingerprintSchema = object({
|
|
27656
|
+
pipelineVersion: string().nullable(),
|
|
27657
|
+
cpuModel: string().nullable(),
|
|
27658
|
+
ramGb: number().nullable(),
|
|
27659
|
+
os: string().nullable(),
|
|
27660
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
27661
|
+
pools: record(string(), object({
|
|
27662
|
+
runtime: string(),
|
|
27663
|
+
numWorkers: number(),
|
|
27664
|
+
concurrency: number(),
|
|
27665
|
+
batchMode: string()
|
|
27666
|
+
})).default({})
|
|
27667
|
+
});
|
|
27668
|
+
/** The frames the run used. */
|
|
27669
|
+
var NodeBenchClipSchema = object({
|
|
27670
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
27671
|
+
id: string(),
|
|
27672
|
+
revision: string().nullable(),
|
|
27673
|
+
frames: number(),
|
|
27674
|
+
width: number(),
|
|
27675
|
+
height: number()
|
|
27676
|
+
});
|
|
27677
|
+
var NodeBenchRunnerInputSchema = object({
|
|
27678
|
+
runId: string().min(1),
|
|
27679
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27680
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
27681
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
27682
|
+
steps: array(string()).default([]),
|
|
27683
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
27684
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
27685
|
+
deadlineAtMs: number(),
|
|
27686
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
27687
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
27688
|
+
keepDownloadedModels: boolean().default(false)
|
|
27689
|
+
});
|
|
27690
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
27691
|
+
"running",
|
|
27692
|
+
"done",
|
|
27693
|
+
"failed",
|
|
27694
|
+
"aborted"
|
|
27695
|
+
]);
|
|
27696
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
27697
|
+
runId: string(),
|
|
27698
|
+
nodeId: string(),
|
|
27699
|
+
state: NodeBenchRunnerStateSchema,
|
|
27700
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27701
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
27702
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
27703
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27704
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27705
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
27706
|
+
activeCameraIds: array(number()).readonly(),
|
|
27707
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
27708
|
+
deletedModels: array(string()).readonly(),
|
|
27709
|
+
error: string().nullable(),
|
|
27710
|
+
startedAtMs: number(),
|
|
27711
|
+
finishedAtMs: number().nullable()
|
|
27712
|
+
});
|
|
27713
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
27714
|
+
"draining",
|
|
27715
|
+
"measuring",
|
|
27716
|
+
"restoring",
|
|
27717
|
+
"done",
|
|
27718
|
+
"failed",
|
|
27719
|
+
"aborted"
|
|
27720
|
+
]);
|
|
27721
|
+
/** Why a run ended. */
|
|
27722
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
27723
|
+
"completed",
|
|
27724
|
+
"operator-abort",
|
|
27725
|
+
"deadline",
|
|
27726
|
+
"node-lost",
|
|
27727
|
+
"runner-lost",
|
|
27728
|
+
"hub-restart",
|
|
27729
|
+
"drain-timeout",
|
|
27730
|
+
"failed"
|
|
27731
|
+
]);
|
|
27732
|
+
var NodeBenchmarkRunSchema = object({
|
|
27733
|
+
runId: string(),
|
|
27734
|
+
nodeId: string(),
|
|
27735
|
+
state: NodeBenchmarkStateSchema,
|
|
27736
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27737
|
+
startedAtMs: number(),
|
|
27738
|
+
deadlineAtMs: number(),
|
|
27739
|
+
finishedAtMs: number().nullable(),
|
|
27740
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
27741
|
+
error: string().nullable(),
|
|
27742
|
+
/** Cameras moved off the node for the run. */
|
|
27743
|
+
moved: array(number()).readonly(),
|
|
27744
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
27745
|
+
staying: array(number()).readonly(),
|
|
27746
|
+
/** Something else ran on the node's pools during the run. */
|
|
27747
|
+
contaminated: boolean(),
|
|
27748
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27749
|
+
resultIds: array(string()).readonly()
|
|
27750
|
+
});
|
|
27751
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
27752
|
+
var NodeBenchmarkStatusSchema = object({
|
|
27753
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
27754
|
+
modeNodeId: string().nullable(),
|
|
27755
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
27756
|
+
});
|
|
27757
|
+
/**
|
|
27758
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
27759
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
27760
|
+
* ends, never by anyone else.
|
|
27761
|
+
*/
|
|
27762
|
+
var NodeBenchmarkResultSchema = object({
|
|
27763
|
+
id: string(),
|
|
27764
|
+
runId: string(),
|
|
27765
|
+
nodeId: string(),
|
|
27766
|
+
cell: NodeBenchCellSchema,
|
|
27767
|
+
fpsPerStream: number(),
|
|
27768
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27769
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27770
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
27771
|
+
contaminated: boolean(),
|
|
27772
|
+
stayingCameras: array(number()).readonly(),
|
|
27773
|
+
/** The run ended early; the cell itself completed. */
|
|
27774
|
+
partialRun: boolean(),
|
|
27775
|
+
measuredAtMs: number()
|
|
27776
|
+
});
|
|
27777
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
27778
|
+
nodeId: string().optional(),
|
|
27779
|
+
deviceKey: string().optional()
|
|
27780
|
+
});
|
|
27781
|
+
/** A result with its standing today: does it still beat the table? */
|
|
27782
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
27783
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
27784
|
+
standing: _enum([
|
|
27785
|
+
"fresh",
|
|
27786
|
+
"stale",
|
|
27787
|
+
"superseded"
|
|
27788
|
+
]),
|
|
27789
|
+
staleWhy: _enum([
|
|
27790
|
+
"age",
|
|
27791
|
+
"runtime",
|
|
27792
|
+
"pool-tuning"
|
|
27793
|
+
]).nullable()
|
|
27794
|
+
});
|
|
27795
|
+
object({
|
|
27796
|
+
runId: string(),
|
|
27797
|
+
nodeId: string(),
|
|
27798
|
+
startedAtMs: number(),
|
|
27799
|
+
deadlineAtMs: number(),
|
|
27800
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27801
|
+
moved: array(number()).readonly(),
|
|
27802
|
+
staying: array(number()).readonly()
|
|
27803
|
+
});
|
|
27804
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
27805
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
27806
|
+
nodeId: string(),
|
|
27807
|
+
reachable: boolean(),
|
|
27808
|
+
devices: array(object({
|
|
27809
|
+
deviceKey: string(),
|
|
27810
|
+
enabled: boolean(),
|
|
27811
|
+
available: boolean(),
|
|
27812
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
27813
|
+
suggested: array(string()).readonly(),
|
|
27814
|
+
/** Every root detector the device has a build for. */
|
|
27815
|
+
all: array(string()).readonly(),
|
|
27816
|
+
/** The model the device runs now, when pinned. */
|
|
27817
|
+
currentModelId: string().nullable()
|
|
27818
|
+
})).readonly(),
|
|
27819
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
27820
|
+
steps: array(object({
|
|
27821
|
+
id: string(),
|
|
27822
|
+
name: string(),
|
|
27823
|
+
slot: string()
|
|
27824
|
+
})).readonly()
|
|
27825
|
+
});
|
|
25307
27826
|
object({
|
|
25308
27827
|
activeCameras: number(),
|
|
25309
27828
|
throttledCameras: number(),
|
|
@@ -26432,7 +28951,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
26432
28951
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
26433
28952
|
deviceId: number(),
|
|
26434
28953
|
trackId: string()
|
|
26435
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28954
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28955
|
+
accepted: literal(true),
|
|
28956
|
+
runId: string()
|
|
28957
|
+
}), {
|
|
28958
|
+
kind: "mutation",
|
|
28959
|
+
auth: "admin"
|
|
28960
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28961
|
+
kind: "mutation",
|
|
28962
|
+
auth: "admin"
|
|
28963
|
+
});
|
|
26436
28964
|
var CameraPipelineConfigSchema = object({
|
|
26437
28965
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
26438
28966
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -27071,6 +29599,21 @@ method(object({
|
|
|
27071
29599
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
27072
29600
|
kind: "mutation",
|
|
27073
29601
|
auth: "admin"
|
|
29602
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
29603
|
+
kind: literal("started"),
|
|
29604
|
+
runId: string()
|
|
29605
|
+
}), object({
|
|
29606
|
+
kind: literal("refused"),
|
|
29607
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
29608
|
+
})]), {
|
|
29609
|
+
kind: "mutation",
|
|
29610
|
+
auth: "admin"
|
|
29611
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
29612
|
+
kind: "mutation",
|
|
29613
|
+
auth: "admin"
|
|
29614
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
29615
|
+
kind: "mutation",
|
|
29616
|
+
auth: "admin"
|
|
27074
29617
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
27075
29618
|
deviceId: number(),
|
|
27076
29619
|
addonId: string(),
|
|
@@ -27476,8 +30019,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27476
30019
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27477
30020
|
*
|
|
27478
30021
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27479
|
-
* one for transactional / one for notifications). Consumers (
|
|
27480
|
-
*
|
|
30022
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
30023
|
+
* addons, …) walk the collection and pick the first
|
|
27481
30024
|
* ready provider OR target a specific addonId.
|
|
27482
30025
|
*
|
|
27483
30026
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27656,7 +30199,7 @@ targets: array(object({
|
|
|
27656
30199
|
})));
|
|
27657
30200
|
/**
|
|
27658
30201
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27659
|
-
* providers (OIDC, SAML,
|
|
30202
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27660
30203
|
* carrying the post-callback claims before redirecting back to
|
|
27661
30204
|
* `/api/auth/sso/finish`.
|
|
27662
30205
|
*
|
|
@@ -27719,7 +30262,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27719
30262
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
27720
30263
|
* subject is unique only per issuer, so a link is bound to it.
|
|
27721
30264
|
*/
|
|
27722
|
-
issuer: string().optional()
|
|
30265
|
+
issuer: string().optional(),
|
|
30266
|
+
/**
|
|
30267
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30268
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30269
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30270
|
+
* any other browser.
|
|
30271
|
+
*/
|
|
30272
|
+
browserBinding: string().optional()
|
|
27723
30273
|
});
|
|
27724
30274
|
method(object({
|
|
27725
30275
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -33178,6 +35728,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
33178
35728
|
enabled: boolean().optional(),
|
|
33179
35729
|
info: record(string(), unknown()).optional(),
|
|
33180
35730
|
settings: record(string(), unknown()).optional(),
|
|
35731
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
35732
|
+
* the keychain, not the table (D787). */
|
|
35733
|
+
secretKeys: array(string()).optional(),
|
|
33181
35734
|
skipRestart: boolean().optional()
|
|
33182
35735
|
});
|
|
33183
35736
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -33201,7 +35754,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
33201
35754
|
auth: "admin"
|
|
33202
35755
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
33203
35756
|
id: string(),
|
|
33204
|
-
settings: record(string(), unknown())
|
|
35757
|
+
settings: record(string(), unknown()),
|
|
35758
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
35759
|
+
secretKeys: array(string()).optional()
|
|
33205
35760
|
}), object({ success: boolean() }), {
|
|
33206
35761
|
kind: "mutation",
|
|
33207
35762
|
auth: "admin"
|
|
@@ -39973,16 +42528,6 @@ var ApiKeySummarySchema = object({
|
|
|
39973
42528
|
createdAt: number(),
|
|
39974
42529
|
lastUsedAt: number().optional()
|
|
39975
42530
|
});
|
|
39976
|
-
var CreateApiKeyInputSchema = object({
|
|
39977
|
-
label: string(),
|
|
39978
|
-
isAdmin: boolean().default(false),
|
|
39979
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39980
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39981
|
-
});
|
|
39982
|
-
var CreateApiKeyResultSchema = object({
|
|
39983
|
-
token: string(),
|
|
39984
|
-
record: ApiKeySummarySchema
|
|
39985
|
-
});
|
|
39986
42531
|
var ScopedTokenSummarySchema = object({
|
|
39987
42532
|
id: string(),
|
|
39988
42533
|
userId: string(),
|
|
@@ -40081,17 +42626,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40081
42626
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40082
42627
|
kind: "mutation",
|
|
40083
42628
|
access: "view"
|
|
40084
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40085
|
-
kind: "mutation",
|
|
40086
|
-
auth: "admin",
|
|
40087
|
-
access: "create"
|
|
40088
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42629
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40089
42630
|
kind: "mutation",
|
|
40090
42631
|
auth: "admin",
|
|
40091
42632
|
access: "delete"
|
|
40092
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40093
|
-
kind: "mutation",
|
|
40094
|
-
access: "view"
|
|
40095
42633
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40096
42634
|
kind: "mutation",
|
|
40097
42635
|
auth: "admin",
|
|
@@ -40165,15 +42703,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40165
42703
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40166
42704
|
userId: string(),
|
|
40167
42705
|
issuer: string()
|
|
40168
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40169
|
-
userId: string(),
|
|
40170
|
-
issuer: string().min(1),
|
|
40171
|
-
label: string().optional()
|
|
40172
|
-
}), object({ success: literal(true) }), {
|
|
40173
|
-
kind: "mutation",
|
|
40174
|
-
auth: "admin",
|
|
40175
|
-
access: "create"
|
|
40176
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42706
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40177
42707
|
kind: "mutation",
|
|
40178
42708
|
auth: "admin",
|
|
40179
42709
|
access: "delete"
|
|
@@ -40878,6 +43408,451 @@ var zoneRulesCapability = {
|
|
|
40878
43408
|
*/
|
|
40879
43409
|
durability: "restored"
|
|
40880
43410
|
};
|
|
43411
|
+
/**
|
|
43412
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43413
|
+
*
|
|
43414
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43415
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43416
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43417
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43418
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43419
|
+
* manifest entry and nothing else.
|
|
43420
|
+
*
|
|
43421
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43422
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43423
|
+
* Every method is `admin`: these spend money.
|
|
43424
|
+
*
|
|
43425
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43426
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43427
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43428
|
+
*
|
|
43429
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43430
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43431
|
+
* ticket the provider mints (D613).
|
|
43432
|
+
*/
|
|
43433
|
+
var TrainingGpuOptionSchema = object({
|
|
43434
|
+
id: string(),
|
|
43435
|
+
label: string(),
|
|
43436
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43437
|
+
usdPerHour: number().nonnegative(),
|
|
43438
|
+
vramGb: number().nonnegative()
|
|
43439
|
+
});
|
|
43440
|
+
var TrainingRegionOptionSchema = object({
|
|
43441
|
+
/** `''` = any region (the provider's choice). */
|
|
43442
|
+
id: string(),
|
|
43443
|
+
label: string(),
|
|
43444
|
+
priceMultiplier: number().positive()
|
|
43445
|
+
});
|
|
43446
|
+
/**
|
|
43447
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43448
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43449
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43450
|
+
*/
|
|
43451
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43452
|
+
gpuType: string(),
|
|
43453
|
+
region: string(),
|
|
43454
|
+
costCapUsd: number().nonnegative(),
|
|
43455
|
+
maxRuntimeSec: number().int().positive(),
|
|
43456
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43457
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43458
|
+
});
|
|
43459
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43460
|
+
addonId: string(),
|
|
43461
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43462
|
+
kind: string(),
|
|
43463
|
+
label: string(),
|
|
43464
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43465
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43466
|
+
maxDatasetBytes: number().int().positive(),
|
|
43467
|
+
maxRuntimeSec: number().int().positive(),
|
|
43468
|
+
freeTierNote: string().optional(),
|
|
43469
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43470
|
+
dataResidencyNote: string(),
|
|
43471
|
+
/** Credentials are present — never the values. */
|
|
43472
|
+
configured: boolean(),
|
|
43473
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43474
|
+
});
|
|
43475
|
+
var TrainingCredentialCheckSchema = object({
|
|
43476
|
+
ok: boolean(),
|
|
43477
|
+
/** Workspace / account name, when the provider says. */
|
|
43478
|
+
account: string().optional(),
|
|
43479
|
+
reason: _enum([
|
|
43480
|
+
"missing",
|
|
43481
|
+
"invalid",
|
|
43482
|
+
"forbidden",
|
|
43483
|
+
"network",
|
|
43484
|
+
"quota"
|
|
43485
|
+
]).optional(),
|
|
43486
|
+
detail: string().optional()
|
|
43487
|
+
});
|
|
43488
|
+
var ProviderJobStateSchema = _enum([
|
|
43489
|
+
"pending",
|
|
43490
|
+
"starting",
|
|
43491
|
+
"running",
|
|
43492
|
+
"succeeded",
|
|
43493
|
+
"failed",
|
|
43494
|
+
"cancelled",
|
|
43495
|
+
"lost"
|
|
43496
|
+
]);
|
|
43497
|
+
var ProviderJobStatusSchema = object({
|
|
43498
|
+
jobKey: string(),
|
|
43499
|
+
providerJobId: string().optional(),
|
|
43500
|
+
state: ProviderJobStateSchema,
|
|
43501
|
+
startedAt: number().optional(),
|
|
43502
|
+
endedAt: number().optional(),
|
|
43503
|
+
exitCode: number().int().optional(),
|
|
43504
|
+
failureReason: string().optional(),
|
|
43505
|
+
gpuType: string(),
|
|
43506
|
+
region: string().optional(),
|
|
43507
|
+
billedSeconds: number().nonnegative(),
|
|
43508
|
+
costUsd: number().nonnegative(),
|
|
43509
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43510
|
+
costIsEstimate: boolean(),
|
|
43511
|
+
lastFetchedAt: number()
|
|
43512
|
+
});
|
|
43513
|
+
/**
|
|
43514
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43515
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43516
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43517
|
+
* in `result.json`.
|
|
43518
|
+
*/
|
|
43519
|
+
var TrainerSourceRefSchema = object({
|
|
43520
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43521
|
+
repo: string().min(1),
|
|
43522
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43523
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43524
|
+
});
|
|
43525
|
+
var JobRef = {
|
|
43526
|
+
addonId: string(),
|
|
43527
|
+
jobKey: string().uuid()
|
|
43528
|
+
};
|
|
43529
|
+
var TrainingLogLineSchema = object({
|
|
43530
|
+
ts: number(),
|
|
43531
|
+
text: string()
|
|
43532
|
+
});
|
|
43533
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43534
|
+
kind: "mutation",
|
|
43535
|
+
auth: "admin",
|
|
43536
|
+
timeoutMs: 3e4
|
|
43537
|
+
}), method(object({
|
|
43538
|
+
addonId: string(),
|
|
43539
|
+
gpuType: string(),
|
|
43540
|
+
region: string(),
|
|
43541
|
+
datasetBytes: number().int().nonnegative(),
|
|
43542
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43543
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43544
|
+
}), object({
|
|
43545
|
+
usdLow: number().nonnegative(),
|
|
43546
|
+
usdHigh: number().nonnegative(),
|
|
43547
|
+
notes: array(string()).readonly()
|
|
43548
|
+
}), { auth: "admin" }), method(object({
|
|
43549
|
+
...JobRef,
|
|
43550
|
+
ticket: PeerBytesTicketSchema
|
|
43551
|
+
}), object({
|
|
43552
|
+
bytes: number().int().nonnegative(),
|
|
43553
|
+
sha256: string()
|
|
43554
|
+
}), {
|
|
43555
|
+
kind: "mutation",
|
|
43556
|
+
auth: "admin",
|
|
43557
|
+
timeoutMs: 120 * 6e4
|
|
43558
|
+
}), method(object({
|
|
43559
|
+
...JobRef,
|
|
43560
|
+
trainer: TrainerSourceRefSchema,
|
|
43561
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43562
|
+
gpuType: string(),
|
|
43563
|
+
region: string(),
|
|
43564
|
+
maxRuntimeSec: number().int().positive()
|
|
43565
|
+
}), ProviderJobStatusSchema, {
|
|
43566
|
+
kind: "mutation",
|
|
43567
|
+
auth: "admin",
|
|
43568
|
+
timeoutMs: 30 * 6e4
|
|
43569
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43570
|
+
auth: "admin",
|
|
43571
|
+
timeoutMs: 6e4
|
|
43572
|
+
}), method(object({
|
|
43573
|
+
...JobRef,
|
|
43574
|
+
cursor: string().optional(),
|
|
43575
|
+
max: number().int().min(1).max(500)
|
|
43576
|
+
}), object({
|
|
43577
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43578
|
+
cursor: string()
|
|
43579
|
+
}), {
|
|
43580
|
+
auth: "admin",
|
|
43581
|
+
timeoutMs: 6e4
|
|
43582
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43583
|
+
kind: "mutation",
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 6e4
|
|
43586
|
+
}), method(object(JobRef), object({
|
|
43587
|
+
found: boolean(),
|
|
43588
|
+
text: string().optional()
|
|
43589
|
+
}), {
|
|
43590
|
+
kind: "mutation",
|
|
43591
|
+
auth: "admin",
|
|
43592
|
+
timeoutMs: 5 * 6e4
|
|
43593
|
+
}), method(object({
|
|
43594
|
+
...JobRef,
|
|
43595
|
+
path: _enum(["bundle.tar"])
|
|
43596
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43597
|
+
kind: "mutation",
|
|
43598
|
+
auth: "admin",
|
|
43599
|
+
timeoutMs: 5 * 6e4
|
|
43600
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43601
|
+
kind: "mutation",
|
|
43602
|
+
auth: "admin",
|
|
43603
|
+
timeoutMs: 5 * 6e4
|
|
43604
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43605
|
+
auth: "admin",
|
|
43606
|
+
timeoutMs: 2 * 6e4
|
|
43607
|
+
});
|
|
43608
|
+
/**
|
|
43609
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43610
|
+
* provided by `addon-training`.
|
|
43611
|
+
*
|
|
43612
|
+
* It owns what every provider must agree on, written once:
|
|
43613
|
+
*
|
|
43614
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43615
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43616
|
+
* the export plan) and reaches this store through the five row methods
|
|
43617
|
+
* below, so the Retrain page and the export did not change.
|
|
43618
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43619
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43620
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43621
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43622
|
+
* rollback. Nothing is ever registered automatically.
|
|
43623
|
+
*
|
|
43624
|
+
* Every method is `admin`.
|
|
43625
|
+
*/
|
|
43626
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43627
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43628
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43629
|
+
var TrainingBaseModelSchema = object({
|
|
43630
|
+
modelId: string(),
|
|
43631
|
+
label: string(),
|
|
43632
|
+
weights: string(),
|
|
43633
|
+
imgsz: number().int(),
|
|
43634
|
+
baselineOnnxUrl: string(),
|
|
43635
|
+
baselineFloors: record(string(), number()),
|
|
43636
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43637
|
+
recommended: boolean()
|
|
43638
|
+
});
|
|
43639
|
+
var TrainingPresetSchema = _enum([
|
|
43640
|
+
"quick",
|
|
43641
|
+
"standard",
|
|
43642
|
+
"thorough"
|
|
43643
|
+
]);
|
|
43644
|
+
var TrainingJobRequestSchema = object({
|
|
43645
|
+
datasetVersionId: string().min(1),
|
|
43646
|
+
/** The `training-provider` addon that runs it. */
|
|
43647
|
+
addonId: string().min(1),
|
|
43648
|
+
gpuType: string().min(1),
|
|
43649
|
+
region: string(),
|
|
43650
|
+
baseModelId: string().min(1),
|
|
43651
|
+
preset: TrainingPresetSchema,
|
|
43652
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43653
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43654
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43655
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43656
|
+
});
|
|
43657
|
+
var TrainingSplitPlanSchema = object({
|
|
43658
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43659
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43660
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43661
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43662
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43663
|
+
trainSubjects: number().int()
|
|
43664
|
+
});
|
|
43665
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43666
|
+
"unknown-dataset",
|
|
43667
|
+
"unknown-provider",
|
|
43668
|
+
"provider-not-configured",
|
|
43669
|
+
"unknown-base-model",
|
|
43670
|
+
"unknown-gpu",
|
|
43671
|
+
"dataset-too-large",
|
|
43672
|
+
"no-training-subjects",
|
|
43673
|
+
"job-already-running"
|
|
43674
|
+
]);
|
|
43675
|
+
var TrainingJobPlanSchema = object({
|
|
43676
|
+
refusal: object({
|
|
43677
|
+
reason: TrainingRefusalReasonSchema,
|
|
43678
|
+
detail: string()
|
|
43679
|
+
}).nullable(),
|
|
43680
|
+
warnings: array(string()).readonly(),
|
|
43681
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43682
|
+
estimate: object({
|
|
43683
|
+
datasetBytes: number().int(),
|
|
43684
|
+
uploadMinutesAt20Mbps: number(),
|
|
43685
|
+
gpuSecondsLow: number(),
|
|
43686
|
+
gpuSecondsHigh: number(),
|
|
43687
|
+
usdLow: number(),
|
|
43688
|
+
usdHigh: number(),
|
|
43689
|
+
notes: array(string()).readonly()
|
|
43690
|
+
}).nullable(),
|
|
43691
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43692
|
+
defaults: object({
|
|
43693
|
+
maxCostUsd: number(),
|
|
43694
|
+
maxRuntimeSec: number().int()
|
|
43695
|
+
}).nullable(),
|
|
43696
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43697
|
+
dataNotice: string()
|
|
43698
|
+
});
|
|
43699
|
+
/**
|
|
43700
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43701
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43702
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43703
|
+
* result lives after the operator acted on it.
|
|
43704
|
+
*/
|
|
43705
|
+
var TrainingJobStateSchema = _enum([
|
|
43706
|
+
"uploading",
|
|
43707
|
+
"submitted",
|
|
43708
|
+
"starting",
|
|
43709
|
+
"running",
|
|
43710
|
+
"collecting",
|
|
43711
|
+
"ready",
|
|
43712
|
+
"registered",
|
|
43713
|
+
"canary",
|
|
43714
|
+
"failed",
|
|
43715
|
+
"cancelling",
|
|
43716
|
+
"cancelled",
|
|
43717
|
+
"lost",
|
|
43718
|
+
"expired",
|
|
43719
|
+
"discarded"
|
|
43720
|
+
]);
|
|
43721
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43722
|
+
"cost-cap",
|
|
43723
|
+
"runtime-cap",
|
|
43724
|
+
"upload-failed",
|
|
43725
|
+
"submit-failed",
|
|
43726
|
+
"trainer-failed",
|
|
43727
|
+
"result-invalid",
|
|
43728
|
+
"checksum-mismatch",
|
|
43729
|
+
"fetch-failed",
|
|
43730
|
+
"provider-error",
|
|
43731
|
+
"hub-restart-during-upload"
|
|
43732
|
+
]);
|
|
43733
|
+
var TrainingProgressPointSchema = object({
|
|
43734
|
+
epoch: number().int(),
|
|
43735
|
+
map50: number().nullable(),
|
|
43736
|
+
map50_95: number().nullable()
|
|
43737
|
+
});
|
|
43738
|
+
var TrainingCanarySchema = object({
|
|
43739
|
+
deviceIds: array(number().int()).readonly(),
|
|
43740
|
+
since: number(),
|
|
43741
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43742
|
+
previous: array(object({
|
|
43743
|
+
deviceId: number().int(),
|
|
43744
|
+
nodeId: string(),
|
|
43745
|
+
deviceKey: string(),
|
|
43746
|
+
patch: object({
|
|
43747
|
+
modelId: string().optional(),
|
|
43748
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43749
|
+
}).nullable()
|
|
43750
|
+
})).readonly()
|
|
43751
|
+
});
|
|
43752
|
+
var TrainingJobSchema = object({
|
|
43753
|
+
id: string(),
|
|
43754
|
+
idempotencyKey: string(),
|
|
43755
|
+
name: string(),
|
|
43756
|
+
createdAt: number(),
|
|
43757
|
+
updatedAt: number(),
|
|
43758
|
+
state: TrainingJobStateSchema,
|
|
43759
|
+
stage: TrainingStageSchema.nullable(),
|
|
43760
|
+
failure: object({
|
|
43761
|
+
reason: TrainingFailureReasonSchema,
|
|
43762
|
+
stage: string().nullable(),
|
|
43763
|
+
detail: string()
|
|
43764
|
+
}).nullable(),
|
|
43765
|
+
request: TrainingJobRequestSchema,
|
|
43766
|
+
maxCostUsd: number().nonnegative(),
|
|
43767
|
+
maxRuntimeSec: number().int().positive(),
|
|
43768
|
+
trainer: TrainerSourceRefSchema,
|
|
43769
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43770
|
+
dataset: object({
|
|
43771
|
+
bytes: number().int(),
|
|
43772
|
+
sha256: string(),
|
|
43773
|
+
uploadedAt: number()
|
|
43774
|
+
}).nullable(),
|
|
43775
|
+
split: TrainingSplitPlanSchema,
|
|
43776
|
+
provider: object({
|
|
43777
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43778
|
+
providerJobId: string().nullable(),
|
|
43779
|
+
startedAt: number().nullable(),
|
|
43780
|
+
endedAt: number().nullable(),
|
|
43781
|
+
billedSeconds: number(),
|
|
43782
|
+
costUsd: number(),
|
|
43783
|
+
costIsEstimate: boolean(),
|
|
43784
|
+
lastPolledAt: number().nullable()
|
|
43785
|
+
}),
|
|
43786
|
+
progress: object({
|
|
43787
|
+
epoch: number().int().nullable(),
|
|
43788
|
+
epochs: number().int().nullable(),
|
|
43789
|
+
etaSec: number().nullable(),
|
|
43790
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43791
|
+
}),
|
|
43792
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43793
|
+
logTail: array(string()).readonly(),
|
|
43794
|
+
logCursor: string().nullable(),
|
|
43795
|
+
artifacts: object({
|
|
43796
|
+
bundleBytes: number().int(),
|
|
43797
|
+
bundleSha256: string(),
|
|
43798
|
+
fetchedAt: number(),
|
|
43799
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43800
|
+
expiresAt: number()
|
|
43801
|
+
}).nullable(),
|
|
43802
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43803
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43804
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43805
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43806
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43807
|
+
registeredModelIds: array(string()).readonly(),
|
|
43808
|
+
canary: TrainingCanarySchema.nullable()
|
|
43809
|
+
});
|
|
43810
|
+
var IdInput = object({ id: string().min(1) });
|
|
43811
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43812
|
+
kind: "mutation",
|
|
43813
|
+
auth: "admin"
|
|
43814
|
+
}), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
|
|
43815
|
+
kind: "mutation",
|
|
43816
|
+
auth: "admin"
|
|
43817
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43818
|
+
auth: "admin",
|
|
43819
|
+
timeoutMs: 6e4
|
|
43820
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43821
|
+
name: string().min(1).max(120),
|
|
43822
|
+
maxCostUsd: number().positive(),
|
|
43823
|
+
maxRuntimeSec: number().int().positive(),
|
|
43824
|
+
idempotencyKey: string().min(8).max(80)
|
|
43825
|
+
}), discriminatedUnion("kind", [object({
|
|
43826
|
+
kind: literal("started"),
|
|
43827
|
+
job: TrainingJobSchema
|
|
43828
|
+
}), object({
|
|
43829
|
+
kind: literal("refused"),
|
|
43830
|
+
reason: TrainingRefusalReasonSchema,
|
|
43831
|
+
detail: string()
|
|
43832
|
+
})]), {
|
|
43833
|
+
kind: "mutation",
|
|
43834
|
+
auth: "admin",
|
|
43835
|
+
timeoutMs: 12e4
|
|
43836
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43837
|
+
kind: "mutation",
|
|
43838
|
+
auth: "admin",
|
|
43839
|
+
timeoutMs: 12e4
|
|
43840
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43841
|
+
kind: "mutation",
|
|
43842
|
+
auth: "admin",
|
|
43843
|
+
timeoutMs: 30 * 6e4
|
|
43844
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43845
|
+
kind: "mutation",
|
|
43846
|
+
auth: "admin",
|
|
43847
|
+
timeoutMs: 12e4
|
|
43848
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43849
|
+
kind: "mutation",
|
|
43850
|
+
auth: "admin",
|
|
43851
|
+
timeoutMs: 12e4
|
|
43852
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43853
|
+
kind: "mutation",
|
|
43854
|
+
auth: "admin"
|
|
43855
|
+
});
|
|
40881
43856
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40882
43857
|
Object.freeze({
|
|
40883
43858
|
person: .5,
|
|
@@ -41364,7 +44339,8 @@ var BaseDevice = class {
|
|
|
41364
44339
|
this.role = options.role;
|
|
41365
44340
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41366
44341
|
const seedData = ctx.persistedConfig ?? {};
|
|
41367
|
-
|
|
44342
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
44343
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41368
44344
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41369
44345
|
tags: {
|
|
41370
44346
|
deviceId: ctx.id,
|
|
@@ -43025,6 +46001,12 @@ Object.freeze({
|
|
|
43025
46001
|
addonId: null,
|
|
43026
46002
|
access: "create"
|
|
43027
46003
|
},
|
|
46004
|
+
"backup.checkBackupKey": {
|
|
46005
|
+
capName: "backup",
|
|
46006
|
+
capScope: "system",
|
|
46007
|
+
addonId: null,
|
|
46008
|
+
access: "create"
|
|
46009
|
+
},
|
|
43028
46010
|
"backup.delete": {
|
|
43029
46011
|
capName: "backup",
|
|
43030
46012
|
capScope: "system",
|
|
@@ -43037,6 +46019,18 @@ Object.freeze({
|
|
|
43037
46019
|
addonId: null,
|
|
43038
46020
|
access: "delete"
|
|
43039
46021
|
},
|
|
46022
|
+
"backup.disableEncryption": {
|
|
46023
|
+
capName: "backup",
|
|
46024
|
+
capScope: "system",
|
|
46025
|
+
addonId: null,
|
|
46026
|
+
access: "create"
|
|
46027
|
+
},
|
|
46028
|
+
"backup.getEncryption": {
|
|
46029
|
+
capName: "backup",
|
|
46030
|
+
capScope: "system",
|
|
46031
|
+
addonId: null,
|
|
46032
|
+
access: "view"
|
|
46033
|
+
},
|
|
43040
46034
|
"backup.getEntries": {
|
|
43041
46035
|
capName: "backup",
|
|
43042
46036
|
capScope: "system",
|
|
@@ -43091,6 +46085,12 @@ Object.freeze({
|
|
|
43091
46085
|
addonId: null,
|
|
43092
46086
|
access: "create"
|
|
43093
46087
|
},
|
|
46088
|
+
"backup.setupEncryption": {
|
|
46089
|
+
capName: "backup",
|
|
46090
|
+
capScope: "system",
|
|
46091
|
+
addonId: null,
|
|
46092
|
+
access: "create"
|
|
46093
|
+
},
|
|
43094
46094
|
"backup.trigger": {
|
|
43095
46095
|
capName: "backup",
|
|
43096
46096
|
capScope: "system",
|
|
@@ -43643,6 +46643,12 @@ Object.freeze({
|
|
|
43643
46643
|
addonId: null,
|
|
43644
46644
|
access: "create"
|
|
43645
46645
|
},
|
|
46646
|
+
"customModelRegistry.importModelBundle": {
|
|
46647
|
+
capName: "custom-model-registry",
|
|
46648
|
+
capScope: "system",
|
|
46649
|
+
addonId: null,
|
|
46650
|
+
access: "create"
|
|
46651
|
+
},
|
|
43646
46652
|
"customModelRegistry.listModels": {
|
|
43647
46653
|
capName: "custom-model-registry",
|
|
43648
46654
|
capScope: "system",
|
|
@@ -45053,6 +48059,108 @@ Object.freeze({
|
|
|
45053
48059
|
addonId: null,
|
|
45054
48060
|
access: "create"
|
|
45055
48061
|
},
|
|
48062
|
+
"keychain.delete": {
|
|
48063
|
+
capName: "keychain",
|
|
48064
|
+
capScope: "system",
|
|
48065
|
+
addonId: null,
|
|
48066
|
+
access: "delete"
|
|
48067
|
+
},
|
|
48068
|
+
"keychain.getState": {
|
|
48069
|
+
capName: "keychain",
|
|
48070
|
+
capScope: "system",
|
|
48071
|
+
addonId: null,
|
|
48072
|
+
access: "view"
|
|
48073
|
+
},
|
|
48074
|
+
"keychain.listMeta": {
|
|
48075
|
+
capName: "keychain",
|
|
48076
|
+
capScope: "system",
|
|
48077
|
+
addonId: null,
|
|
48078
|
+
access: "view"
|
|
48079
|
+
},
|
|
48080
|
+
"keychain.put": {
|
|
48081
|
+
capName: "keychain",
|
|
48082
|
+
capScope: "system",
|
|
48083
|
+
addonId: null,
|
|
48084
|
+
access: "create"
|
|
48085
|
+
},
|
|
48086
|
+
"keychain.resolve": {
|
|
48087
|
+
capName: "keychain",
|
|
48088
|
+
capScope: "system",
|
|
48089
|
+
addonId: null,
|
|
48090
|
+
access: "view"
|
|
48091
|
+
},
|
|
48092
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48093
|
+
capName: "keychain-admin",
|
|
48094
|
+
capScope: "system",
|
|
48095
|
+
addonId: null,
|
|
48096
|
+
access: "create"
|
|
48097
|
+
},
|
|
48098
|
+
"keychainAdmin.deleteOrphans": {
|
|
48099
|
+
capName: "keychain-admin",
|
|
48100
|
+
capScope: "system",
|
|
48101
|
+
addonId: null,
|
|
48102
|
+
access: "delete"
|
|
48103
|
+
},
|
|
48104
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
48105
|
+
capName: "keychain-admin",
|
|
48106
|
+
capScope: "system",
|
|
48107
|
+
addonId: null,
|
|
48108
|
+
access: "create"
|
|
48109
|
+
},
|
|
48110
|
+
"keychainAdmin.listAudit": {
|
|
48111
|
+
capName: "keychain-admin",
|
|
48112
|
+
capScope: "system",
|
|
48113
|
+
addonId: null,
|
|
48114
|
+
access: "view"
|
|
48115
|
+
},
|
|
48116
|
+
"keychainAdmin.listSecrets": {
|
|
48117
|
+
capName: "keychain-admin",
|
|
48118
|
+
capScope: "system",
|
|
48119
|
+
addonId: null,
|
|
48120
|
+
access: "view"
|
|
48121
|
+
},
|
|
48122
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
48123
|
+
capName: "keychain-admin",
|
|
48124
|
+
capScope: "system",
|
|
48125
|
+
addonId: null,
|
|
48126
|
+
access: "delete"
|
|
48127
|
+
},
|
|
48128
|
+
"keychainAdmin.resetKeychain": {
|
|
48129
|
+
capName: "keychain-admin",
|
|
48130
|
+
capScope: "system",
|
|
48131
|
+
addonId: null,
|
|
48132
|
+
access: "delete"
|
|
48133
|
+
},
|
|
48134
|
+
"keychainAdmin.resetReport": {
|
|
48135
|
+
capName: "keychain-admin",
|
|
48136
|
+
capScope: "system",
|
|
48137
|
+
addonId: null,
|
|
48138
|
+
access: "delete"
|
|
48139
|
+
},
|
|
48140
|
+
"keychainAdmin.reveal": {
|
|
48141
|
+
capName: "keychain-admin",
|
|
48142
|
+
capScope: "system",
|
|
48143
|
+
addonId: null,
|
|
48144
|
+
access: "create"
|
|
48145
|
+
},
|
|
48146
|
+
"keychainAdmin.rotateMasterKey": {
|
|
48147
|
+
capName: "keychain-admin",
|
|
48148
|
+
capScope: "system",
|
|
48149
|
+
addonId: null,
|
|
48150
|
+
access: "create"
|
|
48151
|
+
},
|
|
48152
|
+
"keychainAdmin.setSystemSecret": {
|
|
48153
|
+
capName: "keychain-admin",
|
|
48154
|
+
capScope: "system",
|
|
48155
|
+
addonId: null,
|
|
48156
|
+
access: "create"
|
|
48157
|
+
},
|
|
48158
|
+
"keychainAdmin.status": {
|
|
48159
|
+
capName: "keychain-admin",
|
|
48160
|
+
capScope: "system",
|
|
48161
|
+
addonId: null,
|
|
48162
|
+
access: "view"
|
|
48163
|
+
},
|
|
45056
48164
|
"lawnMowerControl.dock": {
|
|
45057
48165
|
capName: "lawn-mower-control",
|
|
45058
48166
|
capScope: "device",
|
|
@@ -46427,6 +49535,18 @@ Object.freeze({
|
|
|
46427
49535
|
addonId: null,
|
|
46428
49536
|
access: "create"
|
|
46429
49537
|
},
|
|
49538
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
49539
|
+
capName: "pipeline-analytics",
|
|
49540
|
+
capScope: "device",
|
|
49541
|
+
addonId: null,
|
|
49542
|
+
access: "create"
|
|
49543
|
+
},
|
|
49544
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
49545
|
+
capName: "pipeline-analytics",
|
|
49546
|
+
capScope: "device",
|
|
49547
|
+
addonId: null,
|
|
49548
|
+
access: "create"
|
|
49549
|
+
},
|
|
46430
49550
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46431
49551
|
capName: "pipeline-analytics",
|
|
46432
49552
|
capScope: "device",
|
|
@@ -46475,12 +49595,36 @@ Object.freeze({
|
|
|
46475
49595
|
addonId: null,
|
|
46476
49596
|
access: "view"
|
|
46477
49597
|
},
|
|
49598
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
49599
|
+
capName: "pipeline-analytics",
|
|
49600
|
+
capScope: "device",
|
|
49601
|
+
addonId: null,
|
|
49602
|
+
access: "create"
|
|
49603
|
+
},
|
|
49604
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49605
|
+
capName: "pipeline-analytics",
|
|
49606
|
+
capScope: "device",
|
|
49607
|
+
addonId: null,
|
|
49608
|
+
access: "create"
|
|
49609
|
+
},
|
|
46478
49610
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46479
49611
|
capName: "pipeline-analytics",
|
|
46480
49612
|
capScope: "device",
|
|
46481
49613
|
addonId: null,
|
|
46482
49614
|
access: "delete"
|
|
46483
49615
|
},
|
|
49616
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
49617
|
+
capName: "pipeline-analytics",
|
|
49618
|
+
capScope: "device",
|
|
49619
|
+
addonId: null,
|
|
49620
|
+
access: "delete"
|
|
49621
|
+
},
|
|
49622
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49623
|
+
capName: "pipeline-analytics",
|
|
49624
|
+
capScope: "device",
|
|
49625
|
+
addonId: null,
|
|
49626
|
+
access: "delete"
|
|
49627
|
+
},
|
|
46484
49628
|
"pipelineAnalytics.deleteTracks": {
|
|
46485
49629
|
capName: "pipeline-analytics",
|
|
46486
49630
|
capScope: "device",
|
|
@@ -46685,6 +49829,30 @@ Object.freeze({
|
|
|
46685
49829
|
addonId: null,
|
|
46686
49830
|
access: "view"
|
|
46687
49831
|
},
|
|
49832
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
49833
|
+
capName: "pipeline-analytics",
|
|
49834
|
+
capScope: "device",
|
|
49835
|
+
addonId: null,
|
|
49836
|
+
access: "view"
|
|
49837
|
+
},
|
|
49838
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
49839
|
+
capName: "pipeline-analytics",
|
|
49840
|
+
capScope: "device",
|
|
49841
|
+
addonId: null,
|
|
49842
|
+
access: "view"
|
|
49843
|
+
},
|
|
49844
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49845
|
+
capName: "pipeline-analytics",
|
|
49846
|
+
capScope: "device",
|
|
49847
|
+
addonId: null,
|
|
49848
|
+
access: "view"
|
|
49849
|
+
},
|
|
49850
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49851
|
+
capName: "pipeline-analytics",
|
|
49852
|
+
capScope: "device",
|
|
49853
|
+
addonId: null,
|
|
49854
|
+
access: "view"
|
|
49855
|
+
},
|
|
46688
49856
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46689
49857
|
capName: "pipeline-analytics",
|
|
46690
49858
|
capScope: "device",
|
|
@@ -46715,6 +49883,12 @@ Object.freeze({
|
|
|
46715
49883
|
addonId: null,
|
|
46716
49884
|
access: "view"
|
|
46717
49885
|
},
|
|
49886
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49887
|
+
capName: "pipeline-analytics",
|
|
49888
|
+
capScope: "device",
|
|
49889
|
+
addonId: null,
|
|
49890
|
+
access: "create"
|
|
49891
|
+
},
|
|
46718
49892
|
"pipelineAnalytics.ownersWithMedia": {
|
|
46719
49893
|
capName: "pipeline-analytics",
|
|
46720
49894
|
capScope: "device",
|
|
@@ -46727,12 +49901,24 @@ Object.freeze({
|
|
|
46727
49901
|
addonId: null,
|
|
46728
49902
|
access: "create"
|
|
46729
49903
|
},
|
|
49904
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49905
|
+
capName: "pipeline-analytics",
|
|
49906
|
+
capScope: "device",
|
|
49907
|
+
addonId: null,
|
|
49908
|
+
access: "view"
|
|
49909
|
+
},
|
|
46730
49910
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
46731
49911
|
capName: "pipeline-analytics",
|
|
46732
49912
|
capScope: "device",
|
|
46733
49913
|
addonId: null,
|
|
46734
49914
|
access: "create"
|
|
46735
49915
|
},
|
|
49916
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49917
|
+
capName: "pipeline-analytics",
|
|
49918
|
+
capScope: "device",
|
|
49919
|
+
addonId: null,
|
|
49920
|
+
access: "create"
|
|
49921
|
+
},
|
|
46736
49922
|
"pipelineAnalytics.pruneEvents": {
|
|
46737
49923
|
capName: "pipeline-analytics",
|
|
46738
49924
|
capScope: "device",
|
|
@@ -46787,6 +49973,18 @@ Object.freeze({
|
|
|
46787
49973
|
addonId: null,
|
|
46788
49974
|
access: "create"
|
|
46789
49975
|
},
|
|
49976
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49977
|
+
capName: "pipeline-analytics",
|
|
49978
|
+
capScope: "device",
|
|
49979
|
+
addonId: null,
|
|
49980
|
+
access: "delete"
|
|
49981
|
+
},
|
|
49982
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49983
|
+
capName: "pipeline-analytics",
|
|
49984
|
+
capScope: "device",
|
|
49985
|
+
addonId: null,
|
|
49986
|
+
access: "create"
|
|
49987
|
+
},
|
|
46790
49988
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46791
49989
|
capName: "pipeline-analytics",
|
|
46792
49990
|
capScope: "device",
|
|
@@ -46847,6 +50045,12 @@ Object.freeze({
|
|
|
46847
50045
|
addonId: null,
|
|
46848
50046
|
access: "create"
|
|
46849
50047
|
},
|
|
50048
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50049
|
+
capName: "pipeline-analytics",
|
|
50050
|
+
capScope: "device",
|
|
50051
|
+
addonId: null,
|
|
50052
|
+
access: "view"
|
|
50053
|
+
},
|
|
46850
50054
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46851
50055
|
capName: "pipeline-analytics",
|
|
46852
50056
|
capScope: "device",
|
|
@@ -47075,6 +50279,12 @@ Object.freeze({
|
|
|
47075
50279
|
addonId: null,
|
|
47076
50280
|
access: "view"
|
|
47077
50281
|
},
|
|
50282
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
50283
|
+
capName: "pipeline-orchestrator",
|
|
50284
|
+
capScope: "system",
|
|
50285
|
+
addonId: null,
|
|
50286
|
+
access: "create"
|
|
50287
|
+
},
|
|
47078
50288
|
"pipelineOrchestrator.applyAutoTune": {
|
|
47079
50289
|
capName: "pipeline-orchestrator",
|
|
47080
50290
|
capScope: "system",
|
|
@@ -47099,6 +50309,12 @@ Object.freeze({
|
|
|
47099
50309
|
addonId: null,
|
|
47100
50310
|
access: "create"
|
|
47101
50311
|
},
|
|
50312
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
50313
|
+
capName: "pipeline-orchestrator",
|
|
50314
|
+
capScope: "system",
|
|
50315
|
+
addonId: null,
|
|
50316
|
+
access: "delete"
|
|
50317
|
+
},
|
|
47102
50318
|
"pipelineOrchestrator.getAgentLoad": {
|
|
47103
50319
|
capName: "pipeline-orchestrator",
|
|
47104
50320
|
capScope: "system",
|
|
@@ -47207,6 +50423,24 @@ Object.freeze({
|
|
|
47207
50423
|
addonId: null,
|
|
47208
50424
|
access: "view"
|
|
47209
50425
|
},
|
|
50426
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
50427
|
+
capName: "pipeline-orchestrator",
|
|
50428
|
+
capScope: "system",
|
|
50429
|
+
addonId: null,
|
|
50430
|
+
access: "view"
|
|
50431
|
+
},
|
|
50432
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
50433
|
+
capName: "pipeline-orchestrator",
|
|
50434
|
+
capScope: "system",
|
|
50435
|
+
addonId: null,
|
|
50436
|
+
access: "view"
|
|
50437
|
+
},
|
|
50438
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
50439
|
+
capName: "pipeline-orchestrator",
|
|
50440
|
+
capScope: "system",
|
|
50441
|
+
addonId: null,
|
|
50442
|
+
access: "view"
|
|
50443
|
+
},
|
|
47210
50444
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
47211
50445
|
capName: "pipeline-orchestrator",
|
|
47212
50446
|
capScope: "system",
|
|
@@ -47249,6 +50483,12 @@ Object.freeze({
|
|
|
47249
50483
|
addonId: null,
|
|
47250
50484
|
access: "view"
|
|
47251
50485
|
},
|
|
50486
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
50487
|
+
capName: "pipeline-orchestrator",
|
|
50488
|
+
capScope: "system",
|
|
50489
|
+
addonId: null,
|
|
50490
|
+
access: "view"
|
|
50491
|
+
},
|
|
47252
50492
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
47253
50493
|
capName: "pipeline-orchestrator",
|
|
47254
50494
|
capScope: "system",
|
|
@@ -47393,6 +50633,12 @@ Object.freeze({
|
|
|
47393
50633
|
addonId: null,
|
|
47394
50634
|
access: "create"
|
|
47395
50635
|
},
|
|
50636
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
50637
|
+
capName: "pipeline-orchestrator",
|
|
50638
|
+
capScope: "system",
|
|
50639
|
+
addonId: null,
|
|
50640
|
+
access: "create"
|
|
50641
|
+
},
|
|
47396
50642
|
"pipelineOrchestrator.suggestShares": {
|
|
47397
50643
|
capName: "pipeline-orchestrator",
|
|
47398
50644
|
capScope: "system",
|
|
@@ -47411,6 +50657,12 @@ Object.freeze({
|
|
|
47411
50657
|
addonId: null,
|
|
47412
50658
|
access: "create"
|
|
47413
50659
|
},
|
|
50660
|
+
"pipelineRunner.abortNodeBench": {
|
|
50661
|
+
capName: "pipeline-runner",
|
|
50662
|
+
capScope: "system",
|
|
50663
|
+
addonId: null,
|
|
50664
|
+
access: "create"
|
|
50665
|
+
},
|
|
47414
50666
|
"pipelineRunner.attachCamera": {
|
|
47415
50667
|
capName: "pipeline-runner",
|
|
47416
50668
|
capScope: "system",
|
|
@@ -47459,6 +50711,12 @@ Object.freeze({
|
|
|
47459
50711
|
addonId: null,
|
|
47460
50712
|
access: "view"
|
|
47461
50713
|
},
|
|
50714
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
50715
|
+
capName: "pipeline-runner",
|
|
50716
|
+
capScope: "system",
|
|
50717
|
+
addonId: null,
|
|
50718
|
+
access: "view"
|
|
50719
|
+
},
|
|
47462
50720
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47463
50721
|
capName: "pipeline-runner",
|
|
47464
50722
|
capScope: "system",
|
|
@@ -47501,6 +50759,12 @@ Object.freeze({
|
|
|
47501
50759
|
addonId: null,
|
|
47502
50760
|
access: "create"
|
|
47503
50761
|
},
|
|
50762
|
+
"pipelineRunner.startNodeBench": {
|
|
50763
|
+
capName: "pipeline-runner",
|
|
50764
|
+
capScope: "system",
|
|
50765
|
+
addonId: null,
|
|
50766
|
+
access: "create"
|
|
50767
|
+
},
|
|
47504
50768
|
"plateGallery.assignPlate": {
|
|
47505
50769
|
capName: "plate-gallery",
|
|
47506
50770
|
capScope: "system",
|
|
@@ -49163,6 +52427,174 @@ Object.freeze({
|
|
|
49163
52427
|
addonId: null,
|
|
49164
52428
|
access: "view"
|
|
49165
52429
|
},
|
|
52430
|
+
"training.canaryResult": {
|
|
52431
|
+
capName: "training",
|
|
52432
|
+
capScope: "system",
|
|
52433
|
+
addonId: null,
|
|
52434
|
+
access: "create"
|
|
52435
|
+
},
|
|
52436
|
+
"training.cancelJob": {
|
|
52437
|
+
capName: "training",
|
|
52438
|
+
capScope: "system",
|
|
52439
|
+
addonId: null,
|
|
52440
|
+
access: "create"
|
|
52441
|
+
},
|
|
52442
|
+
"training.discardResult": {
|
|
52443
|
+
capName: "training",
|
|
52444
|
+
capScope: "system",
|
|
52445
|
+
addonId: null,
|
|
52446
|
+
access: "create"
|
|
52447
|
+
},
|
|
52448
|
+
"training.findDatasetVersionIdByName": {
|
|
52449
|
+
capName: "training",
|
|
52450
|
+
capScope: "system",
|
|
52451
|
+
addonId: null,
|
|
52452
|
+
access: "view"
|
|
52453
|
+
},
|
|
52454
|
+
"training.getDatasetVersion": {
|
|
52455
|
+
capName: "training",
|
|
52456
|
+
capScope: "system",
|
|
52457
|
+
addonId: null,
|
|
52458
|
+
access: "view"
|
|
52459
|
+
},
|
|
52460
|
+
"training.getJob": {
|
|
52461
|
+
capName: "training",
|
|
52462
|
+
capScope: "system",
|
|
52463
|
+
addonId: null,
|
|
52464
|
+
access: "view"
|
|
52465
|
+
},
|
|
52466
|
+
"training.getJobResult": {
|
|
52467
|
+
capName: "training",
|
|
52468
|
+
capScope: "system",
|
|
52469
|
+
addonId: null,
|
|
52470
|
+
access: "view"
|
|
52471
|
+
},
|
|
52472
|
+
"training.listBaseModels": {
|
|
52473
|
+
capName: "training",
|
|
52474
|
+
capScope: "system",
|
|
52475
|
+
addonId: null,
|
|
52476
|
+
access: "view"
|
|
52477
|
+
},
|
|
52478
|
+
"training.listDatasetVersions": {
|
|
52479
|
+
capName: "training",
|
|
52480
|
+
capScope: "system",
|
|
52481
|
+
addonId: null,
|
|
52482
|
+
access: "view"
|
|
52483
|
+
},
|
|
52484
|
+
"training.listJobs": {
|
|
52485
|
+
capName: "training",
|
|
52486
|
+
capScope: "system",
|
|
52487
|
+
addonId: null,
|
|
52488
|
+
access: "view"
|
|
52489
|
+
},
|
|
52490
|
+
"training.planJob": {
|
|
52491
|
+
capName: "training",
|
|
52492
|
+
capScope: "system",
|
|
52493
|
+
addonId: null,
|
|
52494
|
+
access: "view"
|
|
52495
|
+
},
|
|
52496
|
+
"training.putDatasetVersion": {
|
|
52497
|
+
capName: "training",
|
|
52498
|
+
capScope: "system",
|
|
52499
|
+
addonId: null,
|
|
52500
|
+
access: "create"
|
|
52501
|
+
},
|
|
52502
|
+
"training.registerResult": {
|
|
52503
|
+
capName: "training",
|
|
52504
|
+
capScope: "system",
|
|
52505
|
+
addonId: null,
|
|
52506
|
+
access: "create"
|
|
52507
|
+
},
|
|
52508
|
+
"training.removeDatasetVersion": {
|
|
52509
|
+
capName: "training",
|
|
52510
|
+
capScope: "system",
|
|
52511
|
+
addonId: null,
|
|
52512
|
+
access: "delete"
|
|
52513
|
+
},
|
|
52514
|
+
"training.rollbackCanary": {
|
|
52515
|
+
capName: "training",
|
|
52516
|
+
capScope: "system",
|
|
52517
|
+
addonId: null,
|
|
52518
|
+
access: "create"
|
|
52519
|
+
},
|
|
52520
|
+
"training.startJob": {
|
|
52521
|
+
capName: "training",
|
|
52522
|
+
capScope: "system",
|
|
52523
|
+
addonId: null,
|
|
52524
|
+
access: "create"
|
|
52525
|
+
},
|
|
52526
|
+
"trainingProvider.cancelJob": {
|
|
52527
|
+
capName: "training-provider",
|
|
52528
|
+
capScope: "system",
|
|
52529
|
+
addonId: null,
|
|
52530
|
+
access: "create"
|
|
52531
|
+
},
|
|
52532
|
+
"trainingProvider.cleanupJob": {
|
|
52533
|
+
capName: "training-provider",
|
|
52534
|
+
capScope: "system",
|
|
52535
|
+
addonId: null,
|
|
52536
|
+
access: "create"
|
|
52537
|
+
},
|
|
52538
|
+
"trainingProvider.describe": {
|
|
52539
|
+
capName: "training-provider",
|
|
52540
|
+
capScope: "system",
|
|
52541
|
+
addonId: null,
|
|
52542
|
+
access: "view"
|
|
52543
|
+
},
|
|
52544
|
+
"trainingProvider.estimateJob": {
|
|
52545
|
+
capName: "training-provider",
|
|
52546
|
+
capScope: "system",
|
|
52547
|
+
addonId: null,
|
|
52548
|
+
access: "view"
|
|
52549
|
+
},
|
|
52550
|
+
"trainingProvider.getJob": {
|
|
52551
|
+
capName: "training-provider",
|
|
52552
|
+
capScope: "system",
|
|
52553
|
+
addonId: null,
|
|
52554
|
+
access: "view"
|
|
52555
|
+
},
|
|
52556
|
+
"trainingProvider.listJobEvents": {
|
|
52557
|
+
capName: "training-provider",
|
|
52558
|
+
capScope: "system",
|
|
52559
|
+
addonId: null,
|
|
52560
|
+
access: "view"
|
|
52561
|
+
},
|
|
52562
|
+
"trainingProvider.listJobs": {
|
|
52563
|
+
capName: "training-provider",
|
|
52564
|
+
capScope: "system",
|
|
52565
|
+
addonId: null,
|
|
52566
|
+
access: "view"
|
|
52567
|
+
},
|
|
52568
|
+
"trainingProvider.offerArtifact": {
|
|
52569
|
+
capName: "training-provider",
|
|
52570
|
+
capScope: "system",
|
|
52571
|
+
addonId: null,
|
|
52572
|
+
access: "create"
|
|
52573
|
+
},
|
|
52574
|
+
"trainingProvider.readResult": {
|
|
52575
|
+
capName: "training-provider",
|
|
52576
|
+
capScope: "system",
|
|
52577
|
+
addonId: null,
|
|
52578
|
+
access: "create"
|
|
52579
|
+
},
|
|
52580
|
+
"trainingProvider.submitJob": {
|
|
52581
|
+
capName: "training-provider",
|
|
52582
|
+
capScope: "system",
|
|
52583
|
+
addonId: null,
|
|
52584
|
+
access: "create"
|
|
52585
|
+
},
|
|
52586
|
+
"trainingProvider.uploadDataset": {
|
|
52587
|
+
capName: "training-provider",
|
|
52588
|
+
capScope: "system",
|
|
52589
|
+
addonId: null,
|
|
52590
|
+
access: "create"
|
|
52591
|
+
},
|
|
52592
|
+
"trainingProvider.validateCredentials": {
|
|
52593
|
+
capName: "training-provider",
|
|
52594
|
+
capScope: "system",
|
|
52595
|
+
addonId: null,
|
|
52596
|
+
access: "create"
|
|
52597
|
+
},
|
|
49166
52598
|
"turnProvider.getTurnServers": {
|
|
49167
52599
|
capName: "turn-provider",
|
|
49168
52600
|
capScope: "system",
|
|
@@ -49187,12 +52619,6 @@ Object.freeze({
|
|
|
49187
52619
|
addonId: null,
|
|
49188
52620
|
access: "create"
|
|
49189
52621
|
},
|
|
49190
|
-
"userManagement.createApiKey": {
|
|
49191
|
-
capName: "user-management",
|
|
49192
|
-
capScope: "system",
|
|
49193
|
-
addonId: null,
|
|
49194
|
-
access: "create"
|
|
49195
|
-
},
|
|
49196
52622
|
"userManagement.createScopedToken": {
|
|
49197
52623
|
capName: "user-management",
|
|
49198
52624
|
capScope: "system",
|
|
@@ -49229,12 +52655,6 @@ Object.freeze({
|
|
|
49229
52655
|
addonId: null,
|
|
49230
52656
|
access: "view"
|
|
49231
52657
|
},
|
|
49232
|
-
"userManagement.linkExternalIdentity": {
|
|
49233
|
-
capName: "user-management",
|
|
49234
|
-
capScope: "system",
|
|
49235
|
-
addonId: null,
|
|
49236
|
-
access: "create"
|
|
49237
|
-
},
|
|
49238
52658
|
"userManagement.listApiKeys": {
|
|
49239
52659
|
capName: "user-management",
|
|
49240
52660
|
capScope: "system",
|
|
@@ -49337,12 +52757,6 @@ Object.freeze({
|
|
|
49337
52757
|
addonId: null,
|
|
49338
52758
|
access: "create"
|
|
49339
52759
|
},
|
|
49340
|
-
"userManagement.validateApiKey": {
|
|
49341
|
-
capName: "user-management",
|
|
49342
|
-
capScope: "system",
|
|
49343
|
-
addonId: null,
|
|
49344
|
-
access: "view"
|
|
49345
|
-
},
|
|
49346
52760
|
"userManagement.validateCredentials": {
|
|
49347
52761
|
capName: "user-management",
|
|
49348
52762
|
capScope: "system",
|
|
@@ -52430,6 +55844,11 @@ Object.freeze({
|
|
|
52430
55844
|
form: "single",
|
|
52431
55845
|
optional: false
|
|
52432
55846
|
}],
|
|
55847
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
55848
|
+
name: "deviceId",
|
|
55849
|
+
form: "single",
|
|
55850
|
+
optional: false
|
|
55851
|
+
}],
|
|
52433
55852
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52434
55853
|
name: "deviceId",
|
|
52435
55854
|
form: "single",
|
|
@@ -52620,6 +56039,11 @@ Object.freeze({
|
|
|
52620
56039
|
form: "single",
|
|
52621
56040
|
optional: false
|
|
52622
56041
|
}],
|
|
56042
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
56043
|
+
name: "deviceId",
|
|
56044
|
+
form: "single",
|
|
56045
|
+
optional: false
|
|
56046
|
+
}],
|
|
52623
56047
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52624
56048
|
name: "deviceId",
|
|
52625
56049
|
form: "single",
|
|
@@ -53446,6 +56870,11 @@ Object.freeze({
|
|
|
53446
56870
|
form: "single",
|
|
53447
56871
|
optional: false
|
|
53448
56872
|
}],
|
|
56873
|
+
"training.canaryResult": [{
|
|
56874
|
+
name: "deviceIds",
|
|
56875
|
+
form: "array",
|
|
56876
|
+
optional: false
|
|
56877
|
+
}],
|
|
53449
56878
|
"update.getStatus": [{
|
|
53450
56879
|
name: "deviceId",
|
|
53451
56880
|
form: "single",
|