@camstack/addon-provider-petkit 0.2.122 → 0.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +3555 -126
- package/dist/addon.mjs +3555 -126
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -1100,7 +1100,7 @@ var Nodepetkit = class {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
};
|
|
1102
1102
|
//#endregion
|
|
1103
|
-
//#region ../types/dist/event-category-
|
|
1103
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
1104
1104
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
1105
1105
|
EventCategory["SystemBoot"] = "system.boot";
|
|
1106
1106
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -1179,6 +1179,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
1179
1179
|
*/
|
|
1180
1180
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
1181
1181
|
/**
|
|
1182
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
1183
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
1184
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
1185
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
1186
|
+
*/
|
|
1187
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
1188
|
+
/**
|
|
1182
1189
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
1183
1190
|
* transitions from `failed` back to `healthy` (typically via the
|
|
1184
1191
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -6471,7 +6478,7 @@ var ZodIssueCode = {
|
|
|
6471
6478
|
var ZodFirstPartyTypeKind;
|
|
6472
6479
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6473
6480
|
//#endregion
|
|
6474
|
-
//#region ../types/dist/sleep-
|
|
6481
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6475
6482
|
/**
|
|
6476
6483
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6477
6484
|
* window to float samples (D455).
|
|
@@ -6550,6 +6557,97 @@ function buildAlawTable() {
|
|
|
6550
6557
|
}
|
|
6551
6558
|
buildUlawTable();
|
|
6552
6559
|
buildAlawTable();
|
|
6560
|
+
/** Is this field's stored value a credential? */
|
|
6561
|
+
function isSecretConfigField(field) {
|
|
6562
|
+
if (field.type === "password") return true;
|
|
6563
|
+
return "secret" in field && field.secret === true;
|
|
6564
|
+
}
|
|
6565
|
+
/**
|
|
6566
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
6567
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
6568
|
+
*/
|
|
6569
|
+
function isKeychainStoredField(field) {
|
|
6570
|
+
if (!isSecretConfigField(field)) return false;
|
|
6571
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
6572
|
+
return !("storage" in field && field.storage === "inline");
|
|
6573
|
+
}
|
|
6574
|
+
/**
|
|
6575
|
+
* What a settings blob holds where a secret used to be.
|
|
6576
|
+
*
|
|
6577
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
6578
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
6579
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
6580
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
6581
|
+
*
|
|
6582
|
+
* The same shapes travel to and from the admin UI:
|
|
6583
|
+
*
|
|
6584
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
6585
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
6586
|
+
* value is set, never the value.
|
|
6587
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
6588
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
6589
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
6590
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
6591
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
6592
|
+
*
|
|
6593
|
+
* Pure and browser-safe.
|
|
6594
|
+
*/
|
|
6595
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
6596
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6597
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
6598
|
+
function isRecord$2(value) {
|
|
6599
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6600
|
+
}
|
|
6601
|
+
function makeSecretMarker(ref) {
|
|
6602
|
+
return {
|
|
6603
|
+
$secret: ref,
|
|
6604
|
+
v: 1
|
|
6605
|
+
};
|
|
6606
|
+
}
|
|
6607
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6608
|
+
function isSecretMarker(value) {
|
|
6609
|
+
if (!isRecord$2(value)) return false;
|
|
6610
|
+
const ref = value["$secret"];
|
|
6611
|
+
return typeof ref === "string" && ref.length > 0;
|
|
6612
|
+
}
|
|
6613
|
+
function isSecretClear(value) {
|
|
6614
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6615
|
+
}
|
|
6616
|
+
/**
|
|
6617
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
6618
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
6619
|
+
* survives this function.
|
|
6620
|
+
*/
|
|
6621
|
+
function toSecretFieldView(stored) {
|
|
6622
|
+
if (isSecretMarker(stored)) return {
|
|
6623
|
+
$secret: stored.$secret,
|
|
6624
|
+
v: 1,
|
|
6625
|
+
set: true
|
|
6626
|
+
};
|
|
6627
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
6628
|
+
$secret: null,
|
|
6629
|
+
v: 1,
|
|
6630
|
+
set: true,
|
|
6631
|
+
inline: true
|
|
6632
|
+
};
|
|
6633
|
+
return null;
|
|
6634
|
+
}
|
|
6635
|
+
/**
|
|
6636
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
6637
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
6638
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
6639
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
6640
|
+
*/
|
|
6641
|
+
function classifySecretWrite(incoming) {
|
|
6642
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
6643
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
6644
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
6645
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
6646
|
+
return {
|
|
6647
|
+
kind: "set",
|
|
6648
|
+
value: incoming
|
|
6649
|
+
};
|
|
6650
|
+
}
|
|
6553
6651
|
Object.fromEntries([
|
|
6554
6652
|
{
|
|
6555
6653
|
id: "overview",
|
|
@@ -6721,33 +6819,19 @@ Object.fromEntries([
|
|
|
6721
6819
|
function isValuelessField(field) {
|
|
6722
6820
|
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";
|
|
6723
6821
|
}
|
|
6724
|
-
|
|
6725
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
6726
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
6727
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
6728
|
-
*
|
|
6729
|
-
* For each leaf field:
|
|
6730
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
6731
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
6732
|
-
*
|
|
6733
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
6734
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
6735
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
6736
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
6737
|
-
*/
|
|
6738
|
-
function hydrateSchema(schema, values) {
|
|
6822
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
6739
6823
|
return {
|
|
6740
6824
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
6741
6825
|
sections: schema.sections.map((section) => ({
|
|
6742
6826
|
...section,
|
|
6743
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
6827
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
6744
6828
|
}))
|
|
6745
6829
|
};
|
|
6746
6830
|
}
|
|
6747
|
-
function hydrateField(field, values) {
|
|
6831
|
+
function hydrateField(field, values, options) {
|
|
6748
6832
|
if (isValuelessField(field)) return field;
|
|
6749
6833
|
if (field.type === "group") {
|
|
6750
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
6834
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
6751
6835
|
return {
|
|
6752
6836
|
...field,
|
|
6753
6837
|
fields: hydratedChildren
|
|
@@ -6756,7 +6840,7 @@ function hydrateField(field, values) {
|
|
|
6756
6840
|
if (field.type === "sub-tabs") {
|
|
6757
6841
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
6758
6842
|
...tab,
|
|
6759
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
6843
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
6760
6844
|
}));
|
|
6761
6845
|
return {
|
|
6762
6846
|
...field,
|
|
@@ -6766,6 +6850,33 @@ function hydrateField(field, values) {
|
|
|
6766
6850
|
const key = field.key;
|
|
6767
6851
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
6768
6852
|
const defaultValue = field.default;
|
|
6853
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
6854
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
6855
|
+
...field,
|
|
6856
|
+
value: toSecretFieldView(storedValue)
|
|
6857
|
+
};
|
|
6858
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
6859
|
+
...field,
|
|
6860
|
+
value: null
|
|
6861
|
+
};
|
|
6862
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
6863
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
6864
|
+
if (secretItemKeys.length > 0) {
|
|
6865
|
+
const rows = storedValue.map((row) => {
|
|
6866
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
6867
|
+
const out = { ...row };
|
|
6868
|
+
for (const k of secretItemKeys) {
|
|
6869
|
+
const v = Reflect.get(row, k);
|
|
6870
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
6871
|
+
}
|
|
6872
|
+
return out;
|
|
6873
|
+
});
|
|
6874
|
+
return {
|
|
6875
|
+
...field,
|
|
6876
|
+
value: rows
|
|
6877
|
+
};
|
|
6878
|
+
}
|
|
6879
|
+
}
|
|
6769
6880
|
if (field.multiple) {
|
|
6770
6881
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
6771
6882
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -7008,6 +7119,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
7008
7119
|
}
|
|
7009
7120
|
return out;
|
|
7010
7121
|
}
|
|
7122
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
7123
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
7124
|
+
function globalSecretScope() {
|
|
7125
|
+
return GLOBAL_SCOPE;
|
|
7126
|
+
}
|
|
7127
|
+
function encodeSegment(value) {
|
|
7128
|
+
return encodeURIComponent(value);
|
|
7129
|
+
}
|
|
7130
|
+
function decodeSegment(value) {
|
|
7131
|
+
try {
|
|
7132
|
+
return decodeURIComponent(value);
|
|
7133
|
+
} catch {
|
|
7134
|
+
return null;
|
|
7135
|
+
}
|
|
7136
|
+
}
|
|
7137
|
+
/**
|
|
7138
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
7139
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
7140
|
+
* `providers[authentik].clientSecret`.
|
|
7141
|
+
*/
|
|
7142
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
7143
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
7144
|
+
}
|
|
7145
|
+
function parseScope(segments) {
|
|
7146
|
+
switch (segments[0]) {
|
|
7147
|
+
case "global": return {
|
|
7148
|
+
scope: GLOBAL_SCOPE,
|
|
7149
|
+
used: 1
|
|
7150
|
+
};
|
|
7151
|
+
case "node": {
|
|
7152
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7153
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
7154
|
+
scope: {
|
|
7155
|
+
kind: "node",
|
|
7156
|
+
nodeId
|
|
7157
|
+
},
|
|
7158
|
+
used: 2
|
|
7159
|
+
};
|
|
7160
|
+
}
|
|
7161
|
+
case "device": {
|
|
7162
|
+
const raw = segments[1];
|
|
7163
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
7164
|
+
return {
|
|
7165
|
+
scope: {
|
|
7166
|
+
kind: "device",
|
|
7167
|
+
deviceId: Number(raw)
|
|
7168
|
+
},
|
|
7169
|
+
used: 2
|
|
7170
|
+
};
|
|
7171
|
+
}
|
|
7172
|
+
case "integration": {
|
|
7173
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7174
|
+
return id === null || id.length === 0 ? null : {
|
|
7175
|
+
scope: {
|
|
7176
|
+
kind: "integration",
|
|
7177
|
+
integrationId: id
|
|
7178
|
+
},
|
|
7179
|
+
used: 2
|
|
7180
|
+
};
|
|
7181
|
+
}
|
|
7182
|
+
case "row": {
|
|
7183
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7184
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
7185
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
7186
|
+
return {
|
|
7187
|
+
scope: {
|
|
7188
|
+
kind: "row",
|
|
7189
|
+
collection,
|
|
7190
|
+
rowId
|
|
7191
|
+
},
|
|
7192
|
+
used: 3
|
|
7193
|
+
};
|
|
7194
|
+
}
|
|
7195
|
+
default: return null;
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
7199
|
+
function parseSecretRef(ref) {
|
|
7200
|
+
if (!ref.startsWith("secret://")) return null;
|
|
7201
|
+
const segments = ref.slice(9).split("/");
|
|
7202
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
7203
|
+
if (owner === null || owner.length === 0) return null;
|
|
7204
|
+
const parsed = parseScope(segments.slice(1));
|
|
7205
|
+
if (parsed === null) return null;
|
|
7206
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
7207
|
+
if (fieldPath.length === 0) return null;
|
|
7208
|
+
return {
|
|
7209
|
+
owner,
|
|
7210
|
+
scope: parsed.scope,
|
|
7211
|
+
fieldPath
|
|
7212
|
+
};
|
|
7213
|
+
}
|
|
7214
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7215
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
7216
|
+
fieldPath;
|
|
7217
|
+
constructor(fieldPath, cause) {
|
|
7218
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
7219
|
+
this.fieldPath = fieldPath;
|
|
7220
|
+
this.name = "KeychainWriteRefusedError";
|
|
7221
|
+
}
|
|
7222
|
+
};
|
|
7223
|
+
var KEEP = { kind: "keep" };
|
|
7224
|
+
function isRecord$1(value) {
|
|
7225
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7226
|
+
}
|
|
7227
|
+
function defaultMintId() {
|
|
7228
|
+
return globalThis.crypto.randomUUID();
|
|
7229
|
+
}
|
|
7230
|
+
/** Every marker ref anywhere under `value`. */
|
|
7231
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
7232
|
+
if (isSecretMarker(value)) {
|
|
7233
|
+
out.push(value.$secret);
|
|
7234
|
+
return out;
|
|
7235
|
+
}
|
|
7236
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
7237
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7238
|
+
return out;
|
|
7239
|
+
}
|
|
7240
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
7241
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
7242
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
7243
|
+
}
|
|
7244
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
7245
|
+
const intent = classifySecretWrite(incoming);
|
|
7246
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
7247
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
7248
|
+
if (intent.kind === "keep") return KEEP;
|
|
7249
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
7250
|
+
if (intent.kind === "clear") {
|
|
7251
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
7252
|
+
return {
|
|
7253
|
+
kind: "value",
|
|
7254
|
+
value: null
|
|
7255
|
+
};
|
|
7256
|
+
}
|
|
7257
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
7258
|
+
kind: "value",
|
|
7259
|
+
value: stored
|
|
7260
|
+
};
|
|
7261
|
+
try {
|
|
7262
|
+
await ctx.secrets.put(ref, intent.value);
|
|
7263
|
+
} catch (err) {
|
|
7264
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
7265
|
+
}
|
|
7266
|
+
return {
|
|
7267
|
+
kind: "value",
|
|
7268
|
+
value: makeSecretMarker(ref)
|
|
7269
|
+
};
|
|
7270
|
+
}
|
|
7271
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
7272
|
+
function applyMember(out, key, result, storedParent) {
|
|
7273
|
+
if (result.kind === "value") {
|
|
7274
|
+
out[key] = result.value;
|
|
7275
|
+
return;
|
|
7276
|
+
}
|
|
7277
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
7278
|
+
else delete out[key];
|
|
7279
|
+
}
|
|
7280
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
7281
|
+
const out = { ...incoming };
|
|
7282
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
7283
|
+
return out;
|
|
7284
|
+
}
|
|
7285
|
+
function rowId(row, idKey) {
|
|
7286
|
+
const raw = row[idKey];
|
|
7287
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
7288
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
7289
|
+
return null;
|
|
7290
|
+
}
|
|
7291
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7292
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
7293
|
+
if (!Array.isArray(incoming)) {
|
|
7294
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7295
|
+
return {
|
|
7296
|
+
kind: "value",
|
|
7297
|
+
value: incoming
|
|
7298
|
+
};
|
|
7299
|
+
}
|
|
7300
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
7301
|
+
for (const row of storedRows) {
|
|
7302
|
+
const id = rowId(row, node.idKey);
|
|
7303
|
+
if (id !== null) storedById.set(id, row);
|
|
7304
|
+
}
|
|
7305
|
+
const kept = /* @__PURE__ */ new Set();
|
|
7306
|
+
const rows = [];
|
|
7307
|
+
for (const row of incoming) {
|
|
7308
|
+
if (!isRecord$1(row)) {
|
|
7309
|
+
rows.push(row);
|
|
7310
|
+
continue;
|
|
7311
|
+
}
|
|
7312
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7313
|
+
kept.add(id);
|
|
7314
|
+
const withId = {
|
|
7315
|
+
...row,
|
|
7316
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
7317
|
+
};
|
|
7318
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7319
|
+
const storedRow = storedById.get(id) ?? {};
|
|
7320
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
7321
|
+
}
|
|
7322
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
7323
|
+
return {
|
|
7324
|
+
kind: "value",
|
|
7325
|
+
value: rows
|
|
7326
|
+
};
|
|
7327
|
+
}
|
|
7328
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
7329
|
+
switch (node.kind) {
|
|
7330
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7331
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7332
|
+
case "object": {
|
|
7333
|
+
if (!isRecord$1(incoming)) {
|
|
7334
|
+
if (incoming === void 0) return KEEP;
|
|
7335
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7336
|
+
return {
|
|
7337
|
+
kind: "value",
|
|
7338
|
+
value: incoming
|
|
7339
|
+
};
|
|
7340
|
+
}
|
|
7341
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
7342
|
+
return {
|
|
7343
|
+
kind: "value",
|
|
7344
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
7345
|
+
};
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
}
|
|
7349
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
7350
|
+
function splitNodeKey(key) {
|
|
7351
|
+
const at = key.indexOf("@");
|
|
7352
|
+
return at <= 0 ? {
|
|
7353
|
+
base: key,
|
|
7354
|
+
nodeId: null
|
|
7355
|
+
} : {
|
|
7356
|
+
base: key.slice(0, at),
|
|
7357
|
+
nodeId: key.slice(at + 1)
|
|
7358
|
+
};
|
|
7359
|
+
}
|
|
7360
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
7361
|
+
async function transformSecretWrite(input) {
|
|
7362
|
+
const deletes = [];
|
|
7363
|
+
const base = {
|
|
7364
|
+
secrets: input.secrets,
|
|
7365
|
+
mintId: input.mintId ?? defaultMintId,
|
|
7366
|
+
deletes,
|
|
7367
|
+
operatorWrite: input.operatorWrite === true
|
|
7368
|
+
};
|
|
7369
|
+
const out = {};
|
|
7370
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
7371
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
7372
|
+
const node = input.tree.get(baseKey);
|
|
7373
|
+
if (node === void 0) {
|
|
7374
|
+
out[key] = incoming;
|
|
7375
|
+
continue;
|
|
7376
|
+
}
|
|
7377
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
7378
|
+
kind: "node",
|
|
7379
|
+
nodeId
|
|
7380
|
+
} : input.scope ?? globalSecretScope();
|
|
7381
|
+
const result = await writeNode({
|
|
7382
|
+
...base,
|
|
7383
|
+
scope
|
|
7384
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
7385
|
+
if (result.kind === "value") out[key] = result.value;
|
|
7386
|
+
}
|
|
7387
|
+
return {
|
|
7388
|
+
patch: out,
|
|
7389
|
+
afterWrite: async () => {
|
|
7390
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
7391
|
+
try {
|
|
7392
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
7393
|
+
return { orphaned: [] };
|
|
7394
|
+
} catch {
|
|
7395
|
+
return { orphaned: [...new Set(deletes)] };
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
};
|
|
7399
|
+
}
|
|
7400
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7401
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7402
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7403
|
+
}
|
|
7404
|
+
/**
|
|
7405
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7406
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
7407
|
+
*/
|
|
7408
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7409
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7410
|
+
const owner = options.ownedBy;
|
|
7411
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7412
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7413
|
+
if (refs.length === 0) return {
|
|
7414
|
+
value,
|
|
7415
|
+
unresolved: []
|
|
7416
|
+
};
|
|
7417
|
+
const answers = await secrets.resolve(refs);
|
|
7418
|
+
const unresolved = [];
|
|
7419
|
+
for (const ref of new Set(refs)) {
|
|
7420
|
+
const answer = answers[ref];
|
|
7421
|
+
if (answer === void 0) unresolved.push({
|
|
7422
|
+
ref,
|
|
7423
|
+
reason: "not-initialized"
|
|
7424
|
+
});
|
|
7425
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
7426
|
+
ref,
|
|
7427
|
+
reason: answer.reason
|
|
7428
|
+
});
|
|
7429
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
7430
|
+
ref,
|
|
7431
|
+
reason: answer.kind
|
|
7432
|
+
});
|
|
7433
|
+
}
|
|
7434
|
+
const substitute = (v) => {
|
|
7435
|
+
if (isSecretMarker(v)) {
|
|
7436
|
+
if (!inScope(v.$secret)) return {
|
|
7437
|
+
keep: true,
|
|
7438
|
+
value: v
|
|
7439
|
+
};
|
|
7440
|
+
const answer = answers[v.$secret];
|
|
7441
|
+
if (answer?.kind === "value") return {
|
|
7442
|
+
keep: true,
|
|
7443
|
+
value: answer.value
|
|
7444
|
+
};
|
|
7445
|
+
return keepMarker ? {
|
|
7446
|
+
keep: true,
|
|
7447
|
+
value: v
|
|
7448
|
+
} : {
|
|
7449
|
+
keep: false,
|
|
7450
|
+
value: void 0
|
|
7451
|
+
};
|
|
7452
|
+
}
|
|
7453
|
+
if (Array.isArray(v)) {
|
|
7454
|
+
const items = [];
|
|
7455
|
+
for (const item of v) {
|
|
7456
|
+
const s = substitute(item);
|
|
7457
|
+
if (s.keep) items.push(s.value);
|
|
7458
|
+
}
|
|
7459
|
+
return {
|
|
7460
|
+
keep: true,
|
|
7461
|
+
value: items
|
|
7462
|
+
};
|
|
7463
|
+
}
|
|
7464
|
+
if (isRecord$1(v)) {
|
|
7465
|
+
const out = {};
|
|
7466
|
+
for (const [k, child] of Object.entries(v)) {
|
|
7467
|
+
const s = substitute(child);
|
|
7468
|
+
if (s.keep) out[k] = s.value;
|
|
7469
|
+
}
|
|
7470
|
+
return {
|
|
7471
|
+
keep: true,
|
|
7472
|
+
value: out
|
|
7473
|
+
};
|
|
7474
|
+
}
|
|
7475
|
+
return {
|
|
7476
|
+
keep: true,
|
|
7477
|
+
value: v
|
|
7478
|
+
};
|
|
7479
|
+
};
|
|
7480
|
+
return {
|
|
7481
|
+
value: substitute(value).value,
|
|
7482
|
+
unresolved
|
|
7483
|
+
};
|
|
7484
|
+
}
|
|
7485
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7486
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7487
|
+
ref;
|
|
7488
|
+
reason;
|
|
7489
|
+
constructor(ref, reason) {
|
|
7490
|
+
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.`);
|
|
7491
|
+
this.ref = ref;
|
|
7492
|
+
this.reason = reason;
|
|
7493
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7494
|
+
}
|
|
7495
|
+
};
|
|
7496
|
+
function isRecord(value) {
|
|
7497
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7498
|
+
}
|
|
7499
|
+
function resolvedValue(pass, marker) {
|
|
7500
|
+
const answer = pass.answers[marker.$secret];
|
|
7501
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7502
|
+
}
|
|
7503
|
+
async function atMarker(pass, incoming, stored) {
|
|
7504
|
+
if (incoming === null) return stored;
|
|
7505
|
+
if (typeof incoming !== "string") return incoming;
|
|
7506
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7507
|
+
const intent = classifySecretWrite(incoming);
|
|
7508
|
+
if (intent.kind !== "set") return stored;
|
|
7509
|
+
const ref = stored.$secret;
|
|
7510
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7511
|
+
const answer = pass.answers[ref];
|
|
7512
|
+
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);
|
|
7513
|
+
try {
|
|
7514
|
+
await pass.secrets.put(ref, intent.value);
|
|
7515
|
+
} catch (err) {
|
|
7516
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7517
|
+
}
|
|
7518
|
+
pass.changedRefs.push(ref);
|
|
7519
|
+
return stored;
|
|
7520
|
+
}
|
|
7521
|
+
function inArray(pass, incoming, stored) {
|
|
7522
|
+
return incoming.map((item, index) => {
|
|
7523
|
+
const twin = stored[index];
|
|
7524
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7525
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7526
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7527
|
+
return item;
|
|
7528
|
+
});
|
|
7529
|
+
}
|
|
7530
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7531
|
+
const out = { ...incoming };
|
|
7532
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7533
|
+
const twin = stored[key];
|
|
7534
|
+
if (isSecretMarker(twin)) {
|
|
7535
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7536
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7537
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7538
|
+
}
|
|
7539
|
+
return out;
|
|
7540
|
+
}
|
|
7541
|
+
async function walk(pass, incoming, stored) {
|
|
7542
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7543
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7544
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7545
|
+
const out = { ...incoming };
|
|
7546
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7547
|
+
return out;
|
|
7548
|
+
}
|
|
7549
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7550
|
+
async function restoreUnchangedSecrets(input) {
|
|
7551
|
+
const refs = [];
|
|
7552
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7553
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7554
|
+
if (owned.length === 0) return {
|
|
7555
|
+
patch: input.patch,
|
|
7556
|
+
changedRefs: []
|
|
7557
|
+
};
|
|
7558
|
+
const pass = {
|
|
7559
|
+
secrets: input.secrets,
|
|
7560
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7561
|
+
operatorWrite: input.operatorWrite,
|
|
7562
|
+
changedRefs: []
|
|
7563
|
+
};
|
|
7564
|
+
const out = {};
|
|
7565
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7566
|
+
return {
|
|
7567
|
+
patch: out,
|
|
7568
|
+
changedRefs: pass.changedRefs
|
|
7569
|
+
};
|
|
7570
|
+
}
|
|
7571
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7572
|
+
function isJsonEqual(a, b) {
|
|
7573
|
+
if (Object.is(a, b)) return true;
|
|
7574
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7575
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7576
|
+
const keys = Object.keys(a);
|
|
7577
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7578
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7579
|
+
}
|
|
7580
|
+
return false;
|
|
7581
|
+
}
|
|
7582
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7583
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7584
|
+
const out = {};
|
|
7585
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7586
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7587
|
+
out[key] = value;
|
|
7588
|
+
}
|
|
7589
|
+
return out;
|
|
7590
|
+
}
|
|
7591
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7592
|
+
function markerKeysOf(blob, owner) {
|
|
7593
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7594
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7595
|
+
return keys;
|
|
7596
|
+
}
|
|
7597
|
+
function nodeFromStored(value, owner) {
|
|
7598
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7599
|
+
if (!isRecord(value)) return null;
|
|
7600
|
+
const children = /* @__PURE__ */ new Map();
|
|
7601
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7602
|
+
const node = nodeFromStored(child, owner);
|
|
7603
|
+
if (node !== null) children.set(key, node);
|
|
7604
|
+
}
|
|
7605
|
+
return children.size > 0 ? {
|
|
7606
|
+
kind: "object",
|
|
7607
|
+
children
|
|
7608
|
+
} : null;
|
|
7609
|
+
}
|
|
7610
|
+
/**
|
|
7611
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7612
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7613
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7614
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7615
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7616
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7617
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7618
|
+
* over.
|
|
7619
|
+
*/
|
|
7620
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7621
|
+
const added = /* @__PURE__ */ new Map();
|
|
7622
|
+
for (const key of keys) {
|
|
7623
|
+
const at = key.indexOf("@");
|
|
7624
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7625
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7626
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7627
|
+
if (node !== null) added.set(base, node);
|
|
7628
|
+
}
|
|
7629
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7630
|
+
}
|
|
7631
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7632
|
+
async function readStoredAddonBlob(raw) {
|
|
7633
|
+
const threeWay = raw.readAddonStoreResult;
|
|
7634
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
7635
|
+
const result = await threeWay.call(raw);
|
|
7636
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7637
|
+
return result.kind === "missing" ? {} : result.value;
|
|
7638
|
+
}
|
|
7639
|
+
function touchesTree(tree, patch) {
|
|
7640
|
+
if (tree.size === 0) return false;
|
|
7641
|
+
for (const key of Object.keys(patch)) {
|
|
7642
|
+
const at = key.indexOf("@");
|
|
7643
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7644
|
+
}
|
|
7645
|
+
return false;
|
|
7646
|
+
}
|
|
7647
|
+
/**
|
|
7648
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7649
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7650
|
+
*/
|
|
7651
|
+
var MarkerKeyIndex = class {
|
|
7652
|
+
owner;
|
|
7653
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7654
|
+
constructor(owner) {
|
|
7655
|
+
this.owner = owner;
|
|
7656
|
+
}
|
|
7657
|
+
seen(store, blob) {
|
|
7658
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7659
|
+
}
|
|
7660
|
+
wrote(store, patch) {
|
|
7661
|
+
const keys = this.byStore.get(store);
|
|
7662
|
+
if (keys === void 0) return;
|
|
7663
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7664
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7665
|
+
else keys.delete(key);
|
|
7666
|
+
}
|
|
7667
|
+
mayHoldMarkers(store, patch) {
|
|
7668
|
+
const keys = this.byStore.get(store);
|
|
7669
|
+
if (keys === void 0) return true;
|
|
7670
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7671
|
+
}
|
|
7672
|
+
};
|
|
7673
|
+
function createHandle(raw, opts) {
|
|
7674
|
+
const chains = /* @__PURE__ */ new Map();
|
|
7675
|
+
const serialize = (key, fn) => {
|
|
7676
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
7677
|
+
const tail = next.catch(() => void 0);
|
|
7678
|
+
chains.set(key, tail);
|
|
7679
|
+
tail.then(() => {
|
|
7680
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
7681
|
+
});
|
|
7682
|
+
return next;
|
|
7683
|
+
};
|
|
7684
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7685
|
+
const resolveRead = async (store, blob) => {
|
|
7686
|
+
index.seen(store, blob);
|
|
7687
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7688
|
+
unresolved: "keep-marker",
|
|
7689
|
+
ownedBy: opts.secrets.owner
|
|
7690
|
+
});
|
|
7691
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7692
|
+
return value;
|
|
7693
|
+
};
|
|
7694
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7695
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7696
|
+
await rawWrite(patch);
|
|
7697
|
+
index.wrote(store, patch);
|
|
7698
|
+
return { changed: true };
|
|
7699
|
+
}
|
|
7700
|
+
return serialize(store, async () => {
|
|
7701
|
+
const stored = await readStored();
|
|
7702
|
+
index.seen(store, stored);
|
|
7703
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7704
|
+
const restored = await restoreUnchangedSecrets({
|
|
7705
|
+
patch,
|
|
7706
|
+
stored,
|
|
7707
|
+
secrets: opts.secrets,
|
|
7708
|
+
operatorWrite
|
|
7709
|
+
});
|
|
7710
|
+
const result = await transformSecretWrite({
|
|
7711
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7712
|
+
secrets: opts.secrets,
|
|
7713
|
+
patch: restored.patch,
|
|
7714
|
+
stored,
|
|
7715
|
+
...scope !== void 0 ? { scope } : {},
|
|
7716
|
+
operatorWrite
|
|
7717
|
+
});
|
|
7718
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7719
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7720
|
+
if (wroteBlob) {
|
|
7721
|
+
await rawWrite(effective);
|
|
7722
|
+
index.wrote(store, effective);
|
|
7723
|
+
}
|
|
7724
|
+
const { orphaned } = await result.afterWrite();
|
|
7725
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7726
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7727
|
+
});
|
|
7728
|
+
};
|
|
7729
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7730
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7731
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7732
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7733
|
+
const overrides = {
|
|
7734
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7735
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7736
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7737
|
+
return result.kind === "value" ? {
|
|
7738
|
+
kind: "value",
|
|
7739
|
+
value: await resolveRead("addon", result.value)
|
|
7740
|
+
} : result;
|
|
7741
|
+
} } : {},
|
|
7742
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7743
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7744
|
+
if (result.kind !== "present") return result;
|
|
7745
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7746
|
+
unresolved: "keep-marker",
|
|
7747
|
+
ownedBy: opts.secrets.owner
|
|
7748
|
+
});
|
|
7749
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7750
|
+
return {
|
|
7751
|
+
kind: "present",
|
|
7752
|
+
value: value[key]
|
|
7753
|
+
};
|
|
7754
|
+
} } : {},
|
|
7755
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7756
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7757
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7758
|
+
const out = /* @__PURE__ */ new Map();
|
|
7759
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7760
|
+
return out;
|
|
7761
|
+
} } : {},
|
|
7762
|
+
writeAddonStore: async (patch) => {
|
|
7763
|
+
await writeAddon(patch);
|
|
7764
|
+
},
|
|
7765
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7766
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7767
|
+
kind: "device",
|
|
7768
|
+
deviceId
|
|
7769
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7770
|
+
}
|
|
7771
|
+
};
|
|
7772
|
+
return {
|
|
7773
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7774
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7775
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7776
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7777
|
+
} }),
|
|
7778
|
+
raw: {
|
|
7779
|
+
readAddonStore: async () => {
|
|
7780
|
+
const blob = await raw.readAddonStore();
|
|
7781
|
+
index.seen("addon", blob);
|
|
7782
|
+
return blob;
|
|
7783
|
+
},
|
|
7784
|
+
readDeviceStore: async (deviceId) => {
|
|
7785
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7786
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7787
|
+
return blob;
|
|
7788
|
+
}
|
|
7789
|
+
},
|
|
7790
|
+
writeAddonStore: writeAddon
|
|
7791
|
+
};
|
|
7792
|
+
}
|
|
7793
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7794
|
+
function createSecretAwareContext(context, opts) {
|
|
7795
|
+
const raw = context.settings;
|
|
7796
|
+
if (raw === void 0) return {
|
|
7797
|
+
context,
|
|
7798
|
+
handle: null
|
|
7799
|
+
};
|
|
7800
|
+
const handle = createHandle(raw, opts);
|
|
7801
|
+
return {
|
|
7802
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7803
|
+
if (prop === "settings") return handle.settings;
|
|
7804
|
+
return Reflect.get(target, prop, receiver);
|
|
7805
|
+
} }),
|
|
7806
|
+
handle
|
|
7807
|
+
};
|
|
7808
|
+
}
|
|
7809
|
+
var LEAF = { kind: "leaf" };
|
|
7810
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
7811
|
+
function collectFields(fields, out) {
|
|
7812
|
+
for (const field of fields) {
|
|
7813
|
+
if (field.type === "group") {
|
|
7814
|
+
collectFields(field.fields, out);
|
|
7815
|
+
continue;
|
|
7816
|
+
}
|
|
7817
|
+
if (field.type === "sub-tabs") {
|
|
7818
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
7819
|
+
continue;
|
|
7820
|
+
}
|
|
7821
|
+
if (field.type === "editable-array") {
|
|
7822
|
+
const item = /* @__PURE__ */ new Map();
|
|
7823
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
7824
|
+
if (item.size > 0) out.set(field.key, {
|
|
7825
|
+
kind: "array",
|
|
7826
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
7827
|
+
item
|
|
7828
|
+
});
|
|
7829
|
+
continue;
|
|
7830
|
+
}
|
|
7831
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
7832
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
7833
|
+
}
|
|
7834
|
+
}
|
|
7835
|
+
/** The secret tree a settings schema declares. */
|
|
7836
|
+
function secretTreeFromSchema(schema) {
|
|
7837
|
+
const out = /* @__PURE__ */ new Map();
|
|
7838
|
+
if (schema === null) return out;
|
|
7839
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
7840
|
+
return out;
|
|
7841
|
+
}
|
|
7842
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
7843
|
+
function parseSecretStatePath(path) {
|
|
7844
|
+
const segments = [];
|
|
7845
|
+
for (const raw of path.split(".")) {
|
|
7846
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
7847
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
7848
|
+
segments.push(m[2] !== void 0 ? {
|
|
7849
|
+
key: m[1],
|
|
7850
|
+
idKey: m[2]
|
|
7851
|
+
} : { key: m[1] });
|
|
7852
|
+
}
|
|
7853
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
7854
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
7855
|
+
return segments;
|
|
7856
|
+
}
|
|
7857
|
+
function insert(into, segments) {
|
|
7858
|
+
const [head, ...rest] = segments;
|
|
7859
|
+
if (head === void 0) return;
|
|
7860
|
+
if (rest.length === 0) {
|
|
7861
|
+
into.set(head.key, LEAF);
|
|
7862
|
+
return;
|
|
7863
|
+
}
|
|
7864
|
+
const existing = into.get(head.key);
|
|
7865
|
+
if (head.idKey !== void 0) {
|
|
7866
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
7867
|
+
insert(item, rest);
|
|
7868
|
+
into.set(head.key, {
|
|
7869
|
+
kind: "array",
|
|
7870
|
+
idKey: head.idKey,
|
|
7871
|
+
item
|
|
7872
|
+
});
|
|
7873
|
+
return;
|
|
7874
|
+
}
|
|
7875
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
7876
|
+
insert(children, rest);
|
|
7877
|
+
into.set(head.key, {
|
|
7878
|
+
kind: "object",
|
|
7879
|
+
children
|
|
7880
|
+
});
|
|
7881
|
+
}
|
|
7882
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
7883
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
7884
|
+
if (paths.length === 0) return tree;
|
|
7885
|
+
const out = new Map(tree);
|
|
7886
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
7887
|
+
return out;
|
|
7888
|
+
}
|
|
7889
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
7890
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
7891
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
7892
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7893
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
7011
7894
|
/**
|
|
7012
7895
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
7013
7896
|
*
|
|
@@ -7077,6 +7960,33 @@ var BaseAddon = class {
|
|
|
7077
7960
|
settingsStoreReady = false;
|
|
7078
7961
|
/** Default config values. Provided via constructor. */
|
|
7079
7962
|
defaults;
|
|
7963
|
+
/**
|
|
7964
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
7965
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
7966
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
7967
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
7968
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
7969
|
+
*/
|
|
7970
|
+
secretStatePaths = [];
|
|
7971
|
+
_addonSecretTree = null;
|
|
7972
|
+
_deviceSecretTree = null;
|
|
7973
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7974
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
7975
|
+
_unresolvedSecrets = [];
|
|
7976
|
+
_secretRetryTimer = null;
|
|
7977
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7978
|
+
_secretChangeTimer = null;
|
|
7979
|
+
_secretChangeUnsub = null;
|
|
7980
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7981
|
+
_operatorWriteDepth = 0;
|
|
7982
|
+
/**
|
|
7983
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7984
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7985
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7986
|
+
*/
|
|
7987
|
+
_secretSettings = null;
|
|
7988
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7989
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
7080
7990
|
constructor(defaults) {
|
|
7081
7991
|
this.defaults = defaults;
|
|
7082
7992
|
this._config = { ...defaults };
|
|
@@ -7112,8 +8022,26 @@ var BaseAddon = class {
|
|
|
7112
8022
|
return this._config;
|
|
7113
8023
|
}
|
|
7114
8024
|
async initialize(context) {
|
|
7115
|
-
|
|
8025
|
+
const secrets = context.secrets;
|
|
8026
|
+
if (secrets !== void 0) {
|
|
8027
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
8028
|
+
secrets,
|
|
8029
|
+
addonTree: () => this.addonSecretTree(),
|
|
8030
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
8031
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
8032
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
8033
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
8034
|
+
});
|
|
8035
|
+
this._ctx = wrapped;
|
|
8036
|
+
this._secretSettings = handle;
|
|
8037
|
+
} else {
|
|
8038
|
+
this._ctx = context;
|
|
8039
|
+
this._secretSettings = null;
|
|
8040
|
+
}
|
|
7116
8041
|
await this.resolveConfig();
|
|
8042
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
8043
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
8044
|
+
});
|
|
7117
8045
|
const result = await this.onInitialize();
|
|
7118
8046
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
7119
8047
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -7146,6 +8074,12 @@ var BaseAddon = class {
|
|
|
7146
8074
|
*/
|
|
7147
8075
|
async onHubReachable() {}
|
|
7148
8076
|
async shutdown() {
|
|
8077
|
+
this._secretChangeUnsub?.();
|
|
8078
|
+
this._secretChangeUnsub = null;
|
|
8079
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
8080
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
8081
|
+
this._secretRetryTimer = null;
|
|
8082
|
+
this._secretChangeTimer = null;
|
|
7149
8083
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
7150
8084
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
7151
8085
|
await this.onShutdown();
|
|
@@ -7220,11 +8154,8 @@ var BaseAddon = class {
|
|
|
7220
8154
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7221
8155
|
const schema = this.globalSettingsSchema(cap);
|
|
7222
8156
|
if (!schema) return { sections: [] };
|
|
7223
|
-
const projected = await this.
|
|
7224
|
-
return hydrateSchema(schema, overlay ? {
|
|
7225
|
-
...projected,
|
|
7226
|
-
...overlay
|
|
7227
|
-
} : projected);
|
|
8157
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8158
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7228
8159
|
}
|
|
7229
8160
|
/**
|
|
7230
8161
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7269,11 +8200,11 @@ var BaseAddon = class {
|
|
|
7269
8200
|
});
|
|
7270
8201
|
}
|
|
7271
8202
|
if (sections.length === 0) return null;
|
|
7272
|
-
const projected = await this.
|
|
8203
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7273
8204
|
return hydrateSchema({
|
|
7274
8205
|
...schema,
|
|
7275
8206
|
sections
|
|
7276
|
-
}, projected);
|
|
8207
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
7277
8208
|
}
|
|
7278
8209
|
/**
|
|
7279
8210
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -7286,12 +8217,50 @@ var BaseAddon = class {
|
|
|
7286
8217
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7287
8218
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7288
8219
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8220
|
+
*
|
|
8221
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
8222
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
8223
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
8224
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
8225
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
8226
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7289
8227
|
*/
|
|
7290
8228
|
async resolveGlobalStore(nodeId, cap) {
|
|
7291
8229
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8230
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8231
|
+
}
|
|
8232
|
+
projectForNode(store, nodeId, cap) {
|
|
7292
8233
|
const keys = this.perNodeKeys(cap);
|
|
7293
8234
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7294
|
-
return keys.size > 0 ? projectStore(
|
|
8235
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
8236
|
+
}
|
|
8237
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8238
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
8239
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8240
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8241
|
+
}
|
|
8242
|
+
/**
|
|
8243
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
8244
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
8245
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
8246
|
+
* its value.
|
|
8247
|
+
*/
|
|
8248
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
8249
|
+
const secrets = this._ctx?.secrets;
|
|
8250
|
+
const merged = {
|
|
8251
|
+
...stored,
|
|
8252
|
+
...overlay
|
|
8253
|
+
};
|
|
8254
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
8255
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
8256
|
+
unresolved: "keep-marker",
|
|
8257
|
+
ownedBy: secrets.owner
|
|
8258
|
+
});
|
|
8259
|
+
for (const key of Object.keys(overlay)) {
|
|
8260
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
8261
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
8262
|
+
}
|
|
8263
|
+
return merged;
|
|
7295
8264
|
}
|
|
7296
8265
|
/**
|
|
7297
8266
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7327,18 +8296,58 @@ var BaseAddon = class {
|
|
|
7327
8296
|
value: result.value[key]
|
|
7328
8297
|
};
|
|
7329
8298
|
}
|
|
8299
|
+
/**
|
|
8300
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8301
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
8302
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8303
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
8304
|
+
* writing back what it read is not (D787).
|
|
8305
|
+
*/
|
|
8306
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
8307
|
+
this._operatorWriteDepth++;
|
|
8308
|
+
try {
|
|
8309
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8310
|
+
} finally {
|
|
8311
|
+
this._operatorWriteDepth--;
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
7330
8314
|
async updateGlobalSettings(patch, nodeId) {
|
|
8315
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8316
|
+
}
|
|
8317
|
+
/**
|
|
8318
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8319
|
+
*
|
|
8320
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
8321
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
8322
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
8323
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8324
|
+
*/
|
|
8325
|
+
async clearSecrets(keys, nodeId) {
|
|
8326
|
+
const tree = this.addonSecretTree();
|
|
8327
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
8328
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
8329
|
+
const patch = {};
|
|
8330
|
+
for (const key of keys) {
|
|
8331
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8332
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8333
|
+
}
|
|
8334
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8335
|
+
}
|
|
8336
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
7331
8337
|
const keys = this.perNodeKeys();
|
|
7332
8338
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7333
8339
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7334
|
-
const barePatch = patch;
|
|
7335
8340
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7336
|
-
|
|
8341
|
+
const handle = this._secretSettings;
|
|
8342
|
+
if (handle !== null) {
|
|
8343
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8344
|
+
if (!changed) return;
|
|
8345
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7337
8346
|
if (target !== localNode) return;
|
|
7338
8347
|
await this.resolveConfig();
|
|
7339
8348
|
await this.onConfigChanged();
|
|
7340
8349
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
7341
|
-
this.maybeAutoRestart(
|
|
8350
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
7342
8351
|
}
|
|
7343
8352
|
/**
|
|
7344
8353
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -7363,7 +8372,7 @@ var BaseAddon = class {
|
|
|
7363
8372
|
* time to return its response before the addon is torn down and
|
|
7364
8373
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
7365
8374
|
*/
|
|
7366
|
-
maybeAutoRestart(
|
|
8375
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
7367
8376
|
if (!schema) return;
|
|
7368
8377
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
7369
8378
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -7371,13 +8380,13 @@ var BaseAddon = class {
|
|
|
7371
8380
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
7372
8381
|
}
|
|
7373
8382
|
if (restartKeys.size === 0) return;
|
|
7374
|
-
if (!
|
|
8383
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
7375
8384
|
const ctx = this._ctx;
|
|
7376
8385
|
if (!ctx) return;
|
|
7377
8386
|
const addonId = ctx.id;
|
|
7378
8387
|
setImmediate(() => {
|
|
7379
8388
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
7380
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
8389
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7381
8390
|
}).catch((err) => {
|
|
7382
8391
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7383
8392
|
});
|
|
@@ -7386,7 +8395,7 @@ var BaseAddon = class {
|
|
|
7386
8395
|
async getDeviceSettings(deviceId) {
|
|
7387
8396
|
const schema = this.deviceSettingsSchema();
|
|
7388
8397
|
if (!schema) return { sections: [] };
|
|
7389
|
-
return hydrateSchema(schema, await this.
|
|
8398
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7390
8399
|
}
|
|
7391
8400
|
async updateDeviceSettings(deviceId, patch) {
|
|
7392
8401
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7516,7 +8525,7 @@ var BaseAddon = class {
|
|
|
7516
8525
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
7517
8526
|
*/
|
|
7518
8527
|
async resolveConfig() {
|
|
7519
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
8528
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
7520
8529
|
const perNode = this.perNodeKeys();
|
|
7521
8530
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7522
8531
|
const resolved = { ...this.defaults };
|
|
@@ -7541,7 +8550,7 @@ var BaseAddon = class {
|
|
|
7541
8550
|
key,
|
|
7542
8551
|
schema,
|
|
7543
8552
|
fallback,
|
|
7544
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
8553
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
7545
8554
|
write: async (patch) => {
|
|
7546
8555
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
7547
8556
|
},
|
|
@@ -7558,7 +8567,7 @@ var BaseAddon = class {
|
|
|
7558
8567
|
key,
|
|
7559
8568
|
schema,
|
|
7560
8569
|
fallback,
|
|
7561
|
-
read: async () => await this.
|
|
8570
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7562
8571
|
write: async (patch) => {
|
|
7563
8572
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7564
8573
|
},
|
|
@@ -7570,6 +8579,87 @@ var BaseAddon = class {
|
|
|
7570
8579
|
} })
|
|
7571
8580
|
});
|
|
7572
8581
|
}
|
|
8582
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8583
|
+
addonSecretTree() {
|
|
8584
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
8585
|
+
return this._addonSecretTree;
|
|
8586
|
+
}
|
|
8587
|
+
deviceSecretTree() {
|
|
8588
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
8589
|
+
return this._deviceSecretTree;
|
|
8590
|
+
}
|
|
8591
|
+
/**
|
|
8592
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
8593
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
8594
|
+
* an addon whose function needs one should report itself degraded rather
|
|
8595
|
+
* than start on an empty credential.
|
|
8596
|
+
*/
|
|
8597
|
+
get unresolvedSecrets() {
|
|
8598
|
+
return this._unresolvedSecrets;
|
|
8599
|
+
}
|
|
8600
|
+
/**
|
|
8601
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
8602
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
8603
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
8604
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
8605
|
+
* ever written back from here.
|
|
8606
|
+
*/
|
|
8607
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
8608
|
+
const secrets = this._ctx?.secrets;
|
|
8609
|
+
if (secrets === void 0) return blob;
|
|
8610
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
8611
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
8612
|
+
if (refs.length === 0) {
|
|
8613
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
8614
|
+
return blob;
|
|
8615
|
+
}
|
|
8616
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
8617
|
+
if (trackForConfig) {
|
|
8618
|
+
this._unresolvedSecrets = unresolved;
|
|
8619
|
+
if (unresolved.length > 0) {
|
|
8620
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
8621
|
+
ref: u.ref,
|
|
8622
|
+
reason: u.reason
|
|
8623
|
+
})) } });
|
|
8624
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
8625
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
8626
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
8627
|
+
}
|
|
8628
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
8629
|
+
}
|
|
8630
|
+
return value;
|
|
8631
|
+
}
|
|
8632
|
+
/**
|
|
8633
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8634
|
+
* keychain the context's own view is already raw.
|
|
8635
|
+
*/
|
|
8636
|
+
rawSettings() {
|
|
8637
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8638
|
+
}
|
|
8639
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8640
|
+
logUnresolvedRead(unresolved) {
|
|
8641
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8642
|
+
if (fresh.length === 0) return;
|
|
8643
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8644
|
+
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) => ({
|
|
8645
|
+
ref: u.ref,
|
|
8646
|
+
reason: u.reason
|
|
8647
|
+
})) } });
|
|
8648
|
+
}
|
|
8649
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8650
|
+
scheduleSecretReresolve(delayMs) {
|
|
8651
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
8652
|
+
if (this[timerOf] !== null) return;
|
|
8653
|
+
const timer = setTimeout(() => {
|
|
8654
|
+
this[timerOf] = null;
|
|
8655
|
+
if (this._ctx === null) return;
|
|
8656
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
8657
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
8658
|
+
});
|
|
8659
|
+
}, delayMs);
|
|
8660
|
+
timer.unref?.();
|
|
8661
|
+
this[timerOf] = timer;
|
|
8662
|
+
}
|
|
7573
8663
|
/**
|
|
7574
8664
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
7575
8665
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7582,7 +8672,7 @@ var BaseAddon = class {
|
|
|
7582
8672
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7583
8673
|
*/
|
|
7584
8674
|
async readAddonStoreWithRetry() {
|
|
7585
|
-
const settings = this.
|
|
8675
|
+
const settings = this.rawSettings();
|
|
7586
8676
|
if (!settings) return {};
|
|
7587
8677
|
const delaysMs = [
|
|
7588
8678
|
150,
|
|
@@ -8145,6 +9235,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8145
9235
|
kind: "mutation",
|
|
8146
9236
|
auth: "admin"
|
|
8147
9237
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
9238
|
+
function defOf(schema) {
|
|
9239
|
+
return schema._zod?.def ?? {};
|
|
9240
|
+
}
|
|
9241
|
+
function declaredHere(schema) {
|
|
9242
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
9243
|
+
}
|
|
9244
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9245
|
+
var WRAPPERS = new Set([
|
|
9246
|
+
"optional",
|
|
9247
|
+
"nullable",
|
|
9248
|
+
"default",
|
|
9249
|
+
"prefault",
|
|
9250
|
+
"catch",
|
|
9251
|
+
"readonly",
|
|
9252
|
+
"nonoptional"
|
|
9253
|
+
]);
|
|
9254
|
+
/**
|
|
9255
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
9256
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9257
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9258
|
+
* `.transform` on `in`).
|
|
9259
|
+
*/
|
|
9260
|
+
function layersOf(schema) {
|
|
9261
|
+
const out = [];
|
|
9262
|
+
const queue = [schema];
|
|
9263
|
+
while (queue.length > 0) {
|
|
9264
|
+
const s = queue.shift();
|
|
9265
|
+
if (!s || out.includes(s)) continue;
|
|
9266
|
+
out.push(s);
|
|
9267
|
+
const def = defOf(s);
|
|
9268
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9269
|
+
if (def.type === "pipe") {
|
|
9270
|
+
if (def.in) queue.push(def.in);
|
|
9271
|
+
if (def.out) queue.push(def.out);
|
|
9272
|
+
}
|
|
9273
|
+
}
|
|
9274
|
+
return out;
|
|
9275
|
+
}
|
|
9276
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9277
|
+
function isZodSecret(schema) {
|
|
9278
|
+
return layersOf(schema).some(declaredHere);
|
|
9279
|
+
}
|
|
9280
|
+
/**
|
|
9281
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9282
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
9283
|
+
* object or array is reported as one path and not descended into — everything
|
|
9284
|
+
* under it is secret.
|
|
9285
|
+
*/
|
|
9286
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
9287
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9288
|
+
const paths = [];
|
|
9289
|
+
for (const layer of layersOf(schema)) {
|
|
9290
|
+
const def = defOf(layer);
|
|
9291
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9292
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9293
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9294
|
+
else if (def.type === "intersection") {
|
|
9295
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9296
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9297
|
+
}
|
|
9298
|
+
}
|
|
9299
|
+
return [...new Set(paths)];
|
|
9300
|
+
}
|
|
8148
9301
|
//#endregion
|
|
8149
9302
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
8150
9303
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -9822,6 +10975,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9822
10975
|
fetchedAt: number()
|
|
9823
10976
|
});
|
|
9824
10977
|
/**
|
|
10978
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10979
|
+
* gets back (cloud training, D805+).
|
|
10980
|
+
*
|
|
10981
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10982
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10983
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10984
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10985
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10986
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10987
|
+
* change there, in the same piece of work.
|
|
10988
|
+
*
|
|
10989
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10990
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10991
|
+
*/
|
|
10992
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10993
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10994
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10995
|
+
var TrainingExportSchema = _enum([
|
|
10996
|
+
"onnx",
|
|
10997
|
+
"openvino-fp16",
|
|
10998
|
+
"openvino-int8",
|
|
10999
|
+
"coreml-fp16"
|
|
11000
|
+
]);
|
|
11001
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
11002
|
+
object({
|
|
11003
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
11004
|
+
jobKey: string().uuid(),
|
|
11005
|
+
target: object({
|
|
11006
|
+
kind: literal("detector"),
|
|
11007
|
+
step: literal("object-detection")
|
|
11008
|
+
}),
|
|
11009
|
+
base: object({
|
|
11010
|
+
modelId: string().min(1),
|
|
11011
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
11012
|
+
weights: string().min(1),
|
|
11013
|
+
imgsz: number().int().positive()
|
|
11014
|
+
}),
|
|
11015
|
+
baseline: object({
|
|
11016
|
+
modelId: string().min(1),
|
|
11017
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
11018
|
+
onnxUrl: string().url(),
|
|
11019
|
+
imgsz: number().int().positive(),
|
|
11020
|
+
floors: FloorsSchema
|
|
11021
|
+
}),
|
|
11022
|
+
dataset: object({
|
|
11023
|
+
versionId: string().min(1),
|
|
11024
|
+
annotationHash: string(),
|
|
11025
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
11026
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11027
|
+
}),
|
|
11028
|
+
split: object({
|
|
11029
|
+
holdoutCameras: array(number().int()),
|
|
11030
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
11031
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
11032
|
+
valFraction: number().min(0).max(.5),
|
|
11033
|
+
seed: number().int()
|
|
11034
|
+
}),
|
|
11035
|
+
hyper: object({
|
|
11036
|
+
epochs: number().int().positive(),
|
|
11037
|
+
batch: number().int().positive(),
|
|
11038
|
+
lr0: number().positive(),
|
|
11039
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
11040
|
+
freeze: number().int().nonnegative(),
|
|
11041
|
+
patience: number().int().nonnegative(),
|
|
11042
|
+
seed: number().int()
|
|
11043
|
+
}),
|
|
11044
|
+
replay: object({
|
|
11045
|
+
source: literal("coco2017"),
|
|
11046
|
+
count: number().int().nonnegative()
|
|
11047
|
+
}),
|
|
11048
|
+
exports: array(TrainingExportSchema).min(1),
|
|
11049
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
11050
|
+
floors: object({
|
|
11051
|
+
minSupport: number().int().positive(),
|
|
11052
|
+
clamp: number().min(0).max(1)
|
|
11053
|
+
}),
|
|
11054
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
11055
|
+
catalog: object({
|
|
11056
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
11057
|
+
name: string().min(1).max(160)
|
|
11058
|
+
})
|
|
11059
|
+
});
|
|
11060
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
11061
|
+
var TrainingResultFileSchema = object({
|
|
11062
|
+
path: string().min(1),
|
|
11063
|
+
bytes: number().int().nonnegative(),
|
|
11064
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
11065
|
+
format: _enum([
|
|
11066
|
+
"onnx",
|
|
11067
|
+
"openvino",
|
|
11068
|
+
"coreml",
|
|
11069
|
+
"pt"
|
|
11070
|
+
]),
|
|
11071
|
+
variant: _enum(["base", "int8"])
|
|
11072
|
+
});
|
|
11073
|
+
var DraftFormatSchema = object({
|
|
11074
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
11075
|
+
url: string().min(1),
|
|
11076
|
+
sizeMB: number().nonnegative(),
|
|
11077
|
+
isDirectory: boolean().optional(),
|
|
11078
|
+
files: array(string()).optional(),
|
|
11079
|
+
runtimes: array(literal("python")).optional(),
|
|
11080
|
+
revision: string().min(1)
|
|
11081
|
+
});
|
|
11082
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
11083
|
+
var TrainingCatalogDraftSchema = object({
|
|
11084
|
+
id: string().min(1),
|
|
11085
|
+
name: string().min(1),
|
|
11086
|
+
description: string(),
|
|
11087
|
+
labels: array(unknown()),
|
|
11088
|
+
inputSize: object({
|
|
11089
|
+
width: number().int().positive(),
|
|
11090
|
+
height: number().int().positive()
|
|
11091
|
+
}),
|
|
11092
|
+
preprocessMode: literal("letterbox"),
|
|
11093
|
+
defaultClassFloors: FloorsSchema,
|
|
11094
|
+
formats: object({
|
|
11095
|
+
onnx: DraftFormatSchema.optional(),
|
|
11096
|
+
openvino: DraftFormatSchema.optional(),
|
|
11097
|
+
coreml: DraftFormatSchema.optional()
|
|
11098
|
+
})
|
|
11099
|
+
});
|
|
11100
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
11101
|
+
var TrainingEvalClassSchema = object({
|
|
11102
|
+
positives: number().int(),
|
|
11103
|
+
floor: number().nullable(),
|
|
11104
|
+
tp: number().int(),
|
|
11105
|
+
fp: number().int(),
|
|
11106
|
+
fn: number().int(),
|
|
11107
|
+
precision: number().nullable(),
|
|
11108
|
+
recall: number().nullable(),
|
|
11109
|
+
ap50: number().nullable(),
|
|
11110
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
11111
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
11112
|
+
fpByCamera: record(string(), number()).optional(),
|
|
11113
|
+
smallFound: number().int().optional(),
|
|
11114
|
+
smallTotal: number().int().optional()
|
|
11115
|
+
}).passthrough();
|
|
11116
|
+
var TrainingEvalReportSchema = object({
|
|
11117
|
+
frames: number().int(),
|
|
11118
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
11119
|
+
}).passthrough();
|
|
11120
|
+
/**
|
|
11121
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
11122
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
11123
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
11124
|
+
*/
|
|
11125
|
+
var TrainingResultSchema = object({
|
|
11126
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
11127
|
+
jobKey: string(),
|
|
11128
|
+
status: _enum(["succeeded", "failed"]),
|
|
11129
|
+
error: object({
|
|
11130
|
+
stage: string(),
|
|
11131
|
+
code: string(),
|
|
11132
|
+
message: string()
|
|
11133
|
+
}).nullable(),
|
|
11134
|
+
trainer: object({
|
|
11135
|
+
version: string(),
|
|
11136
|
+
revision: string()
|
|
11137
|
+
}),
|
|
11138
|
+
toolchain: record(string(), string().nullable()),
|
|
11139
|
+
dataset: object({
|
|
11140
|
+
versionId: string(),
|
|
11141
|
+
annotationHash: string(),
|
|
11142
|
+
sha256: string(),
|
|
11143
|
+
frames: object({
|
|
11144
|
+
train: number().int(),
|
|
11145
|
+
val: number().int(),
|
|
11146
|
+
holdout: number().int()
|
|
11147
|
+
}),
|
|
11148
|
+
holdoutCameras: array(number().int()),
|
|
11149
|
+
replayImages: number().int()
|
|
11150
|
+
}).optional(),
|
|
11151
|
+
training: object({
|
|
11152
|
+
epochsRun: number().int(),
|
|
11153
|
+
bestEpoch: number().int(),
|
|
11154
|
+
bestMap50: number(),
|
|
11155
|
+
bestMap50_95: number(),
|
|
11156
|
+
seconds: number()
|
|
11157
|
+
}).optional(),
|
|
11158
|
+
evaluation: object({
|
|
11159
|
+
holdoutFrames: number().int(),
|
|
11160
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
11161
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
11162
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
11163
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
11164
|
+
map50: record(string(), number().nullable())
|
|
11165
|
+
}).optional(),
|
|
11166
|
+
floors: object({
|
|
11167
|
+
baseline: FloorsSchema,
|
|
11168
|
+
candidate: FloorsSchema,
|
|
11169
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
11170
|
+
notes: array(string())
|
|
11171
|
+
}).optional(),
|
|
11172
|
+
int8: object({
|
|
11173
|
+
kept: boolean(),
|
|
11174
|
+
map50Fp16: number().nullable(),
|
|
11175
|
+
map50Int8: number().nullable(),
|
|
11176
|
+
reason: string().nullable()
|
|
11177
|
+
}).optional(),
|
|
11178
|
+
exportsDropped: array(object({
|
|
11179
|
+
export: string(),
|
|
11180
|
+
reason: string()
|
|
11181
|
+
})).optional(),
|
|
11182
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
11183
|
+
bundle: object({
|
|
11184
|
+
path: literal("bundle.tar"),
|
|
11185
|
+
bytes: number().int().nonnegative(),
|
|
11186
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11187
|
+
}).nullable().optional(),
|
|
11188
|
+
catalogDraft: object({
|
|
11189
|
+
base: TrainingCatalogDraftSchema,
|
|
11190
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
11191
|
+
}).nullable().optional(),
|
|
11192
|
+
licence: string()
|
|
11193
|
+
});
|
|
11194
|
+
var TrainingStageSchema = _enum([
|
|
11195
|
+
"prepare",
|
|
11196
|
+
"replay",
|
|
11197
|
+
"train",
|
|
11198
|
+
"eval",
|
|
11199
|
+
"export",
|
|
11200
|
+
"package"
|
|
11201
|
+
]);
|
|
11202
|
+
var EventBase = {
|
|
11203
|
+
v: literal(1),
|
|
11204
|
+
ts: number()
|
|
11205
|
+
};
|
|
11206
|
+
discriminatedUnion("type", [
|
|
11207
|
+
object({
|
|
11208
|
+
...EventBase,
|
|
11209
|
+
type: literal("stage"),
|
|
11210
|
+
stage: TrainingStageSchema
|
|
11211
|
+
}),
|
|
11212
|
+
object({
|
|
11213
|
+
...EventBase,
|
|
11214
|
+
type: literal("epoch"),
|
|
11215
|
+
epoch: number().int(),
|
|
11216
|
+
epochs: number().int(),
|
|
11217
|
+
boxLoss: number().nullable().optional(),
|
|
11218
|
+
map50: number().nullable().optional(),
|
|
11219
|
+
map50_95: number().nullable().optional(),
|
|
11220
|
+
etaSec: number().nullable().optional()
|
|
11221
|
+
}),
|
|
11222
|
+
object({
|
|
11223
|
+
...EventBase,
|
|
11224
|
+
type: literal("metric"),
|
|
11225
|
+
name: string(),
|
|
11226
|
+
value: number()
|
|
11227
|
+
}),
|
|
11228
|
+
object({
|
|
11229
|
+
...EventBase,
|
|
11230
|
+
type: literal("artifact"),
|
|
11231
|
+
path: string(),
|
|
11232
|
+
bytes: number(),
|
|
11233
|
+
sha256: string()
|
|
11234
|
+
}),
|
|
11235
|
+
object({
|
|
11236
|
+
...EventBase,
|
|
11237
|
+
type: literal("done"),
|
|
11238
|
+
status: _enum(["succeeded", "failed"]),
|
|
11239
|
+
resultSha256: string().nullable().optional()
|
|
11240
|
+
}),
|
|
11241
|
+
object({
|
|
11242
|
+
...EventBase,
|
|
11243
|
+
type: literal("error"),
|
|
11244
|
+
stage: string(),
|
|
11245
|
+
code: string(),
|
|
11246
|
+
message: string()
|
|
11247
|
+
})
|
|
11248
|
+
]);
|
|
11249
|
+
/**
|
|
9825
11250
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9826
11251
|
*
|
|
9827
11252
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12149,7 +13574,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12149
13574
|
"authenticated",
|
|
12150
13575
|
"admin"
|
|
12151
13576
|
]).optional(),
|
|
12152
|
-
description: string().optional()
|
|
13577
|
+
description: string().optional(),
|
|
13578
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13579
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12153
13580
|
});
|
|
12154
13581
|
/**
|
|
12155
13582
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12854,6 +14281,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12854
14281
|
lastError: string().optional()
|
|
12855
14282
|
});
|
|
12856
14283
|
/**
|
|
14284
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14285
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14286
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14287
|
+
* with it off — which restores without a key.
|
|
14288
|
+
*/
|
|
14289
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14290
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14291
|
+
scheme: string(),
|
|
14292
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14293
|
+
keyId: string()
|
|
14294
|
+
});
|
|
14295
|
+
/**
|
|
14296
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14297
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14298
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14299
|
+
*/
|
|
14300
|
+
var BackupEncryptionStatusSchema = object({
|
|
14301
|
+
enabled: boolean(),
|
|
14302
|
+
active: object({
|
|
14303
|
+
keyId: string(),
|
|
14304
|
+
publicKey: string(),
|
|
14305
|
+
createdAt: number()
|
|
14306
|
+
}).nullable(),
|
|
14307
|
+
/** Every key ever set up, newest first. */
|
|
14308
|
+
keys: array(object({
|
|
14309
|
+
keyId: string(),
|
|
14310
|
+
createdAt: number(),
|
|
14311
|
+
retiredAt: number().nullable()
|
|
14312
|
+
})).readonly()
|
|
14313
|
+
});
|
|
14314
|
+
/**
|
|
12857
14315
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12858
14316
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12859
14317
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12865,7 +14323,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12865
14323
|
sizeBytes: number(),
|
|
12866
14324
|
label: string().optional(),
|
|
12867
14325
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12868
|
-
locations: array(string()).readonly()
|
|
14326
|
+
locations: array(string()).readonly(),
|
|
14327
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14328
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12869
14329
|
});
|
|
12870
14330
|
var BackupEntrySchema = object({
|
|
12871
14331
|
id: string(),
|
|
@@ -12874,7 +14334,8 @@ var BackupEntrySchema = object({
|
|
|
12874
14334
|
label: string().optional(),
|
|
12875
14335
|
createdAt: number(),
|
|
12876
14336
|
sizeBytes: number(),
|
|
12877
|
-
locations: array(string()).optional()
|
|
14337
|
+
locations: array(string()).optional(),
|
|
14338
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12878
14339
|
});
|
|
12879
14340
|
var ArchiveEntrySchema = object({
|
|
12880
14341
|
path: string(),
|
|
@@ -13063,10 +14524,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13063
14524
|
* this list and skips entries whose path doesn't start with
|
|
13064
14525
|
* any of them.
|
|
13065
14526
|
*/
|
|
13066
|
-
locations: array(string()).optional()
|
|
14527
|
+
locations: array(string()).optional(),
|
|
14528
|
+
/**
|
|
14529
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14530
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14531
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14532
|
+
* is refused before the archive is downloaded.
|
|
14533
|
+
*/
|
|
14534
|
+
backupSecretKey: string().optional()
|
|
13067
14535
|
}), _void(), {
|
|
13068
14536
|
kind: "mutation",
|
|
13069
14537
|
auth: "admin"
|
|
14538
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14539
|
+
keyId: string(),
|
|
14540
|
+
secretKey: string(),
|
|
14541
|
+
publicKey: string(),
|
|
14542
|
+
createdAt: number(),
|
|
14543
|
+
replacedKeyId: string().nullable()
|
|
14544
|
+
}), {
|
|
14545
|
+
kind: "mutation",
|
|
14546
|
+
auth: "admin"
|
|
14547
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14548
|
+
kind: "mutation",
|
|
14549
|
+
auth: "admin"
|
|
14550
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14551
|
+
valid: boolean(),
|
|
14552
|
+
keyId: string().nullable(),
|
|
14553
|
+
/** The hub knows this key (active or retired). */
|
|
14554
|
+
known: boolean(),
|
|
14555
|
+
/** It is the key new archives are encrypted to. */
|
|
14556
|
+
active: boolean(),
|
|
14557
|
+
error: string().optional()
|
|
14558
|
+
}), {
|
|
14559
|
+
kind: "mutation",
|
|
14560
|
+
auth: "admin"
|
|
13070
14561
|
}), method(object({
|
|
13071
14562
|
destinationId: string(),
|
|
13072
14563
|
backupId: string()
|
|
@@ -14792,7 +16283,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14792
16283
|
stepId: string(),
|
|
14793
16284
|
entry: ModelCatalogEntrySchema
|
|
14794
16285
|
});
|
|
14795
|
-
|
|
16286
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16287
|
+
var ModelBundleFileSchema = object({
|
|
16288
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16289
|
+
path: string().min(1),
|
|
16290
|
+
bytes: number().int().nonnegative(),
|
|
16291
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16292
|
+
});
|
|
16293
|
+
var ImportModelBundleInputSchema = object({
|
|
16294
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16295
|
+
addonId: string(),
|
|
16296
|
+
stepId: string().min(1),
|
|
16297
|
+
/**
|
|
16298
|
+
* The catalog rows to register, complete, every format URL already
|
|
16299
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16300
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16301
|
+
*/
|
|
16302
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16303
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16304
|
+
bundle: object({
|
|
16305
|
+
ticket: PeerBytesTicketSchema,
|
|
16306
|
+
bytes: number().int().positive(),
|
|
16307
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16308
|
+
}),
|
|
16309
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16310
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16311
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16312
|
+
distribute: boolean()
|
|
16313
|
+
});
|
|
16314
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16315
|
+
kind: literal("imported"),
|
|
16316
|
+
modelIds: array(string()).readonly(),
|
|
16317
|
+
distributed: array(object({
|
|
16318
|
+
modelId: string(),
|
|
16319
|
+
nodeId: string(),
|
|
16320
|
+
format: _enum(MODEL_FORMATS),
|
|
16321
|
+
ok: boolean(),
|
|
16322
|
+
error: string().optional()
|
|
16323
|
+
})).readonly()
|
|
16324
|
+
}), object({
|
|
16325
|
+
kind: literal("refused"),
|
|
16326
|
+
reason: _enum([
|
|
16327
|
+
"transfer-failed",
|
|
16328
|
+
"checksum-mismatch",
|
|
16329
|
+
"bundle-mismatch",
|
|
16330
|
+
"invalid-entry",
|
|
16331
|
+
"id-taken"
|
|
16332
|
+
]),
|
|
16333
|
+
detail: string()
|
|
16334
|
+
})]);
|
|
16335
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16336
|
+
kind: "mutation",
|
|
16337
|
+
auth: "admin",
|
|
16338
|
+
timeoutMs: 30 * 6e4
|
|
16339
|
+
});
|
|
14796
16340
|
/**
|
|
14797
16341
|
* Query filter for settings-store collections.
|
|
14798
16342
|
*/
|
|
@@ -15175,6 +16719,253 @@ id: union([string(), number()]) }), {
|
|
|
15175
16719
|
kind: "mutation",
|
|
15176
16720
|
auth: "admin"
|
|
15177
16721
|
});
|
|
16722
|
+
/**
|
|
16723
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16724
|
+
*
|
|
16725
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
16726
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
16727
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
16728
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
16729
|
+
* against the CALLER, never against anything the caller claims.
|
|
16730
|
+
*
|
|
16731
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
16732
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
16733
|
+
* connection, the agent from its child's connection carried in
|
|
16734
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
16735
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
16736
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
16737
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
16738
|
+
* runner is the same OS user): see the threat model in
|
|
16739
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
16740
|
+
*
|
|
16741
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
16742
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
16743
|
+
* floors every method to admin anyway (D240).
|
|
16744
|
+
*
|
|
16745
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
16746
|
+
*/
|
|
16747
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
16748
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
16749
|
+
"key-missing",
|
|
16750
|
+
"wrong-key",
|
|
16751
|
+
"key-file-unreadable",
|
|
16752
|
+
"store-unavailable",
|
|
16753
|
+
"not-initialized",
|
|
16754
|
+
"decrypt-failed"
|
|
16755
|
+
]);
|
|
16756
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
16757
|
+
state: literal("locked"),
|
|
16758
|
+
reason: KeychainUnavailableReasonSchema
|
|
16759
|
+
})]);
|
|
16760
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
16761
|
+
object({
|
|
16762
|
+
kind: literal("value"),
|
|
16763
|
+
value: string(),
|
|
16764
|
+
version: number().int()
|
|
16765
|
+
}),
|
|
16766
|
+
object({ kind: literal("missing") }),
|
|
16767
|
+
object({
|
|
16768
|
+
kind: literal("unavailable"),
|
|
16769
|
+
reason: KeychainUnavailableReasonSchema
|
|
16770
|
+
}),
|
|
16771
|
+
object({ kind: literal("forbidden") })
|
|
16772
|
+
]);
|
|
16773
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
16774
|
+
/** Metadata of one stored value — never the value. */
|
|
16775
|
+
var KeychainSecretMetaSchema = object({
|
|
16776
|
+
ref: string(),
|
|
16777
|
+
owner: string(),
|
|
16778
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
16779
|
+
scope: string(),
|
|
16780
|
+
fieldPath: string(),
|
|
16781
|
+
version: number().int(),
|
|
16782
|
+
createdAt: number(),
|
|
16783
|
+
updatedAt: number(),
|
|
16784
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16785
|
+
updatedBy: string(),
|
|
16786
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
16787
|
+
lastReadAt: number().nullable()
|
|
16788
|
+
});
|
|
16789
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
16790
|
+
method(object({
|
|
16791
|
+
ref: string().min(1),
|
|
16792
|
+
value: string().min(1)
|
|
16793
|
+
}), object({
|
|
16794
|
+
ref: string(),
|
|
16795
|
+
version: number().int()
|
|
16796
|
+
}), {
|
|
16797
|
+
kind: "mutation",
|
|
16798
|
+
auth: "admin"
|
|
16799
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
16800
|
+
kind: "mutation",
|
|
16801
|
+
auth: "admin"
|
|
16802
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
16803
|
+
var KeychainKeySourceSchema = object({
|
|
16804
|
+
kind: _enum([
|
|
16805
|
+
"config-file",
|
|
16806
|
+
"previous-config-file",
|
|
16807
|
+
"platform",
|
|
16808
|
+
"default-file"
|
|
16809
|
+
]),
|
|
16810
|
+
/** File sources only — a path is not a secret. */
|
|
16811
|
+
path: string().optional(),
|
|
16812
|
+
/**
|
|
16813
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
16814
|
+
* next to the database it protects (the default file). The page warns.
|
|
16815
|
+
*/
|
|
16816
|
+
sharesBackupWithDatabase: boolean()
|
|
16817
|
+
});
|
|
16818
|
+
/**
|
|
16819
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16820
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16821
|
+
*/
|
|
16822
|
+
var KeychainResetRecordSchema = object({
|
|
16823
|
+
id: string(),
|
|
16824
|
+
at: number(),
|
|
16825
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16826
|
+
actor: string(),
|
|
16827
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16828
|
+
lockedReason: string().nullable(),
|
|
16829
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16830
|
+
archived: number().int(),
|
|
16831
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16832
|
+
archivedCollection: string().nullable(),
|
|
16833
|
+
/**
|
|
16834
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16835
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16836
|
+
*/
|
|
16837
|
+
archivedKeysCollection: string().nullable(),
|
|
16838
|
+
/**
|
|
16839
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16840
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16841
|
+
* agent forever (D797).
|
|
16842
|
+
*/
|
|
16843
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16844
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16845
|
+
acknowledgedAt: number().nullable()
|
|
16846
|
+
});
|
|
16847
|
+
var KeychainStatusSchema = object({
|
|
16848
|
+
keychain: KeychainStateSchema,
|
|
16849
|
+
/** The source of the master key in use; `null` while locked. */
|
|
16850
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
16851
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
16852
|
+
configuredSource: KeychainKeySourceSchema,
|
|
16853
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
16854
|
+
fingerprint: string().nullable(),
|
|
16855
|
+
activeKeyId: string().nullable(),
|
|
16856
|
+
/**
|
|
16857
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
16858
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
16859
|
+
*/
|
|
16860
|
+
rotationPending: boolean(),
|
|
16861
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
16862
|
+
retiredWraps: number().int(),
|
|
16863
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
16864
|
+
secretCount: number().int(),
|
|
16865
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16866
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
16867
|
+
});
|
|
16868
|
+
/**
|
|
16869
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
16870
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
16871
|
+
* never reported as an orphan (and never deleted as one).
|
|
16872
|
+
*/
|
|
16873
|
+
var KeychainSecretUsageSchema = _enum([
|
|
16874
|
+
"in-use",
|
|
16875
|
+
"orphan",
|
|
16876
|
+
"unknown"
|
|
16877
|
+
]);
|
|
16878
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
16879
|
+
var KeychainAuditActionSchema = _enum([
|
|
16880
|
+
"put",
|
|
16881
|
+
"delete",
|
|
16882
|
+
"reveal",
|
|
16883
|
+
"rotate-master-key",
|
|
16884
|
+
"purge-retired-keys",
|
|
16885
|
+
"download-recovery-key",
|
|
16886
|
+
"delete-orphans",
|
|
16887
|
+
"reset",
|
|
16888
|
+
"acknowledge-reset",
|
|
16889
|
+
"initialize"
|
|
16890
|
+
]);
|
|
16891
|
+
var KeychainAuditEntrySchema = object({
|
|
16892
|
+
id: string(),
|
|
16893
|
+
at: number(),
|
|
16894
|
+
action: KeychainAuditActionSchema,
|
|
16895
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
16896
|
+
actor: string(),
|
|
16897
|
+
ref: string().nullable(),
|
|
16898
|
+
detail: string().nullable()
|
|
16899
|
+
});
|
|
16900
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16901
|
+
/**
|
|
16902
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16903
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16904
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16905
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16906
|
+
*/
|
|
16907
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
16908
|
+
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({
|
|
16909
|
+
value: string(),
|
|
16910
|
+
version: number().int()
|
|
16911
|
+
}), {
|
|
16912
|
+
kind: "mutation",
|
|
16913
|
+
auth: "admin",
|
|
16914
|
+
caller: "required"
|
|
16915
|
+
}), method(object({
|
|
16916
|
+
name: SystemHeldSecretNameSchema,
|
|
16917
|
+
value: string().min(16)
|
|
16918
|
+
}), object({
|
|
16919
|
+
ref: string(),
|
|
16920
|
+
version: number().int()
|
|
16921
|
+
}), {
|
|
16922
|
+
kind: "mutation",
|
|
16923
|
+
auth: "admin",
|
|
16924
|
+
caller: "required"
|
|
16925
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16926
|
+
deleted: array(string()).readonly(),
|
|
16927
|
+
kept: array(object({
|
|
16928
|
+
ref: string(),
|
|
16929
|
+
usage: KeychainSecretUsageSchema
|
|
16930
|
+
})).readonly()
|
|
16931
|
+
}), {
|
|
16932
|
+
kind: "mutation",
|
|
16933
|
+
auth: "admin",
|
|
16934
|
+
caller: "required"
|
|
16935
|
+
}), method(object({}), object({
|
|
16936
|
+
fingerprint: string(),
|
|
16937
|
+
keySource: KeychainKeySourceSchema
|
|
16938
|
+
}), {
|
|
16939
|
+
kind: "mutation",
|
|
16940
|
+
auth: "admin",
|
|
16941
|
+
caller: "required"
|
|
16942
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
16943
|
+
kind: "mutation",
|
|
16944
|
+
auth: "admin",
|
|
16945
|
+
caller: "required"
|
|
16946
|
+
}), method(object({}), object({
|
|
16947
|
+
key: string(),
|
|
16948
|
+
fingerprint: string(),
|
|
16949
|
+
keySource: KeychainKeySourceSchema
|
|
16950
|
+
}), {
|
|
16951
|
+
kind: "mutation",
|
|
16952
|
+
auth: "admin",
|
|
16953
|
+
caller: "required"
|
|
16954
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
16955
|
+
archivedCollection: string().nullable(),
|
|
16956
|
+
archived: number().int()
|
|
16957
|
+
}), {
|
|
16958
|
+
kind: "mutation",
|
|
16959
|
+
auth: "admin",
|
|
16960
|
+
caller: "required"
|
|
16961
|
+
}), method(object({}), object({
|
|
16962
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16963
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16964
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16965
|
+
kind: "mutation",
|
|
16966
|
+
auth: "admin",
|
|
16967
|
+
caller: "required"
|
|
16968
|
+
});
|
|
15178
16969
|
method(_void(), object({
|
|
15179
16970
|
id: string(),
|
|
15180
16971
|
name: string(),
|
|
@@ -16417,7 +18208,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
16417
18208
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16418
18209
|
var DevicePersistConfigPayloadSchema = object({
|
|
16419
18210
|
deviceId: number(),
|
|
16420
|
-
data: record(string(), unknown())
|
|
18211
|
+
data: record(string(), unknown()),
|
|
18212
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
18213
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
18214
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
18215
|
+
secretConfigPaths: array(string()).optional()
|
|
16421
18216
|
});
|
|
16422
18217
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
16423
18218
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -18020,7 +19815,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18020
19815
|
* `login-method` — collection cap through which auth addons contribute
|
|
18021
19816
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18022
19817
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18023
|
-
* every auth addon (OIDC,
|
|
19818
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18024
19819
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18025
19820
|
* procedure aggregates them for the unauthenticated login page.
|
|
18026
19821
|
*
|
|
@@ -18028,8 +19823,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18028
19823
|
*
|
|
18029
19824
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18030
19825
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18031
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18032
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19826
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18033
19827
|
* login page needs NO change.
|
|
18034
19828
|
*
|
|
18035
19829
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18048,8 +19842,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18048
19842
|
* decision.
|
|
18049
19843
|
*
|
|
18050
19844
|
* Every contribution carries a `stage`:
|
|
18051
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18052
|
-
*
|
|
19845
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19846
|
+
* buttons; a usernameless passkey).
|
|
18053
19847
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18054
19848
|
* returned `factors` (passkey-as-2FA today).
|
|
18055
19849
|
*
|
|
@@ -18076,7 +19870,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18076
19870
|
* The provider names an external identity a signed-in user can link to
|
|
18077
19871
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18078
19872
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18079
|
-
* whatever their id. Absent / false — a login button only
|
|
19873
|
+
* whatever their id. Absent / false — a login button only.
|
|
18080
19874
|
*/
|
|
18081
19875
|
linkable: boolean().optional()
|
|
18082
19876
|
}),
|
|
@@ -21931,8 +23725,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21931
23725
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21932
23726
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21933
23727
|
* distinction was only ever used to route role-specific procedures
|
|
21934
|
-
* which we no longer have.
|
|
21935
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23728
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21936
23729
|
* with `isAdmin: false` + an explicit scope list.
|
|
21937
23730
|
*/
|
|
21938
23731
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23434,8 +25227,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
23434
25227
|
]);
|
|
23435
25228
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
23436
25229
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
23437
|
-
/**
|
|
23438
|
-
|
|
25230
|
+
/**
|
|
25231
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
25232
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
25233
|
+
*
|
|
25234
|
+
* - `operator` — drawn by hand.
|
|
25235
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
25236
|
+
* model, or a larger teacher model).
|
|
25237
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
25238
|
+
* back from the track store (never a re-run).
|
|
25239
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
25240
|
+
*/
|
|
25241
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
25242
|
+
"operator",
|
|
25243
|
+
"assist",
|
|
25244
|
+
"pipeline",
|
|
25245
|
+
"llm"
|
|
25246
|
+
]);
|
|
23439
25247
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
23440
25248
|
var RetrainBboxSchema = object({
|
|
23441
25249
|
x: number(),
|
|
@@ -23453,7 +25261,8 @@ var RetrainBboxSchema = object({
|
|
|
23453
25261
|
*/
|
|
23454
25262
|
var RetrainAnnotationSchema = object({
|
|
23455
25263
|
id: string(),
|
|
23456
|
-
|
|
25264
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
25265
|
+
trackId: string().optional(),
|
|
23457
25266
|
deviceId: number(),
|
|
23458
25267
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
23459
25268
|
mediaKey: string(),
|
|
@@ -23502,13 +25311,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23502
25311
|
* fail, whatever became of the original. */
|
|
23503
25312
|
copied: boolean()
|
|
23504
25313
|
});
|
|
25314
|
+
/**
|
|
25315
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
25316
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
25317
|
+
* box recorded on the source media row when there is one, else the track
|
|
25318
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
25319
|
+
* until the operator confirms it.
|
|
25320
|
+
*/
|
|
25321
|
+
var RetrainPipelineBoxSchema = object({
|
|
25322
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
25323
|
+
bbox: RetrainBboxSchema,
|
|
25324
|
+
macroClass: RetrainMacroClassSchema,
|
|
25325
|
+
label: string().optional(),
|
|
25326
|
+
subLabel: string().optional(),
|
|
25327
|
+
/** The detection score of the position used, when it was recorded. */
|
|
25328
|
+
score: number().optional(),
|
|
25329
|
+
/** The root model that produced the track, when it was recorded. */
|
|
25330
|
+
modelId: string().optional(),
|
|
25331
|
+
trackId: string(),
|
|
25332
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
25333
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
25334
|
+
basis: _enum(["subject-box", "position"]),
|
|
25335
|
+
deltaMs: number()
|
|
25336
|
+
});
|
|
25337
|
+
/**
|
|
25338
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
25339
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
25340
|
+
* track at all.
|
|
25341
|
+
*/
|
|
25342
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23505
25343
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23506
25344
|
var RetrainFrameSchema = object({
|
|
23507
25345
|
frameId: string(),
|
|
23508
25346
|
deviceId: number(),
|
|
23509
|
-
|
|
23510
|
-
/**
|
|
23511
|
-
|
|
25347
|
+
origin: RetrainFrameOriginSchema,
|
|
25348
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
25349
|
+
trackId: string().optional(),
|
|
25350
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
25351
|
+
* Absent on a recording still. */
|
|
25352
|
+
sourceMediaId: number().int().optional(),
|
|
25353
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
25354
|
+
epochMs: number().optional(),
|
|
23512
25355
|
sourceKind: MediaFileKindEnum,
|
|
23513
25356
|
sizeBytes: number().int(),
|
|
23514
25357
|
width: number().int(),
|
|
@@ -23519,7 +25362,12 @@ var RetrainFrameSchema = object({
|
|
|
23519
25362
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
23520
25363
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23521
25364
|
* a false positive. */
|
|
23522
|
-
complete: boolean()
|
|
25365
|
+
complete: boolean(),
|
|
25366
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
25367
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
25368
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
25369
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
25370
|
+
collectionIds: array(string()).readonly().optional()
|
|
23523
25371
|
});
|
|
23524
25372
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23525
25373
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23550,6 +25398,11 @@ var RetrainFrameListSchema = object({
|
|
|
23550
25398
|
var RetrainExportFilterSchema = object({
|
|
23551
25399
|
deviceIds: array(number()).optional(),
|
|
23552
25400
|
frameIds: array(string()).max(2e4).optional(),
|
|
25401
|
+
/** Only frames in at least one of these named collections. */
|
|
25402
|
+
collectionIds: array(string()).max(200).optional(),
|
|
25403
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25404
|
+
* unknown id selects nothing. */
|
|
25405
|
+
datasetVersionId: string().optional(),
|
|
23553
25406
|
batchId: string().optional(),
|
|
23554
25407
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23555
25408
|
completeOnly: boolean().optional()
|
|
@@ -23614,6 +25467,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23614
25467
|
reason: string(),
|
|
23615
25468
|
detail: string().optional()
|
|
23616
25469
|
})]);
|
|
25470
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
25471
|
+
var RetrainCollectionSchema = object({
|
|
25472
|
+
id: string(),
|
|
25473
|
+
name: string(),
|
|
25474
|
+
createdAt: number(),
|
|
25475
|
+
frameCount: number().int()
|
|
25476
|
+
});
|
|
25477
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
25478
|
+
kind: literal("created"),
|
|
25479
|
+
collection: RetrainCollectionSchema
|
|
25480
|
+
}), object({
|
|
25481
|
+
kind: literal("refused"),
|
|
25482
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
25483
|
+
})]);
|
|
25484
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
25485
|
+
kind: literal("renamed"),
|
|
25486
|
+
collection: RetrainCollectionSchema
|
|
25487
|
+
}), object({
|
|
25488
|
+
kind: literal("refused"),
|
|
25489
|
+
reason: _enum([
|
|
25490
|
+
"empty-name",
|
|
25491
|
+
"duplicate-name",
|
|
25492
|
+
"unknown-collection"
|
|
25493
|
+
])
|
|
25494
|
+
})]);
|
|
25495
|
+
/**
|
|
25496
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
25497
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
25498
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
25499
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
25500
|
+
*/
|
|
25501
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
25502
|
+
kind: literal("added"),
|
|
25503
|
+
collectionId: string(),
|
|
25504
|
+
frame: RetrainFrameSchema,
|
|
25505
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
25506
|
+
reused: boolean()
|
|
25507
|
+
}), object({
|
|
25508
|
+
kind: literal("refused"),
|
|
25509
|
+
reason: _enum([
|
|
25510
|
+
"unknown-collection",
|
|
25511
|
+
"still-unavailable",
|
|
25512
|
+
"still-busy",
|
|
25513
|
+
"unreadable-image",
|
|
25514
|
+
"write-failed"
|
|
25515
|
+
]),
|
|
25516
|
+
detail: string().optional()
|
|
25517
|
+
})]);
|
|
25518
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
25519
|
+
var RetrainAssistProfileSchema = object({
|
|
25520
|
+
id: string(),
|
|
25521
|
+
name: string(),
|
|
25522
|
+
model: string(),
|
|
25523
|
+
kind: string(),
|
|
25524
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
25525
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
25526
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
25527
|
+
leavesHouse: boolean()
|
|
25528
|
+
});
|
|
25529
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
25530
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
25531
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
25532
|
+
var RetrainLlmReviewSchema = object({
|
|
25533
|
+
/** The `ref` the page sent the box under. */
|
|
25534
|
+
ref: string(),
|
|
25535
|
+
verdict: _enum([
|
|
25536
|
+
"confirmed",
|
|
25537
|
+
"wrong-class",
|
|
25538
|
+
"not-an-object",
|
|
25539
|
+
"uncertain"
|
|
25540
|
+
]),
|
|
25541
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
25542
|
+
reason: string()
|
|
25543
|
+
});
|
|
25544
|
+
/**
|
|
25545
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
25546
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
25547
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
25548
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
25549
|
+
*/
|
|
25550
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
25551
|
+
kind: literal("proposed"),
|
|
25552
|
+
profileId: string(),
|
|
25553
|
+
model: string(),
|
|
25554
|
+
/** The frame was sent outside the house for this answer. */
|
|
25555
|
+
leftHouse: boolean(),
|
|
25556
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
25557
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
25558
|
+
rejected: number().int()
|
|
25559
|
+
}), object({
|
|
25560
|
+
kind: literal("refused"),
|
|
25561
|
+
reason: _enum([
|
|
25562
|
+
"unknown-frame",
|
|
25563
|
+
"unreadable-frame",
|
|
25564
|
+
"unknown-profile",
|
|
25565
|
+
"profile-disabled",
|
|
25566
|
+
"no-vision",
|
|
25567
|
+
"cloud-not-confirmed",
|
|
25568
|
+
"llm-error",
|
|
25569
|
+
"malformed-answer"
|
|
25570
|
+
]),
|
|
25571
|
+
detail: string().optional()
|
|
25572
|
+
})]);
|
|
25573
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25574
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25575
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25576
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25577
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25578
|
+
});
|
|
25579
|
+
/** The counts a dataset is judged by. */
|
|
25580
|
+
var RetrainDatasetStatsSchema = object({
|
|
25581
|
+
frames: number().int(),
|
|
25582
|
+
completeFrames: number().int(),
|
|
25583
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25584
|
+
completeness: number(),
|
|
25585
|
+
/** Boxes to learn (model errors excluded). */
|
|
25586
|
+
subjects: number().int(),
|
|
25587
|
+
modelErrors: number().int(),
|
|
25588
|
+
/** Complete frames with no subject. */
|
|
25589
|
+
hardNegatives: number().int(),
|
|
25590
|
+
/** Subjects per class × camera × day/night. */
|
|
25591
|
+
cells: array(object({
|
|
25592
|
+
macroClass: string(),
|
|
25593
|
+
deviceId: number(),
|
|
25594
|
+
lighting: _enum([
|
|
25595
|
+
"day",
|
|
25596
|
+
"night",
|
|
25597
|
+
"unknown"
|
|
25598
|
+
]),
|
|
25599
|
+
subjects: number().int(),
|
|
25600
|
+
frames: number().int()
|
|
25601
|
+
})).readonly(),
|
|
25602
|
+
cameras: array(object({
|
|
25603
|
+
deviceId: number(),
|
|
25604
|
+
frames: number().int(),
|
|
25605
|
+
completeFrames: number().int()
|
|
25606
|
+
})).readonly()
|
|
25607
|
+
});
|
|
25608
|
+
/** An immutable dataset version, without its frame list. */
|
|
25609
|
+
var RetrainDatasetVersionSchema = object({
|
|
25610
|
+
id: string(),
|
|
25611
|
+
name: string(),
|
|
25612
|
+
createdAt: number(),
|
|
25613
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25614
|
+
layout: RetrainExportLayoutSchema,
|
|
25615
|
+
completeOnly: boolean(),
|
|
25616
|
+
frameCount: number().int(),
|
|
25617
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25618
|
+
annotationHash: string(),
|
|
25619
|
+
/** The export manifest schema the version was cut under. */
|
|
25620
|
+
manifestSchema: string(),
|
|
25621
|
+
stats: RetrainDatasetStatsSchema
|
|
25622
|
+
});
|
|
25623
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25624
|
+
kind: literal("created"),
|
|
25625
|
+
version: RetrainDatasetVersionSchema
|
|
25626
|
+
}), object({
|
|
25627
|
+
kind: literal("refused"),
|
|
25628
|
+
reason: _enum([
|
|
25629
|
+
"empty-name",
|
|
25630
|
+
"duplicate-name",
|
|
25631
|
+
"no-frames"
|
|
25632
|
+
])
|
|
25633
|
+
})]);
|
|
23617
25634
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23618
25635
|
var RetrainTransitionResultSchema = object({
|
|
23619
25636
|
trackId: string(),
|
|
@@ -24331,7 +26348,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24331
26348
|
auth: "admin"
|
|
24332
26349
|
}), method(object({
|
|
24333
26350
|
deviceId: number(),
|
|
24334
|
-
trackId: string(),
|
|
26351
|
+
trackId: string().optional(),
|
|
24335
26352
|
frameId: string()
|
|
24336
26353
|
}), object({
|
|
24337
26354
|
removed: boolean(),
|
|
@@ -24348,7 +26365,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24348
26365
|
auth: "admin"
|
|
24349
26366
|
}), method(object({
|
|
24350
26367
|
deviceId: number(),
|
|
24351
|
-
|
|
26368
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26369
|
+
trackId: string().optional(),
|
|
24352
26370
|
frameId: string(),
|
|
24353
26371
|
subject: RetrainAssistSubjectSchema,
|
|
24354
26372
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -24356,12 +26374,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24356
26374
|
}), RetrainAssistResultSchema, {
|
|
24357
26375
|
kind: "mutation",
|
|
24358
26376
|
auth: "admin"
|
|
24359
|
-
}), method(object({
|
|
26377
|
+
}), method(object({
|
|
26378
|
+
trackId: string().optional(),
|
|
26379
|
+
frameIds: array(string()).max(2e3).optional()
|
|
26380
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
24360
26381
|
kind: "query",
|
|
24361
26382
|
auth: "admin"
|
|
24362
26383
|
}), method(object({
|
|
24363
26384
|
deviceId: number(),
|
|
24364
|
-
|
|
26385
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26386
|
+
trackId: string().optional(),
|
|
24365
26387
|
frameId: string(),
|
|
24366
26388
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
24367
26389
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -24384,7 +26406,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24384
26406
|
auth: "admin"
|
|
24385
26407
|
}), method(object({
|
|
24386
26408
|
deviceId: number(),
|
|
24387
|
-
trackId: string(),
|
|
26409
|
+
trackId: string().optional(),
|
|
24388
26410
|
frameId: string(),
|
|
24389
26411
|
complete: boolean()
|
|
24390
26412
|
}), RetrainFrameSchema, {
|
|
@@ -24398,6 +26420,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24398
26420
|
kind: "mutation",
|
|
24399
26421
|
auth: "admin",
|
|
24400
26422
|
timeoutMs: 60 * 6e4
|
|
26423
|
+
}), method(object({
|
|
26424
|
+
filter: RetrainExportFilterSchema,
|
|
26425
|
+
layout: RetrainExportLayoutSchema
|
|
26426
|
+
}), object({
|
|
26427
|
+
ticket: PeerBytesTicketSchema,
|
|
26428
|
+
frames: number().int(),
|
|
26429
|
+
annotations: number().int()
|
|
26430
|
+
}), {
|
|
26431
|
+
kind: "mutation",
|
|
26432
|
+
auth: "admin",
|
|
26433
|
+
timeoutMs: 12e4
|
|
26434
|
+
}), method(object({
|
|
26435
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26436
|
+
completeOnly: boolean().optional()
|
|
26437
|
+
}), RetrainDatasetStatsSchema, {
|
|
26438
|
+
kind: "query",
|
|
26439
|
+
auth: "admin"
|
|
26440
|
+
}), method(object({
|
|
26441
|
+
name: string().max(120),
|
|
26442
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26443
|
+
layout: RetrainExportLayoutSchema,
|
|
26444
|
+
completeOnly: boolean()
|
|
26445
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26446
|
+
kind: "mutation",
|
|
26447
|
+
auth: "admin",
|
|
26448
|
+
timeoutMs: 12e4
|
|
26449
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26450
|
+
kind: "query",
|
|
26451
|
+
auth: "admin"
|
|
26452
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26453
|
+
kind: "mutation",
|
|
26454
|
+
auth: "admin"
|
|
26455
|
+
}), method(object({ id: string() }), object({
|
|
26456
|
+
found: boolean(),
|
|
26457
|
+
annotationHash: string(),
|
|
26458
|
+
matches: boolean(),
|
|
26459
|
+
missingFrames: number().int()
|
|
26460
|
+
}), {
|
|
26461
|
+
kind: "query",
|
|
26462
|
+
auth: "admin",
|
|
26463
|
+
timeoutMs: 12e4
|
|
26464
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
26465
|
+
kind: "query",
|
|
26466
|
+
auth: "admin"
|
|
26467
|
+
}), method(object({
|
|
26468
|
+
deviceId: number(),
|
|
26469
|
+
trackId: string().optional(),
|
|
26470
|
+
frameId: string(),
|
|
26471
|
+
profileId: string(),
|
|
26472
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
26473
|
+
boxes: array(object({
|
|
26474
|
+
ref: string(),
|
|
26475
|
+
bbox: RetrainBboxSchema,
|
|
26476
|
+
macroClass: RetrainMacroClassSchema,
|
|
26477
|
+
label: string().optional()
|
|
26478
|
+
})).max(50),
|
|
26479
|
+
allowCloud: boolean()
|
|
26480
|
+
}), RetrainLlmAssistResultSchema, {
|
|
26481
|
+
kind: "mutation",
|
|
26482
|
+
auth: "admin",
|
|
26483
|
+
timeoutMs: 18e4
|
|
26484
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
26485
|
+
kind: "mutation",
|
|
26486
|
+
auth: "admin"
|
|
26487
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
26488
|
+
kind: "query",
|
|
26489
|
+
auth: "admin"
|
|
26490
|
+
}), method(object({
|
|
26491
|
+
id: string(),
|
|
26492
|
+
name: string().max(120)
|
|
26493
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
26494
|
+
kind: "mutation",
|
|
26495
|
+
auth: "admin"
|
|
26496
|
+
}), method(object({ id: string() }), object({
|
|
26497
|
+
deleted: boolean(),
|
|
26498
|
+
removedFrames: number().int()
|
|
26499
|
+
}), {
|
|
26500
|
+
kind: "mutation",
|
|
26501
|
+
auth: "admin"
|
|
26502
|
+
}), method(object({
|
|
26503
|
+
collectionId: string(),
|
|
26504
|
+
deviceId: number(),
|
|
26505
|
+
epochMs: number()
|
|
26506
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
26507
|
+
kind: "mutation",
|
|
26508
|
+
auth: "admin",
|
|
26509
|
+
timeoutMs: 6e4
|
|
26510
|
+
}), method(object({
|
|
26511
|
+
collectionId: string(),
|
|
26512
|
+
frameIds: array(string()).min(1).max(500)
|
|
26513
|
+
}), object({
|
|
26514
|
+
added: number().int(),
|
|
26515
|
+
alreadyMember: number().int(),
|
|
26516
|
+
unknownFrameIds: array(string()).readonly()
|
|
26517
|
+
}), {
|
|
26518
|
+
kind: "mutation",
|
|
26519
|
+
auth: "admin"
|
|
26520
|
+
}), method(object({
|
|
26521
|
+
collectionId: string(),
|
|
26522
|
+
frameId: string()
|
|
26523
|
+
}), object({
|
|
26524
|
+
removed: boolean(),
|
|
26525
|
+
deletedFrame: boolean()
|
|
26526
|
+
}), {
|
|
26527
|
+
kind: "mutation",
|
|
26528
|
+
auth: "admin"
|
|
26529
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
26530
|
+
kind: "query",
|
|
26531
|
+
auth: "admin"
|
|
24401
26532
|
}), method(object({
|
|
24402
26533
|
/** Which of the three event tables owns the row. */
|
|
24403
26534
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -25021,13 +27152,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
25021
27152
|
object({
|
|
25022
27153
|
kind: literal("no-family-build"),
|
|
25023
27154
|
format: ModelFormatSchema$1
|
|
27155
|
+
}),
|
|
27156
|
+
object({
|
|
27157
|
+
kind: literal("kept-custom-pin"),
|
|
27158
|
+
modelId: string(),
|
|
27159
|
+
deviceKey: string()
|
|
25024
27160
|
})
|
|
25025
27161
|
]);
|
|
27162
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
27163
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
27164
|
+
/**
|
|
27165
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
27166
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
27167
|
+
*/
|
|
27168
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
27169
|
+
kind: literal("node-benchmark"),
|
|
27170
|
+
resultId: string(),
|
|
27171
|
+
measuredAtMs: number()
|
|
27172
|
+
})]);
|
|
25026
27173
|
var DeviceModelChoiceSchema = object({
|
|
25027
27174
|
modelId: string(),
|
|
25028
27175
|
p50Ms: number(),
|
|
25029
27176
|
fps: number(),
|
|
25030
27177
|
measured: boolean(),
|
|
27178
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
27179
|
+
source: LatencySourceSchema.optional(),
|
|
25031
27180
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
25032
27181
|
capacitySessions: number(),
|
|
25033
27182
|
personRecall: number()
|
|
@@ -25038,6 +27187,8 @@ var DeviceRecommendationSchema = object({
|
|
|
25038
27187
|
enabled: boolean(),
|
|
25039
27188
|
available: boolean(),
|
|
25040
27189
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
27190
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
27191
|
+
kept: KeptReasonSchema.optional(),
|
|
25041
27192
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
25042
27193
|
});
|
|
25043
27194
|
var NodeRecommendationSchema = object({
|
|
@@ -25091,6 +27242,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
25091
27242
|
kind: literal("coral-enabled"),
|
|
25092
27243
|
nodeId: string(),
|
|
25093
27244
|
deviceKey: string()
|
|
27245
|
+
}),
|
|
27246
|
+
object({
|
|
27247
|
+
kind: literal("custom-pin-kept"),
|
|
27248
|
+
nodeId: string(),
|
|
27249
|
+
deviceKey: string().nullable(),
|
|
27250
|
+
deviceId: number().nullable(),
|
|
27251
|
+
modelId: string()
|
|
27252
|
+
}),
|
|
27253
|
+
object({
|
|
27254
|
+
kind: literal("custom-registry-unreadable"),
|
|
27255
|
+
error: string()
|
|
25094
27256
|
})
|
|
25095
27257
|
]);
|
|
25096
27258
|
var AutoTuneOptionsSchema = object({
|
|
@@ -25269,13 +27431,14 @@ var SuggestSharesResultSchema = object({
|
|
|
25269
27431
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
25270
27432
|
});
|
|
25271
27433
|
/**
|
|
25272
|
-
* Where the node and device shares come from (D750, D755).
|
|
25273
|
-
* - `
|
|
25274
|
-
*
|
|
25275
|
-
*
|
|
25276
|
-
*
|
|
25277
|
-
*
|
|
25278
|
-
*
|
|
27434
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
27435
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
27436
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
27437
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
27438
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
27439
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
27440
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
27441
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
25279
27442
|
* - `manual` — the operator's stored sliders.
|
|
25280
27443
|
* Either way a node or device that cannot take sessions gives its share to
|
|
25281
27444
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -25324,6 +27487,362 @@ var EffectiveSharesSchema = object({
|
|
|
25324
27487
|
nodeWeights: record(string(), number()),
|
|
25325
27488
|
deviceWeights: record(string(), record(string(), number()))
|
|
25326
27489
|
});
|
|
27490
|
+
/**
|
|
27491
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
27492
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
27493
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
27494
|
+
* shares read.
|
|
27495
|
+
*
|
|
27496
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
27497
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
27498
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
27499
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
27500
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
27501
|
+
*
|
|
27502
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
27503
|
+
* cross a process at frame rate, D9):
|
|
27504
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
27505
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
27506
|
+
* interval;
|
|
27507
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
27508
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
27509
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
27510
|
+
* CPU, RAM or the event loop give out.
|
|
27511
|
+
*/
|
|
27512
|
+
/** Defaults and bounds, one place. */
|
|
27513
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
27514
|
+
fpsPerStream: 10,
|
|
27515
|
+
budgetMinutes: 45,
|
|
27516
|
+
minBudgetMinutes: 10,
|
|
27517
|
+
maxBudgetMinutes: 120,
|
|
27518
|
+
/** A result older than this no longer beats the table. */
|
|
27519
|
+
staleAfterDays: 30,
|
|
27520
|
+
/** Warm-in per ramp step (not accounted). */
|
|
27521
|
+
settleSec: 5,
|
|
27522
|
+
/** Accounted window per ramp step. */
|
|
27523
|
+
measureSec: 20,
|
|
27524
|
+
/** Longest the drain may take before the run is refused. */
|
|
27525
|
+
drainTimeoutSec: 120,
|
|
27526
|
+
/** Candidate models per device in one run. */
|
|
27527
|
+
maxModelsPerDevice: 6
|
|
27528
|
+
};
|
|
27529
|
+
/** The two measurements a run can make. */
|
|
27530
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
27531
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
27532
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
27533
|
+
deviceKey: string().min(1),
|
|
27534
|
+
/**
|
|
27535
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
27536
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
27537
|
+
*/
|
|
27538
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
27539
|
+
});
|
|
27540
|
+
/** What the operator confirmed. */
|
|
27541
|
+
var NodeBenchmarkPlanSchema = object({
|
|
27542
|
+
nodeId: string().min(1),
|
|
27543
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27544
|
+
/** Which measurements run. At least one. */
|
|
27545
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
27546
|
+
/**
|
|
27547
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
27548
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
27549
|
+
* detector always runs.
|
|
27550
|
+
*/
|
|
27551
|
+
steps: array(string().min(1)).default([]),
|
|
27552
|
+
/** Offered rate of one stream / session. */
|
|
27553
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
27554
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
27555
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
27556
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
27557
|
+
keepDownloadedModels: boolean().default(false),
|
|
27558
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
27559
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
27560
|
+
});
|
|
27561
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
27562
|
+
kind: _enum([
|
|
27563
|
+
"benchmark-active",
|
|
27564
|
+
"node-offline",
|
|
27565
|
+
"unknown-device",
|
|
27566
|
+
"no-phase",
|
|
27567
|
+
"insufficient-headroom"
|
|
27568
|
+
]),
|
|
27569
|
+
detail: string(),
|
|
27570
|
+
overridable: boolean()
|
|
27571
|
+
});
|
|
27572
|
+
/** A camera whose detection leaves the node for the run. */
|
|
27573
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
27574
|
+
deviceId: number(),
|
|
27575
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
27576
|
+
placedOnNode: boolean(),
|
|
27577
|
+
/** A node pin naming this node, ignored for the run. */
|
|
27578
|
+
pinnedToNode: boolean()
|
|
27579
|
+
});
|
|
27580
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
27581
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
27582
|
+
deviceId: number(),
|
|
27583
|
+
reason: literal("only-frame-source")
|
|
27584
|
+
});
|
|
27585
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
27586
|
+
nodeId: string(),
|
|
27587
|
+
online: boolean(),
|
|
27588
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
27589
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
27590
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
27591
|
+
estimatedDurationMs: number(),
|
|
27592
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
27593
|
+
budgetMs: number(),
|
|
27594
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
27595
|
+
steps: array(string()).readonly(),
|
|
27596
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
27597
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
27598
|
+
headroom: object({
|
|
27599
|
+
sessionsNow: number(),
|
|
27600
|
+
otherNodesCapacitySessions: number().nullable()
|
|
27601
|
+
}),
|
|
27602
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
27603
|
+
canStart: boolean()
|
|
27604
|
+
});
|
|
27605
|
+
/** Where the measuring runner is. */
|
|
27606
|
+
var NodeBenchProgressSchema = object({
|
|
27607
|
+
phase: _enum([
|
|
27608
|
+
"preparing",
|
|
27609
|
+
"device",
|
|
27610
|
+
"pipeline",
|
|
27611
|
+
"cleanup"
|
|
27612
|
+
]),
|
|
27613
|
+
deviceKey: string().nullable(),
|
|
27614
|
+
modelId: string().nullable(),
|
|
27615
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
27616
|
+
load: number().nullable(),
|
|
27617
|
+
cellsDone: number(),
|
|
27618
|
+
cellsTotal: number(),
|
|
27619
|
+
message: string()
|
|
27620
|
+
});
|
|
27621
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
27622
|
+
var NodeBenchLimitSchema = _enum([
|
|
27623
|
+
"p95",
|
|
27624
|
+
"drops",
|
|
27625
|
+
"errors",
|
|
27626
|
+
"stall",
|
|
27627
|
+
"cpu",
|
|
27628
|
+
"ram",
|
|
27629
|
+
"none"
|
|
27630
|
+
]);
|
|
27631
|
+
var NodeBenchRampStepSchema = object({
|
|
27632
|
+
load: number(),
|
|
27633
|
+
pass: boolean(),
|
|
27634
|
+
p95Ms: number(),
|
|
27635
|
+
dropRatio: number(),
|
|
27636
|
+
/** Completed frames per second over the accounted window. */
|
|
27637
|
+
fps: number(),
|
|
27638
|
+
cpuPct: number().nullable(),
|
|
27639
|
+
ramFreePct: number().nullable(),
|
|
27640
|
+
failReasons: array(string()).readonly()
|
|
27641
|
+
});
|
|
27642
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
27643
|
+
phase: literal("device"),
|
|
27644
|
+
deviceKey: string(),
|
|
27645
|
+
modelId: string(),
|
|
27646
|
+
/** Single-stream latency (the K = 1 step). */
|
|
27647
|
+
p50Ms: number(),
|
|
27648
|
+
p95Ms: number(),
|
|
27649
|
+
p99Ms: number(),
|
|
27650
|
+
/** Frames per second sustained at the last passing step. */
|
|
27651
|
+
fps: number(),
|
|
27652
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
27653
|
+
kMax: number(),
|
|
27654
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27655
|
+
/** First call (model load + warm-up). */
|
|
27656
|
+
warmupMs: number(),
|
|
27657
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27658
|
+
}), object({
|
|
27659
|
+
phase: literal("pipeline"),
|
|
27660
|
+
deviceKey: string(),
|
|
27661
|
+
modelId: string(),
|
|
27662
|
+
steps: array(string()).readonly(),
|
|
27663
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
27664
|
+
maxSessions: number(),
|
|
27665
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27666
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
27667
|
+
stepsFired: array(string()).readonly(),
|
|
27668
|
+
warmupMs: number(),
|
|
27669
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27670
|
+
})]);
|
|
27671
|
+
/**
|
|
27672
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
27673
|
+
* the node no longer beats the table.
|
|
27674
|
+
*/
|
|
27675
|
+
var NodeBenchFingerprintSchema = object({
|
|
27676
|
+
pipelineVersion: string().nullable(),
|
|
27677
|
+
cpuModel: string().nullable(),
|
|
27678
|
+
ramGb: number().nullable(),
|
|
27679
|
+
os: string().nullable(),
|
|
27680
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
27681
|
+
pools: record(string(), object({
|
|
27682
|
+
runtime: string(),
|
|
27683
|
+
numWorkers: number(),
|
|
27684
|
+
concurrency: number(),
|
|
27685
|
+
batchMode: string()
|
|
27686
|
+
})).default({})
|
|
27687
|
+
});
|
|
27688
|
+
/** The frames the run used. */
|
|
27689
|
+
var NodeBenchClipSchema = object({
|
|
27690
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
27691
|
+
id: string(),
|
|
27692
|
+
revision: string().nullable(),
|
|
27693
|
+
frames: number(),
|
|
27694
|
+
width: number(),
|
|
27695
|
+
height: number()
|
|
27696
|
+
});
|
|
27697
|
+
var NodeBenchRunnerInputSchema = object({
|
|
27698
|
+
runId: string().min(1),
|
|
27699
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27700
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
27701
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
27702
|
+
steps: array(string()).default([]),
|
|
27703
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
27704
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
27705
|
+
deadlineAtMs: number(),
|
|
27706
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
27707
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
27708
|
+
keepDownloadedModels: boolean().default(false)
|
|
27709
|
+
});
|
|
27710
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
27711
|
+
"running",
|
|
27712
|
+
"done",
|
|
27713
|
+
"failed",
|
|
27714
|
+
"aborted"
|
|
27715
|
+
]);
|
|
27716
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
27717
|
+
runId: string(),
|
|
27718
|
+
nodeId: string(),
|
|
27719
|
+
state: NodeBenchRunnerStateSchema,
|
|
27720
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27721
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
27722
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
27723
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27724
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27725
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
27726
|
+
activeCameraIds: array(number()).readonly(),
|
|
27727
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
27728
|
+
deletedModels: array(string()).readonly(),
|
|
27729
|
+
error: string().nullable(),
|
|
27730
|
+
startedAtMs: number(),
|
|
27731
|
+
finishedAtMs: number().nullable()
|
|
27732
|
+
});
|
|
27733
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
27734
|
+
"draining",
|
|
27735
|
+
"measuring",
|
|
27736
|
+
"restoring",
|
|
27737
|
+
"done",
|
|
27738
|
+
"failed",
|
|
27739
|
+
"aborted"
|
|
27740
|
+
]);
|
|
27741
|
+
/** Why a run ended. */
|
|
27742
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
27743
|
+
"completed",
|
|
27744
|
+
"operator-abort",
|
|
27745
|
+
"deadline",
|
|
27746
|
+
"node-lost",
|
|
27747
|
+
"runner-lost",
|
|
27748
|
+
"hub-restart",
|
|
27749
|
+
"drain-timeout",
|
|
27750
|
+
"failed"
|
|
27751
|
+
]);
|
|
27752
|
+
var NodeBenchmarkRunSchema = object({
|
|
27753
|
+
runId: string(),
|
|
27754
|
+
nodeId: string(),
|
|
27755
|
+
state: NodeBenchmarkStateSchema,
|
|
27756
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27757
|
+
startedAtMs: number(),
|
|
27758
|
+
deadlineAtMs: number(),
|
|
27759
|
+
finishedAtMs: number().nullable(),
|
|
27760
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
27761
|
+
error: string().nullable(),
|
|
27762
|
+
/** Cameras moved off the node for the run. */
|
|
27763
|
+
moved: array(number()).readonly(),
|
|
27764
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
27765
|
+
staying: array(number()).readonly(),
|
|
27766
|
+
/** Something else ran on the node's pools during the run. */
|
|
27767
|
+
contaminated: boolean(),
|
|
27768
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27769
|
+
resultIds: array(string()).readonly()
|
|
27770
|
+
});
|
|
27771
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
27772
|
+
var NodeBenchmarkStatusSchema = object({
|
|
27773
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
27774
|
+
modeNodeId: string().nullable(),
|
|
27775
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
27776
|
+
});
|
|
27777
|
+
/**
|
|
27778
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
27779
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
27780
|
+
* ends, never by anyone else.
|
|
27781
|
+
*/
|
|
27782
|
+
var NodeBenchmarkResultSchema = object({
|
|
27783
|
+
id: string(),
|
|
27784
|
+
runId: string(),
|
|
27785
|
+
nodeId: string(),
|
|
27786
|
+
cell: NodeBenchCellSchema,
|
|
27787
|
+
fpsPerStream: number(),
|
|
27788
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27789
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27790
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
27791
|
+
contaminated: boolean(),
|
|
27792
|
+
stayingCameras: array(number()).readonly(),
|
|
27793
|
+
/** The run ended early; the cell itself completed. */
|
|
27794
|
+
partialRun: boolean(),
|
|
27795
|
+
measuredAtMs: number()
|
|
27796
|
+
});
|
|
27797
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
27798
|
+
nodeId: string().optional(),
|
|
27799
|
+
deviceKey: string().optional()
|
|
27800
|
+
});
|
|
27801
|
+
/** A result with its standing today: does it still beat the table? */
|
|
27802
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
27803
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
27804
|
+
standing: _enum([
|
|
27805
|
+
"fresh",
|
|
27806
|
+
"stale",
|
|
27807
|
+
"superseded"
|
|
27808
|
+
]),
|
|
27809
|
+
staleWhy: _enum([
|
|
27810
|
+
"age",
|
|
27811
|
+
"runtime",
|
|
27812
|
+
"pool-tuning"
|
|
27813
|
+
]).nullable()
|
|
27814
|
+
});
|
|
27815
|
+
object({
|
|
27816
|
+
runId: string(),
|
|
27817
|
+
nodeId: string(),
|
|
27818
|
+
startedAtMs: number(),
|
|
27819
|
+
deadlineAtMs: number(),
|
|
27820
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27821
|
+
moved: array(number()).readonly(),
|
|
27822
|
+
staying: array(number()).readonly()
|
|
27823
|
+
});
|
|
27824
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
27825
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
27826
|
+
nodeId: string(),
|
|
27827
|
+
reachable: boolean(),
|
|
27828
|
+
devices: array(object({
|
|
27829
|
+
deviceKey: string(),
|
|
27830
|
+
enabled: boolean(),
|
|
27831
|
+
available: boolean(),
|
|
27832
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
27833
|
+
suggested: array(string()).readonly(),
|
|
27834
|
+
/** Every root detector the device has a build for. */
|
|
27835
|
+
all: array(string()).readonly(),
|
|
27836
|
+
/** The model the device runs now, when pinned. */
|
|
27837
|
+
currentModelId: string().nullable()
|
|
27838
|
+
})).readonly(),
|
|
27839
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
27840
|
+
steps: array(object({
|
|
27841
|
+
id: string(),
|
|
27842
|
+
name: string(),
|
|
27843
|
+
slot: string()
|
|
27844
|
+
})).readonly()
|
|
27845
|
+
});
|
|
25327
27846
|
object({
|
|
25328
27847
|
activeCameras: number(),
|
|
25329
27848
|
throttledCameras: number(),
|
|
@@ -26452,7 +28971,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
26452
28971
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
26453
28972
|
deviceId: number(),
|
|
26454
28973
|
trackId: string()
|
|
26455
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28974
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28975
|
+
accepted: literal(true),
|
|
28976
|
+
runId: string()
|
|
28977
|
+
}), {
|
|
28978
|
+
kind: "mutation",
|
|
28979
|
+
auth: "admin"
|
|
28980
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28981
|
+
kind: "mutation",
|
|
28982
|
+
auth: "admin"
|
|
28983
|
+
});
|
|
26456
28984
|
var CameraPipelineConfigSchema = object({
|
|
26457
28985
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
26458
28986
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -27091,6 +29619,21 @@ method(object({
|
|
|
27091
29619
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
27092
29620
|
kind: "mutation",
|
|
27093
29621
|
auth: "admin"
|
|
29622
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
29623
|
+
kind: literal("started"),
|
|
29624
|
+
runId: string()
|
|
29625
|
+
}), object({
|
|
29626
|
+
kind: literal("refused"),
|
|
29627
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
29628
|
+
})]), {
|
|
29629
|
+
kind: "mutation",
|
|
29630
|
+
auth: "admin"
|
|
29631
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
29632
|
+
kind: "mutation",
|
|
29633
|
+
auth: "admin"
|
|
29634
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
29635
|
+
kind: "mutation",
|
|
29636
|
+
auth: "admin"
|
|
27094
29637
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
27095
29638
|
deviceId: number(),
|
|
27096
29639
|
addonId: string(),
|
|
@@ -27496,8 +30039,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27496
30039
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27497
30040
|
*
|
|
27498
30041
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27499
|
-
* one for transactional / one for notifications). Consumers (
|
|
27500
|
-
*
|
|
30042
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
30043
|
+
* addons, …) walk the collection and pick the first
|
|
27501
30044
|
* ready provider OR target a specific addonId.
|
|
27502
30045
|
*
|
|
27503
30046
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27676,7 +30219,7 @@ targets: array(object({
|
|
|
27676
30219
|
})));
|
|
27677
30220
|
/**
|
|
27678
30221
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27679
|
-
* providers (OIDC, SAML,
|
|
30222
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27680
30223
|
* carrying the post-callback claims before redirecting back to
|
|
27681
30224
|
* `/api/auth/sso/finish`.
|
|
27682
30225
|
*
|
|
@@ -27739,7 +30282,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27739
30282
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
27740
30283
|
* subject is unique only per issuer, so a link is bound to it.
|
|
27741
30284
|
*/
|
|
27742
|
-
issuer: string().optional()
|
|
30285
|
+
issuer: string().optional(),
|
|
30286
|
+
/**
|
|
30287
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30288
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30289
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30290
|
+
* any other browser.
|
|
30291
|
+
*/
|
|
30292
|
+
browserBinding: string().optional()
|
|
27743
30293
|
});
|
|
27744
30294
|
method(object({
|
|
27745
30295
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -33206,6 +35756,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
33206
35756
|
enabled: boolean().optional(),
|
|
33207
35757
|
info: record(string(), unknown()).optional(),
|
|
33208
35758
|
settings: record(string(), unknown()).optional(),
|
|
35759
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
35760
|
+
* the keychain, not the table (D787). */
|
|
35761
|
+
secretKeys: array(string()).optional(),
|
|
33209
35762
|
skipRestart: boolean().optional()
|
|
33210
35763
|
});
|
|
33211
35764
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -33229,7 +35782,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
33229
35782
|
auth: "admin"
|
|
33230
35783
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
33231
35784
|
id: string(),
|
|
33232
|
-
settings: record(string(), unknown())
|
|
35785
|
+
settings: record(string(), unknown()),
|
|
35786
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
35787
|
+
secretKeys: array(string()).optional()
|
|
33233
35788
|
}), object({ success: boolean() }), {
|
|
33234
35789
|
kind: "mutation",
|
|
33235
35790
|
auth: "admin"
|
|
@@ -40001,16 +42556,6 @@ var ApiKeySummarySchema = object({
|
|
|
40001
42556
|
createdAt: number(),
|
|
40002
42557
|
lastUsedAt: number().optional()
|
|
40003
42558
|
});
|
|
40004
|
-
var CreateApiKeyInputSchema = object({
|
|
40005
|
-
label: string(),
|
|
40006
|
-
isAdmin: boolean().default(false),
|
|
40007
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
40008
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
40009
|
-
});
|
|
40010
|
-
var CreateApiKeyResultSchema = object({
|
|
40011
|
-
token: string(),
|
|
40012
|
-
record: ApiKeySummarySchema
|
|
40013
|
-
});
|
|
40014
42559
|
var ScopedTokenSummarySchema = object({
|
|
40015
42560
|
id: string(),
|
|
40016
42561
|
userId: string(),
|
|
@@ -40109,17 +42654,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40109
42654
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40110
42655
|
kind: "mutation",
|
|
40111
42656
|
access: "view"
|
|
40112
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40113
|
-
kind: "mutation",
|
|
40114
|
-
auth: "admin",
|
|
40115
|
-
access: "create"
|
|
40116
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42657
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40117
42658
|
kind: "mutation",
|
|
40118
42659
|
auth: "admin",
|
|
40119
42660
|
access: "delete"
|
|
40120
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40121
|
-
kind: "mutation",
|
|
40122
|
-
access: "view"
|
|
40123
42661
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40124
42662
|
kind: "mutation",
|
|
40125
42663
|
auth: "admin",
|
|
@@ -40193,15 +42731,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40193
42731
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40194
42732
|
userId: string(),
|
|
40195
42733
|
issuer: string()
|
|
40196
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40197
|
-
userId: string(),
|
|
40198
|
-
issuer: string().min(1),
|
|
40199
|
-
label: string().optional()
|
|
40200
|
-
}), object({ success: literal(true) }), {
|
|
40201
|
-
kind: "mutation",
|
|
40202
|
-
auth: "admin",
|
|
40203
|
-
access: "create"
|
|
40204
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42734
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40205
42735
|
kind: "mutation",
|
|
40206
42736
|
auth: "admin",
|
|
40207
42737
|
access: "delete"
|
|
@@ -40906,6 +43436,451 @@ var zoneRulesCapability = {
|
|
|
40906
43436
|
*/
|
|
40907
43437
|
durability: "restored"
|
|
40908
43438
|
};
|
|
43439
|
+
/**
|
|
43440
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43441
|
+
*
|
|
43442
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43443
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43444
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43445
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43446
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43447
|
+
* manifest entry and nothing else.
|
|
43448
|
+
*
|
|
43449
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43450
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43451
|
+
* Every method is `admin`: these spend money.
|
|
43452
|
+
*
|
|
43453
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43454
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43455
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43456
|
+
*
|
|
43457
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43458
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43459
|
+
* ticket the provider mints (D613).
|
|
43460
|
+
*/
|
|
43461
|
+
var TrainingGpuOptionSchema = object({
|
|
43462
|
+
id: string(),
|
|
43463
|
+
label: string(),
|
|
43464
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43465
|
+
usdPerHour: number().nonnegative(),
|
|
43466
|
+
vramGb: number().nonnegative()
|
|
43467
|
+
});
|
|
43468
|
+
var TrainingRegionOptionSchema = object({
|
|
43469
|
+
/** `''` = any region (the provider's choice). */
|
|
43470
|
+
id: string(),
|
|
43471
|
+
label: string(),
|
|
43472
|
+
priceMultiplier: number().positive()
|
|
43473
|
+
});
|
|
43474
|
+
/**
|
|
43475
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43476
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43477
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43478
|
+
*/
|
|
43479
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43480
|
+
gpuType: string(),
|
|
43481
|
+
region: string(),
|
|
43482
|
+
costCapUsd: number().nonnegative(),
|
|
43483
|
+
maxRuntimeSec: number().int().positive(),
|
|
43484
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43485
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43486
|
+
});
|
|
43487
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43488
|
+
addonId: string(),
|
|
43489
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43490
|
+
kind: string(),
|
|
43491
|
+
label: string(),
|
|
43492
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43493
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43494
|
+
maxDatasetBytes: number().int().positive(),
|
|
43495
|
+
maxRuntimeSec: number().int().positive(),
|
|
43496
|
+
freeTierNote: string().optional(),
|
|
43497
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43498
|
+
dataResidencyNote: string(),
|
|
43499
|
+
/** Credentials are present — never the values. */
|
|
43500
|
+
configured: boolean(),
|
|
43501
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43502
|
+
});
|
|
43503
|
+
var TrainingCredentialCheckSchema = object({
|
|
43504
|
+
ok: boolean(),
|
|
43505
|
+
/** Workspace / account name, when the provider says. */
|
|
43506
|
+
account: string().optional(),
|
|
43507
|
+
reason: _enum([
|
|
43508
|
+
"missing",
|
|
43509
|
+
"invalid",
|
|
43510
|
+
"forbidden",
|
|
43511
|
+
"network",
|
|
43512
|
+
"quota"
|
|
43513
|
+
]).optional(),
|
|
43514
|
+
detail: string().optional()
|
|
43515
|
+
});
|
|
43516
|
+
var ProviderJobStateSchema = _enum([
|
|
43517
|
+
"pending",
|
|
43518
|
+
"starting",
|
|
43519
|
+
"running",
|
|
43520
|
+
"succeeded",
|
|
43521
|
+
"failed",
|
|
43522
|
+
"cancelled",
|
|
43523
|
+
"lost"
|
|
43524
|
+
]);
|
|
43525
|
+
var ProviderJobStatusSchema = object({
|
|
43526
|
+
jobKey: string(),
|
|
43527
|
+
providerJobId: string().optional(),
|
|
43528
|
+
state: ProviderJobStateSchema,
|
|
43529
|
+
startedAt: number().optional(),
|
|
43530
|
+
endedAt: number().optional(),
|
|
43531
|
+
exitCode: number().int().optional(),
|
|
43532
|
+
failureReason: string().optional(),
|
|
43533
|
+
gpuType: string(),
|
|
43534
|
+
region: string().optional(),
|
|
43535
|
+
billedSeconds: number().nonnegative(),
|
|
43536
|
+
costUsd: number().nonnegative(),
|
|
43537
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43538
|
+
costIsEstimate: boolean(),
|
|
43539
|
+
lastFetchedAt: number()
|
|
43540
|
+
});
|
|
43541
|
+
/**
|
|
43542
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43543
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43544
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43545
|
+
* in `result.json`.
|
|
43546
|
+
*/
|
|
43547
|
+
var TrainerSourceRefSchema = object({
|
|
43548
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43549
|
+
repo: string().min(1),
|
|
43550
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43551
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43552
|
+
});
|
|
43553
|
+
var JobRef = {
|
|
43554
|
+
addonId: string(),
|
|
43555
|
+
jobKey: string().uuid()
|
|
43556
|
+
};
|
|
43557
|
+
var TrainingLogLineSchema = object({
|
|
43558
|
+
ts: number(),
|
|
43559
|
+
text: string()
|
|
43560
|
+
});
|
|
43561
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43562
|
+
kind: "mutation",
|
|
43563
|
+
auth: "admin",
|
|
43564
|
+
timeoutMs: 3e4
|
|
43565
|
+
}), method(object({
|
|
43566
|
+
addonId: string(),
|
|
43567
|
+
gpuType: string(),
|
|
43568
|
+
region: string(),
|
|
43569
|
+
datasetBytes: number().int().nonnegative(),
|
|
43570
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43571
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43572
|
+
}), object({
|
|
43573
|
+
usdLow: number().nonnegative(),
|
|
43574
|
+
usdHigh: number().nonnegative(),
|
|
43575
|
+
notes: array(string()).readonly()
|
|
43576
|
+
}), { auth: "admin" }), method(object({
|
|
43577
|
+
...JobRef,
|
|
43578
|
+
ticket: PeerBytesTicketSchema
|
|
43579
|
+
}), object({
|
|
43580
|
+
bytes: number().int().nonnegative(),
|
|
43581
|
+
sha256: string()
|
|
43582
|
+
}), {
|
|
43583
|
+
kind: "mutation",
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 120 * 6e4
|
|
43586
|
+
}), method(object({
|
|
43587
|
+
...JobRef,
|
|
43588
|
+
trainer: TrainerSourceRefSchema,
|
|
43589
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43590
|
+
gpuType: string(),
|
|
43591
|
+
region: string(),
|
|
43592
|
+
maxRuntimeSec: number().int().positive()
|
|
43593
|
+
}), ProviderJobStatusSchema, {
|
|
43594
|
+
kind: "mutation",
|
|
43595
|
+
auth: "admin",
|
|
43596
|
+
timeoutMs: 30 * 6e4
|
|
43597
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43598
|
+
auth: "admin",
|
|
43599
|
+
timeoutMs: 6e4
|
|
43600
|
+
}), method(object({
|
|
43601
|
+
...JobRef,
|
|
43602
|
+
cursor: string().optional(),
|
|
43603
|
+
max: number().int().min(1).max(500)
|
|
43604
|
+
}), object({
|
|
43605
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43606
|
+
cursor: string()
|
|
43607
|
+
}), {
|
|
43608
|
+
auth: "admin",
|
|
43609
|
+
timeoutMs: 6e4
|
|
43610
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43611
|
+
kind: "mutation",
|
|
43612
|
+
auth: "admin",
|
|
43613
|
+
timeoutMs: 6e4
|
|
43614
|
+
}), method(object(JobRef), object({
|
|
43615
|
+
found: boolean(),
|
|
43616
|
+
text: string().optional()
|
|
43617
|
+
}), {
|
|
43618
|
+
kind: "mutation",
|
|
43619
|
+
auth: "admin",
|
|
43620
|
+
timeoutMs: 5 * 6e4
|
|
43621
|
+
}), method(object({
|
|
43622
|
+
...JobRef,
|
|
43623
|
+
path: _enum(["bundle.tar"])
|
|
43624
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43625
|
+
kind: "mutation",
|
|
43626
|
+
auth: "admin",
|
|
43627
|
+
timeoutMs: 5 * 6e4
|
|
43628
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43629
|
+
kind: "mutation",
|
|
43630
|
+
auth: "admin",
|
|
43631
|
+
timeoutMs: 5 * 6e4
|
|
43632
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43633
|
+
auth: "admin",
|
|
43634
|
+
timeoutMs: 2 * 6e4
|
|
43635
|
+
});
|
|
43636
|
+
/**
|
|
43637
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43638
|
+
* provided by `addon-training`.
|
|
43639
|
+
*
|
|
43640
|
+
* It owns what every provider must agree on, written once:
|
|
43641
|
+
*
|
|
43642
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43643
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43644
|
+
* the export plan) and reaches this store through the five row methods
|
|
43645
|
+
* below, so the Retrain page and the export did not change.
|
|
43646
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43647
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43648
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43649
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43650
|
+
* rollback. Nothing is ever registered automatically.
|
|
43651
|
+
*
|
|
43652
|
+
* Every method is `admin`.
|
|
43653
|
+
*/
|
|
43654
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43655
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43656
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43657
|
+
var TrainingBaseModelSchema = object({
|
|
43658
|
+
modelId: string(),
|
|
43659
|
+
label: string(),
|
|
43660
|
+
weights: string(),
|
|
43661
|
+
imgsz: number().int(),
|
|
43662
|
+
baselineOnnxUrl: string(),
|
|
43663
|
+
baselineFloors: record(string(), number()),
|
|
43664
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43665
|
+
recommended: boolean()
|
|
43666
|
+
});
|
|
43667
|
+
var TrainingPresetSchema = _enum([
|
|
43668
|
+
"quick",
|
|
43669
|
+
"standard",
|
|
43670
|
+
"thorough"
|
|
43671
|
+
]);
|
|
43672
|
+
var TrainingJobRequestSchema = object({
|
|
43673
|
+
datasetVersionId: string().min(1),
|
|
43674
|
+
/** The `training-provider` addon that runs it. */
|
|
43675
|
+
addonId: string().min(1),
|
|
43676
|
+
gpuType: string().min(1),
|
|
43677
|
+
region: string(),
|
|
43678
|
+
baseModelId: string().min(1),
|
|
43679
|
+
preset: TrainingPresetSchema,
|
|
43680
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43681
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43682
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43683
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43684
|
+
});
|
|
43685
|
+
var TrainingSplitPlanSchema = object({
|
|
43686
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43687
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43688
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43689
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43690
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43691
|
+
trainSubjects: number().int()
|
|
43692
|
+
});
|
|
43693
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43694
|
+
"unknown-dataset",
|
|
43695
|
+
"unknown-provider",
|
|
43696
|
+
"provider-not-configured",
|
|
43697
|
+
"unknown-base-model",
|
|
43698
|
+
"unknown-gpu",
|
|
43699
|
+
"dataset-too-large",
|
|
43700
|
+
"no-training-subjects",
|
|
43701
|
+
"job-already-running"
|
|
43702
|
+
]);
|
|
43703
|
+
var TrainingJobPlanSchema = object({
|
|
43704
|
+
refusal: object({
|
|
43705
|
+
reason: TrainingRefusalReasonSchema,
|
|
43706
|
+
detail: string()
|
|
43707
|
+
}).nullable(),
|
|
43708
|
+
warnings: array(string()).readonly(),
|
|
43709
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43710
|
+
estimate: object({
|
|
43711
|
+
datasetBytes: number().int(),
|
|
43712
|
+
uploadMinutesAt20Mbps: number(),
|
|
43713
|
+
gpuSecondsLow: number(),
|
|
43714
|
+
gpuSecondsHigh: number(),
|
|
43715
|
+
usdLow: number(),
|
|
43716
|
+
usdHigh: number(),
|
|
43717
|
+
notes: array(string()).readonly()
|
|
43718
|
+
}).nullable(),
|
|
43719
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43720
|
+
defaults: object({
|
|
43721
|
+
maxCostUsd: number(),
|
|
43722
|
+
maxRuntimeSec: number().int()
|
|
43723
|
+
}).nullable(),
|
|
43724
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43725
|
+
dataNotice: string()
|
|
43726
|
+
});
|
|
43727
|
+
/**
|
|
43728
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43729
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43730
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43731
|
+
* result lives after the operator acted on it.
|
|
43732
|
+
*/
|
|
43733
|
+
var TrainingJobStateSchema = _enum([
|
|
43734
|
+
"uploading",
|
|
43735
|
+
"submitted",
|
|
43736
|
+
"starting",
|
|
43737
|
+
"running",
|
|
43738
|
+
"collecting",
|
|
43739
|
+
"ready",
|
|
43740
|
+
"registered",
|
|
43741
|
+
"canary",
|
|
43742
|
+
"failed",
|
|
43743
|
+
"cancelling",
|
|
43744
|
+
"cancelled",
|
|
43745
|
+
"lost",
|
|
43746
|
+
"expired",
|
|
43747
|
+
"discarded"
|
|
43748
|
+
]);
|
|
43749
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43750
|
+
"cost-cap",
|
|
43751
|
+
"runtime-cap",
|
|
43752
|
+
"upload-failed",
|
|
43753
|
+
"submit-failed",
|
|
43754
|
+
"trainer-failed",
|
|
43755
|
+
"result-invalid",
|
|
43756
|
+
"checksum-mismatch",
|
|
43757
|
+
"fetch-failed",
|
|
43758
|
+
"provider-error",
|
|
43759
|
+
"hub-restart-during-upload"
|
|
43760
|
+
]);
|
|
43761
|
+
var TrainingProgressPointSchema = object({
|
|
43762
|
+
epoch: number().int(),
|
|
43763
|
+
map50: number().nullable(),
|
|
43764
|
+
map50_95: number().nullable()
|
|
43765
|
+
});
|
|
43766
|
+
var TrainingCanarySchema = object({
|
|
43767
|
+
deviceIds: array(number().int()).readonly(),
|
|
43768
|
+
since: number(),
|
|
43769
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43770
|
+
previous: array(object({
|
|
43771
|
+
deviceId: number().int(),
|
|
43772
|
+
nodeId: string(),
|
|
43773
|
+
deviceKey: string(),
|
|
43774
|
+
patch: object({
|
|
43775
|
+
modelId: string().optional(),
|
|
43776
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43777
|
+
}).nullable()
|
|
43778
|
+
})).readonly()
|
|
43779
|
+
});
|
|
43780
|
+
var TrainingJobSchema = object({
|
|
43781
|
+
id: string(),
|
|
43782
|
+
idempotencyKey: string(),
|
|
43783
|
+
name: string(),
|
|
43784
|
+
createdAt: number(),
|
|
43785
|
+
updatedAt: number(),
|
|
43786
|
+
state: TrainingJobStateSchema,
|
|
43787
|
+
stage: TrainingStageSchema.nullable(),
|
|
43788
|
+
failure: object({
|
|
43789
|
+
reason: TrainingFailureReasonSchema,
|
|
43790
|
+
stage: string().nullable(),
|
|
43791
|
+
detail: string()
|
|
43792
|
+
}).nullable(),
|
|
43793
|
+
request: TrainingJobRequestSchema,
|
|
43794
|
+
maxCostUsd: number().nonnegative(),
|
|
43795
|
+
maxRuntimeSec: number().int().positive(),
|
|
43796
|
+
trainer: TrainerSourceRefSchema,
|
|
43797
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43798
|
+
dataset: object({
|
|
43799
|
+
bytes: number().int(),
|
|
43800
|
+
sha256: string(),
|
|
43801
|
+
uploadedAt: number()
|
|
43802
|
+
}).nullable(),
|
|
43803
|
+
split: TrainingSplitPlanSchema,
|
|
43804
|
+
provider: object({
|
|
43805
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43806
|
+
providerJobId: string().nullable(),
|
|
43807
|
+
startedAt: number().nullable(),
|
|
43808
|
+
endedAt: number().nullable(),
|
|
43809
|
+
billedSeconds: number(),
|
|
43810
|
+
costUsd: number(),
|
|
43811
|
+
costIsEstimate: boolean(),
|
|
43812
|
+
lastPolledAt: number().nullable()
|
|
43813
|
+
}),
|
|
43814
|
+
progress: object({
|
|
43815
|
+
epoch: number().int().nullable(),
|
|
43816
|
+
epochs: number().int().nullable(),
|
|
43817
|
+
etaSec: number().nullable(),
|
|
43818
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43819
|
+
}),
|
|
43820
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43821
|
+
logTail: array(string()).readonly(),
|
|
43822
|
+
logCursor: string().nullable(),
|
|
43823
|
+
artifacts: object({
|
|
43824
|
+
bundleBytes: number().int(),
|
|
43825
|
+
bundleSha256: string(),
|
|
43826
|
+
fetchedAt: number(),
|
|
43827
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43828
|
+
expiresAt: number()
|
|
43829
|
+
}).nullable(),
|
|
43830
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43831
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43832
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43833
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43834
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43835
|
+
registeredModelIds: array(string()).readonly(),
|
|
43836
|
+
canary: TrainingCanarySchema.nullable()
|
|
43837
|
+
});
|
|
43838
|
+
var IdInput = object({ id: string().min(1) });
|
|
43839
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43840
|
+
kind: "mutation",
|
|
43841
|
+
auth: "admin"
|
|
43842
|
+
}), 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() }), {
|
|
43843
|
+
kind: "mutation",
|
|
43844
|
+
auth: "admin"
|
|
43845
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43846
|
+
auth: "admin",
|
|
43847
|
+
timeoutMs: 6e4
|
|
43848
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43849
|
+
name: string().min(1).max(120),
|
|
43850
|
+
maxCostUsd: number().positive(),
|
|
43851
|
+
maxRuntimeSec: number().int().positive(),
|
|
43852
|
+
idempotencyKey: string().min(8).max(80)
|
|
43853
|
+
}), discriminatedUnion("kind", [object({
|
|
43854
|
+
kind: literal("started"),
|
|
43855
|
+
job: TrainingJobSchema
|
|
43856
|
+
}), object({
|
|
43857
|
+
kind: literal("refused"),
|
|
43858
|
+
reason: TrainingRefusalReasonSchema,
|
|
43859
|
+
detail: string()
|
|
43860
|
+
})]), {
|
|
43861
|
+
kind: "mutation",
|
|
43862
|
+
auth: "admin",
|
|
43863
|
+
timeoutMs: 12e4
|
|
43864
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43865
|
+
kind: "mutation",
|
|
43866
|
+
auth: "admin",
|
|
43867
|
+
timeoutMs: 12e4
|
|
43868
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43869
|
+
kind: "mutation",
|
|
43870
|
+
auth: "admin",
|
|
43871
|
+
timeoutMs: 30 * 6e4
|
|
43872
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43873
|
+
kind: "mutation",
|
|
43874
|
+
auth: "admin",
|
|
43875
|
+
timeoutMs: 12e4
|
|
43876
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43877
|
+
kind: "mutation",
|
|
43878
|
+
auth: "admin",
|
|
43879
|
+
timeoutMs: 12e4
|
|
43880
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43881
|
+
kind: "mutation",
|
|
43882
|
+
auth: "admin"
|
|
43883
|
+
});
|
|
40909
43884
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40910
43885
|
Object.freeze({
|
|
40911
43886
|
person: .5,
|
|
@@ -41392,7 +44367,8 @@ var BaseDevice = class {
|
|
|
41392
44367
|
this.role = options.role;
|
|
41393
44368
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41394
44369
|
const seedData = ctx.persistedConfig ?? {};
|
|
41395
|
-
|
|
44370
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
44371
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41396
44372
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41397
44373
|
tags: {
|
|
41398
44374
|
deviceId: ctx.id,
|
|
@@ -43053,6 +46029,12 @@ Object.freeze({
|
|
|
43053
46029
|
addonId: null,
|
|
43054
46030
|
access: "create"
|
|
43055
46031
|
},
|
|
46032
|
+
"backup.checkBackupKey": {
|
|
46033
|
+
capName: "backup",
|
|
46034
|
+
capScope: "system",
|
|
46035
|
+
addonId: null,
|
|
46036
|
+
access: "create"
|
|
46037
|
+
},
|
|
43056
46038
|
"backup.delete": {
|
|
43057
46039
|
capName: "backup",
|
|
43058
46040
|
capScope: "system",
|
|
@@ -43065,6 +46047,18 @@ Object.freeze({
|
|
|
43065
46047
|
addonId: null,
|
|
43066
46048
|
access: "delete"
|
|
43067
46049
|
},
|
|
46050
|
+
"backup.disableEncryption": {
|
|
46051
|
+
capName: "backup",
|
|
46052
|
+
capScope: "system",
|
|
46053
|
+
addonId: null,
|
|
46054
|
+
access: "create"
|
|
46055
|
+
},
|
|
46056
|
+
"backup.getEncryption": {
|
|
46057
|
+
capName: "backup",
|
|
46058
|
+
capScope: "system",
|
|
46059
|
+
addonId: null,
|
|
46060
|
+
access: "view"
|
|
46061
|
+
},
|
|
43068
46062
|
"backup.getEntries": {
|
|
43069
46063
|
capName: "backup",
|
|
43070
46064
|
capScope: "system",
|
|
@@ -43119,6 +46113,12 @@ Object.freeze({
|
|
|
43119
46113
|
addonId: null,
|
|
43120
46114
|
access: "create"
|
|
43121
46115
|
},
|
|
46116
|
+
"backup.setupEncryption": {
|
|
46117
|
+
capName: "backup",
|
|
46118
|
+
capScope: "system",
|
|
46119
|
+
addonId: null,
|
|
46120
|
+
access: "create"
|
|
46121
|
+
},
|
|
43122
46122
|
"backup.trigger": {
|
|
43123
46123
|
capName: "backup",
|
|
43124
46124
|
capScope: "system",
|
|
@@ -43671,6 +46671,12 @@ Object.freeze({
|
|
|
43671
46671
|
addonId: null,
|
|
43672
46672
|
access: "create"
|
|
43673
46673
|
},
|
|
46674
|
+
"customModelRegistry.importModelBundle": {
|
|
46675
|
+
capName: "custom-model-registry",
|
|
46676
|
+
capScope: "system",
|
|
46677
|
+
addonId: null,
|
|
46678
|
+
access: "create"
|
|
46679
|
+
},
|
|
43674
46680
|
"customModelRegistry.listModels": {
|
|
43675
46681
|
capName: "custom-model-registry",
|
|
43676
46682
|
capScope: "system",
|
|
@@ -45081,6 +48087,108 @@ Object.freeze({
|
|
|
45081
48087
|
addonId: null,
|
|
45082
48088
|
access: "create"
|
|
45083
48089
|
},
|
|
48090
|
+
"keychain.delete": {
|
|
48091
|
+
capName: "keychain",
|
|
48092
|
+
capScope: "system",
|
|
48093
|
+
addonId: null,
|
|
48094
|
+
access: "delete"
|
|
48095
|
+
},
|
|
48096
|
+
"keychain.getState": {
|
|
48097
|
+
capName: "keychain",
|
|
48098
|
+
capScope: "system",
|
|
48099
|
+
addonId: null,
|
|
48100
|
+
access: "view"
|
|
48101
|
+
},
|
|
48102
|
+
"keychain.listMeta": {
|
|
48103
|
+
capName: "keychain",
|
|
48104
|
+
capScope: "system",
|
|
48105
|
+
addonId: null,
|
|
48106
|
+
access: "view"
|
|
48107
|
+
},
|
|
48108
|
+
"keychain.put": {
|
|
48109
|
+
capName: "keychain",
|
|
48110
|
+
capScope: "system",
|
|
48111
|
+
addonId: null,
|
|
48112
|
+
access: "create"
|
|
48113
|
+
},
|
|
48114
|
+
"keychain.resolve": {
|
|
48115
|
+
capName: "keychain",
|
|
48116
|
+
capScope: "system",
|
|
48117
|
+
addonId: null,
|
|
48118
|
+
access: "view"
|
|
48119
|
+
},
|
|
48120
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48121
|
+
capName: "keychain-admin",
|
|
48122
|
+
capScope: "system",
|
|
48123
|
+
addonId: null,
|
|
48124
|
+
access: "create"
|
|
48125
|
+
},
|
|
48126
|
+
"keychainAdmin.deleteOrphans": {
|
|
48127
|
+
capName: "keychain-admin",
|
|
48128
|
+
capScope: "system",
|
|
48129
|
+
addonId: null,
|
|
48130
|
+
access: "delete"
|
|
48131
|
+
},
|
|
48132
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
48133
|
+
capName: "keychain-admin",
|
|
48134
|
+
capScope: "system",
|
|
48135
|
+
addonId: null,
|
|
48136
|
+
access: "create"
|
|
48137
|
+
},
|
|
48138
|
+
"keychainAdmin.listAudit": {
|
|
48139
|
+
capName: "keychain-admin",
|
|
48140
|
+
capScope: "system",
|
|
48141
|
+
addonId: null,
|
|
48142
|
+
access: "view"
|
|
48143
|
+
},
|
|
48144
|
+
"keychainAdmin.listSecrets": {
|
|
48145
|
+
capName: "keychain-admin",
|
|
48146
|
+
capScope: "system",
|
|
48147
|
+
addonId: null,
|
|
48148
|
+
access: "view"
|
|
48149
|
+
},
|
|
48150
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
48151
|
+
capName: "keychain-admin",
|
|
48152
|
+
capScope: "system",
|
|
48153
|
+
addonId: null,
|
|
48154
|
+
access: "delete"
|
|
48155
|
+
},
|
|
48156
|
+
"keychainAdmin.resetKeychain": {
|
|
48157
|
+
capName: "keychain-admin",
|
|
48158
|
+
capScope: "system",
|
|
48159
|
+
addonId: null,
|
|
48160
|
+
access: "delete"
|
|
48161
|
+
},
|
|
48162
|
+
"keychainAdmin.resetReport": {
|
|
48163
|
+
capName: "keychain-admin",
|
|
48164
|
+
capScope: "system",
|
|
48165
|
+
addonId: null,
|
|
48166
|
+
access: "delete"
|
|
48167
|
+
},
|
|
48168
|
+
"keychainAdmin.reveal": {
|
|
48169
|
+
capName: "keychain-admin",
|
|
48170
|
+
capScope: "system",
|
|
48171
|
+
addonId: null,
|
|
48172
|
+
access: "create"
|
|
48173
|
+
},
|
|
48174
|
+
"keychainAdmin.rotateMasterKey": {
|
|
48175
|
+
capName: "keychain-admin",
|
|
48176
|
+
capScope: "system",
|
|
48177
|
+
addonId: null,
|
|
48178
|
+
access: "create"
|
|
48179
|
+
},
|
|
48180
|
+
"keychainAdmin.setSystemSecret": {
|
|
48181
|
+
capName: "keychain-admin",
|
|
48182
|
+
capScope: "system",
|
|
48183
|
+
addonId: null,
|
|
48184
|
+
access: "create"
|
|
48185
|
+
},
|
|
48186
|
+
"keychainAdmin.status": {
|
|
48187
|
+
capName: "keychain-admin",
|
|
48188
|
+
capScope: "system",
|
|
48189
|
+
addonId: null,
|
|
48190
|
+
access: "view"
|
|
48191
|
+
},
|
|
45084
48192
|
"lawnMowerControl.dock": {
|
|
45085
48193
|
capName: "lawn-mower-control",
|
|
45086
48194
|
capScope: "device",
|
|
@@ -46455,6 +49563,18 @@ Object.freeze({
|
|
|
46455
49563
|
addonId: null,
|
|
46456
49564
|
access: "create"
|
|
46457
49565
|
},
|
|
49566
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
49567
|
+
capName: "pipeline-analytics",
|
|
49568
|
+
capScope: "device",
|
|
49569
|
+
addonId: null,
|
|
49570
|
+
access: "create"
|
|
49571
|
+
},
|
|
49572
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
49573
|
+
capName: "pipeline-analytics",
|
|
49574
|
+
capScope: "device",
|
|
49575
|
+
addonId: null,
|
|
49576
|
+
access: "create"
|
|
49577
|
+
},
|
|
46458
49578
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46459
49579
|
capName: "pipeline-analytics",
|
|
46460
49580
|
capScope: "device",
|
|
@@ -46503,12 +49623,36 @@ Object.freeze({
|
|
|
46503
49623
|
addonId: null,
|
|
46504
49624
|
access: "view"
|
|
46505
49625
|
},
|
|
49626
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
49627
|
+
capName: "pipeline-analytics",
|
|
49628
|
+
capScope: "device",
|
|
49629
|
+
addonId: null,
|
|
49630
|
+
access: "create"
|
|
49631
|
+
},
|
|
49632
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49633
|
+
capName: "pipeline-analytics",
|
|
49634
|
+
capScope: "device",
|
|
49635
|
+
addonId: null,
|
|
49636
|
+
access: "create"
|
|
49637
|
+
},
|
|
46506
49638
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46507
49639
|
capName: "pipeline-analytics",
|
|
46508
49640
|
capScope: "device",
|
|
46509
49641
|
addonId: null,
|
|
46510
49642
|
access: "delete"
|
|
46511
49643
|
},
|
|
49644
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
49645
|
+
capName: "pipeline-analytics",
|
|
49646
|
+
capScope: "device",
|
|
49647
|
+
addonId: null,
|
|
49648
|
+
access: "delete"
|
|
49649
|
+
},
|
|
49650
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49651
|
+
capName: "pipeline-analytics",
|
|
49652
|
+
capScope: "device",
|
|
49653
|
+
addonId: null,
|
|
49654
|
+
access: "delete"
|
|
49655
|
+
},
|
|
46512
49656
|
"pipelineAnalytics.deleteTracks": {
|
|
46513
49657
|
capName: "pipeline-analytics",
|
|
46514
49658
|
capScope: "device",
|
|
@@ -46713,6 +49857,30 @@ Object.freeze({
|
|
|
46713
49857
|
addonId: null,
|
|
46714
49858
|
access: "view"
|
|
46715
49859
|
},
|
|
49860
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
49861
|
+
capName: "pipeline-analytics",
|
|
49862
|
+
capScope: "device",
|
|
49863
|
+
addonId: null,
|
|
49864
|
+
access: "view"
|
|
49865
|
+
},
|
|
49866
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
49867
|
+
capName: "pipeline-analytics",
|
|
49868
|
+
capScope: "device",
|
|
49869
|
+
addonId: null,
|
|
49870
|
+
access: "view"
|
|
49871
|
+
},
|
|
49872
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49873
|
+
capName: "pipeline-analytics",
|
|
49874
|
+
capScope: "device",
|
|
49875
|
+
addonId: null,
|
|
49876
|
+
access: "view"
|
|
49877
|
+
},
|
|
49878
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49879
|
+
capName: "pipeline-analytics",
|
|
49880
|
+
capScope: "device",
|
|
49881
|
+
addonId: null,
|
|
49882
|
+
access: "view"
|
|
49883
|
+
},
|
|
46716
49884
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46717
49885
|
capName: "pipeline-analytics",
|
|
46718
49886
|
capScope: "device",
|
|
@@ -46743,6 +49911,12 @@ Object.freeze({
|
|
|
46743
49911
|
addonId: null,
|
|
46744
49912
|
access: "view"
|
|
46745
49913
|
},
|
|
49914
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49915
|
+
capName: "pipeline-analytics",
|
|
49916
|
+
capScope: "device",
|
|
49917
|
+
addonId: null,
|
|
49918
|
+
access: "create"
|
|
49919
|
+
},
|
|
46746
49920
|
"pipelineAnalytics.ownersWithMedia": {
|
|
46747
49921
|
capName: "pipeline-analytics",
|
|
46748
49922
|
capScope: "device",
|
|
@@ -46755,12 +49929,24 @@ Object.freeze({
|
|
|
46755
49929
|
addonId: null,
|
|
46756
49930
|
access: "create"
|
|
46757
49931
|
},
|
|
49932
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49933
|
+
capName: "pipeline-analytics",
|
|
49934
|
+
capScope: "device",
|
|
49935
|
+
addonId: null,
|
|
49936
|
+
access: "view"
|
|
49937
|
+
},
|
|
46758
49938
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
46759
49939
|
capName: "pipeline-analytics",
|
|
46760
49940
|
capScope: "device",
|
|
46761
49941
|
addonId: null,
|
|
46762
49942
|
access: "create"
|
|
46763
49943
|
},
|
|
49944
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49945
|
+
capName: "pipeline-analytics",
|
|
49946
|
+
capScope: "device",
|
|
49947
|
+
addonId: null,
|
|
49948
|
+
access: "create"
|
|
49949
|
+
},
|
|
46764
49950
|
"pipelineAnalytics.pruneEvents": {
|
|
46765
49951
|
capName: "pipeline-analytics",
|
|
46766
49952
|
capScope: "device",
|
|
@@ -46815,6 +50001,18 @@ Object.freeze({
|
|
|
46815
50001
|
addonId: null,
|
|
46816
50002
|
access: "create"
|
|
46817
50003
|
},
|
|
50004
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
50005
|
+
capName: "pipeline-analytics",
|
|
50006
|
+
capScope: "device",
|
|
50007
|
+
addonId: null,
|
|
50008
|
+
access: "delete"
|
|
50009
|
+
},
|
|
50010
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
50011
|
+
capName: "pipeline-analytics",
|
|
50012
|
+
capScope: "device",
|
|
50013
|
+
addonId: null,
|
|
50014
|
+
access: "create"
|
|
50015
|
+
},
|
|
46818
50016
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46819
50017
|
capName: "pipeline-analytics",
|
|
46820
50018
|
capScope: "device",
|
|
@@ -46875,6 +50073,12 @@ Object.freeze({
|
|
|
46875
50073
|
addonId: null,
|
|
46876
50074
|
access: "create"
|
|
46877
50075
|
},
|
|
50076
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50077
|
+
capName: "pipeline-analytics",
|
|
50078
|
+
capScope: "device",
|
|
50079
|
+
addonId: null,
|
|
50080
|
+
access: "view"
|
|
50081
|
+
},
|
|
46878
50082
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46879
50083
|
capName: "pipeline-analytics",
|
|
46880
50084
|
capScope: "device",
|
|
@@ -47103,6 +50307,12 @@ Object.freeze({
|
|
|
47103
50307
|
addonId: null,
|
|
47104
50308
|
access: "view"
|
|
47105
50309
|
},
|
|
50310
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
50311
|
+
capName: "pipeline-orchestrator",
|
|
50312
|
+
capScope: "system",
|
|
50313
|
+
addonId: null,
|
|
50314
|
+
access: "create"
|
|
50315
|
+
},
|
|
47106
50316
|
"pipelineOrchestrator.applyAutoTune": {
|
|
47107
50317
|
capName: "pipeline-orchestrator",
|
|
47108
50318
|
capScope: "system",
|
|
@@ -47127,6 +50337,12 @@ Object.freeze({
|
|
|
47127
50337
|
addonId: null,
|
|
47128
50338
|
access: "create"
|
|
47129
50339
|
},
|
|
50340
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
50341
|
+
capName: "pipeline-orchestrator",
|
|
50342
|
+
capScope: "system",
|
|
50343
|
+
addonId: null,
|
|
50344
|
+
access: "delete"
|
|
50345
|
+
},
|
|
47130
50346
|
"pipelineOrchestrator.getAgentLoad": {
|
|
47131
50347
|
capName: "pipeline-orchestrator",
|
|
47132
50348
|
capScope: "system",
|
|
@@ -47235,6 +50451,24 @@ Object.freeze({
|
|
|
47235
50451
|
addonId: null,
|
|
47236
50452
|
access: "view"
|
|
47237
50453
|
},
|
|
50454
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
50455
|
+
capName: "pipeline-orchestrator",
|
|
50456
|
+
capScope: "system",
|
|
50457
|
+
addonId: null,
|
|
50458
|
+
access: "view"
|
|
50459
|
+
},
|
|
50460
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
50461
|
+
capName: "pipeline-orchestrator",
|
|
50462
|
+
capScope: "system",
|
|
50463
|
+
addonId: null,
|
|
50464
|
+
access: "view"
|
|
50465
|
+
},
|
|
50466
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
50467
|
+
capName: "pipeline-orchestrator",
|
|
50468
|
+
capScope: "system",
|
|
50469
|
+
addonId: null,
|
|
50470
|
+
access: "view"
|
|
50471
|
+
},
|
|
47238
50472
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
47239
50473
|
capName: "pipeline-orchestrator",
|
|
47240
50474
|
capScope: "system",
|
|
@@ -47277,6 +50511,12 @@ Object.freeze({
|
|
|
47277
50511
|
addonId: null,
|
|
47278
50512
|
access: "view"
|
|
47279
50513
|
},
|
|
50514
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
50515
|
+
capName: "pipeline-orchestrator",
|
|
50516
|
+
capScope: "system",
|
|
50517
|
+
addonId: null,
|
|
50518
|
+
access: "view"
|
|
50519
|
+
},
|
|
47280
50520
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
47281
50521
|
capName: "pipeline-orchestrator",
|
|
47282
50522
|
capScope: "system",
|
|
@@ -47421,6 +50661,12 @@ Object.freeze({
|
|
|
47421
50661
|
addonId: null,
|
|
47422
50662
|
access: "create"
|
|
47423
50663
|
},
|
|
50664
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
50665
|
+
capName: "pipeline-orchestrator",
|
|
50666
|
+
capScope: "system",
|
|
50667
|
+
addonId: null,
|
|
50668
|
+
access: "create"
|
|
50669
|
+
},
|
|
47424
50670
|
"pipelineOrchestrator.suggestShares": {
|
|
47425
50671
|
capName: "pipeline-orchestrator",
|
|
47426
50672
|
capScope: "system",
|
|
@@ -47439,6 +50685,12 @@ Object.freeze({
|
|
|
47439
50685
|
addonId: null,
|
|
47440
50686
|
access: "create"
|
|
47441
50687
|
},
|
|
50688
|
+
"pipelineRunner.abortNodeBench": {
|
|
50689
|
+
capName: "pipeline-runner",
|
|
50690
|
+
capScope: "system",
|
|
50691
|
+
addonId: null,
|
|
50692
|
+
access: "create"
|
|
50693
|
+
},
|
|
47442
50694
|
"pipelineRunner.attachCamera": {
|
|
47443
50695
|
capName: "pipeline-runner",
|
|
47444
50696
|
capScope: "system",
|
|
@@ -47487,6 +50739,12 @@ Object.freeze({
|
|
|
47487
50739
|
addonId: null,
|
|
47488
50740
|
access: "view"
|
|
47489
50741
|
},
|
|
50742
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
50743
|
+
capName: "pipeline-runner",
|
|
50744
|
+
capScope: "system",
|
|
50745
|
+
addonId: null,
|
|
50746
|
+
access: "view"
|
|
50747
|
+
},
|
|
47490
50748
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47491
50749
|
capName: "pipeline-runner",
|
|
47492
50750
|
capScope: "system",
|
|
@@ -47529,6 +50787,12 @@ Object.freeze({
|
|
|
47529
50787
|
addonId: null,
|
|
47530
50788
|
access: "create"
|
|
47531
50789
|
},
|
|
50790
|
+
"pipelineRunner.startNodeBench": {
|
|
50791
|
+
capName: "pipeline-runner",
|
|
50792
|
+
capScope: "system",
|
|
50793
|
+
addonId: null,
|
|
50794
|
+
access: "create"
|
|
50795
|
+
},
|
|
47532
50796
|
"plateGallery.assignPlate": {
|
|
47533
50797
|
capName: "plate-gallery",
|
|
47534
50798
|
capScope: "system",
|
|
@@ -49191,6 +52455,174 @@ Object.freeze({
|
|
|
49191
52455
|
addonId: null,
|
|
49192
52456
|
access: "view"
|
|
49193
52457
|
},
|
|
52458
|
+
"training.canaryResult": {
|
|
52459
|
+
capName: "training",
|
|
52460
|
+
capScope: "system",
|
|
52461
|
+
addonId: null,
|
|
52462
|
+
access: "create"
|
|
52463
|
+
},
|
|
52464
|
+
"training.cancelJob": {
|
|
52465
|
+
capName: "training",
|
|
52466
|
+
capScope: "system",
|
|
52467
|
+
addonId: null,
|
|
52468
|
+
access: "create"
|
|
52469
|
+
},
|
|
52470
|
+
"training.discardResult": {
|
|
52471
|
+
capName: "training",
|
|
52472
|
+
capScope: "system",
|
|
52473
|
+
addonId: null,
|
|
52474
|
+
access: "create"
|
|
52475
|
+
},
|
|
52476
|
+
"training.findDatasetVersionIdByName": {
|
|
52477
|
+
capName: "training",
|
|
52478
|
+
capScope: "system",
|
|
52479
|
+
addonId: null,
|
|
52480
|
+
access: "view"
|
|
52481
|
+
},
|
|
52482
|
+
"training.getDatasetVersion": {
|
|
52483
|
+
capName: "training",
|
|
52484
|
+
capScope: "system",
|
|
52485
|
+
addonId: null,
|
|
52486
|
+
access: "view"
|
|
52487
|
+
},
|
|
52488
|
+
"training.getJob": {
|
|
52489
|
+
capName: "training",
|
|
52490
|
+
capScope: "system",
|
|
52491
|
+
addonId: null,
|
|
52492
|
+
access: "view"
|
|
52493
|
+
},
|
|
52494
|
+
"training.getJobResult": {
|
|
52495
|
+
capName: "training",
|
|
52496
|
+
capScope: "system",
|
|
52497
|
+
addonId: null,
|
|
52498
|
+
access: "view"
|
|
52499
|
+
},
|
|
52500
|
+
"training.listBaseModels": {
|
|
52501
|
+
capName: "training",
|
|
52502
|
+
capScope: "system",
|
|
52503
|
+
addonId: null,
|
|
52504
|
+
access: "view"
|
|
52505
|
+
},
|
|
52506
|
+
"training.listDatasetVersions": {
|
|
52507
|
+
capName: "training",
|
|
52508
|
+
capScope: "system",
|
|
52509
|
+
addonId: null,
|
|
52510
|
+
access: "view"
|
|
52511
|
+
},
|
|
52512
|
+
"training.listJobs": {
|
|
52513
|
+
capName: "training",
|
|
52514
|
+
capScope: "system",
|
|
52515
|
+
addonId: null,
|
|
52516
|
+
access: "view"
|
|
52517
|
+
},
|
|
52518
|
+
"training.planJob": {
|
|
52519
|
+
capName: "training",
|
|
52520
|
+
capScope: "system",
|
|
52521
|
+
addonId: null,
|
|
52522
|
+
access: "view"
|
|
52523
|
+
},
|
|
52524
|
+
"training.putDatasetVersion": {
|
|
52525
|
+
capName: "training",
|
|
52526
|
+
capScope: "system",
|
|
52527
|
+
addonId: null,
|
|
52528
|
+
access: "create"
|
|
52529
|
+
},
|
|
52530
|
+
"training.registerResult": {
|
|
52531
|
+
capName: "training",
|
|
52532
|
+
capScope: "system",
|
|
52533
|
+
addonId: null,
|
|
52534
|
+
access: "create"
|
|
52535
|
+
},
|
|
52536
|
+
"training.removeDatasetVersion": {
|
|
52537
|
+
capName: "training",
|
|
52538
|
+
capScope: "system",
|
|
52539
|
+
addonId: null,
|
|
52540
|
+
access: "delete"
|
|
52541
|
+
},
|
|
52542
|
+
"training.rollbackCanary": {
|
|
52543
|
+
capName: "training",
|
|
52544
|
+
capScope: "system",
|
|
52545
|
+
addonId: null,
|
|
52546
|
+
access: "create"
|
|
52547
|
+
},
|
|
52548
|
+
"training.startJob": {
|
|
52549
|
+
capName: "training",
|
|
52550
|
+
capScope: "system",
|
|
52551
|
+
addonId: null,
|
|
52552
|
+
access: "create"
|
|
52553
|
+
},
|
|
52554
|
+
"trainingProvider.cancelJob": {
|
|
52555
|
+
capName: "training-provider",
|
|
52556
|
+
capScope: "system",
|
|
52557
|
+
addonId: null,
|
|
52558
|
+
access: "create"
|
|
52559
|
+
},
|
|
52560
|
+
"trainingProvider.cleanupJob": {
|
|
52561
|
+
capName: "training-provider",
|
|
52562
|
+
capScope: "system",
|
|
52563
|
+
addonId: null,
|
|
52564
|
+
access: "create"
|
|
52565
|
+
},
|
|
52566
|
+
"trainingProvider.describe": {
|
|
52567
|
+
capName: "training-provider",
|
|
52568
|
+
capScope: "system",
|
|
52569
|
+
addonId: null,
|
|
52570
|
+
access: "view"
|
|
52571
|
+
},
|
|
52572
|
+
"trainingProvider.estimateJob": {
|
|
52573
|
+
capName: "training-provider",
|
|
52574
|
+
capScope: "system",
|
|
52575
|
+
addonId: null,
|
|
52576
|
+
access: "view"
|
|
52577
|
+
},
|
|
52578
|
+
"trainingProvider.getJob": {
|
|
52579
|
+
capName: "training-provider",
|
|
52580
|
+
capScope: "system",
|
|
52581
|
+
addonId: null,
|
|
52582
|
+
access: "view"
|
|
52583
|
+
},
|
|
52584
|
+
"trainingProvider.listJobEvents": {
|
|
52585
|
+
capName: "training-provider",
|
|
52586
|
+
capScope: "system",
|
|
52587
|
+
addonId: null,
|
|
52588
|
+
access: "view"
|
|
52589
|
+
},
|
|
52590
|
+
"trainingProvider.listJobs": {
|
|
52591
|
+
capName: "training-provider",
|
|
52592
|
+
capScope: "system",
|
|
52593
|
+
addonId: null,
|
|
52594
|
+
access: "view"
|
|
52595
|
+
},
|
|
52596
|
+
"trainingProvider.offerArtifact": {
|
|
52597
|
+
capName: "training-provider",
|
|
52598
|
+
capScope: "system",
|
|
52599
|
+
addonId: null,
|
|
52600
|
+
access: "create"
|
|
52601
|
+
},
|
|
52602
|
+
"trainingProvider.readResult": {
|
|
52603
|
+
capName: "training-provider",
|
|
52604
|
+
capScope: "system",
|
|
52605
|
+
addonId: null,
|
|
52606
|
+
access: "create"
|
|
52607
|
+
},
|
|
52608
|
+
"trainingProvider.submitJob": {
|
|
52609
|
+
capName: "training-provider",
|
|
52610
|
+
capScope: "system",
|
|
52611
|
+
addonId: null,
|
|
52612
|
+
access: "create"
|
|
52613
|
+
},
|
|
52614
|
+
"trainingProvider.uploadDataset": {
|
|
52615
|
+
capName: "training-provider",
|
|
52616
|
+
capScope: "system",
|
|
52617
|
+
addonId: null,
|
|
52618
|
+
access: "create"
|
|
52619
|
+
},
|
|
52620
|
+
"trainingProvider.validateCredentials": {
|
|
52621
|
+
capName: "training-provider",
|
|
52622
|
+
capScope: "system",
|
|
52623
|
+
addonId: null,
|
|
52624
|
+
access: "create"
|
|
52625
|
+
},
|
|
49194
52626
|
"turnProvider.getTurnServers": {
|
|
49195
52627
|
capName: "turn-provider",
|
|
49196
52628
|
capScope: "system",
|
|
@@ -49215,12 +52647,6 @@ Object.freeze({
|
|
|
49215
52647
|
addonId: null,
|
|
49216
52648
|
access: "create"
|
|
49217
52649
|
},
|
|
49218
|
-
"userManagement.createApiKey": {
|
|
49219
|
-
capName: "user-management",
|
|
49220
|
-
capScope: "system",
|
|
49221
|
-
addonId: null,
|
|
49222
|
-
access: "create"
|
|
49223
|
-
},
|
|
49224
52650
|
"userManagement.createScopedToken": {
|
|
49225
52651
|
capName: "user-management",
|
|
49226
52652
|
capScope: "system",
|
|
@@ -49257,12 +52683,6 @@ Object.freeze({
|
|
|
49257
52683
|
addonId: null,
|
|
49258
52684
|
access: "view"
|
|
49259
52685
|
},
|
|
49260
|
-
"userManagement.linkExternalIdentity": {
|
|
49261
|
-
capName: "user-management",
|
|
49262
|
-
capScope: "system",
|
|
49263
|
-
addonId: null,
|
|
49264
|
-
access: "create"
|
|
49265
|
-
},
|
|
49266
52686
|
"userManagement.listApiKeys": {
|
|
49267
52687
|
capName: "user-management",
|
|
49268
52688
|
capScope: "system",
|
|
@@ -49365,12 +52785,6 @@ Object.freeze({
|
|
|
49365
52785
|
addonId: null,
|
|
49366
52786
|
access: "create"
|
|
49367
52787
|
},
|
|
49368
|
-
"userManagement.validateApiKey": {
|
|
49369
|
-
capName: "user-management",
|
|
49370
|
-
capScope: "system",
|
|
49371
|
-
addonId: null,
|
|
49372
|
-
access: "view"
|
|
49373
|
-
},
|
|
49374
52788
|
"userManagement.validateCredentials": {
|
|
49375
52789
|
capName: "user-management",
|
|
49376
52790
|
capScope: "system",
|
|
@@ -52458,6 +55872,11 @@ Object.freeze({
|
|
|
52458
55872
|
form: "single",
|
|
52459
55873
|
optional: false
|
|
52460
55874
|
}],
|
|
55875
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
55876
|
+
name: "deviceId",
|
|
55877
|
+
form: "single",
|
|
55878
|
+
optional: false
|
|
55879
|
+
}],
|
|
52461
55880
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52462
55881
|
name: "deviceId",
|
|
52463
55882
|
form: "single",
|
|
@@ -52648,6 +56067,11 @@ Object.freeze({
|
|
|
52648
56067
|
form: "single",
|
|
52649
56068
|
optional: false
|
|
52650
56069
|
}],
|
|
56070
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
56071
|
+
name: "deviceId",
|
|
56072
|
+
form: "single",
|
|
56073
|
+
optional: false
|
|
56074
|
+
}],
|
|
52651
56075
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52652
56076
|
name: "deviceId",
|
|
52653
56077
|
form: "single",
|
|
@@ -53474,6 +56898,11 @@ Object.freeze({
|
|
|
53474
56898
|
form: "single",
|
|
53475
56899
|
optional: false
|
|
53476
56900
|
}],
|
|
56901
|
+
"training.canaryResult": [{
|
|
56902
|
+
name: "deviceIds",
|
|
56903
|
+
form: "array",
|
|
56904
|
+
optional: false
|
|
56905
|
+
}],
|
|
53477
56906
|
"update.getStatus": [{
|
|
53478
56907
|
name: "deviceId",
|
|
53479
56908
|
form: "single",
|