@camstack/addon-provider-tuya 0.2.121 → 0.2.123
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
|
@@ -818,7 +818,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
|
|
|
818
818
|
return [...byId.values()];
|
|
819
819
|
}
|
|
820
820
|
//#endregion
|
|
821
|
-
//#region ../types/dist/event-category-
|
|
821
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
822
822
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
823
823
|
EventCategory["SystemBoot"] = "system.boot";
|
|
824
824
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -897,6 +897,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
897
897
|
*/
|
|
898
898
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
899
899
|
/**
|
|
900
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
901
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
902
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
903
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
904
|
+
*/
|
|
905
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
906
|
+
/**
|
|
900
907
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
901
908
|
* transitions from `failed` back to `healthy` (typically via the
|
|
902
909
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -6189,7 +6196,7 @@ var ZodIssueCode = {
|
|
|
6189
6196
|
var ZodFirstPartyTypeKind;
|
|
6190
6197
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6191
6198
|
//#endregion
|
|
6192
|
-
//#region ../types/dist/sleep-
|
|
6199
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6193
6200
|
/**
|
|
6194
6201
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6195
6202
|
* window to float samples (D455).
|
|
@@ -6268,6 +6275,97 @@ function buildAlawTable() {
|
|
|
6268
6275
|
}
|
|
6269
6276
|
buildUlawTable();
|
|
6270
6277
|
buildAlawTable();
|
|
6278
|
+
/** Is this field's stored value a credential? */
|
|
6279
|
+
function isSecretConfigField(field) {
|
|
6280
|
+
if (field.type === "password") return true;
|
|
6281
|
+
return "secret" in field && field.secret === true;
|
|
6282
|
+
}
|
|
6283
|
+
/**
|
|
6284
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
6285
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
6286
|
+
*/
|
|
6287
|
+
function isKeychainStoredField(field) {
|
|
6288
|
+
if (!isSecretConfigField(field)) return false;
|
|
6289
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
6290
|
+
return !("storage" in field && field.storage === "inline");
|
|
6291
|
+
}
|
|
6292
|
+
/**
|
|
6293
|
+
* What a settings blob holds where a secret used to be.
|
|
6294
|
+
*
|
|
6295
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
6296
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
6297
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
6298
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
6299
|
+
*
|
|
6300
|
+
* The same shapes travel to and from the admin UI:
|
|
6301
|
+
*
|
|
6302
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
6303
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
6304
|
+
* value is set, never the value.
|
|
6305
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
6306
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
6307
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
6308
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
6309
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
6310
|
+
*
|
|
6311
|
+
* Pure and browser-safe.
|
|
6312
|
+
*/
|
|
6313
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
6314
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6315
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
6316
|
+
function isRecord$2(value) {
|
|
6317
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6318
|
+
}
|
|
6319
|
+
function makeSecretMarker(ref) {
|
|
6320
|
+
return {
|
|
6321
|
+
$secret: ref,
|
|
6322
|
+
v: 1
|
|
6323
|
+
};
|
|
6324
|
+
}
|
|
6325
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6326
|
+
function isSecretMarker(value) {
|
|
6327
|
+
if (!isRecord$2(value)) return false;
|
|
6328
|
+
const ref = value["$secret"];
|
|
6329
|
+
return typeof ref === "string" && ref.length > 0;
|
|
6330
|
+
}
|
|
6331
|
+
function isSecretClear(value) {
|
|
6332
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6333
|
+
}
|
|
6334
|
+
/**
|
|
6335
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
6336
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
6337
|
+
* survives this function.
|
|
6338
|
+
*/
|
|
6339
|
+
function toSecretFieldView(stored) {
|
|
6340
|
+
if (isSecretMarker(stored)) return {
|
|
6341
|
+
$secret: stored.$secret,
|
|
6342
|
+
v: 1,
|
|
6343
|
+
set: true
|
|
6344
|
+
};
|
|
6345
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
6346
|
+
$secret: null,
|
|
6347
|
+
v: 1,
|
|
6348
|
+
set: true,
|
|
6349
|
+
inline: true
|
|
6350
|
+
};
|
|
6351
|
+
return null;
|
|
6352
|
+
}
|
|
6353
|
+
/**
|
|
6354
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
6355
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
6356
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
6357
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
6358
|
+
*/
|
|
6359
|
+
function classifySecretWrite(incoming) {
|
|
6360
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
6361
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
6362
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
6363
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
6364
|
+
return {
|
|
6365
|
+
kind: "set",
|
|
6366
|
+
value: incoming
|
|
6367
|
+
};
|
|
6368
|
+
}
|
|
6271
6369
|
Object.fromEntries([
|
|
6272
6370
|
{
|
|
6273
6371
|
id: "overview",
|
|
@@ -6439,33 +6537,19 @@ Object.fromEntries([
|
|
|
6439
6537
|
function isValuelessField(field) {
|
|
6440
6538
|
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";
|
|
6441
6539
|
}
|
|
6442
|
-
|
|
6443
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
6444
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
6445
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
6446
|
-
*
|
|
6447
|
-
* For each leaf field:
|
|
6448
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
6449
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
6450
|
-
*
|
|
6451
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
6452
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
6453
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
6454
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
6455
|
-
*/
|
|
6456
|
-
function hydrateSchema(schema, values) {
|
|
6540
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
6457
6541
|
return {
|
|
6458
6542
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
6459
6543
|
sections: schema.sections.map((section) => ({
|
|
6460
6544
|
...section,
|
|
6461
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
6545
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
6462
6546
|
}))
|
|
6463
6547
|
};
|
|
6464
6548
|
}
|
|
6465
|
-
function hydrateField(field, values) {
|
|
6549
|
+
function hydrateField(field, values, options) {
|
|
6466
6550
|
if (isValuelessField(field)) return field;
|
|
6467
6551
|
if (field.type === "group") {
|
|
6468
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
6552
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
6469
6553
|
return {
|
|
6470
6554
|
...field,
|
|
6471
6555
|
fields: hydratedChildren
|
|
@@ -6474,7 +6558,7 @@ function hydrateField(field, values) {
|
|
|
6474
6558
|
if (field.type === "sub-tabs") {
|
|
6475
6559
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
6476
6560
|
...tab,
|
|
6477
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
6561
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
6478
6562
|
}));
|
|
6479
6563
|
return {
|
|
6480
6564
|
...field,
|
|
@@ -6484,6 +6568,33 @@ function hydrateField(field, values) {
|
|
|
6484
6568
|
const key = field.key;
|
|
6485
6569
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
6486
6570
|
const defaultValue = field.default;
|
|
6571
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
6572
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
6573
|
+
...field,
|
|
6574
|
+
value: toSecretFieldView(storedValue)
|
|
6575
|
+
};
|
|
6576
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
6577
|
+
...field,
|
|
6578
|
+
value: null
|
|
6579
|
+
};
|
|
6580
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
6581
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
6582
|
+
if (secretItemKeys.length > 0) {
|
|
6583
|
+
const rows = storedValue.map((row) => {
|
|
6584
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
6585
|
+
const out = { ...row };
|
|
6586
|
+
for (const k of secretItemKeys) {
|
|
6587
|
+
const v = Reflect.get(row, k);
|
|
6588
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
6589
|
+
}
|
|
6590
|
+
return out;
|
|
6591
|
+
});
|
|
6592
|
+
return {
|
|
6593
|
+
...field,
|
|
6594
|
+
value: rows
|
|
6595
|
+
};
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6487
6598
|
if (field.multiple) {
|
|
6488
6599
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
6489
6600
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -6726,6 +6837,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
6726
6837
|
}
|
|
6727
6838
|
return out;
|
|
6728
6839
|
}
|
|
6840
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6841
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6842
|
+
function globalSecretScope() {
|
|
6843
|
+
return GLOBAL_SCOPE;
|
|
6844
|
+
}
|
|
6845
|
+
function encodeSegment(value) {
|
|
6846
|
+
return encodeURIComponent(value);
|
|
6847
|
+
}
|
|
6848
|
+
function decodeSegment(value) {
|
|
6849
|
+
try {
|
|
6850
|
+
return decodeURIComponent(value);
|
|
6851
|
+
} catch {
|
|
6852
|
+
return null;
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
/**
|
|
6856
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6857
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6858
|
+
* `providers[authentik].clientSecret`.
|
|
6859
|
+
*/
|
|
6860
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6861
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6862
|
+
}
|
|
6863
|
+
function parseScope(segments) {
|
|
6864
|
+
switch (segments[0]) {
|
|
6865
|
+
case "global": return {
|
|
6866
|
+
scope: GLOBAL_SCOPE,
|
|
6867
|
+
used: 1
|
|
6868
|
+
};
|
|
6869
|
+
case "node": {
|
|
6870
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6871
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6872
|
+
scope: {
|
|
6873
|
+
kind: "node",
|
|
6874
|
+
nodeId
|
|
6875
|
+
},
|
|
6876
|
+
used: 2
|
|
6877
|
+
};
|
|
6878
|
+
}
|
|
6879
|
+
case "device": {
|
|
6880
|
+
const raw = segments[1];
|
|
6881
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6882
|
+
return {
|
|
6883
|
+
scope: {
|
|
6884
|
+
kind: "device",
|
|
6885
|
+
deviceId: Number(raw)
|
|
6886
|
+
},
|
|
6887
|
+
used: 2
|
|
6888
|
+
};
|
|
6889
|
+
}
|
|
6890
|
+
case "integration": {
|
|
6891
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6892
|
+
return id === null || id.length === 0 ? null : {
|
|
6893
|
+
scope: {
|
|
6894
|
+
kind: "integration",
|
|
6895
|
+
integrationId: id
|
|
6896
|
+
},
|
|
6897
|
+
used: 2
|
|
6898
|
+
};
|
|
6899
|
+
}
|
|
6900
|
+
case "row": {
|
|
6901
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6902
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6903
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6904
|
+
return {
|
|
6905
|
+
scope: {
|
|
6906
|
+
kind: "row",
|
|
6907
|
+
collection,
|
|
6908
|
+
rowId
|
|
6909
|
+
},
|
|
6910
|
+
used: 3
|
|
6911
|
+
};
|
|
6912
|
+
}
|
|
6913
|
+
default: return null;
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6917
|
+
function parseSecretRef(ref) {
|
|
6918
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6919
|
+
const segments = ref.slice(9).split("/");
|
|
6920
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6921
|
+
if (owner === null || owner.length === 0) return null;
|
|
6922
|
+
const parsed = parseScope(segments.slice(1));
|
|
6923
|
+
if (parsed === null) return null;
|
|
6924
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6925
|
+
if (fieldPath.length === 0) return null;
|
|
6926
|
+
return {
|
|
6927
|
+
owner,
|
|
6928
|
+
scope: parsed.scope,
|
|
6929
|
+
fieldPath
|
|
6930
|
+
};
|
|
6931
|
+
}
|
|
6932
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6933
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6934
|
+
fieldPath;
|
|
6935
|
+
constructor(fieldPath, cause) {
|
|
6936
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6937
|
+
this.fieldPath = fieldPath;
|
|
6938
|
+
this.name = "KeychainWriteRefusedError";
|
|
6939
|
+
}
|
|
6940
|
+
};
|
|
6941
|
+
var KEEP = { kind: "keep" };
|
|
6942
|
+
function isRecord$1(value) {
|
|
6943
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6944
|
+
}
|
|
6945
|
+
function defaultMintId() {
|
|
6946
|
+
return globalThis.crypto.randomUUID();
|
|
6947
|
+
}
|
|
6948
|
+
/** Every marker ref anywhere under `value`. */
|
|
6949
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6950
|
+
if (isSecretMarker(value)) {
|
|
6951
|
+
out.push(value.$secret);
|
|
6952
|
+
return out;
|
|
6953
|
+
}
|
|
6954
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6955
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6956
|
+
return out;
|
|
6957
|
+
}
|
|
6958
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6959
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6960
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6961
|
+
}
|
|
6962
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6963
|
+
const intent = classifySecretWrite(incoming);
|
|
6964
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6965
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6966
|
+
if (intent.kind === "keep") return KEEP;
|
|
6967
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6968
|
+
if (intent.kind === "clear") {
|
|
6969
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6970
|
+
return {
|
|
6971
|
+
kind: "value",
|
|
6972
|
+
value: null
|
|
6973
|
+
};
|
|
6974
|
+
}
|
|
6975
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6976
|
+
kind: "value",
|
|
6977
|
+
value: stored
|
|
6978
|
+
};
|
|
6979
|
+
try {
|
|
6980
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6981
|
+
} catch (err) {
|
|
6982
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6983
|
+
}
|
|
6984
|
+
return {
|
|
6985
|
+
kind: "value",
|
|
6986
|
+
value: makeSecretMarker(ref)
|
|
6987
|
+
};
|
|
6988
|
+
}
|
|
6989
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6990
|
+
function applyMember(out, key, result, storedParent) {
|
|
6991
|
+
if (result.kind === "value") {
|
|
6992
|
+
out[key] = result.value;
|
|
6993
|
+
return;
|
|
6994
|
+
}
|
|
6995
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6996
|
+
else delete out[key];
|
|
6997
|
+
}
|
|
6998
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6999
|
+
const out = { ...incoming };
|
|
7000
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
7001
|
+
return out;
|
|
7002
|
+
}
|
|
7003
|
+
function rowId(row, idKey) {
|
|
7004
|
+
const raw = row[idKey];
|
|
7005
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
7006
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
7007
|
+
return null;
|
|
7008
|
+
}
|
|
7009
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7010
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
7011
|
+
if (!Array.isArray(incoming)) {
|
|
7012
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7013
|
+
return {
|
|
7014
|
+
kind: "value",
|
|
7015
|
+
value: incoming
|
|
7016
|
+
};
|
|
7017
|
+
}
|
|
7018
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
7019
|
+
for (const row of storedRows) {
|
|
7020
|
+
const id = rowId(row, node.idKey);
|
|
7021
|
+
if (id !== null) storedById.set(id, row);
|
|
7022
|
+
}
|
|
7023
|
+
const kept = /* @__PURE__ */ new Set();
|
|
7024
|
+
const rows = [];
|
|
7025
|
+
for (const row of incoming) {
|
|
7026
|
+
if (!isRecord$1(row)) {
|
|
7027
|
+
rows.push(row);
|
|
7028
|
+
continue;
|
|
7029
|
+
}
|
|
7030
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7031
|
+
kept.add(id);
|
|
7032
|
+
const withId = {
|
|
7033
|
+
...row,
|
|
7034
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
7035
|
+
};
|
|
7036
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7037
|
+
const storedRow = storedById.get(id) ?? {};
|
|
7038
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
7039
|
+
}
|
|
7040
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
7041
|
+
return {
|
|
7042
|
+
kind: "value",
|
|
7043
|
+
value: rows
|
|
7044
|
+
};
|
|
7045
|
+
}
|
|
7046
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
7047
|
+
switch (node.kind) {
|
|
7048
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7049
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7050
|
+
case "object": {
|
|
7051
|
+
if (!isRecord$1(incoming)) {
|
|
7052
|
+
if (incoming === void 0) return KEEP;
|
|
7053
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7054
|
+
return {
|
|
7055
|
+
kind: "value",
|
|
7056
|
+
value: incoming
|
|
7057
|
+
};
|
|
7058
|
+
}
|
|
7059
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
7060
|
+
return {
|
|
7061
|
+
kind: "value",
|
|
7062
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
7063
|
+
};
|
|
7064
|
+
}
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7067
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
7068
|
+
function splitNodeKey(key) {
|
|
7069
|
+
const at = key.indexOf("@");
|
|
7070
|
+
return at <= 0 ? {
|
|
7071
|
+
base: key,
|
|
7072
|
+
nodeId: null
|
|
7073
|
+
} : {
|
|
7074
|
+
base: key.slice(0, at),
|
|
7075
|
+
nodeId: key.slice(at + 1)
|
|
7076
|
+
};
|
|
7077
|
+
}
|
|
7078
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
7079
|
+
async function transformSecretWrite(input) {
|
|
7080
|
+
const deletes = [];
|
|
7081
|
+
const base = {
|
|
7082
|
+
secrets: input.secrets,
|
|
7083
|
+
mintId: input.mintId ?? defaultMintId,
|
|
7084
|
+
deletes,
|
|
7085
|
+
operatorWrite: input.operatorWrite === true
|
|
7086
|
+
};
|
|
7087
|
+
const out = {};
|
|
7088
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
7089
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
7090
|
+
const node = input.tree.get(baseKey);
|
|
7091
|
+
if (node === void 0) {
|
|
7092
|
+
out[key] = incoming;
|
|
7093
|
+
continue;
|
|
7094
|
+
}
|
|
7095
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
7096
|
+
kind: "node",
|
|
7097
|
+
nodeId
|
|
7098
|
+
} : input.scope ?? globalSecretScope();
|
|
7099
|
+
const result = await writeNode({
|
|
7100
|
+
...base,
|
|
7101
|
+
scope
|
|
7102
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
7103
|
+
if (result.kind === "value") out[key] = result.value;
|
|
7104
|
+
}
|
|
7105
|
+
return {
|
|
7106
|
+
patch: out,
|
|
7107
|
+
afterWrite: async () => {
|
|
7108
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
7109
|
+
try {
|
|
7110
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
7111
|
+
return { orphaned: [] };
|
|
7112
|
+
} catch {
|
|
7113
|
+
return { orphaned: [...new Set(deletes)] };
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
};
|
|
7117
|
+
}
|
|
7118
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7119
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7120
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7121
|
+
}
|
|
7122
|
+
/**
|
|
7123
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7124
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
7125
|
+
*/
|
|
7126
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7127
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7128
|
+
const owner = options.ownedBy;
|
|
7129
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7130
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7131
|
+
if (refs.length === 0) return {
|
|
7132
|
+
value,
|
|
7133
|
+
unresolved: []
|
|
7134
|
+
};
|
|
7135
|
+
const answers = await secrets.resolve(refs);
|
|
7136
|
+
const unresolved = [];
|
|
7137
|
+
for (const ref of new Set(refs)) {
|
|
7138
|
+
const answer = answers[ref];
|
|
7139
|
+
if (answer === void 0) unresolved.push({
|
|
7140
|
+
ref,
|
|
7141
|
+
reason: "not-initialized"
|
|
7142
|
+
});
|
|
7143
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
7144
|
+
ref,
|
|
7145
|
+
reason: answer.reason
|
|
7146
|
+
});
|
|
7147
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
7148
|
+
ref,
|
|
7149
|
+
reason: answer.kind
|
|
7150
|
+
});
|
|
7151
|
+
}
|
|
7152
|
+
const substitute = (v) => {
|
|
7153
|
+
if (isSecretMarker(v)) {
|
|
7154
|
+
if (!inScope(v.$secret)) return {
|
|
7155
|
+
keep: true,
|
|
7156
|
+
value: v
|
|
7157
|
+
};
|
|
7158
|
+
const answer = answers[v.$secret];
|
|
7159
|
+
if (answer?.kind === "value") return {
|
|
7160
|
+
keep: true,
|
|
7161
|
+
value: answer.value
|
|
7162
|
+
};
|
|
7163
|
+
return keepMarker ? {
|
|
7164
|
+
keep: true,
|
|
7165
|
+
value: v
|
|
7166
|
+
} : {
|
|
7167
|
+
keep: false,
|
|
7168
|
+
value: void 0
|
|
7169
|
+
};
|
|
7170
|
+
}
|
|
7171
|
+
if (Array.isArray(v)) {
|
|
7172
|
+
const items = [];
|
|
7173
|
+
for (const item of v) {
|
|
7174
|
+
const s = substitute(item);
|
|
7175
|
+
if (s.keep) items.push(s.value);
|
|
7176
|
+
}
|
|
7177
|
+
return {
|
|
7178
|
+
keep: true,
|
|
7179
|
+
value: items
|
|
7180
|
+
};
|
|
7181
|
+
}
|
|
7182
|
+
if (isRecord$1(v)) {
|
|
7183
|
+
const out = {};
|
|
7184
|
+
for (const [k, child] of Object.entries(v)) {
|
|
7185
|
+
const s = substitute(child);
|
|
7186
|
+
if (s.keep) out[k] = s.value;
|
|
7187
|
+
}
|
|
7188
|
+
return {
|
|
7189
|
+
keep: true,
|
|
7190
|
+
value: out
|
|
7191
|
+
};
|
|
7192
|
+
}
|
|
7193
|
+
return {
|
|
7194
|
+
keep: true,
|
|
7195
|
+
value: v
|
|
7196
|
+
};
|
|
7197
|
+
};
|
|
7198
|
+
return {
|
|
7199
|
+
value: substitute(value).value,
|
|
7200
|
+
unresolved
|
|
7201
|
+
};
|
|
7202
|
+
}
|
|
7203
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7204
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7205
|
+
ref;
|
|
7206
|
+
reason;
|
|
7207
|
+
constructor(ref, reason) {
|
|
7208
|
+
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.`);
|
|
7209
|
+
this.ref = ref;
|
|
7210
|
+
this.reason = reason;
|
|
7211
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7212
|
+
}
|
|
7213
|
+
};
|
|
7214
|
+
function isRecord(value) {
|
|
7215
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7216
|
+
}
|
|
7217
|
+
function resolvedValue(pass, marker) {
|
|
7218
|
+
const answer = pass.answers[marker.$secret];
|
|
7219
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7220
|
+
}
|
|
7221
|
+
async function atMarker(pass, incoming, stored) {
|
|
7222
|
+
if (incoming === null) return stored;
|
|
7223
|
+
if (typeof incoming !== "string") return incoming;
|
|
7224
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7225
|
+
const intent = classifySecretWrite(incoming);
|
|
7226
|
+
if (intent.kind !== "set") return stored;
|
|
7227
|
+
const ref = stored.$secret;
|
|
7228
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7229
|
+
const answer = pass.answers[ref];
|
|
7230
|
+
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);
|
|
7231
|
+
try {
|
|
7232
|
+
await pass.secrets.put(ref, intent.value);
|
|
7233
|
+
} catch (err) {
|
|
7234
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7235
|
+
}
|
|
7236
|
+
pass.changedRefs.push(ref);
|
|
7237
|
+
return stored;
|
|
7238
|
+
}
|
|
7239
|
+
function inArray(pass, incoming, stored) {
|
|
7240
|
+
return incoming.map((item, index) => {
|
|
7241
|
+
const twin = stored[index];
|
|
7242
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7243
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7244
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7245
|
+
return item;
|
|
7246
|
+
});
|
|
7247
|
+
}
|
|
7248
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7249
|
+
const out = { ...incoming };
|
|
7250
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7251
|
+
const twin = stored[key];
|
|
7252
|
+
if (isSecretMarker(twin)) {
|
|
7253
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7254
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7255
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7256
|
+
}
|
|
7257
|
+
return out;
|
|
7258
|
+
}
|
|
7259
|
+
async function walk(pass, incoming, stored) {
|
|
7260
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7261
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7262
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7263
|
+
const out = { ...incoming };
|
|
7264
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7265
|
+
return out;
|
|
7266
|
+
}
|
|
7267
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7268
|
+
async function restoreUnchangedSecrets(input) {
|
|
7269
|
+
const refs = [];
|
|
7270
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7271
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7272
|
+
if (owned.length === 0) return {
|
|
7273
|
+
patch: input.patch,
|
|
7274
|
+
changedRefs: []
|
|
7275
|
+
};
|
|
7276
|
+
const pass = {
|
|
7277
|
+
secrets: input.secrets,
|
|
7278
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7279
|
+
operatorWrite: input.operatorWrite,
|
|
7280
|
+
changedRefs: []
|
|
7281
|
+
};
|
|
7282
|
+
const out = {};
|
|
7283
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7284
|
+
return {
|
|
7285
|
+
patch: out,
|
|
7286
|
+
changedRefs: pass.changedRefs
|
|
7287
|
+
};
|
|
7288
|
+
}
|
|
7289
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7290
|
+
function isJsonEqual(a, b) {
|
|
7291
|
+
if (Object.is(a, b)) return true;
|
|
7292
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7293
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7294
|
+
const keys = Object.keys(a);
|
|
7295
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7296
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7297
|
+
}
|
|
7298
|
+
return false;
|
|
7299
|
+
}
|
|
7300
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7301
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7302
|
+
const out = {};
|
|
7303
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7304
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7305
|
+
out[key] = value;
|
|
7306
|
+
}
|
|
7307
|
+
return out;
|
|
7308
|
+
}
|
|
7309
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7310
|
+
function markerKeysOf(blob, owner) {
|
|
7311
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7312
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7313
|
+
return keys;
|
|
7314
|
+
}
|
|
7315
|
+
function nodeFromStored(value, owner) {
|
|
7316
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7317
|
+
if (!isRecord(value)) return null;
|
|
7318
|
+
const children = /* @__PURE__ */ new Map();
|
|
7319
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7320
|
+
const node = nodeFromStored(child, owner);
|
|
7321
|
+
if (node !== null) children.set(key, node);
|
|
7322
|
+
}
|
|
7323
|
+
return children.size > 0 ? {
|
|
7324
|
+
kind: "object",
|
|
7325
|
+
children
|
|
7326
|
+
} : null;
|
|
7327
|
+
}
|
|
7328
|
+
/**
|
|
7329
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7330
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7331
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7332
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7333
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7334
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7335
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7336
|
+
* over.
|
|
7337
|
+
*/
|
|
7338
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7339
|
+
const added = /* @__PURE__ */ new Map();
|
|
7340
|
+
for (const key of keys) {
|
|
7341
|
+
const at = key.indexOf("@");
|
|
7342
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7343
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7344
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7345
|
+
if (node !== null) added.set(base, node);
|
|
7346
|
+
}
|
|
7347
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7348
|
+
}
|
|
7349
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7350
|
+
async function readStoredAddonBlob(raw) {
|
|
7351
|
+
const threeWay = raw.readAddonStoreResult;
|
|
7352
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
7353
|
+
const result = await threeWay.call(raw);
|
|
7354
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7355
|
+
return result.kind === "missing" ? {} : result.value;
|
|
7356
|
+
}
|
|
7357
|
+
function touchesTree(tree, patch) {
|
|
7358
|
+
if (tree.size === 0) return false;
|
|
7359
|
+
for (const key of Object.keys(patch)) {
|
|
7360
|
+
const at = key.indexOf("@");
|
|
7361
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7362
|
+
}
|
|
7363
|
+
return false;
|
|
7364
|
+
}
|
|
7365
|
+
/**
|
|
7366
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7367
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7368
|
+
*/
|
|
7369
|
+
var MarkerKeyIndex = class {
|
|
7370
|
+
owner;
|
|
7371
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7372
|
+
constructor(owner) {
|
|
7373
|
+
this.owner = owner;
|
|
7374
|
+
}
|
|
7375
|
+
seen(store, blob) {
|
|
7376
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7377
|
+
}
|
|
7378
|
+
wrote(store, patch) {
|
|
7379
|
+
const keys = this.byStore.get(store);
|
|
7380
|
+
if (keys === void 0) return;
|
|
7381
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7382
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7383
|
+
else keys.delete(key);
|
|
7384
|
+
}
|
|
7385
|
+
mayHoldMarkers(store, patch) {
|
|
7386
|
+
const keys = this.byStore.get(store);
|
|
7387
|
+
if (keys === void 0) return true;
|
|
7388
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7389
|
+
}
|
|
7390
|
+
};
|
|
7391
|
+
function createHandle(raw, opts) {
|
|
7392
|
+
const chains = /* @__PURE__ */ new Map();
|
|
7393
|
+
const serialize = (key, fn) => {
|
|
7394
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
7395
|
+
const tail = next.catch(() => void 0);
|
|
7396
|
+
chains.set(key, tail);
|
|
7397
|
+
tail.then(() => {
|
|
7398
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
7399
|
+
});
|
|
7400
|
+
return next;
|
|
7401
|
+
};
|
|
7402
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7403
|
+
const resolveRead = async (store, blob) => {
|
|
7404
|
+
index.seen(store, blob);
|
|
7405
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7406
|
+
unresolved: "keep-marker",
|
|
7407
|
+
ownedBy: opts.secrets.owner
|
|
7408
|
+
});
|
|
7409
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7410
|
+
return value;
|
|
7411
|
+
};
|
|
7412
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7413
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7414
|
+
await rawWrite(patch);
|
|
7415
|
+
index.wrote(store, patch);
|
|
7416
|
+
return { changed: true };
|
|
7417
|
+
}
|
|
7418
|
+
return serialize(store, async () => {
|
|
7419
|
+
const stored = await readStored();
|
|
7420
|
+
index.seen(store, stored);
|
|
7421
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7422
|
+
const restored = await restoreUnchangedSecrets({
|
|
7423
|
+
patch,
|
|
7424
|
+
stored,
|
|
7425
|
+
secrets: opts.secrets,
|
|
7426
|
+
operatorWrite
|
|
7427
|
+
});
|
|
7428
|
+
const result = await transformSecretWrite({
|
|
7429
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7430
|
+
secrets: opts.secrets,
|
|
7431
|
+
patch: restored.patch,
|
|
7432
|
+
stored,
|
|
7433
|
+
...scope !== void 0 ? { scope } : {},
|
|
7434
|
+
operatorWrite
|
|
7435
|
+
});
|
|
7436
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7437
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7438
|
+
if (wroteBlob) {
|
|
7439
|
+
await rawWrite(effective);
|
|
7440
|
+
index.wrote(store, effective);
|
|
7441
|
+
}
|
|
7442
|
+
const { orphaned } = await result.afterWrite();
|
|
7443
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7444
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7445
|
+
});
|
|
7446
|
+
};
|
|
7447
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7448
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7449
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7450
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7451
|
+
const overrides = {
|
|
7452
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7453
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7454
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7455
|
+
return result.kind === "value" ? {
|
|
7456
|
+
kind: "value",
|
|
7457
|
+
value: await resolveRead("addon", result.value)
|
|
7458
|
+
} : result;
|
|
7459
|
+
} } : {},
|
|
7460
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7461
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7462
|
+
if (result.kind !== "present") return result;
|
|
7463
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7464
|
+
unresolved: "keep-marker",
|
|
7465
|
+
ownedBy: opts.secrets.owner
|
|
7466
|
+
});
|
|
7467
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7468
|
+
return {
|
|
7469
|
+
kind: "present",
|
|
7470
|
+
value: value[key]
|
|
7471
|
+
};
|
|
7472
|
+
} } : {},
|
|
7473
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7474
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7475
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7476
|
+
const out = /* @__PURE__ */ new Map();
|
|
7477
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7478
|
+
return out;
|
|
7479
|
+
} } : {},
|
|
7480
|
+
writeAddonStore: async (patch) => {
|
|
7481
|
+
await writeAddon(patch);
|
|
7482
|
+
},
|
|
7483
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7484
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7485
|
+
kind: "device",
|
|
7486
|
+
deviceId
|
|
7487
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7488
|
+
}
|
|
7489
|
+
};
|
|
7490
|
+
return {
|
|
7491
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7492
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7493
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7494
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7495
|
+
} }),
|
|
7496
|
+
raw: {
|
|
7497
|
+
readAddonStore: async () => {
|
|
7498
|
+
const blob = await raw.readAddonStore();
|
|
7499
|
+
index.seen("addon", blob);
|
|
7500
|
+
return blob;
|
|
7501
|
+
},
|
|
7502
|
+
readDeviceStore: async (deviceId) => {
|
|
7503
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7504
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7505
|
+
return blob;
|
|
7506
|
+
}
|
|
7507
|
+
},
|
|
7508
|
+
writeAddonStore: writeAddon
|
|
7509
|
+
};
|
|
7510
|
+
}
|
|
7511
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7512
|
+
function createSecretAwareContext(context, opts) {
|
|
7513
|
+
const raw = context.settings;
|
|
7514
|
+
if (raw === void 0) return {
|
|
7515
|
+
context,
|
|
7516
|
+
handle: null
|
|
7517
|
+
};
|
|
7518
|
+
const handle = createHandle(raw, opts);
|
|
7519
|
+
return {
|
|
7520
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7521
|
+
if (prop === "settings") return handle.settings;
|
|
7522
|
+
return Reflect.get(target, prop, receiver);
|
|
7523
|
+
} }),
|
|
7524
|
+
handle
|
|
7525
|
+
};
|
|
7526
|
+
}
|
|
7527
|
+
var LEAF = { kind: "leaf" };
|
|
7528
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
7529
|
+
function collectFields(fields, out) {
|
|
7530
|
+
for (const field of fields) {
|
|
7531
|
+
if (field.type === "group") {
|
|
7532
|
+
collectFields(field.fields, out);
|
|
7533
|
+
continue;
|
|
7534
|
+
}
|
|
7535
|
+
if (field.type === "sub-tabs") {
|
|
7536
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
7537
|
+
continue;
|
|
7538
|
+
}
|
|
7539
|
+
if (field.type === "editable-array") {
|
|
7540
|
+
const item = /* @__PURE__ */ new Map();
|
|
7541
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
7542
|
+
if (item.size > 0) out.set(field.key, {
|
|
7543
|
+
kind: "array",
|
|
7544
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
7545
|
+
item
|
|
7546
|
+
});
|
|
7547
|
+
continue;
|
|
7548
|
+
}
|
|
7549
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
7550
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
7551
|
+
}
|
|
7552
|
+
}
|
|
7553
|
+
/** The secret tree a settings schema declares. */
|
|
7554
|
+
function secretTreeFromSchema(schema) {
|
|
7555
|
+
const out = /* @__PURE__ */ new Map();
|
|
7556
|
+
if (schema === null) return out;
|
|
7557
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
7558
|
+
return out;
|
|
7559
|
+
}
|
|
7560
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
7561
|
+
function parseSecretStatePath(path) {
|
|
7562
|
+
const segments = [];
|
|
7563
|
+
for (const raw of path.split(".")) {
|
|
7564
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
7565
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
7566
|
+
segments.push(m[2] !== void 0 ? {
|
|
7567
|
+
key: m[1],
|
|
7568
|
+
idKey: m[2]
|
|
7569
|
+
} : { key: m[1] });
|
|
7570
|
+
}
|
|
7571
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
7572
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
7573
|
+
return segments;
|
|
7574
|
+
}
|
|
7575
|
+
function insert(into, segments) {
|
|
7576
|
+
const [head, ...rest] = segments;
|
|
7577
|
+
if (head === void 0) return;
|
|
7578
|
+
if (rest.length === 0) {
|
|
7579
|
+
into.set(head.key, LEAF);
|
|
7580
|
+
return;
|
|
7581
|
+
}
|
|
7582
|
+
const existing = into.get(head.key);
|
|
7583
|
+
if (head.idKey !== void 0) {
|
|
7584
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
7585
|
+
insert(item, rest);
|
|
7586
|
+
into.set(head.key, {
|
|
7587
|
+
kind: "array",
|
|
7588
|
+
idKey: head.idKey,
|
|
7589
|
+
item
|
|
7590
|
+
});
|
|
7591
|
+
return;
|
|
7592
|
+
}
|
|
7593
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
7594
|
+
insert(children, rest);
|
|
7595
|
+
into.set(head.key, {
|
|
7596
|
+
kind: "object",
|
|
7597
|
+
children
|
|
7598
|
+
});
|
|
7599
|
+
}
|
|
7600
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
7601
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
7602
|
+
if (paths.length === 0) return tree;
|
|
7603
|
+
const out = new Map(tree);
|
|
7604
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
7605
|
+
return out;
|
|
7606
|
+
}
|
|
7607
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
7608
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
7609
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
7610
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7611
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
6729
7612
|
/**
|
|
6730
7613
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
6731
7614
|
*
|
|
@@ -6795,6 +7678,33 @@ var BaseAddon = class {
|
|
|
6795
7678
|
settingsStoreReady = false;
|
|
6796
7679
|
/** Default config values. Provided via constructor. */
|
|
6797
7680
|
defaults;
|
|
7681
|
+
/**
|
|
7682
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
7683
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
7684
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
7685
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
7686
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
7687
|
+
*/
|
|
7688
|
+
secretStatePaths = [];
|
|
7689
|
+
_addonSecretTree = null;
|
|
7690
|
+
_deviceSecretTree = null;
|
|
7691
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7692
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
7693
|
+
_unresolvedSecrets = [];
|
|
7694
|
+
_secretRetryTimer = null;
|
|
7695
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7696
|
+
_secretChangeTimer = null;
|
|
7697
|
+
_secretChangeUnsub = null;
|
|
7698
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7699
|
+
_operatorWriteDepth = 0;
|
|
7700
|
+
/**
|
|
7701
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7702
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7703
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7704
|
+
*/
|
|
7705
|
+
_secretSettings = null;
|
|
7706
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7707
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6798
7708
|
constructor(defaults) {
|
|
6799
7709
|
this.defaults = defaults;
|
|
6800
7710
|
this._config = { ...defaults };
|
|
@@ -6830,8 +7740,26 @@ var BaseAddon = class {
|
|
|
6830
7740
|
return this._config;
|
|
6831
7741
|
}
|
|
6832
7742
|
async initialize(context) {
|
|
6833
|
-
|
|
7743
|
+
const secrets = context.secrets;
|
|
7744
|
+
if (secrets !== void 0) {
|
|
7745
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7746
|
+
secrets,
|
|
7747
|
+
addonTree: () => this.addonSecretTree(),
|
|
7748
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7749
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7750
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7751
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7752
|
+
});
|
|
7753
|
+
this._ctx = wrapped;
|
|
7754
|
+
this._secretSettings = handle;
|
|
7755
|
+
} else {
|
|
7756
|
+
this._ctx = context;
|
|
7757
|
+
this._secretSettings = null;
|
|
7758
|
+
}
|
|
6834
7759
|
await this.resolveConfig();
|
|
7760
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7761
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
7762
|
+
});
|
|
6835
7763
|
const result = await this.onInitialize();
|
|
6836
7764
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6837
7765
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6864,6 +7792,12 @@ var BaseAddon = class {
|
|
|
6864
7792
|
*/
|
|
6865
7793
|
async onHubReachable() {}
|
|
6866
7794
|
async shutdown() {
|
|
7795
|
+
this._secretChangeUnsub?.();
|
|
7796
|
+
this._secretChangeUnsub = null;
|
|
7797
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7798
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7799
|
+
this._secretRetryTimer = null;
|
|
7800
|
+
this._secretChangeTimer = null;
|
|
6867
7801
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6868
7802
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6869
7803
|
await this.onShutdown();
|
|
@@ -6938,11 +7872,8 @@ var BaseAddon = class {
|
|
|
6938
7872
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6939
7873
|
const schema = this.globalSettingsSchema(cap);
|
|
6940
7874
|
if (!schema) return { sections: [] };
|
|
6941
|
-
const projected = await this.
|
|
6942
|
-
return hydrateSchema(schema, overlay ? {
|
|
6943
|
-
...projected,
|
|
6944
|
-
...overlay
|
|
6945
|
-
} : projected);
|
|
7875
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7876
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6946
7877
|
}
|
|
6947
7878
|
/**
|
|
6948
7879
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6987,11 +7918,11 @@ var BaseAddon = class {
|
|
|
6987
7918
|
});
|
|
6988
7919
|
}
|
|
6989
7920
|
if (sections.length === 0) return null;
|
|
6990
|
-
const projected = await this.
|
|
7921
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6991
7922
|
return hydrateSchema({
|
|
6992
7923
|
...schema,
|
|
6993
7924
|
sections
|
|
6994
|
-
}, projected);
|
|
7925
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6995
7926
|
}
|
|
6996
7927
|
/**
|
|
6997
7928
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -7004,12 +7935,50 @@ var BaseAddon = class {
|
|
|
7004
7935
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7005
7936
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7006
7937
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7938
|
+
*
|
|
7939
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7940
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7941
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7942
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7943
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7944
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7007
7945
|
*/
|
|
7008
7946
|
async resolveGlobalStore(nodeId, cap) {
|
|
7009
7947
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7948
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7949
|
+
}
|
|
7950
|
+
projectForNode(store, nodeId, cap) {
|
|
7010
7951
|
const keys = this.perNodeKeys(cap);
|
|
7011
7952
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7012
|
-
return keys.size > 0 ? projectStore(
|
|
7953
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7954
|
+
}
|
|
7955
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7956
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7957
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7958
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7959
|
+
}
|
|
7960
|
+
/**
|
|
7961
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7962
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7963
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7964
|
+
* its value.
|
|
7965
|
+
*/
|
|
7966
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7967
|
+
const secrets = this._ctx?.secrets;
|
|
7968
|
+
const merged = {
|
|
7969
|
+
...stored,
|
|
7970
|
+
...overlay
|
|
7971
|
+
};
|
|
7972
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7973
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7974
|
+
unresolved: "keep-marker",
|
|
7975
|
+
ownedBy: secrets.owner
|
|
7976
|
+
});
|
|
7977
|
+
for (const key of Object.keys(overlay)) {
|
|
7978
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7979
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7980
|
+
}
|
|
7981
|
+
return merged;
|
|
7013
7982
|
}
|
|
7014
7983
|
/**
|
|
7015
7984
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7045,18 +8014,58 @@ var BaseAddon = class {
|
|
|
7045
8014
|
value: result.value[key]
|
|
7046
8015
|
};
|
|
7047
8016
|
}
|
|
8017
|
+
/**
|
|
8018
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
8019
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
8020
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
8021
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
8022
|
+
* writing back what it read is not (D787).
|
|
8023
|
+
*/
|
|
8024
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
8025
|
+
this._operatorWriteDepth++;
|
|
8026
|
+
try {
|
|
8027
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8028
|
+
} finally {
|
|
8029
|
+
this._operatorWriteDepth--;
|
|
8030
|
+
}
|
|
8031
|
+
}
|
|
7048
8032
|
async updateGlobalSettings(patch, nodeId) {
|
|
8033
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8034
|
+
}
|
|
8035
|
+
/**
|
|
8036
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
8037
|
+
*
|
|
8038
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
8039
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
8040
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
8041
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8042
|
+
*/
|
|
8043
|
+
async clearSecrets(keys, nodeId) {
|
|
8044
|
+
const tree = this.addonSecretTree();
|
|
8045
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
8046
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
8047
|
+
const patch = {};
|
|
8048
|
+
for (const key of keys) {
|
|
8049
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8050
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8051
|
+
}
|
|
8052
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
8053
|
+
}
|
|
8054
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
7049
8055
|
const keys = this.perNodeKeys();
|
|
7050
8056
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7051
8057
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7052
|
-
const barePatch = patch;
|
|
7053
8058
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7054
|
-
|
|
8059
|
+
const handle = this._secretSettings;
|
|
8060
|
+
if (handle !== null) {
|
|
8061
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8062
|
+
if (!changed) return;
|
|
8063
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7055
8064
|
if (target !== localNode) return;
|
|
7056
8065
|
await this.resolveConfig();
|
|
7057
8066
|
await this.onConfigChanged();
|
|
7058
8067
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
7059
|
-
this.maybeAutoRestart(
|
|
8068
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
7060
8069
|
}
|
|
7061
8070
|
/**
|
|
7062
8071
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -7081,7 +8090,7 @@ var BaseAddon = class {
|
|
|
7081
8090
|
* time to return its response before the addon is torn down and
|
|
7082
8091
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
7083
8092
|
*/
|
|
7084
|
-
maybeAutoRestart(
|
|
8093
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
7085
8094
|
if (!schema) return;
|
|
7086
8095
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
7087
8096
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -7089,13 +8098,13 @@ var BaseAddon = class {
|
|
|
7089
8098
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
7090
8099
|
}
|
|
7091
8100
|
if (restartKeys.size === 0) return;
|
|
7092
|
-
if (!
|
|
8101
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
7093
8102
|
const ctx = this._ctx;
|
|
7094
8103
|
if (!ctx) return;
|
|
7095
8104
|
const addonId = ctx.id;
|
|
7096
8105
|
setImmediate(() => {
|
|
7097
8106
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
7098
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
8107
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7099
8108
|
}).catch((err) => {
|
|
7100
8109
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7101
8110
|
});
|
|
@@ -7104,7 +8113,7 @@ var BaseAddon = class {
|
|
|
7104
8113
|
async getDeviceSettings(deviceId) {
|
|
7105
8114
|
const schema = this.deviceSettingsSchema();
|
|
7106
8115
|
if (!schema) return { sections: [] };
|
|
7107
|
-
return hydrateSchema(schema, await this.
|
|
8116
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7108
8117
|
}
|
|
7109
8118
|
async updateDeviceSettings(deviceId, patch) {
|
|
7110
8119
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7234,7 +8243,7 @@ var BaseAddon = class {
|
|
|
7234
8243
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
7235
8244
|
*/
|
|
7236
8245
|
async resolveConfig() {
|
|
7237
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
8246
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
7238
8247
|
const perNode = this.perNodeKeys();
|
|
7239
8248
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7240
8249
|
const resolved = { ...this.defaults };
|
|
@@ -7259,7 +8268,7 @@ var BaseAddon = class {
|
|
|
7259
8268
|
key,
|
|
7260
8269
|
schema,
|
|
7261
8270
|
fallback,
|
|
7262
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
8271
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
7263
8272
|
write: async (patch) => {
|
|
7264
8273
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
7265
8274
|
},
|
|
@@ -7276,7 +8285,7 @@ var BaseAddon = class {
|
|
|
7276
8285
|
key,
|
|
7277
8286
|
schema,
|
|
7278
8287
|
fallback,
|
|
7279
|
-
read: async () => await this.
|
|
8288
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7280
8289
|
write: async (patch) => {
|
|
7281
8290
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7282
8291
|
},
|
|
@@ -7288,6 +8297,87 @@ var BaseAddon = class {
|
|
|
7288
8297
|
} })
|
|
7289
8298
|
});
|
|
7290
8299
|
}
|
|
8300
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8301
|
+
addonSecretTree() {
|
|
8302
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
8303
|
+
return this._addonSecretTree;
|
|
8304
|
+
}
|
|
8305
|
+
deviceSecretTree() {
|
|
8306
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
8307
|
+
return this._deviceSecretTree;
|
|
8308
|
+
}
|
|
8309
|
+
/**
|
|
8310
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
8311
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
8312
|
+
* an addon whose function needs one should report itself degraded rather
|
|
8313
|
+
* than start on an empty credential.
|
|
8314
|
+
*/
|
|
8315
|
+
get unresolvedSecrets() {
|
|
8316
|
+
return this._unresolvedSecrets;
|
|
8317
|
+
}
|
|
8318
|
+
/**
|
|
8319
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
8320
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
8321
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
8322
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
8323
|
+
* ever written back from here.
|
|
8324
|
+
*/
|
|
8325
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
8326
|
+
const secrets = this._ctx?.secrets;
|
|
8327
|
+
if (secrets === void 0) return blob;
|
|
8328
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
8329
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
8330
|
+
if (refs.length === 0) {
|
|
8331
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
8332
|
+
return blob;
|
|
8333
|
+
}
|
|
8334
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
8335
|
+
if (trackForConfig) {
|
|
8336
|
+
this._unresolvedSecrets = unresolved;
|
|
8337
|
+
if (unresolved.length > 0) {
|
|
8338
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
8339
|
+
ref: u.ref,
|
|
8340
|
+
reason: u.reason
|
|
8341
|
+
})) } });
|
|
8342
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
8343
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
8344
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
8345
|
+
}
|
|
8346
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
8347
|
+
}
|
|
8348
|
+
return value;
|
|
8349
|
+
}
|
|
8350
|
+
/**
|
|
8351
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8352
|
+
* keychain the context's own view is already raw.
|
|
8353
|
+
*/
|
|
8354
|
+
rawSettings() {
|
|
8355
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8356
|
+
}
|
|
8357
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8358
|
+
logUnresolvedRead(unresolved) {
|
|
8359
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8360
|
+
if (fresh.length === 0) return;
|
|
8361
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8362
|
+
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) => ({
|
|
8363
|
+
ref: u.ref,
|
|
8364
|
+
reason: u.reason
|
|
8365
|
+
})) } });
|
|
8366
|
+
}
|
|
8367
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8368
|
+
scheduleSecretReresolve(delayMs) {
|
|
8369
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
8370
|
+
if (this[timerOf] !== null) return;
|
|
8371
|
+
const timer = setTimeout(() => {
|
|
8372
|
+
this[timerOf] = null;
|
|
8373
|
+
if (this._ctx === null) return;
|
|
8374
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
8375
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
8376
|
+
});
|
|
8377
|
+
}, delayMs);
|
|
8378
|
+
timer.unref?.();
|
|
8379
|
+
this[timerOf] = timer;
|
|
8380
|
+
}
|
|
7291
8381
|
/**
|
|
7292
8382
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
7293
8383
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7300,7 +8390,7 @@ var BaseAddon = class {
|
|
|
7300
8390
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7301
8391
|
*/
|
|
7302
8392
|
async readAddonStoreWithRetry() {
|
|
7303
|
-
const settings = this.
|
|
8393
|
+
const settings = this.rawSettings();
|
|
7304
8394
|
if (!settings) return {};
|
|
7305
8395
|
const delaysMs = [
|
|
7306
8396
|
150,
|
|
@@ -7863,6 +8953,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7863
8953
|
kind: "mutation",
|
|
7864
8954
|
auth: "admin"
|
|
7865
8955
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8956
|
+
function defOf(schema) {
|
|
8957
|
+
return schema._zod?.def ?? {};
|
|
8958
|
+
}
|
|
8959
|
+
function declaredHere(schema) {
|
|
8960
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8961
|
+
}
|
|
8962
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8963
|
+
var WRAPPERS = new Set([
|
|
8964
|
+
"optional",
|
|
8965
|
+
"nullable",
|
|
8966
|
+
"default",
|
|
8967
|
+
"prefault",
|
|
8968
|
+
"catch",
|
|
8969
|
+
"readonly",
|
|
8970
|
+
"nonoptional"
|
|
8971
|
+
]);
|
|
8972
|
+
/**
|
|
8973
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8974
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8975
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8976
|
+
* `.transform` on `in`).
|
|
8977
|
+
*/
|
|
8978
|
+
function layersOf(schema) {
|
|
8979
|
+
const out = [];
|
|
8980
|
+
const queue = [schema];
|
|
8981
|
+
while (queue.length > 0) {
|
|
8982
|
+
const s = queue.shift();
|
|
8983
|
+
if (!s || out.includes(s)) continue;
|
|
8984
|
+
out.push(s);
|
|
8985
|
+
const def = defOf(s);
|
|
8986
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8987
|
+
if (def.type === "pipe") {
|
|
8988
|
+
if (def.in) queue.push(def.in);
|
|
8989
|
+
if (def.out) queue.push(def.out);
|
|
8990
|
+
}
|
|
8991
|
+
}
|
|
8992
|
+
return out;
|
|
8993
|
+
}
|
|
8994
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8995
|
+
function isZodSecret(schema) {
|
|
8996
|
+
return layersOf(schema).some(declaredHere);
|
|
8997
|
+
}
|
|
8998
|
+
/**
|
|
8999
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9000
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
9001
|
+
* object or array is reported as one path and not descended into — everything
|
|
9002
|
+
* under it is secret.
|
|
9003
|
+
*/
|
|
9004
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
9005
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9006
|
+
const paths = [];
|
|
9007
|
+
for (const layer of layersOf(schema)) {
|
|
9008
|
+
const def = defOf(layer);
|
|
9009
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9010
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9011
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9012
|
+
else if (def.type === "intersection") {
|
|
9013
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9014
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9015
|
+
}
|
|
9016
|
+
}
|
|
9017
|
+
return [...new Set(paths)];
|
|
9018
|
+
}
|
|
7866
9019
|
//#endregion
|
|
7867
9020
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7868
9021
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -9540,6 +10693,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9540
10693
|
fetchedAt: number()
|
|
9541
10694
|
});
|
|
9542
10695
|
/**
|
|
10696
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10697
|
+
* gets back (cloud training, D805+).
|
|
10698
|
+
*
|
|
10699
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10700
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10701
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10702
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10703
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10704
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10705
|
+
* change there, in the same piece of work.
|
|
10706
|
+
*
|
|
10707
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10708
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10709
|
+
*/
|
|
10710
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10711
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10712
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10713
|
+
var TrainingExportSchema = _enum([
|
|
10714
|
+
"onnx",
|
|
10715
|
+
"openvino-fp16",
|
|
10716
|
+
"openvino-int8",
|
|
10717
|
+
"coreml-fp16"
|
|
10718
|
+
]);
|
|
10719
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10720
|
+
object({
|
|
10721
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10722
|
+
jobKey: string().uuid(),
|
|
10723
|
+
target: object({
|
|
10724
|
+
kind: literal("detector"),
|
|
10725
|
+
step: literal("object-detection")
|
|
10726
|
+
}),
|
|
10727
|
+
base: object({
|
|
10728
|
+
modelId: string().min(1),
|
|
10729
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10730
|
+
weights: string().min(1),
|
|
10731
|
+
imgsz: number().int().positive()
|
|
10732
|
+
}),
|
|
10733
|
+
baseline: object({
|
|
10734
|
+
modelId: string().min(1),
|
|
10735
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10736
|
+
onnxUrl: string().url(),
|
|
10737
|
+
imgsz: number().int().positive(),
|
|
10738
|
+
floors: FloorsSchema
|
|
10739
|
+
}),
|
|
10740
|
+
dataset: object({
|
|
10741
|
+
versionId: string().min(1),
|
|
10742
|
+
annotationHash: string(),
|
|
10743
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10744
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10745
|
+
}),
|
|
10746
|
+
split: object({
|
|
10747
|
+
holdoutCameras: array(number().int()),
|
|
10748
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10749
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10750
|
+
valFraction: number().min(0).max(.5),
|
|
10751
|
+
seed: number().int()
|
|
10752
|
+
}),
|
|
10753
|
+
hyper: object({
|
|
10754
|
+
epochs: number().int().positive(),
|
|
10755
|
+
batch: number().int().positive(),
|
|
10756
|
+
lr0: number().positive(),
|
|
10757
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10758
|
+
freeze: number().int().nonnegative(),
|
|
10759
|
+
patience: number().int().nonnegative(),
|
|
10760
|
+
seed: number().int()
|
|
10761
|
+
}),
|
|
10762
|
+
replay: object({
|
|
10763
|
+
source: literal("coco2017"),
|
|
10764
|
+
count: number().int().nonnegative()
|
|
10765
|
+
}),
|
|
10766
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10767
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10768
|
+
floors: object({
|
|
10769
|
+
minSupport: number().int().positive(),
|
|
10770
|
+
clamp: number().min(0).max(1)
|
|
10771
|
+
}),
|
|
10772
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10773
|
+
catalog: object({
|
|
10774
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10775
|
+
name: string().min(1).max(160)
|
|
10776
|
+
})
|
|
10777
|
+
});
|
|
10778
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10779
|
+
var TrainingResultFileSchema = object({
|
|
10780
|
+
path: string().min(1),
|
|
10781
|
+
bytes: number().int().nonnegative(),
|
|
10782
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10783
|
+
format: _enum([
|
|
10784
|
+
"onnx",
|
|
10785
|
+
"openvino",
|
|
10786
|
+
"coreml",
|
|
10787
|
+
"pt"
|
|
10788
|
+
]),
|
|
10789
|
+
variant: _enum(["base", "int8"])
|
|
10790
|
+
});
|
|
10791
|
+
var DraftFormatSchema = object({
|
|
10792
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10793
|
+
url: string().min(1),
|
|
10794
|
+
sizeMB: number().nonnegative(),
|
|
10795
|
+
isDirectory: boolean().optional(),
|
|
10796
|
+
files: array(string()).optional(),
|
|
10797
|
+
runtimes: array(literal("python")).optional(),
|
|
10798
|
+
revision: string().min(1)
|
|
10799
|
+
});
|
|
10800
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10801
|
+
var TrainingCatalogDraftSchema = object({
|
|
10802
|
+
id: string().min(1),
|
|
10803
|
+
name: string().min(1),
|
|
10804
|
+
description: string(),
|
|
10805
|
+
labels: array(unknown()),
|
|
10806
|
+
inputSize: object({
|
|
10807
|
+
width: number().int().positive(),
|
|
10808
|
+
height: number().int().positive()
|
|
10809
|
+
}),
|
|
10810
|
+
preprocessMode: literal("letterbox"),
|
|
10811
|
+
defaultClassFloors: FloorsSchema,
|
|
10812
|
+
formats: object({
|
|
10813
|
+
onnx: DraftFormatSchema.optional(),
|
|
10814
|
+
openvino: DraftFormatSchema.optional(),
|
|
10815
|
+
coreml: DraftFormatSchema.optional()
|
|
10816
|
+
})
|
|
10817
|
+
});
|
|
10818
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10819
|
+
var TrainingEvalClassSchema = object({
|
|
10820
|
+
positives: number().int(),
|
|
10821
|
+
floor: number().nullable(),
|
|
10822
|
+
tp: number().int(),
|
|
10823
|
+
fp: number().int(),
|
|
10824
|
+
fn: number().int(),
|
|
10825
|
+
precision: number().nullable(),
|
|
10826
|
+
recall: number().nullable(),
|
|
10827
|
+
ap50: number().nullable(),
|
|
10828
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10829
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10830
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10831
|
+
smallFound: number().int().optional(),
|
|
10832
|
+
smallTotal: number().int().optional()
|
|
10833
|
+
}).passthrough();
|
|
10834
|
+
var TrainingEvalReportSchema = object({
|
|
10835
|
+
frames: number().int(),
|
|
10836
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10837
|
+
}).passthrough();
|
|
10838
|
+
/**
|
|
10839
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10840
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10841
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10842
|
+
*/
|
|
10843
|
+
var TrainingResultSchema = object({
|
|
10844
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10845
|
+
jobKey: string(),
|
|
10846
|
+
status: _enum(["succeeded", "failed"]),
|
|
10847
|
+
error: object({
|
|
10848
|
+
stage: string(),
|
|
10849
|
+
code: string(),
|
|
10850
|
+
message: string()
|
|
10851
|
+
}).nullable(),
|
|
10852
|
+
trainer: object({
|
|
10853
|
+
version: string(),
|
|
10854
|
+
revision: string()
|
|
10855
|
+
}),
|
|
10856
|
+
toolchain: record(string(), string().nullable()),
|
|
10857
|
+
dataset: object({
|
|
10858
|
+
versionId: string(),
|
|
10859
|
+
annotationHash: string(),
|
|
10860
|
+
sha256: string(),
|
|
10861
|
+
frames: object({
|
|
10862
|
+
train: number().int(),
|
|
10863
|
+
val: number().int(),
|
|
10864
|
+
holdout: number().int()
|
|
10865
|
+
}),
|
|
10866
|
+
holdoutCameras: array(number().int()),
|
|
10867
|
+
replayImages: number().int()
|
|
10868
|
+
}).optional(),
|
|
10869
|
+
training: object({
|
|
10870
|
+
epochsRun: number().int(),
|
|
10871
|
+
bestEpoch: number().int(),
|
|
10872
|
+
bestMap50: number(),
|
|
10873
|
+
bestMap50_95: number(),
|
|
10874
|
+
seconds: number()
|
|
10875
|
+
}).optional(),
|
|
10876
|
+
evaluation: object({
|
|
10877
|
+
holdoutFrames: number().int(),
|
|
10878
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10879
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10880
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10881
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10882
|
+
map50: record(string(), number().nullable())
|
|
10883
|
+
}).optional(),
|
|
10884
|
+
floors: object({
|
|
10885
|
+
baseline: FloorsSchema,
|
|
10886
|
+
candidate: FloorsSchema,
|
|
10887
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10888
|
+
notes: array(string())
|
|
10889
|
+
}).optional(),
|
|
10890
|
+
int8: object({
|
|
10891
|
+
kept: boolean(),
|
|
10892
|
+
map50Fp16: number().nullable(),
|
|
10893
|
+
map50Int8: number().nullable(),
|
|
10894
|
+
reason: string().nullable()
|
|
10895
|
+
}).optional(),
|
|
10896
|
+
exportsDropped: array(object({
|
|
10897
|
+
export: string(),
|
|
10898
|
+
reason: string()
|
|
10899
|
+
})).optional(),
|
|
10900
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10901
|
+
bundle: object({
|
|
10902
|
+
path: literal("bundle.tar"),
|
|
10903
|
+
bytes: number().int().nonnegative(),
|
|
10904
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10905
|
+
}).nullable().optional(),
|
|
10906
|
+
catalogDraft: object({
|
|
10907
|
+
base: TrainingCatalogDraftSchema,
|
|
10908
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10909
|
+
}).nullable().optional(),
|
|
10910
|
+
licence: string()
|
|
10911
|
+
});
|
|
10912
|
+
var TrainingStageSchema = _enum([
|
|
10913
|
+
"prepare",
|
|
10914
|
+
"replay",
|
|
10915
|
+
"train",
|
|
10916
|
+
"eval",
|
|
10917
|
+
"export",
|
|
10918
|
+
"package"
|
|
10919
|
+
]);
|
|
10920
|
+
var EventBase = {
|
|
10921
|
+
v: literal(1),
|
|
10922
|
+
ts: number()
|
|
10923
|
+
};
|
|
10924
|
+
discriminatedUnion("type", [
|
|
10925
|
+
object({
|
|
10926
|
+
...EventBase,
|
|
10927
|
+
type: literal("stage"),
|
|
10928
|
+
stage: TrainingStageSchema
|
|
10929
|
+
}),
|
|
10930
|
+
object({
|
|
10931
|
+
...EventBase,
|
|
10932
|
+
type: literal("epoch"),
|
|
10933
|
+
epoch: number().int(),
|
|
10934
|
+
epochs: number().int(),
|
|
10935
|
+
boxLoss: number().nullable().optional(),
|
|
10936
|
+
map50: number().nullable().optional(),
|
|
10937
|
+
map50_95: number().nullable().optional(),
|
|
10938
|
+
etaSec: number().nullable().optional()
|
|
10939
|
+
}),
|
|
10940
|
+
object({
|
|
10941
|
+
...EventBase,
|
|
10942
|
+
type: literal("metric"),
|
|
10943
|
+
name: string(),
|
|
10944
|
+
value: number()
|
|
10945
|
+
}),
|
|
10946
|
+
object({
|
|
10947
|
+
...EventBase,
|
|
10948
|
+
type: literal("artifact"),
|
|
10949
|
+
path: string(),
|
|
10950
|
+
bytes: number(),
|
|
10951
|
+
sha256: string()
|
|
10952
|
+
}),
|
|
10953
|
+
object({
|
|
10954
|
+
...EventBase,
|
|
10955
|
+
type: literal("done"),
|
|
10956
|
+
status: _enum(["succeeded", "failed"]),
|
|
10957
|
+
resultSha256: string().nullable().optional()
|
|
10958
|
+
}),
|
|
10959
|
+
object({
|
|
10960
|
+
...EventBase,
|
|
10961
|
+
type: literal("error"),
|
|
10962
|
+
stage: string(),
|
|
10963
|
+
code: string(),
|
|
10964
|
+
message: string()
|
|
10965
|
+
})
|
|
10966
|
+
]);
|
|
10967
|
+
/**
|
|
9543
10968
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9544
10969
|
*
|
|
9545
10970
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11867,7 +13292,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11867
13292
|
"authenticated",
|
|
11868
13293
|
"admin"
|
|
11869
13294
|
]).optional(),
|
|
11870
|
-
description: string().optional()
|
|
13295
|
+
description: string().optional(),
|
|
13296
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13297
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11871
13298
|
});
|
|
11872
13299
|
/**
|
|
11873
13300
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12572,6 +13999,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12572
13999
|
lastError: string().optional()
|
|
12573
14000
|
});
|
|
12574
14001
|
/**
|
|
14002
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14003
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14004
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14005
|
+
* with it off — which restores without a key.
|
|
14006
|
+
*/
|
|
14007
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14008
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14009
|
+
scheme: string(),
|
|
14010
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14011
|
+
keyId: string()
|
|
14012
|
+
});
|
|
14013
|
+
/**
|
|
14014
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14015
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14016
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14017
|
+
*/
|
|
14018
|
+
var BackupEncryptionStatusSchema = object({
|
|
14019
|
+
enabled: boolean(),
|
|
14020
|
+
active: object({
|
|
14021
|
+
keyId: string(),
|
|
14022
|
+
publicKey: string(),
|
|
14023
|
+
createdAt: number()
|
|
14024
|
+
}).nullable(),
|
|
14025
|
+
/** Every key ever set up, newest first. */
|
|
14026
|
+
keys: array(object({
|
|
14027
|
+
keyId: string(),
|
|
14028
|
+
createdAt: number(),
|
|
14029
|
+
retiredAt: number().nullable()
|
|
14030
|
+
})).readonly()
|
|
14031
|
+
});
|
|
14032
|
+
/**
|
|
12575
14033
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12576
14034
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12577
14035
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12583,7 +14041,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12583
14041
|
sizeBytes: number(),
|
|
12584
14042
|
label: string().optional(),
|
|
12585
14043
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12586
|
-
locations: array(string()).readonly()
|
|
14044
|
+
locations: array(string()).readonly(),
|
|
14045
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14046
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12587
14047
|
});
|
|
12588
14048
|
var BackupEntrySchema = object({
|
|
12589
14049
|
id: string(),
|
|
@@ -12592,7 +14052,8 @@ var BackupEntrySchema = object({
|
|
|
12592
14052
|
label: string().optional(),
|
|
12593
14053
|
createdAt: number(),
|
|
12594
14054
|
sizeBytes: number(),
|
|
12595
|
-
locations: array(string()).optional()
|
|
14055
|
+
locations: array(string()).optional(),
|
|
14056
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12596
14057
|
});
|
|
12597
14058
|
var ArchiveEntrySchema = object({
|
|
12598
14059
|
path: string(),
|
|
@@ -12781,10 +14242,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12781
14242
|
* this list and skips entries whose path doesn't start with
|
|
12782
14243
|
* any of them.
|
|
12783
14244
|
*/
|
|
12784
|
-
locations: array(string()).optional()
|
|
14245
|
+
locations: array(string()).optional(),
|
|
14246
|
+
/**
|
|
14247
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14248
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14249
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14250
|
+
* is refused before the archive is downloaded.
|
|
14251
|
+
*/
|
|
14252
|
+
backupSecretKey: string().optional()
|
|
12785
14253
|
}), _void(), {
|
|
12786
14254
|
kind: "mutation",
|
|
12787
14255
|
auth: "admin"
|
|
14256
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14257
|
+
keyId: string(),
|
|
14258
|
+
secretKey: string(),
|
|
14259
|
+
publicKey: string(),
|
|
14260
|
+
createdAt: number(),
|
|
14261
|
+
replacedKeyId: string().nullable()
|
|
14262
|
+
}), {
|
|
14263
|
+
kind: "mutation",
|
|
14264
|
+
auth: "admin"
|
|
14265
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14266
|
+
kind: "mutation",
|
|
14267
|
+
auth: "admin"
|
|
14268
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14269
|
+
valid: boolean(),
|
|
14270
|
+
keyId: string().nullable(),
|
|
14271
|
+
/** The hub knows this key (active or retired). */
|
|
14272
|
+
known: boolean(),
|
|
14273
|
+
/** It is the key new archives are encrypted to. */
|
|
14274
|
+
active: boolean(),
|
|
14275
|
+
error: string().optional()
|
|
14276
|
+
}), {
|
|
14277
|
+
kind: "mutation",
|
|
14278
|
+
auth: "admin"
|
|
12788
14279
|
}), method(object({
|
|
12789
14280
|
destinationId: string(),
|
|
12790
14281
|
backupId: string()
|
|
@@ -14510,7 +16001,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14510
16001
|
stepId: string(),
|
|
14511
16002
|
entry: ModelCatalogEntrySchema
|
|
14512
16003
|
});
|
|
14513
|
-
|
|
16004
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16005
|
+
var ModelBundleFileSchema = object({
|
|
16006
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16007
|
+
path: string().min(1),
|
|
16008
|
+
bytes: number().int().nonnegative(),
|
|
16009
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16010
|
+
});
|
|
16011
|
+
var ImportModelBundleInputSchema = object({
|
|
16012
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16013
|
+
addonId: string(),
|
|
16014
|
+
stepId: string().min(1),
|
|
16015
|
+
/**
|
|
16016
|
+
* The catalog rows to register, complete, every format URL already
|
|
16017
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16018
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16019
|
+
*/
|
|
16020
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16021
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16022
|
+
bundle: object({
|
|
16023
|
+
ticket: PeerBytesTicketSchema,
|
|
16024
|
+
bytes: number().int().positive(),
|
|
16025
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16026
|
+
}),
|
|
16027
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16028
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16029
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16030
|
+
distribute: boolean()
|
|
16031
|
+
});
|
|
16032
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16033
|
+
kind: literal("imported"),
|
|
16034
|
+
modelIds: array(string()).readonly(),
|
|
16035
|
+
distributed: array(object({
|
|
16036
|
+
modelId: string(),
|
|
16037
|
+
nodeId: string(),
|
|
16038
|
+
format: _enum(MODEL_FORMATS),
|
|
16039
|
+
ok: boolean(),
|
|
16040
|
+
error: string().optional()
|
|
16041
|
+
})).readonly()
|
|
16042
|
+
}), object({
|
|
16043
|
+
kind: literal("refused"),
|
|
16044
|
+
reason: _enum([
|
|
16045
|
+
"transfer-failed",
|
|
16046
|
+
"checksum-mismatch",
|
|
16047
|
+
"bundle-mismatch",
|
|
16048
|
+
"invalid-entry",
|
|
16049
|
+
"id-taken"
|
|
16050
|
+
]),
|
|
16051
|
+
detail: string()
|
|
16052
|
+
})]);
|
|
16053
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16054
|
+
kind: "mutation",
|
|
16055
|
+
auth: "admin",
|
|
16056
|
+
timeoutMs: 30 * 6e4
|
|
16057
|
+
});
|
|
14514
16058
|
/**
|
|
14515
16059
|
* Query filter for settings-store collections.
|
|
14516
16060
|
*/
|
|
@@ -14893,6 +16437,253 @@ id: union([string(), number()]) }), {
|
|
|
14893
16437
|
kind: "mutation",
|
|
14894
16438
|
auth: "admin"
|
|
14895
16439
|
});
|
|
16440
|
+
/**
|
|
16441
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16442
|
+
*
|
|
16443
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
16444
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
16445
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
16446
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
16447
|
+
* against the CALLER, never against anything the caller claims.
|
|
16448
|
+
*
|
|
16449
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
16450
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
16451
|
+
* connection, the agent from its child's connection carried in
|
|
16452
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
16453
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
16454
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
16455
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
16456
|
+
* runner is the same OS user): see the threat model in
|
|
16457
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
16458
|
+
*
|
|
16459
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
16460
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
16461
|
+
* floors every method to admin anyway (D240).
|
|
16462
|
+
*
|
|
16463
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
16464
|
+
*/
|
|
16465
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
16466
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
16467
|
+
"key-missing",
|
|
16468
|
+
"wrong-key",
|
|
16469
|
+
"key-file-unreadable",
|
|
16470
|
+
"store-unavailable",
|
|
16471
|
+
"not-initialized",
|
|
16472
|
+
"decrypt-failed"
|
|
16473
|
+
]);
|
|
16474
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
16475
|
+
state: literal("locked"),
|
|
16476
|
+
reason: KeychainUnavailableReasonSchema
|
|
16477
|
+
})]);
|
|
16478
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
16479
|
+
object({
|
|
16480
|
+
kind: literal("value"),
|
|
16481
|
+
value: string(),
|
|
16482
|
+
version: number().int()
|
|
16483
|
+
}),
|
|
16484
|
+
object({ kind: literal("missing") }),
|
|
16485
|
+
object({
|
|
16486
|
+
kind: literal("unavailable"),
|
|
16487
|
+
reason: KeychainUnavailableReasonSchema
|
|
16488
|
+
}),
|
|
16489
|
+
object({ kind: literal("forbidden") })
|
|
16490
|
+
]);
|
|
16491
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
16492
|
+
/** Metadata of one stored value — never the value. */
|
|
16493
|
+
var KeychainSecretMetaSchema = object({
|
|
16494
|
+
ref: string(),
|
|
16495
|
+
owner: string(),
|
|
16496
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
16497
|
+
scope: string(),
|
|
16498
|
+
fieldPath: string(),
|
|
16499
|
+
version: number().int(),
|
|
16500
|
+
createdAt: number(),
|
|
16501
|
+
updatedAt: number(),
|
|
16502
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16503
|
+
updatedBy: string(),
|
|
16504
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
16505
|
+
lastReadAt: number().nullable()
|
|
16506
|
+
});
|
|
16507
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
16508
|
+
method(object({
|
|
16509
|
+
ref: string().min(1),
|
|
16510
|
+
value: string().min(1)
|
|
16511
|
+
}), object({
|
|
16512
|
+
ref: string(),
|
|
16513
|
+
version: number().int()
|
|
16514
|
+
}), {
|
|
16515
|
+
kind: "mutation",
|
|
16516
|
+
auth: "admin"
|
|
16517
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
16518
|
+
kind: "mutation",
|
|
16519
|
+
auth: "admin"
|
|
16520
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
16521
|
+
var KeychainKeySourceSchema = object({
|
|
16522
|
+
kind: _enum([
|
|
16523
|
+
"config-file",
|
|
16524
|
+
"previous-config-file",
|
|
16525
|
+
"platform",
|
|
16526
|
+
"default-file"
|
|
16527
|
+
]),
|
|
16528
|
+
/** File sources only — a path is not a secret. */
|
|
16529
|
+
path: string().optional(),
|
|
16530
|
+
/**
|
|
16531
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
16532
|
+
* next to the database it protects (the default file). The page warns.
|
|
16533
|
+
*/
|
|
16534
|
+
sharesBackupWithDatabase: boolean()
|
|
16535
|
+
});
|
|
16536
|
+
/**
|
|
16537
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16538
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16539
|
+
*/
|
|
16540
|
+
var KeychainResetRecordSchema = object({
|
|
16541
|
+
id: string(),
|
|
16542
|
+
at: number(),
|
|
16543
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16544
|
+
actor: string(),
|
|
16545
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16546
|
+
lockedReason: string().nullable(),
|
|
16547
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16548
|
+
archived: number().int(),
|
|
16549
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16550
|
+
archivedCollection: string().nullable(),
|
|
16551
|
+
/**
|
|
16552
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16553
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16554
|
+
*/
|
|
16555
|
+
archivedKeysCollection: string().nullable(),
|
|
16556
|
+
/**
|
|
16557
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16558
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16559
|
+
* agent forever (D797).
|
|
16560
|
+
*/
|
|
16561
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16562
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16563
|
+
acknowledgedAt: number().nullable()
|
|
16564
|
+
});
|
|
16565
|
+
var KeychainStatusSchema = object({
|
|
16566
|
+
keychain: KeychainStateSchema,
|
|
16567
|
+
/** The source of the master key in use; `null` while locked. */
|
|
16568
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
16569
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
16570
|
+
configuredSource: KeychainKeySourceSchema,
|
|
16571
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
16572
|
+
fingerprint: string().nullable(),
|
|
16573
|
+
activeKeyId: string().nullable(),
|
|
16574
|
+
/**
|
|
16575
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
16576
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
16577
|
+
*/
|
|
16578
|
+
rotationPending: boolean(),
|
|
16579
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
16580
|
+
retiredWraps: number().int(),
|
|
16581
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
16582
|
+
secretCount: number().int(),
|
|
16583
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16584
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
16585
|
+
});
|
|
16586
|
+
/**
|
|
16587
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
16588
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
16589
|
+
* never reported as an orphan (and never deleted as one).
|
|
16590
|
+
*/
|
|
16591
|
+
var KeychainSecretUsageSchema = _enum([
|
|
16592
|
+
"in-use",
|
|
16593
|
+
"orphan",
|
|
16594
|
+
"unknown"
|
|
16595
|
+
]);
|
|
16596
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
16597
|
+
var KeychainAuditActionSchema = _enum([
|
|
16598
|
+
"put",
|
|
16599
|
+
"delete",
|
|
16600
|
+
"reveal",
|
|
16601
|
+
"rotate-master-key",
|
|
16602
|
+
"purge-retired-keys",
|
|
16603
|
+
"download-recovery-key",
|
|
16604
|
+
"delete-orphans",
|
|
16605
|
+
"reset",
|
|
16606
|
+
"acknowledge-reset",
|
|
16607
|
+
"initialize"
|
|
16608
|
+
]);
|
|
16609
|
+
var KeychainAuditEntrySchema = object({
|
|
16610
|
+
id: string(),
|
|
16611
|
+
at: number(),
|
|
16612
|
+
action: KeychainAuditActionSchema,
|
|
16613
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
16614
|
+
actor: string(),
|
|
16615
|
+
ref: string().nullable(),
|
|
16616
|
+
detail: string().nullable()
|
|
16617
|
+
});
|
|
16618
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16619
|
+
/**
|
|
16620
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16621
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16622
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16623
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16624
|
+
*/
|
|
16625
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
16626
|
+
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({
|
|
16627
|
+
value: string(),
|
|
16628
|
+
version: number().int()
|
|
16629
|
+
}), {
|
|
16630
|
+
kind: "mutation",
|
|
16631
|
+
auth: "admin",
|
|
16632
|
+
caller: "required"
|
|
16633
|
+
}), method(object({
|
|
16634
|
+
name: SystemHeldSecretNameSchema,
|
|
16635
|
+
value: string().min(16)
|
|
16636
|
+
}), object({
|
|
16637
|
+
ref: string(),
|
|
16638
|
+
version: number().int()
|
|
16639
|
+
}), {
|
|
16640
|
+
kind: "mutation",
|
|
16641
|
+
auth: "admin",
|
|
16642
|
+
caller: "required"
|
|
16643
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16644
|
+
deleted: array(string()).readonly(),
|
|
16645
|
+
kept: array(object({
|
|
16646
|
+
ref: string(),
|
|
16647
|
+
usage: KeychainSecretUsageSchema
|
|
16648
|
+
})).readonly()
|
|
16649
|
+
}), {
|
|
16650
|
+
kind: "mutation",
|
|
16651
|
+
auth: "admin",
|
|
16652
|
+
caller: "required"
|
|
16653
|
+
}), method(object({}), object({
|
|
16654
|
+
fingerprint: string(),
|
|
16655
|
+
keySource: KeychainKeySourceSchema
|
|
16656
|
+
}), {
|
|
16657
|
+
kind: "mutation",
|
|
16658
|
+
auth: "admin",
|
|
16659
|
+
caller: "required"
|
|
16660
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
16661
|
+
kind: "mutation",
|
|
16662
|
+
auth: "admin",
|
|
16663
|
+
caller: "required"
|
|
16664
|
+
}), method(object({}), object({
|
|
16665
|
+
key: string(),
|
|
16666
|
+
fingerprint: string(),
|
|
16667
|
+
keySource: KeychainKeySourceSchema
|
|
16668
|
+
}), {
|
|
16669
|
+
kind: "mutation",
|
|
16670
|
+
auth: "admin",
|
|
16671
|
+
caller: "required"
|
|
16672
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
16673
|
+
archivedCollection: string().nullable(),
|
|
16674
|
+
archived: number().int()
|
|
16675
|
+
}), {
|
|
16676
|
+
kind: "mutation",
|
|
16677
|
+
auth: "admin",
|
|
16678
|
+
caller: "required"
|
|
16679
|
+
}), method(object({}), object({
|
|
16680
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16681
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16682
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16683
|
+
kind: "mutation",
|
|
16684
|
+
auth: "admin",
|
|
16685
|
+
caller: "required"
|
|
16686
|
+
});
|
|
14896
16687
|
method(_void(), object({
|
|
14897
16688
|
id: string(),
|
|
14898
16689
|
name: string(),
|
|
@@ -16135,7 +17926,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
16135
17926
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16136
17927
|
var DevicePersistConfigPayloadSchema = object({
|
|
16137
17928
|
deviceId: number(),
|
|
16138
|
-
data: record(string(), unknown())
|
|
17929
|
+
data: record(string(), unknown()),
|
|
17930
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17931
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17932
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17933
|
+
secretConfigPaths: array(string()).optional()
|
|
16139
17934
|
});
|
|
16140
17935
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
16141
17936
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17738,7 +19533,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17738
19533
|
* `login-method` — collection cap through which auth addons contribute
|
|
17739
19534
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17740
19535
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17741
|
-
* every auth addon (OIDC,
|
|
19536
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17742
19537
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17743
19538
|
* procedure aggregates them for the unauthenticated login page.
|
|
17744
19539
|
*
|
|
@@ -17746,8 +19541,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17746
19541
|
*
|
|
17747
19542
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17748
19543
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17749
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17750
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19544
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17751
19545
|
* login page needs NO change.
|
|
17752
19546
|
*
|
|
17753
19547
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17766,8 +19560,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17766
19560
|
* decision.
|
|
17767
19561
|
*
|
|
17768
19562
|
* Every contribution carries a `stage`:
|
|
17769
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17770
|
-
*
|
|
19563
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19564
|
+
* buttons; a usernameless passkey).
|
|
17771
19565
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17772
19566
|
* returned `factors` (passkey-as-2FA today).
|
|
17773
19567
|
*
|
|
@@ -17794,7 +19588,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17794
19588
|
* The provider names an external identity a signed-in user can link to
|
|
17795
19589
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17796
19590
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17797
|
-
* whatever their id. Absent / false — a login button only
|
|
19591
|
+
* whatever their id. Absent / false — a login button only.
|
|
17798
19592
|
*/
|
|
17799
19593
|
linkable: boolean().optional()
|
|
17800
19594
|
}),
|
|
@@ -21649,8 +23443,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21649
23443
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21650
23444
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21651
23445
|
* distinction was only ever used to route role-specific procedures
|
|
21652
|
-
* which we no longer have.
|
|
21653
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23446
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21654
23447
|
* with `isAdmin: false` + an explicit scope list.
|
|
21655
23448
|
*/
|
|
21656
23449
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23152,8 +24945,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
23152
24945
|
]);
|
|
23153
24946
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
23154
24947
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
23155
|
-
/**
|
|
23156
|
-
|
|
24948
|
+
/**
|
|
24949
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24950
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24951
|
+
*
|
|
24952
|
+
* - `operator` — drawn by hand.
|
|
24953
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24954
|
+
* model, or a larger teacher model).
|
|
24955
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24956
|
+
* back from the track store (never a re-run).
|
|
24957
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24958
|
+
*/
|
|
24959
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24960
|
+
"operator",
|
|
24961
|
+
"assist",
|
|
24962
|
+
"pipeline",
|
|
24963
|
+
"llm"
|
|
24964
|
+
]);
|
|
23157
24965
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
23158
24966
|
var RetrainBboxSchema = object({
|
|
23159
24967
|
x: number(),
|
|
@@ -23171,7 +24979,8 @@ var RetrainBboxSchema = object({
|
|
|
23171
24979
|
*/
|
|
23172
24980
|
var RetrainAnnotationSchema = object({
|
|
23173
24981
|
id: string(),
|
|
23174
|
-
|
|
24982
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24983
|
+
trackId: string().optional(),
|
|
23175
24984
|
deviceId: number(),
|
|
23176
24985
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
23177
24986
|
mediaKey: string(),
|
|
@@ -23220,13 +25029,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23220
25029
|
* fail, whatever became of the original. */
|
|
23221
25030
|
copied: boolean()
|
|
23222
25031
|
});
|
|
25032
|
+
/**
|
|
25033
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
25034
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
25035
|
+
* box recorded on the source media row when there is one, else the track
|
|
25036
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
25037
|
+
* until the operator confirms it.
|
|
25038
|
+
*/
|
|
25039
|
+
var RetrainPipelineBoxSchema = object({
|
|
25040
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
25041
|
+
bbox: RetrainBboxSchema,
|
|
25042
|
+
macroClass: RetrainMacroClassSchema,
|
|
25043
|
+
label: string().optional(),
|
|
25044
|
+
subLabel: string().optional(),
|
|
25045
|
+
/** The detection score of the position used, when it was recorded. */
|
|
25046
|
+
score: number().optional(),
|
|
25047
|
+
/** The root model that produced the track, when it was recorded. */
|
|
25048
|
+
modelId: string().optional(),
|
|
25049
|
+
trackId: string(),
|
|
25050
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
25051
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
25052
|
+
basis: _enum(["subject-box", "position"]),
|
|
25053
|
+
deltaMs: number()
|
|
25054
|
+
});
|
|
25055
|
+
/**
|
|
25056
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
25057
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
25058
|
+
* track at all.
|
|
25059
|
+
*/
|
|
25060
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23223
25061
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23224
25062
|
var RetrainFrameSchema = object({
|
|
23225
25063
|
frameId: string(),
|
|
23226
25064
|
deviceId: number(),
|
|
23227
|
-
|
|
23228
|
-
/**
|
|
23229
|
-
|
|
25065
|
+
origin: RetrainFrameOriginSchema,
|
|
25066
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
25067
|
+
trackId: string().optional(),
|
|
25068
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
25069
|
+
* Absent on a recording still. */
|
|
25070
|
+
sourceMediaId: number().int().optional(),
|
|
25071
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
25072
|
+
epochMs: number().optional(),
|
|
23230
25073
|
sourceKind: MediaFileKindEnum,
|
|
23231
25074
|
sizeBytes: number().int(),
|
|
23232
25075
|
width: number().int(),
|
|
@@ -23237,7 +25080,12 @@ var RetrainFrameSchema = object({
|
|
|
23237
25080
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
23238
25081
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23239
25082
|
* a false positive. */
|
|
23240
|
-
complete: boolean()
|
|
25083
|
+
complete: boolean(),
|
|
25084
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
25085
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
25086
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
25087
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
25088
|
+
collectionIds: array(string()).readonly().optional()
|
|
23241
25089
|
});
|
|
23242
25090
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23243
25091
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23268,6 +25116,11 @@ var RetrainFrameListSchema = object({
|
|
|
23268
25116
|
var RetrainExportFilterSchema = object({
|
|
23269
25117
|
deviceIds: array(number()).optional(),
|
|
23270
25118
|
frameIds: array(string()).max(2e4).optional(),
|
|
25119
|
+
/** Only frames in at least one of these named collections. */
|
|
25120
|
+
collectionIds: array(string()).max(200).optional(),
|
|
25121
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25122
|
+
* unknown id selects nothing. */
|
|
25123
|
+
datasetVersionId: string().optional(),
|
|
23271
25124
|
batchId: string().optional(),
|
|
23272
25125
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23273
25126
|
completeOnly: boolean().optional()
|
|
@@ -23332,6 +25185,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23332
25185
|
reason: string(),
|
|
23333
25186
|
detail: string().optional()
|
|
23334
25187
|
})]);
|
|
25188
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
25189
|
+
var RetrainCollectionSchema = object({
|
|
25190
|
+
id: string(),
|
|
25191
|
+
name: string(),
|
|
25192
|
+
createdAt: number(),
|
|
25193
|
+
frameCount: number().int()
|
|
25194
|
+
});
|
|
25195
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
25196
|
+
kind: literal("created"),
|
|
25197
|
+
collection: RetrainCollectionSchema
|
|
25198
|
+
}), object({
|
|
25199
|
+
kind: literal("refused"),
|
|
25200
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
25201
|
+
})]);
|
|
25202
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
25203
|
+
kind: literal("renamed"),
|
|
25204
|
+
collection: RetrainCollectionSchema
|
|
25205
|
+
}), object({
|
|
25206
|
+
kind: literal("refused"),
|
|
25207
|
+
reason: _enum([
|
|
25208
|
+
"empty-name",
|
|
25209
|
+
"duplicate-name",
|
|
25210
|
+
"unknown-collection"
|
|
25211
|
+
])
|
|
25212
|
+
})]);
|
|
25213
|
+
/**
|
|
25214
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
25215
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
25216
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
25217
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
25218
|
+
*/
|
|
25219
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
25220
|
+
kind: literal("added"),
|
|
25221
|
+
collectionId: string(),
|
|
25222
|
+
frame: RetrainFrameSchema,
|
|
25223
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
25224
|
+
reused: boolean()
|
|
25225
|
+
}), object({
|
|
25226
|
+
kind: literal("refused"),
|
|
25227
|
+
reason: _enum([
|
|
25228
|
+
"unknown-collection",
|
|
25229
|
+
"still-unavailable",
|
|
25230
|
+
"still-busy",
|
|
25231
|
+
"unreadable-image",
|
|
25232
|
+
"write-failed"
|
|
25233
|
+
]),
|
|
25234
|
+
detail: string().optional()
|
|
25235
|
+
})]);
|
|
25236
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
25237
|
+
var RetrainAssistProfileSchema = object({
|
|
25238
|
+
id: string(),
|
|
25239
|
+
name: string(),
|
|
25240
|
+
model: string(),
|
|
25241
|
+
kind: string(),
|
|
25242
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
25243
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
25244
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
25245
|
+
leavesHouse: boolean()
|
|
25246
|
+
});
|
|
25247
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
25248
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
25249
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
25250
|
+
var RetrainLlmReviewSchema = object({
|
|
25251
|
+
/** The `ref` the page sent the box under. */
|
|
25252
|
+
ref: string(),
|
|
25253
|
+
verdict: _enum([
|
|
25254
|
+
"confirmed",
|
|
25255
|
+
"wrong-class",
|
|
25256
|
+
"not-an-object",
|
|
25257
|
+
"uncertain"
|
|
25258
|
+
]),
|
|
25259
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
25260
|
+
reason: string()
|
|
25261
|
+
});
|
|
25262
|
+
/**
|
|
25263
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
25264
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
25265
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
25266
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
25267
|
+
*/
|
|
25268
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
25269
|
+
kind: literal("proposed"),
|
|
25270
|
+
profileId: string(),
|
|
25271
|
+
model: string(),
|
|
25272
|
+
/** The frame was sent outside the house for this answer. */
|
|
25273
|
+
leftHouse: boolean(),
|
|
25274
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
25275
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
25276
|
+
rejected: number().int()
|
|
25277
|
+
}), object({
|
|
25278
|
+
kind: literal("refused"),
|
|
25279
|
+
reason: _enum([
|
|
25280
|
+
"unknown-frame",
|
|
25281
|
+
"unreadable-frame",
|
|
25282
|
+
"unknown-profile",
|
|
25283
|
+
"profile-disabled",
|
|
25284
|
+
"no-vision",
|
|
25285
|
+
"cloud-not-confirmed",
|
|
25286
|
+
"llm-error",
|
|
25287
|
+
"malformed-answer"
|
|
25288
|
+
]),
|
|
25289
|
+
detail: string().optional()
|
|
25290
|
+
})]);
|
|
25291
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25292
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25293
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25294
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25295
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25296
|
+
});
|
|
25297
|
+
/** The counts a dataset is judged by. */
|
|
25298
|
+
var RetrainDatasetStatsSchema = object({
|
|
25299
|
+
frames: number().int(),
|
|
25300
|
+
completeFrames: number().int(),
|
|
25301
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25302
|
+
completeness: number(),
|
|
25303
|
+
/** Boxes to learn (model errors excluded). */
|
|
25304
|
+
subjects: number().int(),
|
|
25305
|
+
modelErrors: number().int(),
|
|
25306
|
+
/** Complete frames with no subject. */
|
|
25307
|
+
hardNegatives: number().int(),
|
|
25308
|
+
/** Subjects per class × camera × day/night. */
|
|
25309
|
+
cells: array(object({
|
|
25310
|
+
macroClass: string(),
|
|
25311
|
+
deviceId: number(),
|
|
25312
|
+
lighting: _enum([
|
|
25313
|
+
"day",
|
|
25314
|
+
"night",
|
|
25315
|
+
"unknown"
|
|
25316
|
+
]),
|
|
25317
|
+
subjects: number().int(),
|
|
25318
|
+
frames: number().int()
|
|
25319
|
+
})).readonly(),
|
|
25320
|
+
cameras: array(object({
|
|
25321
|
+
deviceId: number(),
|
|
25322
|
+
frames: number().int(),
|
|
25323
|
+
completeFrames: number().int()
|
|
25324
|
+
})).readonly()
|
|
25325
|
+
});
|
|
25326
|
+
/** An immutable dataset version, without its frame list. */
|
|
25327
|
+
var RetrainDatasetVersionSchema = object({
|
|
25328
|
+
id: string(),
|
|
25329
|
+
name: string(),
|
|
25330
|
+
createdAt: number(),
|
|
25331
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25332
|
+
layout: RetrainExportLayoutSchema,
|
|
25333
|
+
completeOnly: boolean(),
|
|
25334
|
+
frameCount: number().int(),
|
|
25335
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25336
|
+
annotationHash: string(),
|
|
25337
|
+
/** The export manifest schema the version was cut under. */
|
|
25338
|
+
manifestSchema: string(),
|
|
25339
|
+
stats: RetrainDatasetStatsSchema
|
|
25340
|
+
});
|
|
25341
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25342
|
+
kind: literal("created"),
|
|
25343
|
+
version: RetrainDatasetVersionSchema
|
|
25344
|
+
}), object({
|
|
25345
|
+
kind: literal("refused"),
|
|
25346
|
+
reason: _enum([
|
|
25347
|
+
"empty-name",
|
|
25348
|
+
"duplicate-name",
|
|
25349
|
+
"no-frames"
|
|
25350
|
+
])
|
|
25351
|
+
})]);
|
|
23335
25352
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23336
25353
|
var RetrainTransitionResultSchema = object({
|
|
23337
25354
|
trackId: string(),
|
|
@@ -24049,7 +26066,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24049
26066
|
auth: "admin"
|
|
24050
26067
|
}), method(object({
|
|
24051
26068
|
deviceId: number(),
|
|
24052
|
-
trackId: string(),
|
|
26069
|
+
trackId: string().optional(),
|
|
24053
26070
|
frameId: string()
|
|
24054
26071
|
}), object({
|
|
24055
26072
|
removed: boolean(),
|
|
@@ -24066,7 +26083,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24066
26083
|
auth: "admin"
|
|
24067
26084
|
}), method(object({
|
|
24068
26085
|
deviceId: number(),
|
|
24069
|
-
|
|
26086
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26087
|
+
trackId: string().optional(),
|
|
24070
26088
|
frameId: string(),
|
|
24071
26089
|
subject: RetrainAssistSubjectSchema,
|
|
24072
26090
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -24074,12 +26092,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24074
26092
|
}), RetrainAssistResultSchema, {
|
|
24075
26093
|
kind: "mutation",
|
|
24076
26094
|
auth: "admin"
|
|
24077
|
-
}), method(object({
|
|
26095
|
+
}), method(object({
|
|
26096
|
+
trackId: string().optional(),
|
|
26097
|
+
frameIds: array(string()).max(2e3).optional()
|
|
26098
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
24078
26099
|
kind: "query",
|
|
24079
26100
|
auth: "admin"
|
|
24080
26101
|
}), method(object({
|
|
24081
26102
|
deviceId: number(),
|
|
24082
|
-
|
|
26103
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26104
|
+
trackId: string().optional(),
|
|
24083
26105
|
frameId: string(),
|
|
24084
26106
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
24085
26107
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -24102,7 +26124,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24102
26124
|
auth: "admin"
|
|
24103
26125
|
}), method(object({
|
|
24104
26126
|
deviceId: number(),
|
|
24105
|
-
trackId: string(),
|
|
26127
|
+
trackId: string().optional(),
|
|
24106
26128
|
frameId: string(),
|
|
24107
26129
|
complete: boolean()
|
|
24108
26130
|
}), RetrainFrameSchema, {
|
|
@@ -24116,6 +26138,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24116
26138
|
kind: "mutation",
|
|
24117
26139
|
auth: "admin",
|
|
24118
26140
|
timeoutMs: 60 * 6e4
|
|
26141
|
+
}), method(object({
|
|
26142
|
+
filter: RetrainExportFilterSchema,
|
|
26143
|
+
layout: RetrainExportLayoutSchema
|
|
26144
|
+
}), object({
|
|
26145
|
+
ticket: PeerBytesTicketSchema,
|
|
26146
|
+
frames: number().int(),
|
|
26147
|
+
annotations: number().int()
|
|
26148
|
+
}), {
|
|
26149
|
+
kind: "mutation",
|
|
26150
|
+
auth: "admin",
|
|
26151
|
+
timeoutMs: 12e4
|
|
26152
|
+
}), method(object({
|
|
26153
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26154
|
+
completeOnly: boolean().optional()
|
|
26155
|
+
}), RetrainDatasetStatsSchema, {
|
|
26156
|
+
kind: "query",
|
|
26157
|
+
auth: "admin"
|
|
26158
|
+
}), method(object({
|
|
26159
|
+
name: string().max(120),
|
|
26160
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26161
|
+
layout: RetrainExportLayoutSchema,
|
|
26162
|
+
completeOnly: boolean()
|
|
26163
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26164
|
+
kind: "mutation",
|
|
26165
|
+
auth: "admin",
|
|
26166
|
+
timeoutMs: 12e4
|
|
26167
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26168
|
+
kind: "query",
|
|
26169
|
+
auth: "admin"
|
|
26170
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26171
|
+
kind: "mutation",
|
|
26172
|
+
auth: "admin"
|
|
26173
|
+
}), method(object({ id: string() }), object({
|
|
26174
|
+
found: boolean(),
|
|
26175
|
+
annotationHash: string(),
|
|
26176
|
+
matches: boolean(),
|
|
26177
|
+
missingFrames: number().int()
|
|
26178
|
+
}), {
|
|
26179
|
+
kind: "query",
|
|
26180
|
+
auth: "admin",
|
|
26181
|
+
timeoutMs: 12e4
|
|
26182
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
26183
|
+
kind: "query",
|
|
26184
|
+
auth: "admin"
|
|
26185
|
+
}), method(object({
|
|
26186
|
+
deviceId: number(),
|
|
26187
|
+
trackId: string().optional(),
|
|
26188
|
+
frameId: string(),
|
|
26189
|
+
profileId: string(),
|
|
26190
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
26191
|
+
boxes: array(object({
|
|
26192
|
+
ref: string(),
|
|
26193
|
+
bbox: RetrainBboxSchema,
|
|
26194
|
+
macroClass: RetrainMacroClassSchema,
|
|
26195
|
+
label: string().optional()
|
|
26196
|
+
})).max(50),
|
|
26197
|
+
allowCloud: boolean()
|
|
26198
|
+
}), RetrainLlmAssistResultSchema, {
|
|
26199
|
+
kind: "mutation",
|
|
26200
|
+
auth: "admin",
|
|
26201
|
+
timeoutMs: 18e4
|
|
26202
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
26203
|
+
kind: "mutation",
|
|
26204
|
+
auth: "admin"
|
|
26205
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
26206
|
+
kind: "query",
|
|
26207
|
+
auth: "admin"
|
|
26208
|
+
}), method(object({
|
|
26209
|
+
id: string(),
|
|
26210
|
+
name: string().max(120)
|
|
26211
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
26212
|
+
kind: "mutation",
|
|
26213
|
+
auth: "admin"
|
|
26214
|
+
}), method(object({ id: string() }), object({
|
|
26215
|
+
deleted: boolean(),
|
|
26216
|
+
removedFrames: number().int()
|
|
26217
|
+
}), {
|
|
26218
|
+
kind: "mutation",
|
|
26219
|
+
auth: "admin"
|
|
26220
|
+
}), method(object({
|
|
26221
|
+
collectionId: string(),
|
|
26222
|
+
deviceId: number(),
|
|
26223
|
+
epochMs: number()
|
|
26224
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
26225
|
+
kind: "mutation",
|
|
26226
|
+
auth: "admin",
|
|
26227
|
+
timeoutMs: 6e4
|
|
26228
|
+
}), method(object({
|
|
26229
|
+
collectionId: string(),
|
|
26230
|
+
frameIds: array(string()).min(1).max(500)
|
|
26231
|
+
}), object({
|
|
26232
|
+
added: number().int(),
|
|
26233
|
+
alreadyMember: number().int(),
|
|
26234
|
+
unknownFrameIds: array(string()).readonly()
|
|
26235
|
+
}), {
|
|
26236
|
+
kind: "mutation",
|
|
26237
|
+
auth: "admin"
|
|
26238
|
+
}), method(object({
|
|
26239
|
+
collectionId: string(),
|
|
26240
|
+
frameId: string()
|
|
26241
|
+
}), object({
|
|
26242
|
+
removed: boolean(),
|
|
26243
|
+
deletedFrame: boolean()
|
|
26244
|
+
}), {
|
|
26245
|
+
kind: "mutation",
|
|
26246
|
+
auth: "admin"
|
|
26247
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
26248
|
+
kind: "query",
|
|
26249
|
+
auth: "admin"
|
|
24119
26250
|
}), method(object({
|
|
24120
26251
|
/** Which of the three event tables owns the row. */
|
|
24121
26252
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24739,13 +26870,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24739
26870
|
object({
|
|
24740
26871
|
kind: literal("no-family-build"),
|
|
24741
26872
|
format: ModelFormatSchema$1
|
|
26873
|
+
}),
|
|
26874
|
+
object({
|
|
26875
|
+
kind: literal("kept-custom-pin"),
|
|
26876
|
+
modelId: string(),
|
|
26877
|
+
deviceKey: string()
|
|
24742
26878
|
})
|
|
24743
26879
|
]);
|
|
26880
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26881
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26882
|
+
/**
|
|
26883
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26884
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26885
|
+
*/
|
|
26886
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26887
|
+
kind: literal("node-benchmark"),
|
|
26888
|
+
resultId: string(),
|
|
26889
|
+
measuredAtMs: number()
|
|
26890
|
+
})]);
|
|
24744
26891
|
var DeviceModelChoiceSchema = object({
|
|
24745
26892
|
modelId: string(),
|
|
24746
26893
|
p50Ms: number(),
|
|
24747
26894
|
fps: number(),
|
|
24748
26895
|
measured: boolean(),
|
|
26896
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26897
|
+
source: LatencySourceSchema.optional(),
|
|
24749
26898
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24750
26899
|
capacitySessions: number(),
|
|
24751
26900
|
personRecall: number()
|
|
@@ -24756,6 +26905,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24756
26905
|
enabled: boolean(),
|
|
24757
26906
|
available: boolean(),
|
|
24758
26907
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26908
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26909
|
+
kept: KeptReasonSchema.optional(),
|
|
24759
26910
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24760
26911
|
});
|
|
24761
26912
|
var NodeRecommendationSchema = object({
|
|
@@ -24809,6 +26960,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24809
26960
|
kind: literal("coral-enabled"),
|
|
24810
26961
|
nodeId: string(),
|
|
24811
26962
|
deviceKey: string()
|
|
26963
|
+
}),
|
|
26964
|
+
object({
|
|
26965
|
+
kind: literal("custom-pin-kept"),
|
|
26966
|
+
nodeId: string(),
|
|
26967
|
+
deviceKey: string().nullable(),
|
|
26968
|
+
deviceId: number().nullable(),
|
|
26969
|
+
modelId: string()
|
|
26970
|
+
}),
|
|
26971
|
+
object({
|
|
26972
|
+
kind: literal("custom-registry-unreadable"),
|
|
26973
|
+
error: string()
|
|
24812
26974
|
})
|
|
24813
26975
|
]);
|
|
24814
26976
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24987,13 +27149,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24987
27149
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24988
27150
|
});
|
|
24989
27151
|
/**
|
|
24990
|
-
* Where the node and device shares come from (D750, D755).
|
|
24991
|
-
* - `
|
|
24992
|
-
*
|
|
24993
|
-
*
|
|
24994
|
-
*
|
|
24995
|
-
*
|
|
24996
|
-
*
|
|
27152
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
27153
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
27154
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
27155
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
27156
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
27157
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
27158
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
27159
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24997
27160
|
* - `manual` — the operator's stored sliders.
|
|
24998
27161
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24999
27162
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -25042,6 +27205,362 @@ var EffectiveSharesSchema = object({
|
|
|
25042
27205
|
nodeWeights: record(string(), number()),
|
|
25043
27206
|
deviceWeights: record(string(), record(string(), number()))
|
|
25044
27207
|
});
|
|
27208
|
+
/**
|
|
27209
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
27210
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
27211
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
27212
|
+
* shares read.
|
|
27213
|
+
*
|
|
27214
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
27215
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
27216
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
27217
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
27218
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
27219
|
+
*
|
|
27220
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
27221
|
+
* cross a process at frame rate, D9):
|
|
27222
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
27223
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
27224
|
+
* interval;
|
|
27225
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
27226
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
27227
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
27228
|
+
* CPU, RAM or the event loop give out.
|
|
27229
|
+
*/
|
|
27230
|
+
/** Defaults and bounds, one place. */
|
|
27231
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
27232
|
+
fpsPerStream: 10,
|
|
27233
|
+
budgetMinutes: 45,
|
|
27234
|
+
minBudgetMinutes: 10,
|
|
27235
|
+
maxBudgetMinutes: 120,
|
|
27236
|
+
/** A result older than this no longer beats the table. */
|
|
27237
|
+
staleAfterDays: 30,
|
|
27238
|
+
/** Warm-in per ramp step (not accounted). */
|
|
27239
|
+
settleSec: 5,
|
|
27240
|
+
/** Accounted window per ramp step. */
|
|
27241
|
+
measureSec: 20,
|
|
27242
|
+
/** Longest the drain may take before the run is refused. */
|
|
27243
|
+
drainTimeoutSec: 120,
|
|
27244
|
+
/** Candidate models per device in one run. */
|
|
27245
|
+
maxModelsPerDevice: 6
|
|
27246
|
+
};
|
|
27247
|
+
/** The two measurements a run can make. */
|
|
27248
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
27249
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
27250
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
27251
|
+
deviceKey: string().min(1),
|
|
27252
|
+
/**
|
|
27253
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
27254
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
27255
|
+
*/
|
|
27256
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
27257
|
+
});
|
|
27258
|
+
/** What the operator confirmed. */
|
|
27259
|
+
var NodeBenchmarkPlanSchema = object({
|
|
27260
|
+
nodeId: string().min(1),
|
|
27261
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27262
|
+
/** Which measurements run. At least one. */
|
|
27263
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
27264
|
+
/**
|
|
27265
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
27266
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
27267
|
+
* detector always runs.
|
|
27268
|
+
*/
|
|
27269
|
+
steps: array(string().min(1)).default([]),
|
|
27270
|
+
/** Offered rate of one stream / session. */
|
|
27271
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
27272
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
27273
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
27274
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
27275
|
+
keepDownloadedModels: boolean().default(false),
|
|
27276
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
27277
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
27278
|
+
});
|
|
27279
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
27280
|
+
kind: _enum([
|
|
27281
|
+
"benchmark-active",
|
|
27282
|
+
"node-offline",
|
|
27283
|
+
"unknown-device",
|
|
27284
|
+
"no-phase",
|
|
27285
|
+
"insufficient-headroom"
|
|
27286
|
+
]),
|
|
27287
|
+
detail: string(),
|
|
27288
|
+
overridable: boolean()
|
|
27289
|
+
});
|
|
27290
|
+
/** A camera whose detection leaves the node for the run. */
|
|
27291
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
27292
|
+
deviceId: number(),
|
|
27293
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
27294
|
+
placedOnNode: boolean(),
|
|
27295
|
+
/** A node pin naming this node, ignored for the run. */
|
|
27296
|
+
pinnedToNode: boolean()
|
|
27297
|
+
});
|
|
27298
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
27299
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
27300
|
+
deviceId: number(),
|
|
27301
|
+
reason: literal("only-frame-source")
|
|
27302
|
+
});
|
|
27303
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
27304
|
+
nodeId: string(),
|
|
27305
|
+
online: boolean(),
|
|
27306
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
27307
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
27308
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
27309
|
+
estimatedDurationMs: number(),
|
|
27310
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
27311
|
+
budgetMs: number(),
|
|
27312
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
27313
|
+
steps: array(string()).readonly(),
|
|
27314
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
27315
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
27316
|
+
headroom: object({
|
|
27317
|
+
sessionsNow: number(),
|
|
27318
|
+
otherNodesCapacitySessions: number().nullable()
|
|
27319
|
+
}),
|
|
27320
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
27321
|
+
canStart: boolean()
|
|
27322
|
+
});
|
|
27323
|
+
/** Where the measuring runner is. */
|
|
27324
|
+
var NodeBenchProgressSchema = object({
|
|
27325
|
+
phase: _enum([
|
|
27326
|
+
"preparing",
|
|
27327
|
+
"device",
|
|
27328
|
+
"pipeline",
|
|
27329
|
+
"cleanup"
|
|
27330
|
+
]),
|
|
27331
|
+
deviceKey: string().nullable(),
|
|
27332
|
+
modelId: string().nullable(),
|
|
27333
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
27334
|
+
load: number().nullable(),
|
|
27335
|
+
cellsDone: number(),
|
|
27336
|
+
cellsTotal: number(),
|
|
27337
|
+
message: string()
|
|
27338
|
+
});
|
|
27339
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
27340
|
+
var NodeBenchLimitSchema = _enum([
|
|
27341
|
+
"p95",
|
|
27342
|
+
"drops",
|
|
27343
|
+
"errors",
|
|
27344
|
+
"stall",
|
|
27345
|
+
"cpu",
|
|
27346
|
+
"ram",
|
|
27347
|
+
"none"
|
|
27348
|
+
]);
|
|
27349
|
+
var NodeBenchRampStepSchema = object({
|
|
27350
|
+
load: number(),
|
|
27351
|
+
pass: boolean(),
|
|
27352
|
+
p95Ms: number(),
|
|
27353
|
+
dropRatio: number(),
|
|
27354
|
+
/** Completed frames per second over the accounted window. */
|
|
27355
|
+
fps: number(),
|
|
27356
|
+
cpuPct: number().nullable(),
|
|
27357
|
+
ramFreePct: number().nullable(),
|
|
27358
|
+
failReasons: array(string()).readonly()
|
|
27359
|
+
});
|
|
27360
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
27361
|
+
phase: literal("device"),
|
|
27362
|
+
deviceKey: string(),
|
|
27363
|
+
modelId: string(),
|
|
27364
|
+
/** Single-stream latency (the K = 1 step). */
|
|
27365
|
+
p50Ms: number(),
|
|
27366
|
+
p95Ms: number(),
|
|
27367
|
+
p99Ms: number(),
|
|
27368
|
+
/** Frames per second sustained at the last passing step. */
|
|
27369
|
+
fps: number(),
|
|
27370
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
27371
|
+
kMax: number(),
|
|
27372
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27373
|
+
/** First call (model load + warm-up). */
|
|
27374
|
+
warmupMs: number(),
|
|
27375
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27376
|
+
}), object({
|
|
27377
|
+
phase: literal("pipeline"),
|
|
27378
|
+
deviceKey: string(),
|
|
27379
|
+
modelId: string(),
|
|
27380
|
+
steps: array(string()).readonly(),
|
|
27381
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
27382
|
+
maxSessions: number(),
|
|
27383
|
+
limitedBy: NodeBenchLimitSchema,
|
|
27384
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
27385
|
+
stepsFired: array(string()).readonly(),
|
|
27386
|
+
warmupMs: number(),
|
|
27387
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
27388
|
+
})]);
|
|
27389
|
+
/**
|
|
27390
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
27391
|
+
* the node no longer beats the table.
|
|
27392
|
+
*/
|
|
27393
|
+
var NodeBenchFingerprintSchema = object({
|
|
27394
|
+
pipelineVersion: string().nullable(),
|
|
27395
|
+
cpuModel: string().nullable(),
|
|
27396
|
+
ramGb: number().nullable(),
|
|
27397
|
+
os: string().nullable(),
|
|
27398
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
27399
|
+
pools: record(string(), object({
|
|
27400
|
+
runtime: string(),
|
|
27401
|
+
numWorkers: number(),
|
|
27402
|
+
concurrency: number(),
|
|
27403
|
+
batchMode: string()
|
|
27404
|
+
})).default({})
|
|
27405
|
+
});
|
|
27406
|
+
/** The frames the run used. */
|
|
27407
|
+
var NodeBenchClipSchema = object({
|
|
27408
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
27409
|
+
id: string(),
|
|
27410
|
+
revision: string().nullable(),
|
|
27411
|
+
frames: number(),
|
|
27412
|
+
width: number(),
|
|
27413
|
+
height: number()
|
|
27414
|
+
});
|
|
27415
|
+
var NodeBenchRunnerInputSchema = object({
|
|
27416
|
+
runId: string().min(1),
|
|
27417
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
27418
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
27419
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
27420
|
+
steps: array(string()).default([]),
|
|
27421
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
27422
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
27423
|
+
deadlineAtMs: number(),
|
|
27424
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
27425
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
27426
|
+
keepDownloadedModels: boolean().default(false)
|
|
27427
|
+
});
|
|
27428
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
27429
|
+
"running",
|
|
27430
|
+
"done",
|
|
27431
|
+
"failed",
|
|
27432
|
+
"aborted"
|
|
27433
|
+
]);
|
|
27434
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
27435
|
+
runId: string(),
|
|
27436
|
+
nodeId: string(),
|
|
27437
|
+
state: NodeBenchRunnerStateSchema,
|
|
27438
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27439
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
27440
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
27441
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27442
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27443
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
27444
|
+
activeCameraIds: array(number()).readonly(),
|
|
27445
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
27446
|
+
deletedModels: array(string()).readonly(),
|
|
27447
|
+
error: string().nullable(),
|
|
27448
|
+
startedAtMs: number(),
|
|
27449
|
+
finishedAtMs: number().nullable()
|
|
27450
|
+
});
|
|
27451
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
27452
|
+
"draining",
|
|
27453
|
+
"measuring",
|
|
27454
|
+
"restoring",
|
|
27455
|
+
"done",
|
|
27456
|
+
"failed",
|
|
27457
|
+
"aborted"
|
|
27458
|
+
]);
|
|
27459
|
+
/** Why a run ended. */
|
|
27460
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
27461
|
+
"completed",
|
|
27462
|
+
"operator-abort",
|
|
27463
|
+
"deadline",
|
|
27464
|
+
"node-lost",
|
|
27465
|
+
"runner-lost",
|
|
27466
|
+
"hub-restart",
|
|
27467
|
+
"drain-timeout",
|
|
27468
|
+
"failed"
|
|
27469
|
+
]);
|
|
27470
|
+
var NodeBenchmarkRunSchema = object({
|
|
27471
|
+
runId: string(),
|
|
27472
|
+
nodeId: string(),
|
|
27473
|
+
state: NodeBenchmarkStateSchema,
|
|
27474
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27475
|
+
startedAtMs: number(),
|
|
27476
|
+
deadlineAtMs: number(),
|
|
27477
|
+
finishedAtMs: number().nullable(),
|
|
27478
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
27479
|
+
error: string().nullable(),
|
|
27480
|
+
/** Cameras moved off the node for the run. */
|
|
27481
|
+
moved: array(number()).readonly(),
|
|
27482
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
27483
|
+
staying: array(number()).readonly(),
|
|
27484
|
+
/** Something else ran on the node's pools during the run. */
|
|
27485
|
+
contaminated: boolean(),
|
|
27486
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
27487
|
+
resultIds: array(string()).readonly()
|
|
27488
|
+
});
|
|
27489
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
27490
|
+
var NodeBenchmarkStatusSchema = object({
|
|
27491
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
27492
|
+
modeNodeId: string().nullable(),
|
|
27493
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
27494
|
+
});
|
|
27495
|
+
/**
|
|
27496
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
27497
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
27498
|
+
* ends, never by anyone else.
|
|
27499
|
+
*/
|
|
27500
|
+
var NodeBenchmarkResultSchema = object({
|
|
27501
|
+
id: string(),
|
|
27502
|
+
runId: string(),
|
|
27503
|
+
nodeId: string(),
|
|
27504
|
+
cell: NodeBenchCellSchema,
|
|
27505
|
+
fpsPerStream: number(),
|
|
27506
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
27507
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
27508
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
27509
|
+
contaminated: boolean(),
|
|
27510
|
+
stayingCameras: array(number()).readonly(),
|
|
27511
|
+
/** The run ended early; the cell itself completed. */
|
|
27512
|
+
partialRun: boolean(),
|
|
27513
|
+
measuredAtMs: number()
|
|
27514
|
+
});
|
|
27515
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
27516
|
+
nodeId: string().optional(),
|
|
27517
|
+
deviceKey: string().optional()
|
|
27518
|
+
});
|
|
27519
|
+
/** A result with its standing today: does it still beat the table? */
|
|
27520
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
27521
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
27522
|
+
standing: _enum([
|
|
27523
|
+
"fresh",
|
|
27524
|
+
"stale",
|
|
27525
|
+
"superseded"
|
|
27526
|
+
]),
|
|
27527
|
+
staleWhy: _enum([
|
|
27528
|
+
"age",
|
|
27529
|
+
"runtime",
|
|
27530
|
+
"pool-tuning"
|
|
27531
|
+
]).nullable()
|
|
27532
|
+
});
|
|
27533
|
+
object({
|
|
27534
|
+
runId: string(),
|
|
27535
|
+
nodeId: string(),
|
|
27536
|
+
startedAtMs: number(),
|
|
27537
|
+
deadlineAtMs: number(),
|
|
27538
|
+
plan: NodeBenchmarkPlanSchema,
|
|
27539
|
+
moved: array(number()).readonly(),
|
|
27540
|
+
staying: array(number()).readonly()
|
|
27541
|
+
});
|
|
27542
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
27543
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
27544
|
+
nodeId: string(),
|
|
27545
|
+
reachable: boolean(),
|
|
27546
|
+
devices: array(object({
|
|
27547
|
+
deviceKey: string(),
|
|
27548
|
+
enabled: boolean(),
|
|
27549
|
+
available: boolean(),
|
|
27550
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
27551
|
+
suggested: array(string()).readonly(),
|
|
27552
|
+
/** Every root detector the device has a build for. */
|
|
27553
|
+
all: array(string()).readonly(),
|
|
27554
|
+
/** The model the device runs now, when pinned. */
|
|
27555
|
+
currentModelId: string().nullable()
|
|
27556
|
+
})).readonly(),
|
|
27557
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
27558
|
+
steps: array(object({
|
|
27559
|
+
id: string(),
|
|
27560
|
+
name: string(),
|
|
27561
|
+
slot: string()
|
|
27562
|
+
})).readonly()
|
|
27563
|
+
});
|
|
25045
27564
|
object({
|
|
25046
27565
|
activeCameras: number(),
|
|
25047
27566
|
throttledCameras: number(),
|
|
@@ -26170,7 +28689,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
26170
28689
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
26171
28690
|
deviceId: number(),
|
|
26172
28691
|
trackId: string()
|
|
26173
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28692
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28693
|
+
accepted: literal(true),
|
|
28694
|
+
runId: string()
|
|
28695
|
+
}), {
|
|
28696
|
+
kind: "mutation",
|
|
28697
|
+
auth: "admin"
|
|
28698
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28699
|
+
kind: "mutation",
|
|
28700
|
+
auth: "admin"
|
|
28701
|
+
});
|
|
26174
28702
|
var CameraPipelineConfigSchema = object({
|
|
26175
28703
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
26176
28704
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26809,6 +29337,21 @@ method(object({
|
|
|
26809
29337
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26810
29338
|
kind: "mutation",
|
|
26811
29339
|
auth: "admin"
|
|
29340
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
29341
|
+
kind: literal("started"),
|
|
29342
|
+
runId: string()
|
|
29343
|
+
}), object({
|
|
29344
|
+
kind: literal("refused"),
|
|
29345
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
29346
|
+
})]), {
|
|
29347
|
+
kind: "mutation",
|
|
29348
|
+
auth: "admin"
|
|
29349
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
29350
|
+
kind: "mutation",
|
|
29351
|
+
auth: "admin"
|
|
29352
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
29353
|
+
kind: "mutation",
|
|
29354
|
+
auth: "admin"
|
|
26812
29355
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26813
29356
|
deviceId: number(),
|
|
26814
29357
|
addonId: string(),
|
|
@@ -27214,8 +29757,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27214
29757
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27215
29758
|
*
|
|
27216
29759
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27217
|
-
* one for transactional / one for notifications). Consumers (
|
|
27218
|
-
*
|
|
29760
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29761
|
+
* addons, …) walk the collection and pick the first
|
|
27219
29762
|
* ready provider OR target a specific addonId.
|
|
27220
29763
|
*
|
|
27221
29764
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27394,7 +29937,7 @@ targets: array(object({
|
|
|
27394
29937
|
})));
|
|
27395
29938
|
/**
|
|
27396
29939
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27397
|
-
* providers (OIDC, SAML,
|
|
29940
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27398
29941
|
* carrying the post-callback claims before redirecting back to
|
|
27399
29942
|
* `/api/auth/sso/finish`.
|
|
27400
29943
|
*
|
|
@@ -27457,7 +30000,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27457
30000
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
27458
30001
|
* subject is unique only per issuer, so a link is bound to it.
|
|
27459
30002
|
*/
|
|
27460
|
-
issuer: string().optional()
|
|
30003
|
+
issuer: string().optional(),
|
|
30004
|
+
/**
|
|
30005
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30006
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30007
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30008
|
+
* any other browser.
|
|
30009
|
+
*/
|
|
30010
|
+
browserBinding: string().optional()
|
|
27461
30011
|
});
|
|
27462
30012
|
method(object({
|
|
27463
30013
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32924,6 +35474,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32924
35474
|
enabled: boolean().optional(),
|
|
32925
35475
|
info: record(string(), unknown()).optional(),
|
|
32926
35476
|
settings: record(string(), unknown()).optional(),
|
|
35477
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
35478
|
+
* the keychain, not the table (D787). */
|
|
35479
|
+
secretKeys: array(string()).optional(),
|
|
32927
35480
|
skipRestart: boolean().optional()
|
|
32928
35481
|
});
|
|
32929
35482
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32947,7 +35500,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32947
35500
|
auth: "admin"
|
|
32948
35501
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32949
35502
|
id: string(),
|
|
32950
|
-
settings: record(string(), unknown())
|
|
35503
|
+
settings: record(string(), unknown()),
|
|
35504
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
35505
|
+
secretKeys: array(string()).optional()
|
|
32951
35506
|
}), object({ success: boolean() }), {
|
|
32952
35507
|
kind: "mutation",
|
|
32953
35508
|
auth: "admin"
|
|
@@ -39719,16 +42274,6 @@ var ApiKeySummarySchema = object({
|
|
|
39719
42274
|
createdAt: number(),
|
|
39720
42275
|
lastUsedAt: number().optional()
|
|
39721
42276
|
});
|
|
39722
|
-
var CreateApiKeyInputSchema = object({
|
|
39723
|
-
label: string(),
|
|
39724
|
-
isAdmin: boolean().default(false),
|
|
39725
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39726
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39727
|
-
});
|
|
39728
|
-
var CreateApiKeyResultSchema = object({
|
|
39729
|
-
token: string(),
|
|
39730
|
-
record: ApiKeySummarySchema
|
|
39731
|
-
});
|
|
39732
42277
|
var ScopedTokenSummarySchema = object({
|
|
39733
42278
|
id: string(),
|
|
39734
42279
|
userId: string(),
|
|
@@ -39827,17 +42372,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39827
42372
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39828
42373
|
kind: "mutation",
|
|
39829
42374
|
access: "view"
|
|
39830
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39831
|
-
kind: "mutation",
|
|
39832
|
-
auth: "admin",
|
|
39833
|
-
access: "create"
|
|
39834
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42375
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39835
42376
|
kind: "mutation",
|
|
39836
42377
|
auth: "admin",
|
|
39837
42378
|
access: "delete"
|
|
39838
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39839
|
-
kind: "mutation",
|
|
39840
|
-
access: "view"
|
|
39841
42379
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39842
42380
|
kind: "mutation",
|
|
39843
42381
|
auth: "admin",
|
|
@@ -39911,15 +42449,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39911
42449
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39912
42450
|
userId: string(),
|
|
39913
42451
|
issuer: string()
|
|
39914
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39915
|
-
userId: string(),
|
|
39916
|
-
issuer: string().min(1),
|
|
39917
|
-
label: string().optional()
|
|
39918
|
-
}), object({ success: literal(true) }), {
|
|
39919
|
-
kind: "mutation",
|
|
39920
|
-
auth: "admin",
|
|
39921
|
-
access: "create"
|
|
39922
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42452
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39923
42453
|
kind: "mutation",
|
|
39924
42454
|
auth: "admin",
|
|
39925
42455
|
access: "delete"
|
|
@@ -40624,6 +43154,451 @@ var zoneRulesCapability = {
|
|
|
40624
43154
|
*/
|
|
40625
43155
|
durability: "restored"
|
|
40626
43156
|
};
|
|
43157
|
+
/**
|
|
43158
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43159
|
+
*
|
|
43160
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43161
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43162
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43163
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43164
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43165
|
+
* manifest entry and nothing else.
|
|
43166
|
+
*
|
|
43167
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43168
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43169
|
+
* Every method is `admin`: these spend money.
|
|
43170
|
+
*
|
|
43171
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43172
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43173
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43174
|
+
*
|
|
43175
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43176
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43177
|
+
* ticket the provider mints (D613).
|
|
43178
|
+
*/
|
|
43179
|
+
var TrainingGpuOptionSchema = object({
|
|
43180
|
+
id: string(),
|
|
43181
|
+
label: string(),
|
|
43182
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43183
|
+
usdPerHour: number().nonnegative(),
|
|
43184
|
+
vramGb: number().nonnegative()
|
|
43185
|
+
});
|
|
43186
|
+
var TrainingRegionOptionSchema = object({
|
|
43187
|
+
/** `''` = any region (the provider's choice). */
|
|
43188
|
+
id: string(),
|
|
43189
|
+
label: string(),
|
|
43190
|
+
priceMultiplier: number().positive()
|
|
43191
|
+
});
|
|
43192
|
+
/**
|
|
43193
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43194
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43195
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43196
|
+
*/
|
|
43197
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43198
|
+
gpuType: string(),
|
|
43199
|
+
region: string(),
|
|
43200
|
+
costCapUsd: number().nonnegative(),
|
|
43201
|
+
maxRuntimeSec: number().int().positive(),
|
|
43202
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43203
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43204
|
+
});
|
|
43205
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43206
|
+
addonId: string(),
|
|
43207
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43208
|
+
kind: string(),
|
|
43209
|
+
label: string(),
|
|
43210
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43211
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43212
|
+
maxDatasetBytes: number().int().positive(),
|
|
43213
|
+
maxRuntimeSec: number().int().positive(),
|
|
43214
|
+
freeTierNote: string().optional(),
|
|
43215
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43216
|
+
dataResidencyNote: string(),
|
|
43217
|
+
/** Credentials are present — never the values. */
|
|
43218
|
+
configured: boolean(),
|
|
43219
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43220
|
+
});
|
|
43221
|
+
var TrainingCredentialCheckSchema = object({
|
|
43222
|
+
ok: boolean(),
|
|
43223
|
+
/** Workspace / account name, when the provider says. */
|
|
43224
|
+
account: string().optional(),
|
|
43225
|
+
reason: _enum([
|
|
43226
|
+
"missing",
|
|
43227
|
+
"invalid",
|
|
43228
|
+
"forbidden",
|
|
43229
|
+
"network",
|
|
43230
|
+
"quota"
|
|
43231
|
+
]).optional(),
|
|
43232
|
+
detail: string().optional()
|
|
43233
|
+
});
|
|
43234
|
+
var ProviderJobStateSchema = _enum([
|
|
43235
|
+
"pending",
|
|
43236
|
+
"starting",
|
|
43237
|
+
"running",
|
|
43238
|
+
"succeeded",
|
|
43239
|
+
"failed",
|
|
43240
|
+
"cancelled",
|
|
43241
|
+
"lost"
|
|
43242
|
+
]);
|
|
43243
|
+
var ProviderJobStatusSchema = object({
|
|
43244
|
+
jobKey: string(),
|
|
43245
|
+
providerJobId: string().optional(),
|
|
43246
|
+
state: ProviderJobStateSchema,
|
|
43247
|
+
startedAt: number().optional(),
|
|
43248
|
+
endedAt: number().optional(),
|
|
43249
|
+
exitCode: number().int().optional(),
|
|
43250
|
+
failureReason: string().optional(),
|
|
43251
|
+
gpuType: string(),
|
|
43252
|
+
region: string().optional(),
|
|
43253
|
+
billedSeconds: number().nonnegative(),
|
|
43254
|
+
costUsd: number().nonnegative(),
|
|
43255
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43256
|
+
costIsEstimate: boolean(),
|
|
43257
|
+
lastFetchedAt: number()
|
|
43258
|
+
});
|
|
43259
|
+
/**
|
|
43260
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43261
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43262
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43263
|
+
* in `result.json`.
|
|
43264
|
+
*/
|
|
43265
|
+
var TrainerSourceRefSchema = object({
|
|
43266
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43267
|
+
repo: string().min(1),
|
|
43268
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43269
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43270
|
+
});
|
|
43271
|
+
var JobRef = {
|
|
43272
|
+
addonId: string(),
|
|
43273
|
+
jobKey: string().uuid()
|
|
43274
|
+
};
|
|
43275
|
+
var TrainingLogLineSchema = object({
|
|
43276
|
+
ts: number(),
|
|
43277
|
+
text: string()
|
|
43278
|
+
});
|
|
43279
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43280
|
+
kind: "mutation",
|
|
43281
|
+
auth: "admin",
|
|
43282
|
+
timeoutMs: 3e4
|
|
43283
|
+
}), method(object({
|
|
43284
|
+
addonId: string(),
|
|
43285
|
+
gpuType: string(),
|
|
43286
|
+
region: string(),
|
|
43287
|
+
datasetBytes: number().int().nonnegative(),
|
|
43288
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43289
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43290
|
+
}), object({
|
|
43291
|
+
usdLow: number().nonnegative(),
|
|
43292
|
+
usdHigh: number().nonnegative(),
|
|
43293
|
+
notes: array(string()).readonly()
|
|
43294
|
+
}), { auth: "admin" }), method(object({
|
|
43295
|
+
...JobRef,
|
|
43296
|
+
ticket: PeerBytesTicketSchema
|
|
43297
|
+
}), object({
|
|
43298
|
+
bytes: number().int().nonnegative(),
|
|
43299
|
+
sha256: string()
|
|
43300
|
+
}), {
|
|
43301
|
+
kind: "mutation",
|
|
43302
|
+
auth: "admin",
|
|
43303
|
+
timeoutMs: 120 * 6e4
|
|
43304
|
+
}), method(object({
|
|
43305
|
+
...JobRef,
|
|
43306
|
+
trainer: TrainerSourceRefSchema,
|
|
43307
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43308
|
+
gpuType: string(),
|
|
43309
|
+
region: string(),
|
|
43310
|
+
maxRuntimeSec: number().int().positive()
|
|
43311
|
+
}), ProviderJobStatusSchema, {
|
|
43312
|
+
kind: "mutation",
|
|
43313
|
+
auth: "admin",
|
|
43314
|
+
timeoutMs: 30 * 6e4
|
|
43315
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43316
|
+
auth: "admin",
|
|
43317
|
+
timeoutMs: 6e4
|
|
43318
|
+
}), method(object({
|
|
43319
|
+
...JobRef,
|
|
43320
|
+
cursor: string().optional(),
|
|
43321
|
+
max: number().int().min(1).max(500)
|
|
43322
|
+
}), object({
|
|
43323
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43324
|
+
cursor: string()
|
|
43325
|
+
}), {
|
|
43326
|
+
auth: "admin",
|
|
43327
|
+
timeoutMs: 6e4
|
|
43328
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43329
|
+
kind: "mutation",
|
|
43330
|
+
auth: "admin",
|
|
43331
|
+
timeoutMs: 6e4
|
|
43332
|
+
}), method(object(JobRef), object({
|
|
43333
|
+
found: boolean(),
|
|
43334
|
+
text: string().optional()
|
|
43335
|
+
}), {
|
|
43336
|
+
kind: "mutation",
|
|
43337
|
+
auth: "admin",
|
|
43338
|
+
timeoutMs: 5 * 6e4
|
|
43339
|
+
}), method(object({
|
|
43340
|
+
...JobRef,
|
|
43341
|
+
path: _enum(["bundle.tar"])
|
|
43342
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43343
|
+
kind: "mutation",
|
|
43344
|
+
auth: "admin",
|
|
43345
|
+
timeoutMs: 5 * 6e4
|
|
43346
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43347
|
+
kind: "mutation",
|
|
43348
|
+
auth: "admin",
|
|
43349
|
+
timeoutMs: 5 * 6e4
|
|
43350
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43351
|
+
auth: "admin",
|
|
43352
|
+
timeoutMs: 2 * 6e4
|
|
43353
|
+
});
|
|
43354
|
+
/**
|
|
43355
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43356
|
+
* provided by `addon-training`.
|
|
43357
|
+
*
|
|
43358
|
+
* It owns what every provider must agree on, written once:
|
|
43359
|
+
*
|
|
43360
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43361
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43362
|
+
* the export plan) and reaches this store through the five row methods
|
|
43363
|
+
* below, so the Retrain page and the export did not change.
|
|
43364
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43365
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43366
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43367
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43368
|
+
* rollback. Nothing is ever registered automatically.
|
|
43369
|
+
*
|
|
43370
|
+
* Every method is `admin`.
|
|
43371
|
+
*/
|
|
43372
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43373
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43374
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43375
|
+
var TrainingBaseModelSchema = object({
|
|
43376
|
+
modelId: string(),
|
|
43377
|
+
label: string(),
|
|
43378
|
+
weights: string(),
|
|
43379
|
+
imgsz: number().int(),
|
|
43380
|
+
baselineOnnxUrl: string(),
|
|
43381
|
+
baselineFloors: record(string(), number()),
|
|
43382
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43383
|
+
recommended: boolean()
|
|
43384
|
+
});
|
|
43385
|
+
var TrainingPresetSchema = _enum([
|
|
43386
|
+
"quick",
|
|
43387
|
+
"standard",
|
|
43388
|
+
"thorough"
|
|
43389
|
+
]);
|
|
43390
|
+
var TrainingJobRequestSchema = object({
|
|
43391
|
+
datasetVersionId: string().min(1),
|
|
43392
|
+
/** The `training-provider` addon that runs it. */
|
|
43393
|
+
addonId: string().min(1),
|
|
43394
|
+
gpuType: string().min(1),
|
|
43395
|
+
region: string(),
|
|
43396
|
+
baseModelId: string().min(1),
|
|
43397
|
+
preset: TrainingPresetSchema,
|
|
43398
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43399
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43400
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43401
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43402
|
+
});
|
|
43403
|
+
var TrainingSplitPlanSchema = object({
|
|
43404
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43405
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43406
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43407
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43408
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43409
|
+
trainSubjects: number().int()
|
|
43410
|
+
});
|
|
43411
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43412
|
+
"unknown-dataset",
|
|
43413
|
+
"unknown-provider",
|
|
43414
|
+
"provider-not-configured",
|
|
43415
|
+
"unknown-base-model",
|
|
43416
|
+
"unknown-gpu",
|
|
43417
|
+
"dataset-too-large",
|
|
43418
|
+
"no-training-subjects",
|
|
43419
|
+
"job-already-running"
|
|
43420
|
+
]);
|
|
43421
|
+
var TrainingJobPlanSchema = object({
|
|
43422
|
+
refusal: object({
|
|
43423
|
+
reason: TrainingRefusalReasonSchema,
|
|
43424
|
+
detail: string()
|
|
43425
|
+
}).nullable(),
|
|
43426
|
+
warnings: array(string()).readonly(),
|
|
43427
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43428
|
+
estimate: object({
|
|
43429
|
+
datasetBytes: number().int(),
|
|
43430
|
+
uploadMinutesAt20Mbps: number(),
|
|
43431
|
+
gpuSecondsLow: number(),
|
|
43432
|
+
gpuSecondsHigh: number(),
|
|
43433
|
+
usdLow: number(),
|
|
43434
|
+
usdHigh: number(),
|
|
43435
|
+
notes: array(string()).readonly()
|
|
43436
|
+
}).nullable(),
|
|
43437
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43438
|
+
defaults: object({
|
|
43439
|
+
maxCostUsd: number(),
|
|
43440
|
+
maxRuntimeSec: number().int()
|
|
43441
|
+
}).nullable(),
|
|
43442
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43443
|
+
dataNotice: string()
|
|
43444
|
+
});
|
|
43445
|
+
/**
|
|
43446
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43447
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43448
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43449
|
+
* result lives after the operator acted on it.
|
|
43450
|
+
*/
|
|
43451
|
+
var TrainingJobStateSchema = _enum([
|
|
43452
|
+
"uploading",
|
|
43453
|
+
"submitted",
|
|
43454
|
+
"starting",
|
|
43455
|
+
"running",
|
|
43456
|
+
"collecting",
|
|
43457
|
+
"ready",
|
|
43458
|
+
"registered",
|
|
43459
|
+
"canary",
|
|
43460
|
+
"failed",
|
|
43461
|
+
"cancelling",
|
|
43462
|
+
"cancelled",
|
|
43463
|
+
"lost",
|
|
43464
|
+
"expired",
|
|
43465
|
+
"discarded"
|
|
43466
|
+
]);
|
|
43467
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43468
|
+
"cost-cap",
|
|
43469
|
+
"runtime-cap",
|
|
43470
|
+
"upload-failed",
|
|
43471
|
+
"submit-failed",
|
|
43472
|
+
"trainer-failed",
|
|
43473
|
+
"result-invalid",
|
|
43474
|
+
"checksum-mismatch",
|
|
43475
|
+
"fetch-failed",
|
|
43476
|
+
"provider-error",
|
|
43477
|
+
"hub-restart-during-upload"
|
|
43478
|
+
]);
|
|
43479
|
+
var TrainingProgressPointSchema = object({
|
|
43480
|
+
epoch: number().int(),
|
|
43481
|
+
map50: number().nullable(),
|
|
43482
|
+
map50_95: number().nullable()
|
|
43483
|
+
});
|
|
43484
|
+
var TrainingCanarySchema = object({
|
|
43485
|
+
deviceIds: array(number().int()).readonly(),
|
|
43486
|
+
since: number(),
|
|
43487
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43488
|
+
previous: array(object({
|
|
43489
|
+
deviceId: number().int(),
|
|
43490
|
+
nodeId: string(),
|
|
43491
|
+
deviceKey: string(),
|
|
43492
|
+
patch: object({
|
|
43493
|
+
modelId: string().optional(),
|
|
43494
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43495
|
+
}).nullable()
|
|
43496
|
+
})).readonly()
|
|
43497
|
+
});
|
|
43498
|
+
var TrainingJobSchema = object({
|
|
43499
|
+
id: string(),
|
|
43500
|
+
idempotencyKey: string(),
|
|
43501
|
+
name: string(),
|
|
43502
|
+
createdAt: number(),
|
|
43503
|
+
updatedAt: number(),
|
|
43504
|
+
state: TrainingJobStateSchema,
|
|
43505
|
+
stage: TrainingStageSchema.nullable(),
|
|
43506
|
+
failure: object({
|
|
43507
|
+
reason: TrainingFailureReasonSchema,
|
|
43508
|
+
stage: string().nullable(),
|
|
43509
|
+
detail: string()
|
|
43510
|
+
}).nullable(),
|
|
43511
|
+
request: TrainingJobRequestSchema,
|
|
43512
|
+
maxCostUsd: number().nonnegative(),
|
|
43513
|
+
maxRuntimeSec: number().int().positive(),
|
|
43514
|
+
trainer: TrainerSourceRefSchema,
|
|
43515
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43516
|
+
dataset: object({
|
|
43517
|
+
bytes: number().int(),
|
|
43518
|
+
sha256: string(),
|
|
43519
|
+
uploadedAt: number()
|
|
43520
|
+
}).nullable(),
|
|
43521
|
+
split: TrainingSplitPlanSchema,
|
|
43522
|
+
provider: object({
|
|
43523
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43524
|
+
providerJobId: string().nullable(),
|
|
43525
|
+
startedAt: number().nullable(),
|
|
43526
|
+
endedAt: number().nullable(),
|
|
43527
|
+
billedSeconds: number(),
|
|
43528
|
+
costUsd: number(),
|
|
43529
|
+
costIsEstimate: boolean(),
|
|
43530
|
+
lastPolledAt: number().nullable()
|
|
43531
|
+
}),
|
|
43532
|
+
progress: object({
|
|
43533
|
+
epoch: number().int().nullable(),
|
|
43534
|
+
epochs: number().int().nullable(),
|
|
43535
|
+
etaSec: number().nullable(),
|
|
43536
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43537
|
+
}),
|
|
43538
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43539
|
+
logTail: array(string()).readonly(),
|
|
43540
|
+
logCursor: string().nullable(),
|
|
43541
|
+
artifacts: object({
|
|
43542
|
+
bundleBytes: number().int(),
|
|
43543
|
+
bundleSha256: string(),
|
|
43544
|
+
fetchedAt: number(),
|
|
43545
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43546
|
+
expiresAt: number()
|
|
43547
|
+
}).nullable(),
|
|
43548
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43549
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43550
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43551
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43552
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43553
|
+
registeredModelIds: array(string()).readonly(),
|
|
43554
|
+
canary: TrainingCanarySchema.nullable()
|
|
43555
|
+
});
|
|
43556
|
+
var IdInput = object({ id: string().min(1) });
|
|
43557
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43558
|
+
kind: "mutation",
|
|
43559
|
+
auth: "admin"
|
|
43560
|
+
}), 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() }), {
|
|
43561
|
+
kind: "mutation",
|
|
43562
|
+
auth: "admin"
|
|
43563
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43564
|
+
auth: "admin",
|
|
43565
|
+
timeoutMs: 6e4
|
|
43566
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43567
|
+
name: string().min(1).max(120),
|
|
43568
|
+
maxCostUsd: number().positive(),
|
|
43569
|
+
maxRuntimeSec: number().int().positive(),
|
|
43570
|
+
idempotencyKey: string().min(8).max(80)
|
|
43571
|
+
}), discriminatedUnion("kind", [object({
|
|
43572
|
+
kind: literal("started"),
|
|
43573
|
+
job: TrainingJobSchema
|
|
43574
|
+
}), object({
|
|
43575
|
+
kind: literal("refused"),
|
|
43576
|
+
reason: TrainingRefusalReasonSchema,
|
|
43577
|
+
detail: string()
|
|
43578
|
+
})]), {
|
|
43579
|
+
kind: "mutation",
|
|
43580
|
+
auth: "admin",
|
|
43581
|
+
timeoutMs: 12e4
|
|
43582
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43583
|
+
kind: "mutation",
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 12e4
|
|
43586
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43587
|
+
kind: "mutation",
|
|
43588
|
+
auth: "admin",
|
|
43589
|
+
timeoutMs: 30 * 6e4
|
|
43590
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43591
|
+
kind: "mutation",
|
|
43592
|
+
auth: "admin",
|
|
43593
|
+
timeoutMs: 12e4
|
|
43594
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43595
|
+
kind: "mutation",
|
|
43596
|
+
auth: "admin",
|
|
43597
|
+
timeoutMs: 12e4
|
|
43598
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43599
|
+
kind: "mutation",
|
|
43600
|
+
auth: "admin"
|
|
43601
|
+
});
|
|
40627
43602
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40628
43603
|
Object.freeze({
|
|
40629
43604
|
person: .5,
|
|
@@ -41110,7 +44085,8 @@ var BaseDevice = class {
|
|
|
41110
44085
|
this.role = options.role;
|
|
41111
44086
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41112
44087
|
const seedData = ctx.persistedConfig ?? {};
|
|
41113
|
-
|
|
44088
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
44089
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41114
44090
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41115
44091
|
tags: {
|
|
41116
44092
|
deviceId: ctx.id,
|
|
@@ -42771,6 +45747,12 @@ Object.freeze({
|
|
|
42771
45747
|
addonId: null,
|
|
42772
45748
|
access: "create"
|
|
42773
45749
|
},
|
|
45750
|
+
"backup.checkBackupKey": {
|
|
45751
|
+
capName: "backup",
|
|
45752
|
+
capScope: "system",
|
|
45753
|
+
addonId: null,
|
|
45754
|
+
access: "create"
|
|
45755
|
+
},
|
|
42774
45756
|
"backup.delete": {
|
|
42775
45757
|
capName: "backup",
|
|
42776
45758
|
capScope: "system",
|
|
@@ -42783,6 +45765,18 @@ Object.freeze({
|
|
|
42783
45765
|
addonId: null,
|
|
42784
45766
|
access: "delete"
|
|
42785
45767
|
},
|
|
45768
|
+
"backup.disableEncryption": {
|
|
45769
|
+
capName: "backup",
|
|
45770
|
+
capScope: "system",
|
|
45771
|
+
addonId: null,
|
|
45772
|
+
access: "create"
|
|
45773
|
+
},
|
|
45774
|
+
"backup.getEncryption": {
|
|
45775
|
+
capName: "backup",
|
|
45776
|
+
capScope: "system",
|
|
45777
|
+
addonId: null,
|
|
45778
|
+
access: "view"
|
|
45779
|
+
},
|
|
42786
45780
|
"backup.getEntries": {
|
|
42787
45781
|
capName: "backup",
|
|
42788
45782
|
capScope: "system",
|
|
@@ -42837,6 +45831,12 @@ Object.freeze({
|
|
|
42837
45831
|
addonId: null,
|
|
42838
45832
|
access: "create"
|
|
42839
45833
|
},
|
|
45834
|
+
"backup.setupEncryption": {
|
|
45835
|
+
capName: "backup",
|
|
45836
|
+
capScope: "system",
|
|
45837
|
+
addonId: null,
|
|
45838
|
+
access: "create"
|
|
45839
|
+
},
|
|
42840
45840
|
"backup.trigger": {
|
|
42841
45841
|
capName: "backup",
|
|
42842
45842
|
capScope: "system",
|
|
@@ -43389,6 +46389,12 @@ Object.freeze({
|
|
|
43389
46389
|
addonId: null,
|
|
43390
46390
|
access: "create"
|
|
43391
46391
|
},
|
|
46392
|
+
"customModelRegistry.importModelBundle": {
|
|
46393
|
+
capName: "custom-model-registry",
|
|
46394
|
+
capScope: "system",
|
|
46395
|
+
addonId: null,
|
|
46396
|
+
access: "create"
|
|
46397
|
+
},
|
|
43392
46398
|
"customModelRegistry.listModels": {
|
|
43393
46399
|
capName: "custom-model-registry",
|
|
43394
46400
|
capScope: "system",
|
|
@@ -44799,6 +47805,108 @@ Object.freeze({
|
|
|
44799
47805
|
addonId: null,
|
|
44800
47806
|
access: "create"
|
|
44801
47807
|
},
|
|
47808
|
+
"keychain.delete": {
|
|
47809
|
+
capName: "keychain",
|
|
47810
|
+
capScope: "system",
|
|
47811
|
+
addonId: null,
|
|
47812
|
+
access: "delete"
|
|
47813
|
+
},
|
|
47814
|
+
"keychain.getState": {
|
|
47815
|
+
capName: "keychain",
|
|
47816
|
+
capScope: "system",
|
|
47817
|
+
addonId: null,
|
|
47818
|
+
access: "view"
|
|
47819
|
+
},
|
|
47820
|
+
"keychain.listMeta": {
|
|
47821
|
+
capName: "keychain",
|
|
47822
|
+
capScope: "system",
|
|
47823
|
+
addonId: null,
|
|
47824
|
+
access: "view"
|
|
47825
|
+
},
|
|
47826
|
+
"keychain.put": {
|
|
47827
|
+
capName: "keychain",
|
|
47828
|
+
capScope: "system",
|
|
47829
|
+
addonId: null,
|
|
47830
|
+
access: "create"
|
|
47831
|
+
},
|
|
47832
|
+
"keychain.resolve": {
|
|
47833
|
+
capName: "keychain",
|
|
47834
|
+
capScope: "system",
|
|
47835
|
+
addonId: null,
|
|
47836
|
+
access: "view"
|
|
47837
|
+
},
|
|
47838
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47839
|
+
capName: "keychain-admin",
|
|
47840
|
+
capScope: "system",
|
|
47841
|
+
addonId: null,
|
|
47842
|
+
access: "create"
|
|
47843
|
+
},
|
|
47844
|
+
"keychainAdmin.deleteOrphans": {
|
|
47845
|
+
capName: "keychain-admin",
|
|
47846
|
+
capScope: "system",
|
|
47847
|
+
addonId: null,
|
|
47848
|
+
access: "delete"
|
|
47849
|
+
},
|
|
47850
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47851
|
+
capName: "keychain-admin",
|
|
47852
|
+
capScope: "system",
|
|
47853
|
+
addonId: null,
|
|
47854
|
+
access: "create"
|
|
47855
|
+
},
|
|
47856
|
+
"keychainAdmin.listAudit": {
|
|
47857
|
+
capName: "keychain-admin",
|
|
47858
|
+
capScope: "system",
|
|
47859
|
+
addonId: null,
|
|
47860
|
+
access: "view"
|
|
47861
|
+
},
|
|
47862
|
+
"keychainAdmin.listSecrets": {
|
|
47863
|
+
capName: "keychain-admin",
|
|
47864
|
+
capScope: "system",
|
|
47865
|
+
addonId: null,
|
|
47866
|
+
access: "view"
|
|
47867
|
+
},
|
|
47868
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47869
|
+
capName: "keychain-admin",
|
|
47870
|
+
capScope: "system",
|
|
47871
|
+
addonId: null,
|
|
47872
|
+
access: "delete"
|
|
47873
|
+
},
|
|
47874
|
+
"keychainAdmin.resetKeychain": {
|
|
47875
|
+
capName: "keychain-admin",
|
|
47876
|
+
capScope: "system",
|
|
47877
|
+
addonId: null,
|
|
47878
|
+
access: "delete"
|
|
47879
|
+
},
|
|
47880
|
+
"keychainAdmin.resetReport": {
|
|
47881
|
+
capName: "keychain-admin",
|
|
47882
|
+
capScope: "system",
|
|
47883
|
+
addonId: null,
|
|
47884
|
+
access: "delete"
|
|
47885
|
+
},
|
|
47886
|
+
"keychainAdmin.reveal": {
|
|
47887
|
+
capName: "keychain-admin",
|
|
47888
|
+
capScope: "system",
|
|
47889
|
+
addonId: null,
|
|
47890
|
+
access: "create"
|
|
47891
|
+
},
|
|
47892
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47893
|
+
capName: "keychain-admin",
|
|
47894
|
+
capScope: "system",
|
|
47895
|
+
addonId: null,
|
|
47896
|
+
access: "create"
|
|
47897
|
+
},
|
|
47898
|
+
"keychainAdmin.setSystemSecret": {
|
|
47899
|
+
capName: "keychain-admin",
|
|
47900
|
+
capScope: "system",
|
|
47901
|
+
addonId: null,
|
|
47902
|
+
access: "create"
|
|
47903
|
+
},
|
|
47904
|
+
"keychainAdmin.status": {
|
|
47905
|
+
capName: "keychain-admin",
|
|
47906
|
+
capScope: "system",
|
|
47907
|
+
addonId: null,
|
|
47908
|
+
access: "view"
|
|
47909
|
+
},
|
|
44802
47910
|
"lawnMowerControl.dock": {
|
|
44803
47911
|
capName: "lawn-mower-control",
|
|
44804
47912
|
capScope: "device",
|
|
@@ -46173,6 +49281,18 @@ Object.freeze({
|
|
|
46173
49281
|
addonId: null,
|
|
46174
49282
|
access: "create"
|
|
46175
49283
|
},
|
|
49284
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
49285
|
+
capName: "pipeline-analytics",
|
|
49286
|
+
capScope: "device",
|
|
49287
|
+
addonId: null,
|
|
49288
|
+
access: "create"
|
|
49289
|
+
},
|
|
49290
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
49291
|
+
capName: "pipeline-analytics",
|
|
49292
|
+
capScope: "device",
|
|
49293
|
+
addonId: null,
|
|
49294
|
+
access: "create"
|
|
49295
|
+
},
|
|
46176
49296
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46177
49297
|
capName: "pipeline-analytics",
|
|
46178
49298
|
capScope: "device",
|
|
@@ -46221,12 +49341,36 @@ Object.freeze({
|
|
|
46221
49341
|
addonId: null,
|
|
46222
49342
|
access: "view"
|
|
46223
49343
|
},
|
|
49344
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
49345
|
+
capName: "pipeline-analytics",
|
|
49346
|
+
capScope: "device",
|
|
49347
|
+
addonId: null,
|
|
49348
|
+
access: "create"
|
|
49349
|
+
},
|
|
49350
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49351
|
+
capName: "pipeline-analytics",
|
|
49352
|
+
capScope: "device",
|
|
49353
|
+
addonId: null,
|
|
49354
|
+
access: "create"
|
|
49355
|
+
},
|
|
46224
49356
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46225
49357
|
capName: "pipeline-analytics",
|
|
46226
49358
|
capScope: "device",
|
|
46227
49359
|
addonId: null,
|
|
46228
49360
|
access: "delete"
|
|
46229
49361
|
},
|
|
49362
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
49363
|
+
capName: "pipeline-analytics",
|
|
49364
|
+
capScope: "device",
|
|
49365
|
+
addonId: null,
|
|
49366
|
+
access: "delete"
|
|
49367
|
+
},
|
|
49368
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49369
|
+
capName: "pipeline-analytics",
|
|
49370
|
+
capScope: "device",
|
|
49371
|
+
addonId: null,
|
|
49372
|
+
access: "delete"
|
|
49373
|
+
},
|
|
46230
49374
|
"pipelineAnalytics.deleteTracks": {
|
|
46231
49375
|
capName: "pipeline-analytics",
|
|
46232
49376
|
capScope: "device",
|
|
@@ -46431,6 +49575,30 @@ Object.freeze({
|
|
|
46431
49575
|
addonId: null,
|
|
46432
49576
|
access: "view"
|
|
46433
49577
|
},
|
|
49578
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
49579
|
+
capName: "pipeline-analytics",
|
|
49580
|
+
capScope: "device",
|
|
49581
|
+
addonId: null,
|
|
49582
|
+
access: "view"
|
|
49583
|
+
},
|
|
49584
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
49585
|
+
capName: "pipeline-analytics",
|
|
49586
|
+
capScope: "device",
|
|
49587
|
+
addonId: null,
|
|
49588
|
+
access: "view"
|
|
49589
|
+
},
|
|
49590
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49591
|
+
capName: "pipeline-analytics",
|
|
49592
|
+
capScope: "device",
|
|
49593
|
+
addonId: null,
|
|
49594
|
+
access: "view"
|
|
49595
|
+
},
|
|
49596
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49597
|
+
capName: "pipeline-analytics",
|
|
49598
|
+
capScope: "device",
|
|
49599
|
+
addonId: null,
|
|
49600
|
+
access: "view"
|
|
49601
|
+
},
|
|
46434
49602
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46435
49603
|
capName: "pipeline-analytics",
|
|
46436
49604
|
capScope: "device",
|
|
@@ -46461,6 +49629,12 @@ Object.freeze({
|
|
|
46461
49629
|
addonId: null,
|
|
46462
49630
|
access: "view"
|
|
46463
49631
|
},
|
|
49632
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49633
|
+
capName: "pipeline-analytics",
|
|
49634
|
+
capScope: "device",
|
|
49635
|
+
addonId: null,
|
|
49636
|
+
access: "create"
|
|
49637
|
+
},
|
|
46464
49638
|
"pipelineAnalytics.ownersWithMedia": {
|
|
46465
49639
|
capName: "pipeline-analytics",
|
|
46466
49640
|
capScope: "device",
|
|
@@ -46473,12 +49647,24 @@ Object.freeze({
|
|
|
46473
49647
|
addonId: null,
|
|
46474
49648
|
access: "create"
|
|
46475
49649
|
},
|
|
49650
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49651
|
+
capName: "pipeline-analytics",
|
|
49652
|
+
capScope: "device",
|
|
49653
|
+
addonId: null,
|
|
49654
|
+
access: "view"
|
|
49655
|
+
},
|
|
46476
49656
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
46477
49657
|
capName: "pipeline-analytics",
|
|
46478
49658
|
capScope: "device",
|
|
46479
49659
|
addonId: null,
|
|
46480
49660
|
access: "create"
|
|
46481
49661
|
},
|
|
49662
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49663
|
+
capName: "pipeline-analytics",
|
|
49664
|
+
capScope: "device",
|
|
49665
|
+
addonId: null,
|
|
49666
|
+
access: "create"
|
|
49667
|
+
},
|
|
46482
49668
|
"pipelineAnalytics.pruneEvents": {
|
|
46483
49669
|
capName: "pipeline-analytics",
|
|
46484
49670
|
capScope: "device",
|
|
@@ -46533,6 +49719,18 @@ Object.freeze({
|
|
|
46533
49719
|
addonId: null,
|
|
46534
49720
|
access: "create"
|
|
46535
49721
|
},
|
|
49722
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49723
|
+
capName: "pipeline-analytics",
|
|
49724
|
+
capScope: "device",
|
|
49725
|
+
addonId: null,
|
|
49726
|
+
access: "delete"
|
|
49727
|
+
},
|
|
49728
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49729
|
+
capName: "pipeline-analytics",
|
|
49730
|
+
capScope: "device",
|
|
49731
|
+
addonId: null,
|
|
49732
|
+
access: "create"
|
|
49733
|
+
},
|
|
46536
49734
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46537
49735
|
capName: "pipeline-analytics",
|
|
46538
49736
|
capScope: "device",
|
|
@@ -46593,6 +49791,12 @@ Object.freeze({
|
|
|
46593
49791
|
addonId: null,
|
|
46594
49792
|
access: "create"
|
|
46595
49793
|
},
|
|
49794
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49795
|
+
capName: "pipeline-analytics",
|
|
49796
|
+
capScope: "device",
|
|
49797
|
+
addonId: null,
|
|
49798
|
+
access: "view"
|
|
49799
|
+
},
|
|
46596
49800
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46597
49801
|
capName: "pipeline-analytics",
|
|
46598
49802
|
capScope: "device",
|
|
@@ -46821,6 +50025,12 @@ Object.freeze({
|
|
|
46821
50025
|
addonId: null,
|
|
46822
50026
|
access: "view"
|
|
46823
50027
|
},
|
|
50028
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
50029
|
+
capName: "pipeline-orchestrator",
|
|
50030
|
+
capScope: "system",
|
|
50031
|
+
addonId: null,
|
|
50032
|
+
access: "create"
|
|
50033
|
+
},
|
|
46824
50034
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46825
50035
|
capName: "pipeline-orchestrator",
|
|
46826
50036
|
capScope: "system",
|
|
@@ -46845,6 +50055,12 @@ Object.freeze({
|
|
|
46845
50055
|
addonId: null,
|
|
46846
50056
|
access: "create"
|
|
46847
50057
|
},
|
|
50058
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
50059
|
+
capName: "pipeline-orchestrator",
|
|
50060
|
+
capScope: "system",
|
|
50061
|
+
addonId: null,
|
|
50062
|
+
access: "delete"
|
|
50063
|
+
},
|
|
46848
50064
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46849
50065
|
capName: "pipeline-orchestrator",
|
|
46850
50066
|
capScope: "system",
|
|
@@ -46953,6 +50169,24 @@ Object.freeze({
|
|
|
46953
50169
|
addonId: null,
|
|
46954
50170
|
access: "view"
|
|
46955
50171
|
},
|
|
50172
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
50173
|
+
capName: "pipeline-orchestrator",
|
|
50174
|
+
capScope: "system",
|
|
50175
|
+
addonId: null,
|
|
50176
|
+
access: "view"
|
|
50177
|
+
},
|
|
50178
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
50179
|
+
capName: "pipeline-orchestrator",
|
|
50180
|
+
capScope: "system",
|
|
50181
|
+
addonId: null,
|
|
50182
|
+
access: "view"
|
|
50183
|
+
},
|
|
50184
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
50185
|
+
capName: "pipeline-orchestrator",
|
|
50186
|
+
capScope: "system",
|
|
50187
|
+
addonId: null,
|
|
50188
|
+
access: "view"
|
|
50189
|
+
},
|
|
46956
50190
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46957
50191
|
capName: "pipeline-orchestrator",
|
|
46958
50192
|
capScope: "system",
|
|
@@ -46995,6 +50229,12 @@ Object.freeze({
|
|
|
46995
50229
|
addonId: null,
|
|
46996
50230
|
access: "view"
|
|
46997
50231
|
},
|
|
50232
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
50233
|
+
capName: "pipeline-orchestrator",
|
|
50234
|
+
capScope: "system",
|
|
50235
|
+
addonId: null,
|
|
50236
|
+
access: "view"
|
|
50237
|
+
},
|
|
46998
50238
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46999
50239
|
capName: "pipeline-orchestrator",
|
|
47000
50240
|
capScope: "system",
|
|
@@ -47139,6 +50379,12 @@ Object.freeze({
|
|
|
47139
50379
|
addonId: null,
|
|
47140
50380
|
access: "create"
|
|
47141
50381
|
},
|
|
50382
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
50383
|
+
capName: "pipeline-orchestrator",
|
|
50384
|
+
capScope: "system",
|
|
50385
|
+
addonId: null,
|
|
50386
|
+
access: "create"
|
|
50387
|
+
},
|
|
47142
50388
|
"pipelineOrchestrator.suggestShares": {
|
|
47143
50389
|
capName: "pipeline-orchestrator",
|
|
47144
50390
|
capScope: "system",
|
|
@@ -47157,6 +50403,12 @@ Object.freeze({
|
|
|
47157
50403
|
addonId: null,
|
|
47158
50404
|
access: "create"
|
|
47159
50405
|
},
|
|
50406
|
+
"pipelineRunner.abortNodeBench": {
|
|
50407
|
+
capName: "pipeline-runner",
|
|
50408
|
+
capScope: "system",
|
|
50409
|
+
addonId: null,
|
|
50410
|
+
access: "create"
|
|
50411
|
+
},
|
|
47160
50412
|
"pipelineRunner.attachCamera": {
|
|
47161
50413
|
capName: "pipeline-runner",
|
|
47162
50414
|
capScope: "system",
|
|
@@ -47205,6 +50457,12 @@ Object.freeze({
|
|
|
47205
50457
|
addonId: null,
|
|
47206
50458
|
access: "view"
|
|
47207
50459
|
},
|
|
50460
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
50461
|
+
capName: "pipeline-runner",
|
|
50462
|
+
capScope: "system",
|
|
50463
|
+
addonId: null,
|
|
50464
|
+
access: "view"
|
|
50465
|
+
},
|
|
47208
50466
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47209
50467
|
capName: "pipeline-runner",
|
|
47210
50468
|
capScope: "system",
|
|
@@ -47247,6 +50505,12 @@ Object.freeze({
|
|
|
47247
50505
|
addonId: null,
|
|
47248
50506
|
access: "create"
|
|
47249
50507
|
},
|
|
50508
|
+
"pipelineRunner.startNodeBench": {
|
|
50509
|
+
capName: "pipeline-runner",
|
|
50510
|
+
capScope: "system",
|
|
50511
|
+
addonId: null,
|
|
50512
|
+
access: "create"
|
|
50513
|
+
},
|
|
47250
50514
|
"plateGallery.assignPlate": {
|
|
47251
50515
|
capName: "plate-gallery",
|
|
47252
50516
|
capScope: "system",
|
|
@@ -48909,6 +52173,174 @@ Object.freeze({
|
|
|
48909
52173
|
addonId: null,
|
|
48910
52174
|
access: "view"
|
|
48911
52175
|
},
|
|
52176
|
+
"training.canaryResult": {
|
|
52177
|
+
capName: "training",
|
|
52178
|
+
capScope: "system",
|
|
52179
|
+
addonId: null,
|
|
52180
|
+
access: "create"
|
|
52181
|
+
},
|
|
52182
|
+
"training.cancelJob": {
|
|
52183
|
+
capName: "training",
|
|
52184
|
+
capScope: "system",
|
|
52185
|
+
addonId: null,
|
|
52186
|
+
access: "create"
|
|
52187
|
+
},
|
|
52188
|
+
"training.discardResult": {
|
|
52189
|
+
capName: "training",
|
|
52190
|
+
capScope: "system",
|
|
52191
|
+
addonId: null,
|
|
52192
|
+
access: "create"
|
|
52193
|
+
},
|
|
52194
|
+
"training.findDatasetVersionIdByName": {
|
|
52195
|
+
capName: "training",
|
|
52196
|
+
capScope: "system",
|
|
52197
|
+
addonId: null,
|
|
52198
|
+
access: "view"
|
|
52199
|
+
},
|
|
52200
|
+
"training.getDatasetVersion": {
|
|
52201
|
+
capName: "training",
|
|
52202
|
+
capScope: "system",
|
|
52203
|
+
addonId: null,
|
|
52204
|
+
access: "view"
|
|
52205
|
+
},
|
|
52206
|
+
"training.getJob": {
|
|
52207
|
+
capName: "training",
|
|
52208
|
+
capScope: "system",
|
|
52209
|
+
addonId: null,
|
|
52210
|
+
access: "view"
|
|
52211
|
+
},
|
|
52212
|
+
"training.getJobResult": {
|
|
52213
|
+
capName: "training",
|
|
52214
|
+
capScope: "system",
|
|
52215
|
+
addonId: null,
|
|
52216
|
+
access: "view"
|
|
52217
|
+
},
|
|
52218
|
+
"training.listBaseModels": {
|
|
52219
|
+
capName: "training",
|
|
52220
|
+
capScope: "system",
|
|
52221
|
+
addonId: null,
|
|
52222
|
+
access: "view"
|
|
52223
|
+
},
|
|
52224
|
+
"training.listDatasetVersions": {
|
|
52225
|
+
capName: "training",
|
|
52226
|
+
capScope: "system",
|
|
52227
|
+
addonId: null,
|
|
52228
|
+
access: "view"
|
|
52229
|
+
},
|
|
52230
|
+
"training.listJobs": {
|
|
52231
|
+
capName: "training",
|
|
52232
|
+
capScope: "system",
|
|
52233
|
+
addonId: null,
|
|
52234
|
+
access: "view"
|
|
52235
|
+
},
|
|
52236
|
+
"training.planJob": {
|
|
52237
|
+
capName: "training",
|
|
52238
|
+
capScope: "system",
|
|
52239
|
+
addonId: null,
|
|
52240
|
+
access: "view"
|
|
52241
|
+
},
|
|
52242
|
+
"training.putDatasetVersion": {
|
|
52243
|
+
capName: "training",
|
|
52244
|
+
capScope: "system",
|
|
52245
|
+
addonId: null,
|
|
52246
|
+
access: "create"
|
|
52247
|
+
},
|
|
52248
|
+
"training.registerResult": {
|
|
52249
|
+
capName: "training",
|
|
52250
|
+
capScope: "system",
|
|
52251
|
+
addonId: null,
|
|
52252
|
+
access: "create"
|
|
52253
|
+
},
|
|
52254
|
+
"training.removeDatasetVersion": {
|
|
52255
|
+
capName: "training",
|
|
52256
|
+
capScope: "system",
|
|
52257
|
+
addonId: null,
|
|
52258
|
+
access: "delete"
|
|
52259
|
+
},
|
|
52260
|
+
"training.rollbackCanary": {
|
|
52261
|
+
capName: "training",
|
|
52262
|
+
capScope: "system",
|
|
52263
|
+
addonId: null,
|
|
52264
|
+
access: "create"
|
|
52265
|
+
},
|
|
52266
|
+
"training.startJob": {
|
|
52267
|
+
capName: "training",
|
|
52268
|
+
capScope: "system",
|
|
52269
|
+
addonId: null,
|
|
52270
|
+
access: "create"
|
|
52271
|
+
},
|
|
52272
|
+
"trainingProvider.cancelJob": {
|
|
52273
|
+
capName: "training-provider",
|
|
52274
|
+
capScope: "system",
|
|
52275
|
+
addonId: null,
|
|
52276
|
+
access: "create"
|
|
52277
|
+
},
|
|
52278
|
+
"trainingProvider.cleanupJob": {
|
|
52279
|
+
capName: "training-provider",
|
|
52280
|
+
capScope: "system",
|
|
52281
|
+
addonId: null,
|
|
52282
|
+
access: "create"
|
|
52283
|
+
},
|
|
52284
|
+
"trainingProvider.describe": {
|
|
52285
|
+
capName: "training-provider",
|
|
52286
|
+
capScope: "system",
|
|
52287
|
+
addonId: null,
|
|
52288
|
+
access: "view"
|
|
52289
|
+
},
|
|
52290
|
+
"trainingProvider.estimateJob": {
|
|
52291
|
+
capName: "training-provider",
|
|
52292
|
+
capScope: "system",
|
|
52293
|
+
addonId: null,
|
|
52294
|
+
access: "view"
|
|
52295
|
+
},
|
|
52296
|
+
"trainingProvider.getJob": {
|
|
52297
|
+
capName: "training-provider",
|
|
52298
|
+
capScope: "system",
|
|
52299
|
+
addonId: null,
|
|
52300
|
+
access: "view"
|
|
52301
|
+
},
|
|
52302
|
+
"trainingProvider.listJobEvents": {
|
|
52303
|
+
capName: "training-provider",
|
|
52304
|
+
capScope: "system",
|
|
52305
|
+
addonId: null,
|
|
52306
|
+
access: "view"
|
|
52307
|
+
},
|
|
52308
|
+
"trainingProvider.listJobs": {
|
|
52309
|
+
capName: "training-provider",
|
|
52310
|
+
capScope: "system",
|
|
52311
|
+
addonId: null,
|
|
52312
|
+
access: "view"
|
|
52313
|
+
},
|
|
52314
|
+
"trainingProvider.offerArtifact": {
|
|
52315
|
+
capName: "training-provider",
|
|
52316
|
+
capScope: "system",
|
|
52317
|
+
addonId: null,
|
|
52318
|
+
access: "create"
|
|
52319
|
+
},
|
|
52320
|
+
"trainingProvider.readResult": {
|
|
52321
|
+
capName: "training-provider",
|
|
52322
|
+
capScope: "system",
|
|
52323
|
+
addonId: null,
|
|
52324
|
+
access: "create"
|
|
52325
|
+
},
|
|
52326
|
+
"trainingProvider.submitJob": {
|
|
52327
|
+
capName: "training-provider",
|
|
52328
|
+
capScope: "system",
|
|
52329
|
+
addonId: null,
|
|
52330
|
+
access: "create"
|
|
52331
|
+
},
|
|
52332
|
+
"trainingProvider.uploadDataset": {
|
|
52333
|
+
capName: "training-provider",
|
|
52334
|
+
capScope: "system",
|
|
52335
|
+
addonId: null,
|
|
52336
|
+
access: "create"
|
|
52337
|
+
},
|
|
52338
|
+
"trainingProvider.validateCredentials": {
|
|
52339
|
+
capName: "training-provider",
|
|
52340
|
+
capScope: "system",
|
|
52341
|
+
addonId: null,
|
|
52342
|
+
access: "create"
|
|
52343
|
+
},
|
|
48912
52344
|
"turnProvider.getTurnServers": {
|
|
48913
52345
|
capName: "turn-provider",
|
|
48914
52346
|
capScope: "system",
|
|
@@ -48933,12 +52365,6 @@ Object.freeze({
|
|
|
48933
52365
|
addonId: null,
|
|
48934
52366
|
access: "create"
|
|
48935
52367
|
},
|
|
48936
|
-
"userManagement.createApiKey": {
|
|
48937
|
-
capName: "user-management",
|
|
48938
|
-
capScope: "system",
|
|
48939
|
-
addonId: null,
|
|
48940
|
-
access: "create"
|
|
48941
|
-
},
|
|
48942
52368
|
"userManagement.createScopedToken": {
|
|
48943
52369
|
capName: "user-management",
|
|
48944
52370
|
capScope: "system",
|
|
@@ -48975,12 +52401,6 @@ Object.freeze({
|
|
|
48975
52401
|
addonId: null,
|
|
48976
52402
|
access: "view"
|
|
48977
52403
|
},
|
|
48978
|
-
"userManagement.linkExternalIdentity": {
|
|
48979
|
-
capName: "user-management",
|
|
48980
|
-
capScope: "system",
|
|
48981
|
-
addonId: null,
|
|
48982
|
-
access: "create"
|
|
48983
|
-
},
|
|
48984
52404
|
"userManagement.listApiKeys": {
|
|
48985
52405
|
capName: "user-management",
|
|
48986
52406
|
capScope: "system",
|
|
@@ -49083,12 +52503,6 @@ Object.freeze({
|
|
|
49083
52503
|
addonId: null,
|
|
49084
52504
|
access: "create"
|
|
49085
52505
|
},
|
|
49086
|
-
"userManagement.validateApiKey": {
|
|
49087
|
-
capName: "user-management",
|
|
49088
|
-
capScope: "system",
|
|
49089
|
-
addonId: null,
|
|
49090
|
-
access: "view"
|
|
49091
|
-
},
|
|
49092
52506
|
"userManagement.validateCredentials": {
|
|
49093
52507
|
capName: "user-management",
|
|
49094
52508
|
capScope: "system",
|
|
@@ -52176,6 +55590,11 @@ Object.freeze({
|
|
|
52176
55590
|
form: "single",
|
|
52177
55591
|
optional: false
|
|
52178
55592
|
}],
|
|
55593
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
55594
|
+
name: "deviceId",
|
|
55595
|
+
form: "single",
|
|
55596
|
+
optional: false
|
|
55597
|
+
}],
|
|
52179
55598
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52180
55599
|
name: "deviceId",
|
|
52181
55600
|
form: "single",
|
|
@@ -52366,6 +55785,11 @@ Object.freeze({
|
|
|
52366
55785
|
form: "single",
|
|
52367
55786
|
optional: false
|
|
52368
55787
|
}],
|
|
55788
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55789
|
+
name: "deviceId",
|
|
55790
|
+
form: "single",
|
|
55791
|
+
optional: false
|
|
55792
|
+
}],
|
|
52369
55793
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52370
55794
|
name: "deviceId",
|
|
52371
55795
|
form: "single",
|
|
@@ -53192,6 +56616,11 @@ Object.freeze({
|
|
|
53192
56616
|
form: "single",
|
|
53193
56617
|
optional: false
|
|
53194
56618
|
}],
|
|
56619
|
+
"training.canaryResult": [{
|
|
56620
|
+
name: "deviceIds",
|
|
56621
|
+
form: "array",
|
|
56622
|
+
optional: false
|
|
56623
|
+
}],
|
|
53195
56624
|
"update.getStatus": [{
|
|
53196
56625
|
name: "deviceId",
|
|
53197
56626
|
form: "single",
|