@camstack/addon-provider-homematic 1.2.130 → 1.2.131
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 +1771 -131
- package/dist/addon.mjs +1771 -131
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -5387,7 +5387,7 @@ var ZodIssueCode = {
|
|
|
5387
5387
|
var ZodFirstPartyTypeKind;
|
|
5388
5388
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5389
5389
|
//#endregion
|
|
5390
|
-
//#region ../types/dist/sleep-
|
|
5390
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5391
5391
|
/**
|
|
5392
5392
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5393
5393
|
* window to float samples (D455).
|
|
@@ -5504,7 +5504,7 @@ function isKeychainStoredField(field) {
|
|
|
5504
5504
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5505
5505
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5506
5506
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5507
|
-
function isRecord$
|
|
5507
|
+
function isRecord$2(value) {
|
|
5508
5508
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5509
5509
|
}
|
|
5510
5510
|
function makeSecretMarker(ref) {
|
|
@@ -5515,12 +5515,12 @@ function makeSecretMarker(ref) {
|
|
|
5515
5515
|
}
|
|
5516
5516
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5517
5517
|
function isSecretMarker(value) {
|
|
5518
|
-
if (!isRecord$
|
|
5518
|
+
if (!isRecord$2(value)) return false;
|
|
5519
5519
|
const ref = value["$secret"];
|
|
5520
5520
|
return typeof ref === "string" && ref.length > 0;
|
|
5521
5521
|
}
|
|
5522
5522
|
function isSecretClear(value) {
|
|
5523
|
-
return isRecord$
|
|
5523
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5524
5524
|
}
|
|
5525
5525
|
/**
|
|
5526
5526
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6036,6 +6036,13 @@ function globalSecretScope() {
|
|
|
6036
6036
|
function encodeSegment(value) {
|
|
6037
6037
|
return encodeURIComponent(value);
|
|
6038
6038
|
}
|
|
6039
|
+
function decodeSegment(value) {
|
|
6040
|
+
try {
|
|
6041
|
+
return decodeURIComponent(value);
|
|
6042
|
+
} catch {
|
|
6043
|
+
return null;
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6039
6046
|
/**
|
|
6040
6047
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6041
6048
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6044,6 +6051,75 @@ function encodeSegment(value) {
|
|
|
6044
6051
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6045
6052
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6046
6053
|
}
|
|
6054
|
+
function parseScope(segments) {
|
|
6055
|
+
switch (segments[0]) {
|
|
6056
|
+
case "global": return {
|
|
6057
|
+
scope: GLOBAL_SCOPE,
|
|
6058
|
+
used: 1
|
|
6059
|
+
};
|
|
6060
|
+
case "node": {
|
|
6061
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6062
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6063
|
+
scope: {
|
|
6064
|
+
kind: "node",
|
|
6065
|
+
nodeId
|
|
6066
|
+
},
|
|
6067
|
+
used: 2
|
|
6068
|
+
};
|
|
6069
|
+
}
|
|
6070
|
+
case "device": {
|
|
6071
|
+
const raw = segments[1];
|
|
6072
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6073
|
+
return {
|
|
6074
|
+
scope: {
|
|
6075
|
+
kind: "device",
|
|
6076
|
+
deviceId: Number(raw)
|
|
6077
|
+
},
|
|
6078
|
+
used: 2
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
case "integration": {
|
|
6082
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6083
|
+
return id === null || id.length === 0 ? null : {
|
|
6084
|
+
scope: {
|
|
6085
|
+
kind: "integration",
|
|
6086
|
+
integrationId: id
|
|
6087
|
+
},
|
|
6088
|
+
used: 2
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
case "row": {
|
|
6092
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6093
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6094
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6095
|
+
return {
|
|
6096
|
+
scope: {
|
|
6097
|
+
kind: "row",
|
|
6098
|
+
collection,
|
|
6099
|
+
rowId
|
|
6100
|
+
},
|
|
6101
|
+
used: 3
|
|
6102
|
+
};
|
|
6103
|
+
}
|
|
6104
|
+
default: return null;
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6108
|
+
function parseSecretRef(ref) {
|
|
6109
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6110
|
+
const segments = ref.slice(9).split("/");
|
|
6111
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6112
|
+
if (owner === null || owner.length === 0) return null;
|
|
6113
|
+
const parsed = parseScope(segments.slice(1));
|
|
6114
|
+
if (parsed === null) return null;
|
|
6115
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6116
|
+
if (fieldPath.length === 0) return null;
|
|
6117
|
+
return {
|
|
6118
|
+
owner,
|
|
6119
|
+
scope: parsed.scope,
|
|
6120
|
+
fieldPath
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6047
6123
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6048
6124
|
var KeychainWriteRefusedError = class extends Error {
|
|
6049
6125
|
fieldPath;
|
|
@@ -6054,7 +6130,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6054
6130
|
}
|
|
6055
6131
|
};
|
|
6056
6132
|
var KEEP = { kind: "keep" };
|
|
6057
|
-
function isRecord$
|
|
6133
|
+
function isRecord$1(value) {
|
|
6058
6134
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6059
6135
|
}
|
|
6060
6136
|
function defaultMintId() {
|
|
@@ -6067,7 +6143,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6067
6143
|
return out;
|
|
6068
6144
|
}
|
|
6069
6145
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6070
|
-
else if (isRecord$
|
|
6146
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6071
6147
|
return out;
|
|
6072
6148
|
}
|
|
6073
6149
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6122,7 +6198,7 @@ function rowId(row, idKey) {
|
|
|
6122
6198
|
return null;
|
|
6123
6199
|
}
|
|
6124
6200
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6125
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6201
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6126
6202
|
if (!Array.isArray(incoming)) {
|
|
6127
6203
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6128
6204
|
return {
|
|
@@ -6138,7 +6214,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6138
6214
|
const kept = /* @__PURE__ */ new Set();
|
|
6139
6215
|
const rows = [];
|
|
6140
6216
|
for (const row of incoming) {
|
|
6141
|
-
if (!isRecord$
|
|
6217
|
+
if (!isRecord$1(row)) {
|
|
6142
6218
|
rows.push(row);
|
|
6143
6219
|
continue;
|
|
6144
6220
|
}
|
|
@@ -6163,7 +6239,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6163
6239
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6164
6240
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6165
6241
|
case "object": {
|
|
6166
|
-
if (!isRecord$
|
|
6242
|
+
if (!isRecord$1(incoming)) {
|
|
6167
6243
|
if (incoming === void 0) return KEEP;
|
|
6168
6244
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6169
6245
|
return {
|
|
@@ -6171,7 +6247,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6171
6247
|
value: incoming
|
|
6172
6248
|
};
|
|
6173
6249
|
}
|
|
6174
|
-
const storedObj = isRecord$
|
|
6250
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6175
6251
|
return {
|
|
6176
6252
|
kind: "value",
|
|
6177
6253
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6230,12 +6306,19 @@ async function transformSecretWrite(input) {
|
|
|
6230
6306
|
}
|
|
6231
6307
|
};
|
|
6232
6308
|
}
|
|
6309
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6310
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6311
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6312
|
+
}
|
|
6233
6313
|
/**
|
|
6234
6314
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6235
6315
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6236
6316
|
*/
|
|
6237
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6238
|
-
const
|
|
6317
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6318
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6319
|
+
const owner = options.ownedBy;
|
|
6320
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6321
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6239
6322
|
if (refs.length === 0) return {
|
|
6240
6323
|
value,
|
|
6241
6324
|
unresolved: []
|
|
@@ -6259,10 +6342,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6259
6342
|
}
|
|
6260
6343
|
const substitute = (v) => {
|
|
6261
6344
|
if (isSecretMarker(v)) {
|
|
6345
|
+
if (!inScope(v.$secret)) return {
|
|
6346
|
+
keep: true,
|
|
6347
|
+
value: v
|
|
6348
|
+
};
|
|
6262
6349
|
const answer = answers[v.$secret];
|
|
6263
|
-
|
|
6350
|
+
if (answer?.kind === "value") return {
|
|
6264
6351
|
keep: true,
|
|
6265
6352
|
value: answer.value
|
|
6353
|
+
};
|
|
6354
|
+
return keepMarker ? {
|
|
6355
|
+
keep: true,
|
|
6356
|
+
value: v
|
|
6266
6357
|
} : {
|
|
6267
6358
|
keep: false,
|
|
6268
6359
|
value: void 0
|
|
@@ -6279,7 +6370,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6279
6370
|
value: items
|
|
6280
6371
|
};
|
|
6281
6372
|
}
|
|
6282
|
-
if (isRecord$
|
|
6373
|
+
if (isRecord$1(v)) {
|
|
6283
6374
|
const out = {};
|
|
6284
6375
|
for (const [k, child] of Object.entries(v)) {
|
|
6285
6376
|
const s = substitute(child);
|
|
@@ -6300,14 +6391,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6300
6391
|
unresolved
|
|
6301
6392
|
};
|
|
6302
6393
|
}
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6394
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6395
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6396
|
+
ref;
|
|
6397
|
+
reason;
|
|
6398
|
+
constructor(ref, reason) {
|
|
6399
|
+
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.`);
|
|
6400
|
+
this.ref = ref;
|
|
6401
|
+
this.reason = reason;
|
|
6402
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6403
|
+
}
|
|
6404
|
+
};
|
|
6405
|
+
function isRecord$3(value) {
|
|
6406
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6407
|
+
}
|
|
6408
|
+
function resolvedValue(pass, marker) {
|
|
6409
|
+
const answer = pass.answers[marker.$secret];
|
|
6410
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6411
|
+
}
|
|
6412
|
+
async function atMarker(pass, incoming, stored) {
|
|
6413
|
+
if (incoming === null) return stored;
|
|
6414
|
+
if (typeof incoming !== "string") return incoming;
|
|
6415
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6416
|
+
const intent = classifySecretWrite(incoming);
|
|
6417
|
+
if (intent.kind !== "set") return stored;
|
|
6418
|
+
const ref = stored.$secret;
|
|
6419
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6420
|
+
const answer = pass.answers[ref];
|
|
6421
|
+
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);
|
|
6422
|
+
try {
|
|
6423
|
+
await pass.secrets.put(ref, intent.value);
|
|
6424
|
+
} catch (err) {
|
|
6425
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6426
|
+
}
|
|
6427
|
+
pass.changedRefs.push(ref);
|
|
6428
|
+
return stored;
|
|
6429
|
+
}
|
|
6430
|
+
function inArray(pass, incoming, stored) {
|
|
6431
|
+
return incoming.map((item, index) => {
|
|
6432
|
+
const twin = stored[index];
|
|
6433
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6434
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6435
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6436
|
+
return item;
|
|
6437
|
+
});
|
|
6438
|
+
}
|
|
6439
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6440
|
+
const out = { ...incoming };
|
|
6441
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6442
|
+
const twin = stored[key];
|
|
6443
|
+
if (isSecretMarker(twin)) {
|
|
6444
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6445
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6446
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6447
|
+
}
|
|
6448
|
+
return out;
|
|
6449
|
+
}
|
|
6450
|
+
async function walk(pass, incoming, stored) {
|
|
6451
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6452
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6453
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6454
|
+
const out = { ...incoming };
|
|
6455
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6456
|
+
return out;
|
|
6457
|
+
}
|
|
6458
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6459
|
+
async function restoreUnchangedSecrets(input) {
|
|
6460
|
+
const refs = [];
|
|
6461
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6462
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6463
|
+
if (owned.length === 0) return {
|
|
6464
|
+
patch: input.patch,
|
|
6465
|
+
changedRefs: []
|
|
6466
|
+
};
|
|
6467
|
+
const pass = {
|
|
6468
|
+
secrets: input.secrets,
|
|
6469
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6470
|
+
operatorWrite: input.operatorWrite,
|
|
6471
|
+
changedRefs: []
|
|
6472
|
+
};
|
|
6473
|
+
const out = {};
|
|
6474
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6475
|
+
return {
|
|
6476
|
+
patch: out,
|
|
6477
|
+
changedRefs: pass.changedRefs
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6481
|
+
function isJsonEqual(a, b) {
|
|
6482
|
+
if (Object.is(a, b)) return true;
|
|
6483
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6484
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6485
|
+
const keys = Object.keys(a);
|
|
6486
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6487
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6308
6488
|
}
|
|
6309
6489
|
return false;
|
|
6310
6490
|
}
|
|
6491
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6492
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6493
|
+
const out = {};
|
|
6494
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6495
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6496
|
+
out[key] = value;
|
|
6497
|
+
}
|
|
6498
|
+
return out;
|
|
6499
|
+
}
|
|
6500
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6501
|
+
function markerKeysOf(blob, owner) {
|
|
6502
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6503
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6504
|
+
return keys;
|
|
6505
|
+
}
|
|
6506
|
+
function nodeFromStored(value, owner) {
|
|
6507
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6508
|
+
if (!isRecord$3(value)) return null;
|
|
6509
|
+
const children = /* @__PURE__ */ new Map();
|
|
6510
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6511
|
+
const node = nodeFromStored(child, owner);
|
|
6512
|
+
if (node !== null) children.set(key, node);
|
|
6513
|
+
}
|
|
6514
|
+
return children.size > 0 ? {
|
|
6515
|
+
kind: "object",
|
|
6516
|
+
children
|
|
6517
|
+
} : null;
|
|
6518
|
+
}
|
|
6519
|
+
/**
|
|
6520
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6521
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6522
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6523
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6524
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6525
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6526
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6527
|
+
* over.
|
|
6528
|
+
*/
|
|
6529
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6530
|
+
const added = /* @__PURE__ */ new Map();
|
|
6531
|
+
for (const key of keys) {
|
|
6532
|
+
const at = key.indexOf("@");
|
|
6533
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6534
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6535
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6536
|
+
if (node !== null) added.set(base, node);
|
|
6537
|
+
}
|
|
6538
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6539
|
+
}
|
|
6311
6540
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6312
6541
|
async function readStoredAddonBlob(raw) {
|
|
6313
6542
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6316,7 +6545,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6316
6545
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6317
6546
|
return result.kind === "missing" ? {} : result.value;
|
|
6318
6547
|
}
|
|
6319
|
-
function
|
|
6548
|
+
function touchesTree(tree, patch) {
|
|
6549
|
+
if (tree.size === 0) return false;
|
|
6550
|
+
for (const key of Object.keys(patch)) {
|
|
6551
|
+
const at = key.indexOf("@");
|
|
6552
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6553
|
+
}
|
|
6554
|
+
return false;
|
|
6555
|
+
}
|
|
6556
|
+
/**
|
|
6557
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6558
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6559
|
+
*/
|
|
6560
|
+
var MarkerKeyIndex = class {
|
|
6561
|
+
owner;
|
|
6562
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6563
|
+
constructor(owner) {
|
|
6564
|
+
this.owner = owner;
|
|
6565
|
+
}
|
|
6566
|
+
seen(store, blob) {
|
|
6567
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6568
|
+
}
|
|
6569
|
+
wrote(store, patch) {
|
|
6570
|
+
const keys = this.byStore.get(store);
|
|
6571
|
+
if (keys === void 0) return;
|
|
6572
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6573
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6574
|
+
else keys.delete(key);
|
|
6575
|
+
}
|
|
6576
|
+
mayHoldMarkers(store, patch) {
|
|
6577
|
+
const keys = this.byStore.get(store);
|
|
6578
|
+
if (keys === void 0) return true;
|
|
6579
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6580
|
+
}
|
|
6581
|
+
};
|
|
6582
|
+
function createHandle(raw, opts) {
|
|
6320
6583
|
const chains = /* @__PURE__ */ new Map();
|
|
6321
6584
|
const serialize = (key, fn) => {
|
|
6322
6585
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6327,46 +6590,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6327
6590
|
});
|
|
6328
6591
|
return next;
|
|
6329
6592
|
};
|
|
6330
|
-
const
|
|
6331
|
-
|
|
6332
|
-
|
|
6593
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6594
|
+
const resolveRead = async (store, blob) => {
|
|
6595
|
+
index.seen(store, blob);
|
|
6596
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6597
|
+
unresolved: "keep-marker",
|
|
6598
|
+
ownedBy: opts.secrets.owner
|
|
6599
|
+
});
|
|
6600
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6601
|
+
return value;
|
|
6602
|
+
};
|
|
6603
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6604
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6605
|
+
await rawWrite(patch);
|
|
6606
|
+
index.wrote(store, patch);
|
|
6607
|
+
return { changed: true };
|
|
6608
|
+
}
|
|
6609
|
+
return serialize(store, async () => {
|
|
6333
6610
|
const stored = await readStored();
|
|
6611
|
+
index.seen(store, stored);
|
|
6612
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6613
|
+
const restored = await restoreUnchangedSecrets({
|
|
6614
|
+
patch,
|
|
6615
|
+
stored,
|
|
6616
|
+
secrets: opts.secrets,
|
|
6617
|
+
operatorWrite
|
|
6618
|
+
});
|
|
6334
6619
|
const result = await transformSecretWrite({
|
|
6335
|
-
tree,
|
|
6620
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6336
6621
|
secrets: opts.secrets,
|
|
6337
|
-
patch,
|
|
6622
|
+
patch: restored.patch,
|
|
6338
6623
|
stored,
|
|
6339
6624
|
...scope !== void 0 ? { scope } : {},
|
|
6340
|
-
operatorWrite
|
|
6625
|
+
operatorWrite
|
|
6341
6626
|
});
|
|
6342
|
-
|
|
6627
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6628
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6629
|
+
if (wroteBlob) {
|
|
6630
|
+
await rawWrite(effective);
|
|
6631
|
+
index.wrote(store, effective);
|
|
6632
|
+
}
|
|
6343
6633
|
const { orphaned } = await result.afterWrite();
|
|
6344
6634
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6635
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6345
6636
|
});
|
|
6346
6637
|
};
|
|
6347
|
-
const
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6638
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6639
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6640
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6641
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6642
|
+
const overrides = {
|
|
6643
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6644
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6645
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6646
|
+
return result.kind === "value" ? {
|
|
6647
|
+
kind: "value",
|
|
6648
|
+
value: await resolveRead("addon", result.value)
|
|
6649
|
+
} : result;
|
|
6650
|
+
} } : {},
|
|
6651
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6652
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6653
|
+
if (result.kind !== "present") return result;
|
|
6654
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6655
|
+
unresolved: "keep-marker",
|
|
6656
|
+
ownedBy: opts.secrets.owner
|
|
6657
|
+
});
|
|
6658
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6659
|
+
return {
|
|
6660
|
+
kind: "present",
|
|
6661
|
+
value: value[key]
|
|
6662
|
+
};
|
|
6663
|
+
} } : {},
|
|
6664
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6665
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6666
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6667
|
+
const out = /* @__PURE__ */ new Map();
|
|
6668
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6669
|
+
return out;
|
|
6670
|
+
} } : {},
|
|
6671
|
+
writeAddonStore: async (patch) => {
|
|
6672
|
+
await writeAddon(patch);
|
|
6673
|
+
},
|
|
6674
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6675
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6676
|
+
kind: "device",
|
|
6677
|
+
deviceId
|
|
6678
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6679
|
+
}
|
|
6680
|
+
};
|
|
6681
|
+
return {
|
|
6682
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6683
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6684
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6685
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6686
|
+
} }),
|
|
6687
|
+
raw: {
|
|
6688
|
+
readAddonStore: async () => {
|
|
6689
|
+
const blob = await raw.readAddonStore();
|
|
6690
|
+
index.seen("addon", blob);
|
|
6691
|
+
return blob;
|
|
6692
|
+
},
|
|
6693
|
+
readDeviceStore: async (deviceId) => {
|
|
6694
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6695
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6696
|
+
return blob;
|
|
6697
|
+
}
|
|
6698
|
+
},
|
|
6699
|
+
writeAddonStore: writeAddon
|
|
6353
6700
|
};
|
|
6354
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6355
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6356
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6357
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6358
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6359
|
-
} });
|
|
6360
6701
|
}
|
|
6361
|
-
/** The context the addon sees
|
|
6362
|
-
function
|
|
6702
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6703
|
+
function createSecretAwareContext(context, opts) {
|
|
6363
6704
|
const raw = context.settings;
|
|
6364
|
-
if (raw === void 0) return
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6705
|
+
if (raw === void 0) return {
|
|
6706
|
+
context,
|
|
6707
|
+
handle: null
|
|
6708
|
+
};
|
|
6709
|
+
const handle = createHandle(raw, opts);
|
|
6710
|
+
return {
|
|
6711
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6712
|
+
if (prop === "settings") return handle.settings;
|
|
6713
|
+
return Reflect.get(target, prop, receiver);
|
|
6714
|
+
} }),
|
|
6715
|
+
handle
|
|
6716
|
+
};
|
|
6370
6717
|
}
|
|
6371
6718
|
var LEAF = { kind: "leaf" };
|
|
6372
6719
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6541,6 +6888,14 @@ var BaseAddon = class {
|
|
|
6541
6888
|
_secretChangeUnsub = null;
|
|
6542
6889
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6543
6890
|
_operatorWriteDepth = 0;
|
|
6891
|
+
/**
|
|
6892
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6893
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6894
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6895
|
+
*/
|
|
6896
|
+
_secretSettings = null;
|
|
6897
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6898
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6544
6899
|
constructor(defaults) {
|
|
6545
6900
|
this.defaults = defaults;
|
|
6546
6901
|
this._config = { ...defaults };
|
|
@@ -6577,13 +6932,21 @@ var BaseAddon = class {
|
|
|
6577
6932
|
}
|
|
6578
6933
|
async initialize(context) {
|
|
6579
6934
|
const secrets = context.secrets;
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6935
|
+
if (secrets !== void 0) {
|
|
6936
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6937
|
+
secrets,
|
|
6938
|
+
addonTree: () => this.addonSecretTree(),
|
|
6939
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6940
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6941
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6942
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6943
|
+
});
|
|
6944
|
+
this._ctx = wrapped;
|
|
6945
|
+
this._secretSettings = handle;
|
|
6946
|
+
} else {
|
|
6947
|
+
this._ctx = context;
|
|
6948
|
+
this._secretSettings = null;
|
|
6949
|
+
}
|
|
6587
6950
|
await this.resolveConfig();
|
|
6588
6951
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6589
6952
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6700,11 +7063,8 @@ var BaseAddon = class {
|
|
|
6700
7063
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6701
7064
|
const schema = this.globalSettingsSchema(cap);
|
|
6702
7065
|
if (!schema) return { sections: [] };
|
|
6703
|
-
const projected = await this.
|
|
6704
|
-
return hydrateSchema(schema, overlay ? {
|
|
6705
|
-
...projected,
|
|
6706
|
-
...overlay
|
|
6707
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7066
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7067
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6708
7068
|
}
|
|
6709
7069
|
/**
|
|
6710
7070
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6749,7 +7109,7 @@ var BaseAddon = class {
|
|
|
6749
7109
|
});
|
|
6750
7110
|
}
|
|
6751
7111
|
if (sections.length === 0) return null;
|
|
6752
|
-
const projected = await this.
|
|
7112
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6753
7113
|
return hydrateSchema({
|
|
6754
7114
|
...schema,
|
|
6755
7115
|
sections
|
|
@@ -6766,12 +7126,50 @@ var BaseAddon = class {
|
|
|
6766
7126
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6767
7127
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6768
7128
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7129
|
+
*
|
|
7130
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7131
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7132
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7133
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7134
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7135
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6769
7136
|
*/
|
|
6770
7137
|
async resolveGlobalStore(nodeId, cap) {
|
|
6771
7138
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7139
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7140
|
+
}
|
|
7141
|
+
projectForNode(store, nodeId, cap) {
|
|
6772
7142
|
const keys = this.perNodeKeys(cap);
|
|
6773
7143
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6774
|
-
return keys.size > 0 ? projectStore(
|
|
7144
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7145
|
+
}
|
|
7146
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7147
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7148
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7149
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7150
|
+
}
|
|
7151
|
+
/**
|
|
7152
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7153
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7154
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7155
|
+
* its value.
|
|
7156
|
+
*/
|
|
7157
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7158
|
+
const secrets = this._ctx?.secrets;
|
|
7159
|
+
const merged = {
|
|
7160
|
+
...stored,
|
|
7161
|
+
...overlay
|
|
7162
|
+
};
|
|
7163
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7164
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7165
|
+
unresolved: "keep-marker",
|
|
7166
|
+
ownedBy: secrets.owner
|
|
7167
|
+
});
|
|
7168
|
+
for (const key of Object.keys(overlay)) {
|
|
7169
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7170
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7171
|
+
}
|
|
7172
|
+
return merged;
|
|
6775
7173
|
}
|
|
6776
7174
|
/**
|
|
6777
7175
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6836,8 +7234,12 @@ var BaseAddon = class {
|
|
|
6836
7234
|
async clearSecrets(keys, nodeId) {
|
|
6837
7235
|
const tree = this.addonSecretTree();
|
|
6838
7236
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7237
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6839
7238
|
const patch = {};
|
|
6840
|
-
for (const key of keys)
|
|
7239
|
+
for (const key of keys) {
|
|
7240
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7241
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7242
|
+
}
|
|
6841
7243
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6842
7244
|
}
|
|
6843
7245
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6845,7 +7247,11 @@ var BaseAddon = class {
|
|
|
6845
7247
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6846
7248
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6847
7249
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6848
|
-
|
|
7250
|
+
const handle = this._secretSettings;
|
|
7251
|
+
if (handle !== null) {
|
|
7252
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7253
|
+
if (!changed) return;
|
|
7254
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6849
7255
|
if (target !== localNode) return;
|
|
6850
7256
|
await this.resolveConfig();
|
|
6851
7257
|
await this.onConfigChanged();
|
|
@@ -6898,7 +7304,7 @@ var BaseAddon = class {
|
|
|
6898
7304
|
async getDeviceSettings(deviceId) {
|
|
6899
7305
|
const schema = this.deviceSettingsSchema();
|
|
6900
7306
|
if (!schema) return { sections: [] };
|
|
6901
|
-
return hydrateSchema(schema, await this.
|
|
7307
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6902
7308
|
}
|
|
6903
7309
|
async updateDeviceSettings(deviceId, patch) {
|
|
6904
7310
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7070,7 +7476,7 @@ var BaseAddon = class {
|
|
|
7070
7476
|
key,
|
|
7071
7477
|
schema,
|
|
7072
7478
|
fallback,
|
|
7073
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7479
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7074
7480
|
write: async (patch) => {
|
|
7075
7481
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7076
7482
|
},
|
|
@@ -7132,6 +7538,23 @@ var BaseAddon = class {
|
|
|
7132
7538
|
}
|
|
7133
7539
|
return value;
|
|
7134
7540
|
}
|
|
7541
|
+
/**
|
|
7542
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7543
|
+
* keychain the context's own view is already raw.
|
|
7544
|
+
*/
|
|
7545
|
+
rawSettings() {
|
|
7546
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7547
|
+
}
|
|
7548
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7549
|
+
logUnresolvedRead(unresolved) {
|
|
7550
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7551
|
+
if (fresh.length === 0) return;
|
|
7552
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7553
|
+
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) => ({
|
|
7554
|
+
ref: u.ref,
|
|
7555
|
+
reason: u.reason
|
|
7556
|
+
})) } });
|
|
7557
|
+
}
|
|
7135
7558
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7136
7559
|
scheduleSecretReresolve(delayMs) {
|
|
7137
7560
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7158,7 +7581,7 @@ var BaseAddon = class {
|
|
|
7158
7581
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7159
7582
|
*/
|
|
7160
7583
|
async readAddonStoreWithRetry() {
|
|
7161
|
-
const settings = this.
|
|
7584
|
+
const settings = this.rawSettings();
|
|
7162
7585
|
if (!settings) return {};
|
|
7163
7586
|
const delaysMs = [
|
|
7164
7587
|
150,
|
|
@@ -9461,6 +9884,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9461
9884
|
fetchedAt: number()
|
|
9462
9885
|
});
|
|
9463
9886
|
/**
|
|
9887
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9888
|
+
* gets back (cloud training, D805+).
|
|
9889
|
+
*
|
|
9890
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9891
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9892
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9893
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9894
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9895
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9896
|
+
* change there, in the same piece of work.
|
|
9897
|
+
*
|
|
9898
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9899
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9900
|
+
*/
|
|
9901
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9902
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9903
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9904
|
+
var TrainingExportSchema = _enum([
|
|
9905
|
+
"onnx",
|
|
9906
|
+
"openvino-fp16",
|
|
9907
|
+
"openvino-int8",
|
|
9908
|
+
"coreml-fp16"
|
|
9909
|
+
]);
|
|
9910
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9911
|
+
object({
|
|
9912
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9913
|
+
jobKey: string().uuid(),
|
|
9914
|
+
target: object({
|
|
9915
|
+
kind: literal("detector"),
|
|
9916
|
+
step: literal("object-detection")
|
|
9917
|
+
}),
|
|
9918
|
+
base: object({
|
|
9919
|
+
modelId: string().min(1),
|
|
9920
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9921
|
+
weights: string().min(1),
|
|
9922
|
+
imgsz: number().int().positive()
|
|
9923
|
+
}),
|
|
9924
|
+
baseline: object({
|
|
9925
|
+
modelId: string().min(1),
|
|
9926
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9927
|
+
onnxUrl: string().url(),
|
|
9928
|
+
imgsz: number().int().positive(),
|
|
9929
|
+
floors: FloorsSchema
|
|
9930
|
+
}),
|
|
9931
|
+
dataset: object({
|
|
9932
|
+
versionId: string().min(1),
|
|
9933
|
+
annotationHash: string(),
|
|
9934
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9935
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9936
|
+
}),
|
|
9937
|
+
split: object({
|
|
9938
|
+
holdoutCameras: array(number().int()),
|
|
9939
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9940
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9941
|
+
valFraction: number().min(0).max(.5),
|
|
9942
|
+
seed: number().int()
|
|
9943
|
+
}),
|
|
9944
|
+
hyper: object({
|
|
9945
|
+
epochs: number().int().positive(),
|
|
9946
|
+
batch: number().int().positive(),
|
|
9947
|
+
lr0: number().positive(),
|
|
9948
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9949
|
+
freeze: number().int().nonnegative(),
|
|
9950
|
+
patience: number().int().nonnegative(),
|
|
9951
|
+
seed: number().int()
|
|
9952
|
+
}),
|
|
9953
|
+
replay: object({
|
|
9954
|
+
source: literal("coco2017"),
|
|
9955
|
+
count: number().int().nonnegative()
|
|
9956
|
+
}),
|
|
9957
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9958
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9959
|
+
floors: object({
|
|
9960
|
+
minSupport: number().int().positive(),
|
|
9961
|
+
clamp: number().min(0).max(1)
|
|
9962
|
+
}),
|
|
9963
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9964
|
+
catalog: object({
|
|
9965
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9966
|
+
name: string().min(1).max(160)
|
|
9967
|
+
})
|
|
9968
|
+
});
|
|
9969
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9970
|
+
var TrainingResultFileSchema = object({
|
|
9971
|
+
path: string().min(1),
|
|
9972
|
+
bytes: number().int().nonnegative(),
|
|
9973
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9974
|
+
format: _enum([
|
|
9975
|
+
"onnx",
|
|
9976
|
+
"openvino",
|
|
9977
|
+
"coreml",
|
|
9978
|
+
"pt"
|
|
9979
|
+
]),
|
|
9980
|
+
variant: _enum(["base", "int8"])
|
|
9981
|
+
});
|
|
9982
|
+
var DraftFormatSchema = object({
|
|
9983
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9984
|
+
url: string().min(1),
|
|
9985
|
+
sizeMB: number().nonnegative(),
|
|
9986
|
+
isDirectory: boolean().optional(),
|
|
9987
|
+
files: array(string()).optional(),
|
|
9988
|
+
runtimes: array(literal("python")).optional(),
|
|
9989
|
+
revision: string().min(1)
|
|
9990
|
+
});
|
|
9991
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9992
|
+
var TrainingCatalogDraftSchema = object({
|
|
9993
|
+
id: string().min(1),
|
|
9994
|
+
name: string().min(1),
|
|
9995
|
+
description: string(),
|
|
9996
|
+
labels: array(unknown()),
|
|
9997
|
+
inputSize: object({
|
|
9998
|
+
width: number().int().positive(),
|
|
9999
|
+
height: number().int().positive()
|
|
10000
|
+
}),
|
|
10001
|
+
preprocessMode: literal("letterbox"),
|
|
10002
|
+
defaultClassFloors: FloorsSchema,
|
|
10003
|
+
formats: object({
|
|
10004
|
+
onnx: DraftFormatSchema.optional(),
|
|
10005
|
+
openvino: DraftFormatSchema.optional(),
|
|
10006
|
+
coreml: DraftFormatSchema.optional()
|
|
10007
|
+
})
|
|
10008
|
+
});
|
|
10009
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10010
|
+
var TrainingEvalClassSchema = object({
|
|
10011
|
+
positives: number().int(),
|
|
10012
|
+
floor: number().nullable(),
|
|
10013
|
+
tp: number().int(),
|
|
10014
|
+
fp: number().int(),
|
|
10015
|
+
fn: number().int(),
|
|
10016
|
+
precision: number().nullable(),
|
|
10017
|
+
recall: number().nullable(),
|
|
10018
|
+
ap50: number().nullable(),
|
|
10019
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10020
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10021
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10022
|
+
smallFound: number().int().optional(),
|
|
10023
|
+
smallTotal: number().int().optional()
|
|
10024
|
+
}).passthrough();
|
|
10025
|
+
var TrainingEvalReportSchema = object({
|
|
10026
|
+
frames: number().int(),
|
|
10027
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10028
|
+
}).passthrough();
|
|
10029
|
+
/**
|
|
10030
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10031
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10032
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10033
|
+
*/
|
|
10034
|
+
var TrainingResultSchema = object({
|
|
10035
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10036
|
+
jobKey: string(),
|
|
10037
|
+
status: _enum(["succeeded", "failed"]),
|
|
10038
|
+
error: object({
|
|
10039
|
+
stage: string(),
|
|
10040
|
+
code: string(),
|
|
10041
|
+
message: string()
|
|
10042
|
+
}).nullable(),
|
|
10043
|
+
trainer: object({
|
|
10044
|
+
version: string(),
|
|
10045
|
+
revision: string()
|
|
10046
|
+
}),
|
|
10047
|
+
toolchain: record(string(), string().nullable()),
|
|
10048
|
+
dataset: object({
|
|
10049
|
+
versionId: string(),
|
|
10050
|
+
annotationHash: string(),
|
|
10051
|
+
sha256: string(),
|
|
10052
|
+
frames: object({
|
|
10053
|
+
train: number().int(),
|
|
10054
|
+
val: number().int(),
|
|
10055
|
+
holdout: number().int()
|
|
10056
|
+
}),
|
|
10057
|
+
holdoutCameras: array(number().int()),
|
|
10058
|
+
replayImages: number().int()
|
|
10059
|
+
}).optional(),
|
|
10060
|
+
training: object({
|
|
10061
|
+
epochsRun: number().int(),
|
|
10062
|
+
bestEpoch: number().int(),
|
|
10063
|
+
bestMap50: number(),
|
|
10064
|
+
bestMap50_95: number(),
|
|
10065
|
+
seconds: number()
|
|
10066
|
+
}).optional(),
|
|
10067
|
+
evaluation: object({
|
|
10068
|
+
holdoutFrames: number().int(),
|
|
10069
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10070
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10071
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10072
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10073
|
+
map50: record(string(), number().nullable())
|
|
10074
|
+
}).optional(),
|
|
10075
|
+
floors: object({
|
|
10076
|
+
baseline: FloorsSchema,
|
|
10077
|
+
candidate: FloorsSchema,
|
|
10078
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10079
|
+
notes: array(string())
|
|
10080
|
+
}).optional(),
|
|
10081
|
+
int8: object({
|
|
10082
|
+
kept: boolean(),
|
|
10083
|
+
map50Fp16: number().nullable(),
|
|
10084
|
+
map50Int8: number().nullable(),
|
|
10085
|
+
reason: string().nullable()
|
|
10086
|
+
}).optional(),
|
|
10087
|
+
exportsDropped: array(object({
|
|
10088
|
+
export: string(),
|
|
10089
|
+
reason: string()
|
|
10090
|
+
})).optional(),
|
|
10091
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10092
|
+
bundle: object({
|
|
10093
|
+
path: literal("bundle.tar"),
|
|
10094
|
+
bytes: number().int().nonnegative(),
|
|
10095
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10096
|
+
}).nullable().optional(),
|
|
10097
|
+
catalogDraft: object({
|
|
10098
|
+
base: TrainingCatalogDraftSchema,
|
|
10099
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10100
|
+
}).nullable().optional(),
|
|
10101
|
+
licence: string()
|
|
10102
|
+
});
|
|
10103
|
+
var TrainingStageSchema = _enum([
|
|
10104
|
+
"prepare",
|
|
10105
|
+
"replay",
|
|
10106
|
+
"train",
|
|
10107
|
+
"eval",
|
|
10108
|
+
"export",
|
|
10109
|
+
"package"
|
|
10110
|
+
]);
|
|
10111
|
+
var EventBase = {
|
|
10112
|
+
v: literal(1),
|
|
10113
|
+
ts: number()
|
|
10114
|
+
};
|
|
10115
|
+
discriminatedUnion("type", [
|
|
10116
|
+
object({
|
|
10117
|
+
...EventBase,
|
|
10118
|
+
type: literal("stage"),
|
|
10119
|
+
stage: TrainingStageSchema
|
|
10120
|
+
}),
|
|
10121
|
+
object({
|
|
10122
|
+
...EventBase,
|
|
10123
|
+
type: literal("epoch"),
|
|
10124
|
+
epoch: number().int(),
|
|
10125
|
+
epochs: number().int(),
|
|
10126
|
+
boxLoss: number().nullable().optional(),
|
|
10127
|
+
map50: number().nullable().optional(),
|
|
10128
|
+
map50_95: number().nullable().optional(),
|
|
10129
|
+
etaSec: number().nullable().optional()
|
|
10130
|
+
}),
|
|
10131
|
+
object({
|
|
10132
|
+
...EventBase,
|
|
10133
|
+
type: literal("metric"),
|
|
10134
|
+
name: string(),
|
|
10135
|
+
value: number()
|
|
10136
|
+
}),
|
|
10137
|
+
object({
|
|
10138
|
+
...EventBase,
|
|
10139
|
+
type: literal("artifact"),
|
|
10140
|
+
path: string(),
|
|
10141
|
+
bytes: number(),
|
|
10142
|
+
sha256: string()
|
|
10143
|
+
}),
|
|
10144
|
+
object({
|
|
10145
|
+
...EventBase,
|
|
10146
|
+
type: literal("done"),
|
|
10147
|
+
status: _enum(["succeeded", "failed"]),
|
|
10148
|
+
resultSha256: string().nullable().optional()
|
|
10149
|
+
}),
|
|
10150
|
+
object({
|
|
10151
|
+
...EventBase,
|
|
10152
|
+
type: literal("error"),
|
|
10153
|
+
stage: string(),
|
|
10154
|
+
code: string(),
|
|
10155
|
+
message: string()
|
|
10156
|
+
})
|
|
10157
|
+
]);
|
|
10158
|
+
/**
|
|
9464
10159
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9465
10160
|
*
|
|
9466
10161
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11788,7 +12483,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11788
12483
|
"authenticated",
|
|
11789
12484
|
"admin"
|
|
11790
12485
|
]).optional(),
|
|
11791
|
-
description: string().optional()
|
|
12486
|
+
description: string().optional(),
|
|
12487
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12488
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11792
12489
|
});
|
|
11793
12490
|
/**
|
|
11794
12491
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12493,6 +13190,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12493
13190
|
lastError: string().optional()
|
|
12494
13191
|
});
|
|
12495
13192
|
/**
|
|
13193
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13194
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13195
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13196
|
+
* with it off — which restores without a key.
|
|
13197
|
+
*/
|
|
13198
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13199
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13200
|
+
scheme: string(),
|
|
13201
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13202
|
+
keyId: string()
|
|
13203
|
+
});
|
|
13204
|
+
/**
|
|
13205
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13206
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13207
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13208
|
+
*/
|
|
13209
|
+
var BackupEncryptionStatusSchema = object({
|
|
13210
|
+
enabled: boolean(),
|
|
13211
|
+
active: object({
|
|
13212
|
+
keyId: string(),
|
|
13213
|
+
publicKey: string(),
|
|
13214
|
+
createdAt: number()
|
|
13215
|
+
}).nullable(),
|
|
13216
|
+
/** Every key ever set up, newest first. */
|
|
13217
|
+
keys: array(object({
|
|
13218
|
+
keyId: string(),
|
|
13219
|
+
createdAt: number(),
|
|
13220
|
+
retiredAt: number().nullable()
|
|
13221
|
+
})).readonly()
|
|
13222
|
+
});
|
|
13223
|
+
/**
|
|
12496
13224
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12497
13225
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12498
13226
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12504,7 +13232,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12504
13232
|
sizeBytes: number(),
|
|
12505
13233
|
label: string().optional(),
|
|
12506
13234
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12507
|
-
locations: array(string()).readonly()
|
|
13235
|
+
locations: array(string()).readonly(),
|
|
13236
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13237
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12508
13238
|
});
|
|
12509
13239
|
var BackupEntrySchema = object({
|
|
12510
13240
|
id: string(),
|
|
@@ -12513,7 +13243,8 @@ var BackupEntrySchema = object({
|
|
|
12513
13243
|
label: string().optional(),
|
|
12514
13244
|
createdAt: number(),
|
|
12515
13245
|
sizeBytes: number(),
|
|
12516
|
-
locations: array(string()).optional()
|
|
13246
|
+
locations: array(string()).optional(),
|
|
13247
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12517
13248
|
});
|
|
12518
13249
|
var ArchiveEntrySchema = object({
|
|
12519
13250
|
path: string(),
|
|
@@ -12702,10 +13433,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12702
13433
|
* this list and skips entries whose path doesn't start with
|
|
12703
13434
|
* any of them.
|
|
12704
13435
|
*/
|
|
12705
|
-
locations: array(string()).optional()
|
|
13436
|
+
locations: array(string()).optional(),
|
|
13437
|
+
/**
|
|
13438
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13439
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13440
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13441
|
+
* is refused before the archive is downloaded.
|
|
13442
|
+
*/
|
|
13443
|
+
backupSecretKey: string().optional()
|
|
12706
13444
|
}), _void(), {
|
|
12707
13445
|
kind: "mutation",
|
|
12708
13446
|
auth: "admin"
|
|
13447
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13448
|
+
keyId: string(),
|
|
13449
|
+
secretKey: string(),
|
|
13450
|
+
publicKey: string(),
|
|
13451
|
+
createdAt: number(),
|
|
13452
|
+
replacedKeyId: string().nullable()
|
|
13453
|
+
}), {
|
|
13454
|
+
kind: "mutation",
|
|
13455
|
+
auth: "admin"
|
|
13456
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13457
|
+
kind: "mutation",
|
|
13458
|
+
auth: "admin"
|
|
13459
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13460
|
+
valid: boolean(),
|
|
13461
|
+
keyId: string().nullable(),
|
|
13462
|
+
/** The hub knows this key (active or retired). */
|
|
13463
|
+
known: boolean(),
|
|
13464
|
+
/** It is the key new archives are encrypted to. */
|
|
13465
|
+
active: boolean(),
|
|
13466
|
+
error: string().optional()
|
|
13467
|
+
}), {
|
|
13468
|
+
kind: "mutation",
|
|
13469
|
+
auth: "admin"
|
|
12709
13470
|
}), method(object({
|
|
12710
13471
|
destinationId: string(),
|
|
12711
13472
|
backupId: string()
|
|
@@ -14480,7 +15241,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14480
15241
|
stepId: string(),
|
|
14481
15242
|
entry: ModelCatalogEntrySchema
|
|
14482
15243
|
});
|
|
14483
|
-
|
|
15244
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15245
|
+
var ModelBundleFileSchema = object({
|
|
15246
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15247
|
+
path: string().min(1),
|
|
15248
|
+
bytes: number().int().nonnegative(),
|
|
15249
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15250
|
+
});
|
|
15251
|
+
var ImportModelBundleInputSchema = object({
|
|
15252
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15253
|
+
addonId: string(),
|
|
15254
|
+
stepId: string().min(1),
|
|
15255
|
+
/**
|
|
15256
|
+
* The catalog rows to register, complete, every format URL already
|
|
15257
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15258
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15259
|
+
*/
|
|
15260
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15261
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15262
|
+
bundle: object({
|
|
15263
|
+
ticket: PeerBytesTicketSchema,
|
|
15264
|
+
bytes: number().int().positive(),
|
|
15265
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15266
|
+
}),
|
|
15267
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15268
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15269
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15270
|
+
distribute: boolean()
|
|
15271
|
+
});
|
|
15272
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15273
|
+
kind: literal("imported"),
|
|
15274
|
+
modelIds: array(string()).readonly(),
|
|
15275
|
+
distributed: array(object({
|
|
15276
|
+
modelId: string(),
|
|
15277
|
+
nodeId: string(),
|
|
15278
|
+
format: _enum(MODEL_FORMATS),
|
|
15279
|
+
ok: boolean(),
|
|
15280
|
+
error: string().optional()
|
|
15281
|
+
})).readonly()
|
|
15282
|
+
}), object({
|
|
15283
|
+
kind: literal("refused"),
|
|
15284
|
+
reason: _enum([
|
|
15285
|
+
"transfer-failed",
|
|
15286
|
+
"checksum-mismatch",
|
|
15287
|
+
"bundle-mismatch",
|
|
15288
|
+
"invalid-entry",
|
|
15289
|
+
"id-taken"
|
|
15290
|
+
]),
|
|
15291
|
+
detail: string()
|
|
15292
|
+
})]);
|
|
15293
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15294
|
+
kind: "mutation",
|
|
15295
|
+
auth: "admin",
|
|
15296
|
+
timeoutMs: 30 * 6e4
|
|
15297
|
+
});
|
|
14484
15298
|
/**
|
|
14485
15299
|
* Query filter for settings-store collections.
|
|
14486
15300
|
*/
|
|
@@ -14959,6 +15773,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14959
15773
|
*/
|
|
14960
15774
|
sharesBackupWithDatabase: boolean()
|
|
14961
15775
|
});
|
|
15776
|
+
/**
|
|
15777
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15778
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15779
|
+
*/
|
|
15780
|
+
var KeychainResetRecordSchema = object({
|
|
15781
|
+
id: string(),
|
|
15782
|
+
at: number(),
|
|
15783
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15784
|
+
actor: string(),
|
|
15785
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15786
|
+
lockedReason: string().nullable(),
|
|
15787
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15788
|
+
archived: number().int(),
|
|
15789
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15790
|
+
archivedCollection: string().nullable(),
|
|
15791
|
+
/**
|
|
15792
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15793
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15794
|
+
*/
|
|
15795
|
+
archivedKeysCollection: string().nullable(),
|
|
15796
|
+
/**
|
|
15797
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15798
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15799
|
+
* agent forever (D797).
|
|
15800
|
+
*/
|
|
15801
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15802
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15803
|
+
acknowledgedAt: number().nullable()
|
|
15804
|
+
});
|
|
14962
15805
|
var KeychainStatusSchema = object({
|
|
14963
15806
|
keychain: KeychainStateSchema,
|
|
14964
15807
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14976,7 +15819,9 @@ var KeychainStatusSchema = object({
|
|
|
14976
15819
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14977
15820
|
retiredWraps: number().int(),
|
|
14978
15821
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14979
|
-
secretCount: number().int()
|
|
15822
|
+
secretCount: number().int(),
|
|
15823
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15824
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14980
15825
|
});
|
|
14981
15826
|
/**
|
|
14982
15827
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -14998,17 +15843,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
14998
15843
|
"download-recovery-key",
|
|
14999
15844
|
"delete-orphans",
|
|
15000
15845
|
"reset",
|
|
15846
|
+
"acknowledge-reset",
|
|
15001
15847
|
"initialize"
|
|
15002
15848
|
]);
|
|
15003
15849
|
var KeychainAuditEntrySchema = object({
|
|
15004
15850
|
id: string(),
|
|
15005
15851
|
at: number(),
|
|
15006
15852
|
action: KeychainAuditActionSchema,
|
|
15007
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15853
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15008
15854
|
actor: string(),
|
|
15009
15855
|
ref: string().nullable(),
|
|
15010
15856
|
detail: string().nullable()
|
|
15011
15857
|
});
|
|
15858
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15859
|
+
/**
|
|
15860
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15861
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15862
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15863
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15864
|
+
*/
|
|
15865
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15012
15866
|
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({
|
|
15013
15867
|
value: string(),
|
|
15014
15868
|
version: number().int()
|
|
@@ -15016,6 +15870,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15016
15870
|
kind: "mutation",
|
|
15017
15871
|
auth: "admin",
|
|
15018
15872
|
caller: "required"
|
|
15873
|
+
}), method(object({
|
|
15874
|
+
name: SystemHeldSecretNameSchema,
|
|
15875
|
+
value: string().min(16)
|
|
15876
|
+
}), object({
|
|
15877
|
+
ref: string(),
|
|
15878
|
+
version: number().int()
|
|
15879
|
+
}), {
|
|
15880
|
+
kind: "mutation",
|
|
15881
|
+
auth: "admin",
|
|
15882
|
+
caller: "required"
|
|
15019
15883
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15020
15884
|
deleted: array(string()).readonly(),
|
|
15021
15885
|
kept: array(object({
|
|
@@ -15045,13 +15909,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15045
15909
|
kind: "mutation",
|
|
15046
15910
|
auth: "admin",
|
|
15047
15911
|
caller: "required"
|
|
15048
|
-
}), method(object({ confirm: literal(
|
|
15912
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15049
15913
|
archivedCollection: string().nullable(),
|
|
15050
15914
|
archived: number().int()
|
|
15051
15915
|
}), {
|
|
15052
15916
|
kind: "mutation",
|
|
15053
15917
|
auth: "admin",
|
|
15054
15918
|
caller: "required"
|
|
15919
|
+
}), method(object({}), object({
|
|
15920
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15921
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15922
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15923
|
+
kind: "mutation",
|
|
15924
|
+
auth: "admin",
|
|
15925
|
+
caller: "required"
|
|
15055
15926
|
});
|
|
15056
15927
|
method(_void(), object({
|
|
15057
15928
|
id: string(),
|
|
@@ -18015,7 +18886,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18015
18886
|
* `login-method` — collection cap through which auth addons contribute
|
|
18016
18887
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18017
18888
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18018
|
-
* every auth addon (OIDC,
|
|
18889
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18019
18890
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18020
18891
|
* procedure aggregates them for the unauthenticated login page.
|
|
18021
18892
|
*
|
|
@@ -18023,8 +18894,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18023
18894
|
*
|
|
18024
18895
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18025
18896
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18026
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18027
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18897
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18028
18898
|
* login page needs NO change.
|
|
18029
18899
|
*
|
|
18030
18900
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18043,8 +18913,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18043
18913
|
* decision.
|
|
18044
18914
|
*
|
|
18045
18915
|
* Every contribution carries a `stage`:
|
|
18046
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18047
|
-
*
|
|
18916
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18917
|
+
* buttons; a usernameless passkey).
|
|
18048
18918
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18049
18919
|
* returned `factors` (passkey-as-2FA today).
|
|
18050
18920
|
*
|
|
@@ -18071,7 +18941,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18071
18941
|
* The provider names an external identity a signed-in user can link to
|
|
18072
18942
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18073
18943
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18074
|
-
* whatever their id. Absent / false — a login button only
|
|
18944
|
+
* whatever their id. Absent / false — a login button only.
|
|
18075
18945
|
*/
|
|
18076
18946
|
linkable: boolean().optional()
|
|
18077
18947
|
}),
|
|
@@ -21926,8 +22796,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21926
22796
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21927
22797
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21928
22798
|
* distinction was only ever used to route role-specific procedures
|
|
21929
|
-
* which we no longer have.
|
|
21930
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22799
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21931
22800
|
* with `isAdmin: false` + an explicit scope list.
|
|
21932
22801
|
*/
|
|
21933
22802
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23602,6 +24471,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23602
24471
|
frameIds: array(string()).max(2e4).optional(),
|
|
23603
24472
|
/** Only frames in at least one of these named collections. */
|
|
23604
24473
|
collectionIds: array(string()).max(200).optional(),
|
|
24474
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24475
|
+
* unknown id selects nothing. */
|
|
24476
|
+
datasetVersionId: string().optional(),
|
|
23605
24477
|
batchId: string().optional(),
|
|
23606
24478
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23607
24479
|
completeOnly: boolean().optional()
|
|
@@ -23769,6 +24641,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23769
24641
|
]),
|
|
23770
24642
|
detail: string().optional()
|
|
23771
24643
|
})]);
|
|
24644
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24645
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24646
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24647
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24648
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24649
|
+
});
|
|
24650
|
+
/** The counts a dataset is judged by. */
|
|
24651
|
+
var RetrainDatasetStatsSchema = object({
|
|
24652
|
+
frames: number().int(),
|
|
24653
|
+
completeFrames: number().int(),
|
|
24654
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24655
|
+
completeness: number(),
|
|
24656
|
+
/** Boxes to learn (model errors excluded). */
|
|
24657
|
+
subjects: number().int(),
|
|
24658
|
+
modelErrors: number().int(),
|
|
24659
|
+
/** Complete frames with no subject. */
|
|
24660
|
+
hardNegatives: number().int(),
|
|
24661
|
+
/** Subjects per class × camera × day/night. */
|
|
24662
|
+
cells: array(object({
|
|
24663
|
+
macroClass: string(),
|
|
24664
|
+
deviceId: number(),
|
|
24665
|
+
lighting: _enum([
|
|
24666
|
+
"day",
|
|
24667
|
+
"night",
|
|
24668
|
+
"unknown"
|
|
24669
|
+
]),
|
|
24670
|
+
subjects: number().int(),
|
|
24671
|
+
frames: number().int()
|
|
24672
|
+
})).readonly(),
|
|
24673
|
+
cameras: array(object({
|
|
24674
|
+
deviceId: number(),
|
|
24675
|
+
frames: number().int(),
|
|
24676
|
+
completeFrames: number().int()
|
|
24677
|
+
})).readonly()
|
|
24678
|
+
});
|
|
24679
|
+
/** An immutable dataset version, without its frame list. */
|
|
24680
|
+
var RetrainDatasetVersionSchema = object({
|
|
24681
|
+
id: string(),
|
|
24682
|
+
name: string(),
|
|
24683
|
+
createdAt: number(),
|
|
24684
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24685
|
+
layout: RetrainExportLayoutSchema,
|
|
24686
|
+
completeOnly: boolean(),
|
|
24687
|
+
frameCount: number().int(),
|
|
24688
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24689
|
+
annotationHash: string(),
|
|
24690
|
+
/** The export manifest schema the version was cut under. */
|
|
24691
|
+
manifestSchema: string(),
|
|
24692
|
+
stats: RetrainDatasetStatsSchema
|
|
24693
|
+
});
|
|
24694
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24695
|
+
kind: literal("created"),
|
|
24696
|
+
version: RetrainDatasetVersionSchema
|
|
24697
|
+
}), object({
|
|
24698
|
+
kind: literal("refused"),
|
|
24699
|
+
reason: _enum([
|
|
24700
|
+
"empty-name",
|
|
24701
|
+
"duplicate-name",
|
|
24702
|
+
"no-frames"
|
|
24703
|
+
])
|
|
24704
|
+
})]);
|
|
23772
24705
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23773
24706
|
var RetrainTransitionResultSchema = object({
|
|
23774
24707
|
trackId: string(),
|
|
@@ -24558,6 +25491,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24558
25491
|
kind: "mutation",
|
|
24559
25492
|
auth: "admin",
|
|
24560
25493
|
timeoutMs: 60 * 6e4
|
|
25494
|
+
}), method(object({
|
|
25495
|
+
filter: RetrainExportFilterSchema,
|
|
25496
|
+
layout: RetrainExportLayoutSchema
|
|
25497
|
+
}), object({
|
|
25498
|
+
ticket: PeerBytesTicketSchema,
|
|
25499
|
+
frames: number().int(),
|
|
25500
|
+
annotations: number().int()
|
|
25501
|
+
}), {
|
|
25502
|
+
kind: "mutation",
|
|
25503
|
+
auth: "admin",
|
|
25504
|
+
timeoutMs: 12e4
|
|
25505
|
+
}), method(object({
|
|
25506
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25507
|
+
completeOnly: boolean().optional()
|
|
25508
|
+
}), RetrainDatasetStatsSchema, {
|
|
25509
|
+
kind: "query",
|
|
25510
|
+
auth: "admin"
|
|
25511
|
+
}), method(object({
|
|
25512
|
+
name: string().max(120),
|
|
25513
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25514
|
+
layout: RetrainExportLayoutSchema,
|
|
25515
|
+
completeOnly: boolean()
|
|
25516
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25517
|
+
kind: "mutation",
|
|
25518
|
+
auth: "admin",
|
|
25519
|
+
timeoutMs: 12e4
|
|
25520
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25521
|
+
kind: "query",
|
|
25522
|
+
auth: "admin"
|
|
25523
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25524
|
+
kind: "mutation",
|
|
25525
|
+
auth: "admin"
|
|
25526
|
+
}), method(object({ id: string() }), object({
|
|
25527
|
+
found: boolean(),
|
|
25528
|
+
annotationHash: string(),
|
|
25529
|
+
matches: boolean(),
|
|
25530
|
+
missingFrames: number().int()
|
|
25531
|
+
}), {
|
|
25532
|
+
kind: "query",
|
|
25533
|
+
auth: "admin",
|
|
25534
|
+
timeoutMs: 12e4
|
|
24561
25535
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24562
25536
|
kind: "query",
|
|
24563
25537
|
auth: "admin"
|
|
@@ -28136,8 +29110,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28136
29110
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28137
29111
|
*
|
|
28138
29112
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28139
|
-
* one for transactional / one for notifications). Consumers (
|
|
28140
|
-
*
|
|
29113
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29114
|
+
* addons, …) walk the collection and pick the first
|
|
28141
29115
|
* ready provider OR target a specific addonId.
|
|
28142
29116
|
*
|
|
28143
29117
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28316,7 +29290,7 @@ targets: array(object({
|
|
|
28316
29290
|
})));
|
|
28317
29291
|
/**
|
|
28318
29292
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28319
|
-
* providers (OIDC, SAML,
|
|
29293
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28320
29294
|
* carrying the post-callback claims before redirecting back to
|
|
28321
29295
|
* `/api/auth/sso/finish`.
|
|
28322
29296
|
*
|
|
@@ -28379,7 +29353,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28379
29353
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28380
29354
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28381
29355
|
*/
|
|
28382
|
-
issuer: string().optional()
|
|
29356
|
+
issuer: string().optional(),
|
|
29357
|
+
/**
|
|
29358
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29359
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29360
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29361
|
+
* any other browser.
|
|
29362
|
+
*/
|
|
29363
|
+
browserBinding: string().optional()
|
|
28383
29364
|
});
|
|
28384
29365
|
method(object({
|
|
28385
29366
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -40638,16 +41619,6 @@ var ApiKeySummarySchema = object({
|
|
|
40638
41619
|
createdAt: number(),
|
|
40639
41620
|
lastUsedAt: number().optional()
|
|
40640
41621
|
});
|
|
40641
|
-
var CreateApiKeyInputSchema = object({
|
|
40642
|
-
label: string(),
|
|
40643
|
-
isAdmin: boolean().default(false),
|
|
40644
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
40645
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
40646
|
-
});
|
|
40647
|
-
var CreateApiKeyResultSchema = object({
|
|
40648
|
-
token: string(),
|
|
40649
|
-
record: ApiKeySummarySchema
|
|
40650
|
-
});
|
|
40651
41622
|
var ScopedTokenSummarySchema = object({
|
|
40652
41623
|
id: string(),
|
|
40653
41624
|
userId: string(),
|
|
@@ -40746,17 +41717,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40746
41717
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40747
41718
|
kind: "mutation",
|
|
40748
41719
|
access: "view"
|
|
40749
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40750
|
-
kind: "mutation",
|
|
40751
|
-
auth: "admin",
|
|
40752
|
-
access: "create"
|
|
40753
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41720
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40754
41721
|
kind: "mutation",
|
|
40755
41722
|
auth: "admin",
|
|
40756
41723
|
access: "delete"
|
|
40757
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40758
|
-
kind: "mutation",
|
|
40759
|
-
access: "view"
|
|
40760
41724
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40761
41725
|
kind: "mutation",
|
|
40762
41726
|
auth: "admin",
|
|
@@ -40830,15 +41794,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40830
41794
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40831
41795
|
userId: string(),
|
|
40832
41796
|
issuer: string()
|
|
40833
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40834
|
-
userId: string(),
|
|
40835
|
-
issuer: string().min(1),
|
|
40836
|
-
label: string().optional()
|
|
40837
|
-
}), object({ success: literal(true) }), {
|
|
40838
|
-
kind: "mutation",
|
|
40839
|
-
auth: "admin",
|
|
40840
|
-
access: "create"
|
|
40841
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41797
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40842
41798
|
kind: "mutation",
|
|
40843
41799
|
auth: "admin",
|
|
40844
41800
|
access: "delete"
|
|
@@ -41543,6 +42499,451 @@ var zoneRulesCapability = {
|
|
|
41543
42499
|
*/
|
|
41544
42500
|
durability: "restored"
|
|
41545
42501
|
};
|
|
42502
|
+
/**
|
|
42503
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42504
|
+
*
|
|
42505
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42506
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42507
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42508
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42509
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42510
|
+
* manifest entry and nothing else.
|
|
42511
|
+
*
|
|
42512
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42513
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42514
|
+
* Every method is `admin`: these spend money.
|
|
42515
|
+
*
|
|
42516
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42517
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42518
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42519
|
+
*
|
|
42520
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42521
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42522
|
+
* ticket the provider mints (D613).
|
|
42523
|
+
*/
|
|
42524
|
+
var TrainingGpuOptionSchema = object({
|
|
42525
|
+
id: string(),
|
|
42526
|
+
label: string(),
|
|
42527
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42528
|
+
usdPerHour: number().nonnegative(),
|
|
42529
|
+
vramGb: number().nonnegative()
|
|
42530
|
+
});
|
|
42531
|
+
var TrainingRegionOptionSchema = object({
|
|
42532
|
+
/** `''` = any region (the provider's choice). */
|
|
42533
|
+
id: string(),
|
|
42534
|
+
label: string(),
|
|
42535
|
+
priceMultiplier: number().positive()
|
|
42536
|
+
});
|
|
42537
|
+
/**
|
|
42538
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42539
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42540
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42541
|
+
*/
|
|
42542
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42543
|
+
gpuType: string(),
|
|
42544
|
+
region: string(),
|
|
42545
|
+
costCapUsd: number().nonnegative(),
|
|
42546
|
+
maxRuntimeSec: number().int().positive(),
|
|
42547
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42548
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42549
|
+
});
|
|
42550
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42551
|
+
addonId: string(),
|
|
42552
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42553
|
+
kind: string(),
|
|
42554
|
+
label: string(),
|
|
42555
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42556
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42557
|
+
maxDatasetBytes: number().int().positive(),
|
|
42558
|
+
maxRuntimeSec: number().int().positive(),
|
|
42559
|
+
freeTierNote: string().optional(),
|
|
42560
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42561
|
+
dataResidencyNote: string(),
|
|
42562
|
+
/** Credentials are present — never the values. */
|
|
42563
|
+
configured: boolean(),
|
|
42564
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42565
|
+
});
|
|
42566
|
+
var TrainingCredentialCheckSchema = object({
|
|
42567
|
+
ok: boolean(),
|
|
42568
|
+
/** Workspace / account name, when the provider says. */
|
|
42569
|
+
account: string().optional(),
|
|
42570
|
+
reason: _enum([
|
|
42571
|
+
"missing",
|
|
42572
|
+
"invalid",
|
|
42573
|
+
"forbidden",
|
|
42574
|
+
"network",
|
|
42575
|
+
"quota"
|
|
42576
|
+
]).optional(),
|
|
42577
|
+
detail: string().optional()
|
|
42578
|
+
});
|
|
42579
|
+
var ProviderJobStateSchema = _enum([
|
|
42580
|
+
"pending",
|
|
42581
|
+
"starting",
|
|
42582
|
+
"running",
|
|
42583
|
+
"succeeded",
|
|
42584
|
+
"failed",
|
|
42585
|
+
"cancelled",
|
|
42586
|
+
"lost"
|
|
42587
|
+
]);
|
|
42588
|
+
var ProviderJobStatusSchema = object({
|
|
42589
|
+
jobKey: string(),
|
|
42590
|
+
providerJobId: string().optional(),
|
|
42591
|
+
state: ProviderJobStateSchema,
|
|
42592
|
+
startedAt: number().optional(),
|
|
42593
|
+
endedAt: number().optional(),
|
|
42594
|
+
exitCode: number().int().optional(),
|
|
42595
|
+
failureReason: string().optional(),
|
|
42596
|
+
gpuType: string(),
|
|
42597
|
+
region: string().optional(),
|
|
42598
|
+
billedSeconds: number().nonnegative(),
|
|
42599
|
+
costUsd: number().nonnegative(),
|
|
42600
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42601
|
+
costIsEstimate: boolean(),
|
|
42602
|
+
lastFetchedAt: number()
|
|
42603
|
+
});
|
|
42604
|
+
/**
|
|
42605
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42606
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42607
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42608
|
+
* in `result.json`.
|
|
42609
|
+
*/
|
|
42610
|
+
var TrainerSourceRefSchema = object({
|
|
42611
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42612
|
+
repo: string().min(1),
|
|
42613
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42614
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42615
|
+
});
|
|
42616
|
+
var JobRef = {
|
|
42617
|
+
addonId: string(),
|
|
42618
|
+
jobKey: string().uuid()
|
|
42619
|
+
};
|
|
42620
|
+
var TrainingLogLineSchema = object({
|
|
42621
|
+
ts: number(),
|
|
42622
|
+
text: string()
|
|
42623
|
+
});
|
|
42624
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42625
|
+
kind: "mutation",
|
|
42626
|
+
auth: "admin",
|
|
42627
|
+
timeoutMs: 3e4
|
|
42628
|
+
}), method(object({
|
|
42629
|
+
addonId: string(),
|
|
42630
|
+
gpuType: string(),
|
|
42631
|
+
region: string(),
|
|
42632
|
+
datasetBytes: number().int().nonnegative(),
|
|
42633
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42634
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42635
|
+
}), object({
|
|
42636
|
+
usdLow: number().nonnegative(),
|
|
42637
|
+
usdHigh: number().nonnegative(),
|
|
42638
|
+
notes: array(string()).readonly()
|
|
42639
|
+
}), { auth: "admin" }), method(object({
|
|
42640
|
+
...JobRef,
|
|
42641
|
+
ticket: PeerBytesTicketSchema
|
|
42642
|
+
}), object({
|
|
42643
|
+
bytes: number().int().nonnegative(),
|
|
42644
|
+
sha256: string()
|
|
42645
|
+
}), {
|
|
42646
|
+
kind: "mutation",
|
|
42647
|
+
auth: "admin",
|
|
42648
|
+
timeoutMs: 120 * 6e4
|
|
42649
|
+
}), method(object({
|
|
42650
|
+
...JobRef,
|
|
42651
|
+
trainer: TrainerSourceRefSchema,
|
|
42652
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42653
|
+
gpuType: string(),
|
|
42654
|
+
region: string(),
|
|
42655
|
+
maxRuntimeSec: number().int().positive()
|
|
42656
|
+
}), ProviderJobStatusSchema, {
|
|
42657
|
+
kind: "mutation",
|
|
42658
|
+
auth: "admin",
|
|
42659
|
+
timeoutMs: 30 * 6e4
|
|
42660
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42661
|
+
auth: "admin",
|
|
42662
|
+
timeoutMs: 6e4
|
|
42663
|
+
}), method(object({
|
|
42664
|
+
...JobRef,
|
|
42665
|
+
cursor: string().optional(),
|
|
42666
|
+
max: number().int().min(1).max(500)
|
|
42667
|
+
}), object({
|
|
42668
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42669
|
+
cursor: string()
|
|
42670
|
+
}), {
|
|
42671
|
+
auth: "admin",
|
|
42672
|
+
timeoutMs: 6e4
|
|
42673
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42674
|
+
kind: "mutation",
|
|
42675
|
+
auth: "admin",
|
|
42676
|
+
timeoutMs: 6e4
|
|
42677
|
+
}), method(object(JobRef), object({
|
|
42678
|
+
found: boolean(),
|
|
42679
|
+
text: string().optional()
|
|
42680
|
+
}), {
|
|
42681
|
+
kind: "mutation",
|
|
42682
|
+
auth: "admin",
|
|
42683
|
+
timeoutMs: 5 * 6e4
|
|
42684
|
+
}), method(object({
|
|
42685
|
+
...JobRef,
|
|
42686
|
+
path: _enum(["bundle.tar"])
|
|
42687
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42688
|
+
kind: "mutation",
|
|
42689
|
+
auth: "admin",
|
|
42690
|
+
timeoutMs: 5 * 6e4
|
|
42691
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42692
|
+
kind: "mutation",
|
|
42693
|
+
auth: "admin",
|
|
42694
|
+
timeoutMs: 5 * 6e4
|
|
42695
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42696
|
+
auth: "admin",
|
|
42697
|
+
timeoutMs: 2 * 6e4
|
|
42698
|
+
});
|
|
42699
|
+
/**
|
|
42700
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42701
|
+
* provided by `addon-training`.
|
|
42702
|
+
*
|
|
42703
|
+
* It owns what every provider must agree on, written once:
|
|
42704
|
+
*
|
|
42705
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42706
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42707
|
+
* the export plan) and reaches this store through the five row methods
|
|
42708
|
+
* below, so the Retrain page and the export did not change.
|
|
42709
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42710
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42711
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42712
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42713
|
+
* rollback. Nothing is ever registered automatically.
|
|
42714
|
+
*
|
|
42715
|
+
* Every method is `admin`.
|
|
42716
|
+
*/
|
|
42717
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42718
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42719
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42720
|
+
var TrainingBaseModelSchema = object({
|
|
42721
|
+
modelId: string(),
|
|
42722
|
+
label: string(),
|
|
42723
|
+
weights: string(),
|
|
42724
|
+
imgsz: number().int(),
|
|
42725
|
+
baselineOnnxUrl: string(),
|
|
42726
|
+
baselineFloors: record(string(), number()),
|
|
42727
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42728
|
+
recommended: boolean()
|
|
42729
|
+
});
|
|
42730
|
+
var TrainingPresetSchema = _enum([
|
|
42731
|
+
"quick",
|
|
42732
|
+
"standard",
|
|
42733
|
+
"thorough"
|
|
42734
|
+
]);
|
|
42735
|
+
var TrainingJobRequestSchema = object({
|
|
42736
|
+
datasetVersionId: string().min(1),
|
|
42737
|
+
/** The `training-provider` addon that runs it. */
|
|
42738
|
+
addonId: string().min(1),
|
|
42739
|
+
gpuType: string().min(1),
|
|
42740
|
+
region: string(),
|
|
42741
|
+
baseModelId: string().min(1),
|
|
42742
|
+
preset: TrainingPresetSchema,
|
|
42743
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42744
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42745
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42746
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42747
|
+
});
|
|
42748
|
+
var TrainingSplitPlanSchema = object({
|
|
42749
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42750
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42751
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42752
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42753
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42754
|
+
trainSubjects: number().int()
|
|
42755
|
+
});
|
|
42756
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42757
|
+
"unknown-dataset",
|
|
42758
|
+
"unknown-provider",
|
|
42759
|
+
"provider-not-configured",
|
|
42760
|
+
"unknown-base-model",
|
|
42761
|
+
"unknown-gpu",
|
|
42762
|
+
"dataset-too-large",
|
|
42763
|
+
"no-training-subjects",
|
|
42764
|
+
"job-already-running"
|
|
42765
|
+
]);
|
|
42766
|
+
var TrainingJobPlanSchema = object({
|
|
42767
|
+
refusal: object({
|
|
42768
|
+
reason: TrainingRefusalReasonSchema,
|
|
42769
|
+
detail: string()
|
|
42770
|
+
}).nullable(),
|
|
42771
|
+
warnings: array(string()).readonly(),
|
|
42772
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42773
|
+
estimate: object({
|
|
42774
|
+
datasetBytes: number().int(),
|
|
42775
|
+
uploadMinutesAt20Mbps: number(),
|
|
42776
|
+
gpuSecondsLow: number(),
|
|
42777
|
+
gpuSecondsHigh: number(),
|
|
42778
|
+
usdLow: number(),
|
|
42779
|
+
usdHigh: number(),
|
|
42780
|
+
notes: array(string()).readonly()
|
|
42781
|
+
}).nullable(),
|
|
42782
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42783
|
+
defaults: object({
|
|
42784
|
+
maxCostUsd: number(),
|
|
42785
|
+
maxRuntimeSec: number().int()
|
|
42786
|
+
}).nullable(),
|
|
42787
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42788
|
+
dataNotice: string()
|
|
42789
|
+
});
|
|
42790
|
+
/**
|
|
42791
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42792
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42793
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42794
|
+
* result lives after the operator acted on it.
|
|
42795
|
+
*/
|
|
42796
|
+
var TrainingJobStateSchema = _enum([
|
|
42797
|
+
"uploading",
|
|
42798
|
+
"submitted",
|
|
42799
|
+
"starting",
|
|
42800
|
+
"running",
|
|
42801
|
+
"collecting",
|
|
42802
|
+
"ready",
|
|
42803
|
+
"registered",
|
|
42804
|
+
"canary",
|
|
42805
|
+
"failed",
|
|
42806
|
+
"cancelling",
|
|
42807
|
+
"cancelled",
|
|
42808
|
+
"lost",
|
|
42809
|
+
"expired",
|
|
42810
|
+
"discarded"
|
|
42811
|
+
]);
|
|
42812
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42813
|
+
"cost-cap",
|
|
42814
|
+
"runtime-cap",
|
|
42815
|
+
"upload-failed",
|
|
42816
|
+
"submit-failed",
|
|
42817
|
+
"trainer-failed",
|
|
42818
|
+
"result-invalid",
|
|
42819
|
+
"checksum-mismatch",
|
|
42820
|
+
"fetch-failed",
|
|
42821
|
+
"provider-error",
|
|
42822
|
+
"hub-restart-during-upload"
|
|
42823
|
+
]);
|
|
42824
|
+
var TrainingProgressPointSchema = object({
|
|
42825
|
+
epoch: number().int(),
|
|
42826
|
+
map50: number().nullable(),
|
|
42827
|
+
map50_95: number().nullable()
|
|
42828
|
+
});
|
|
42829
|
+
var TrainingCanarySchema = object({
|
|
42830
|
+
deviceIds: array(number().int()).readonly(),
|
|
42831
|
+
since: number(),
|
|
42832
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42833
|
+
previous: array(object({
|
|
42834
|
+
deviceId: number().int(),
|
|
42835
|
+
nodeId: string(),
|
|
42836
|
+
deviceKey: string(),
|
|
42837
|
+
patch: object({
|
|
42838
|
+
modelId: string().optional(),
|
|
42839
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42840
|
+
}).nullable()
|
|
42841
|
+
})).readonly()
|
|
42842
|
+
});
|
|
42843
|
+
var TrainingJobSchema = object({
|
|
42844
|
+
id: string(),
|
|
42845
|
+
idempotencyKey: string(),
|
|
42846
|
+
name: string(),
|
|
42847
|
+
createdAt: number(),
|
|
42848
|
+
updatedAt: number(),
|
|
42849
|
+
state: TrainingJobStateSchema,
|
|
42850
|
+
stage: TrainingStageSchema.nullable(),
|
|
42851
|
+
failure: object({
|
|
42852
|
+
reason: TrainingFailureReasonSchema,
|
|
42853
|
+
stage: string().nullable(),
|
|
42854
|
+
detail: string()
|
|
42855
|
+
}).nullable(),
|
|
42856
|
+
request: TrainingJobRequestSchema,
|
|
42857
|
+
maxCostUsd: number().nonnegative(),
|
|
42858
|
+
maxRuntimeSec: number().int().positive(),
|
|
42859
|
+
trainer: TrainerSourceRefSchema,
|
|
42860
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42861
|
+
dataset: object({
|
|
42862
|
+
bytes: number().int(),
|
|
42863
|
+
sha256: string(),
|
|
42864
|
+
uploadedAt: number()
|
|
42865
|
+
}).nullable(),
|
|
42866
|
+
split: TrainingSplitPlanSchema,
|
|
42867
|
+
provider: object({
|
|
42868
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42869
|
+
providerJobId: string().nullable(),
|
|
42870
|
+
startedAt: number().nullable(),
|
|
42871
|
+
endedAt: number().nullable(),
|
|
42872
|
+
billedSeconds: number(),
|
|
42873
|
+
costUsd: number(),
|
|
42874
|
+
costIsEstimate: boolean(),
|
|
42875
|
+
lastPolledAt: number().nullable()
|
|
42876
|
+
}),
|
|
42877
|
+
progress: object({
|
|
42878
|
+
epoch: number().int().nullable(),
|
|
42879
|
+
epochs: number().int().nullable(),
|
|
42880
|
+
etaSec: number().nullable(),
|
|
42881
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42882
|
+
}),
|
|
42883
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42884
|
+
logTail: array(string()).readonly(),
|
|
42885
|
+
logCursor: string().nullable(),
|
|
42886
|
+
artifacts: object({
|
|
42887
|
+
bundleBytes: number().int(),
|
|
42888
|
+
bundleSha256: string(),
|
|
42889
|
+
fetchedAt: number(),
|
|
42890
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42891
|
+
expiresAt: number()
|
|
42892
|
+
}).nullable(),
|
|
42893
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42894
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42895
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42896
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42897
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42898
|
+
registeredModelIds: array(string()).readonly(),
|
|
42899
|
+
canary: TrainingCanarySchema.nullable()
|
|
42900
|
+
});
|
|
42901
|
+
var IdInput = object({ id: string().min(1) });
|
|
42902
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42903
|
+
kind: "mutation",
|
|
42904
|
+
auth: "admin"
|
|
42905
|
+
}), 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() }), {
|
|
42906
|
+
kind: "mutation",
|
|
42907
|
+
auth: "admin"
|
|
42908
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42909
|
+
auth: "admin",
|
|
42910
|
+
timeoutMs: 6e4
|
|
42911
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42912
|
+
name: string().min(1).max(120),
|
|
42913
|
+
maxCostUsd: number().positive(),
|
|
42914
|
+
maxRuntimeSec: number().int().positive(),
|
|
42915
|
+
idempotencyKey: string().min(8).max(80)
|
|
42916
|
+
}), discriminatedUnion("kind", [object({
|
|
42917
|
+
kind: literal("started"),
|
|
42918
|
+
job: TrainingJobSchema
|
|
42919
|
+
}), object({
|
|
42920
|
+
kind: literal("refused"),
|
|
42921
|
+
reason: TrainingRefusalReasonSchema,
|
|
42922
|
+
detail: string()
|
|
42923
|
+
})]), {
|
|
42924
|
+
kind: "mutation",
|
|
42925
|
+
auth: "admin",
|
|
42926
|
+
timeoutMs: 12e4
|
|
42927
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42928
|
+
kind: "mutation",
|
|
42929
|
+
auth: "admin",
|
|
42930
|
+
timeoutMs: 12e4
|
|
42931
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42932
|
+
kind: "mutation",
|
|
42933
|
+
auth: "admin",
|
|
42934
|
+
timeoutMs: 30 * 6e4
|
|
42935
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42936
|
+
kind: "mutation",
|
|
42937
|
+
auth: "admin",
|
|
42938
|
+
timeoutMs: 12e4
|
|
42939
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42940
|
+
kind: "mutation",
|
|
42941
|
+
auth: "admin",
|
|
42942
|
+
timeoutMs: 12e4
|
|
42943
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42944
|
+
kind: "mutation",
|
|
42945
|
+
auth: "admin"
|
|
42946
|
+
});
|
|
41546
42947
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
41547
42948
|
Object.freeze({
|
|
41548
42949
|
person: .5,
|
|
@@ -43691,6 +45092,12 @@ Object.freeze({
|
|
|
43691
45092
|
addonId: null,
|
|
43692
45093
|
access: "create"
|
|
43693
45094
|
},
|
|
45095
|
+
"backup.checkBackupKey": {
|
|
45096
|
+
capName: "backup",
|
|
45097
|
+
capScope: "system",
|
|
45098
|
+
addonId: null,
|
|
45099
|
+
access: "create"
|
|
45100
|
+
},
|
|
43694
45101
|
"backup.delete": {
|
|
43695
45102
|
capName: "backup",
|
|
43696
45103
|
capScope: "system",
|
|
@@ -43703,6 +45110,18 @@ Object.freeze({
|
|
|
43703
45110
|
addonId: null,
|
|
43704
45111
|
access: "delete"
|
|
43705
45112
|
},
|
|
45113
|
+
"backup.disableEncryption": {
|
|
45114
|
+
capName: "backup",
|
|
45115
|
+
capScope: "system",
|
|
45116
|
+
addonId: null,
|
|
45117
|
+
access: "create"
|
|
45118
|
+
},
|
|
45119
|
+
"backup.getEncryption": {
|
|
45120
|
+
capName: "backup",
|
|
45121
|
+
capScope: "system",
|
|
45122
|
+
addonId: null,
|
|
45123
|
+
access: "view"
|
|
45124
|
+
},
|
|
43706
45125
|
"backup.getEntries": {
|
|
43707
45126
|
capName: "backup",
|
|
43708
45127
|
capScope: "system",
|
|
@@ -43757,6 +45176,12 @@ Object.freeze({
|
|
|
43757
45176
|
addonId: null,
|
|
43758
45177
|
access: "create"
|
|
43759
45178
|
},
|
|
45179
|
+
"backup.setupEncryption": {
|
|
45180
|
+
capName: "backup",
|
|
45181
|
+
capScope: "system",
|
|
45182
|
+
addonId: null,
|
|
45183
|
+
access: "create"
|
|
45184
|
+
},
|
|
43760
45185
|
"backup.trigger": {
|
|
43761
45186
|
capName: "backup",
|
|
43762
45187
|
capScope: "system",
|
|
@@ -44309,6 +45734,12 @@ Object.freeze({
|
|
|
44309
45734
|
addonId: null,
|
|
44310
45735
|
access: "create"
|
|
44311
45736
|
},
|
|
45737
|
+
"customModelRegistry.importModelBundle": {
|
|
45738
|
+
capName: "custom-model-registry",
|
|
45739
|
+
capScope: "system",
|
|
45740
|
+
addonId: null,
|
|
45741
|
+
access: "create"
|
|
45742
|
+
},
|
|
44312
45743
|
"customModelRegistry.listModels": {
|
|
44313
45744
|
capName: "custom-model-registry",
|
|
44314
45745
|
capScope: "system",
|
|
@@ -45749,6 +47180,12 @@ Object.freeze({
|
|
|
45749
47180
|
addonId: null,
|
|
45750
47181
|
access: "view"
|
|
45751
47182
|
},
|
|
47183
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47184
|
+
capName: "keychain-admin",
|
|
47185
|
+
capScope: "system",
|
|
47186
|
+
addonId: null,
|
|
47187
|
+
access: "create"
|
|
47188
|
+
},
|
|
45752
47189
|
"keychainAdmin.deleteOrphans": {
|
|
45753
47190
|
capName: "keychain-admin",
|
|
45754
47191
|
capScope: "system",
|
|
@@ -45785,6 +47222,12 @@ Object.freeze({
|
|
|
45785
47222
|
addonId: null,
|
|
45786
47223
|
access: "delete"
|
|
45787
47224
|
},
|
|
47225
|
+
"keychainAdmin.resetReport": {
|
|
47226
|
+
capName: "keychain-admin",
|
|
47227
|
+
capScope: "system",
|
|
47228
|
+
addonId: null,
|
|
47229
|
+
access: "delete"
|
|
47230
|
+
},
|
|
45788
47231
|
"keychainAdmin.reveal": {
|
|
45789
47232
|
capName: "keychain-admin",
|
|
45790
47233
|
capScope: "system",
|
|
@@ -45797,6 +47240,12 @@ Object.freeze({
|
|
|
45797
47240
|
addonId: null,
|
|
45798
47241
|
access: "create"
|
|
45799
47242
|
},
|
|
47243
|
+
"keychainAdmin.setSystemSecret": {
|
|
47244
|
+
capName: "keychain-admin",
|
|
47245
|
+
capScope: "system",
|
|
47246
|
+
addonId: null,
|
|
47247
|
+
access: "create"
|
|
47248
|
+
},
|
|
45800
47249
|
"keychainAdmin.status": {
|
|
45801
47250
|
capName: "keychain-admin",
|
|
45802
47251
|
capScope: "system",
|
|
@@ -47243,6 +48692,12 @@ Object.freeze({
|
|
|
47243
48692
|
addonId: null,
|
|
47244
48693
|
access: "create"
|
|
47245
48694
|
},
|
|
48695
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48696
|
+
capName: "pipeline-analytics",
|
|
48697
|
+
capScope: "device",
|
|
48698
|
+
addonId: null,
|
|
48699
|
+
access: "create"
|
|
48700
|
+
},
|
|
47246
48701
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
47247
48702
|
capName: "pipeline-analytics",
|
|
47248
48703
|
capScope: "device",
|
|
@@ -47255,6 +48710,12 @@ Object.freeze({
|
|
|
47255
48710
|
addonId: null,
|
|
47256
48711
|
access: "delete"
|
|
47257
48712
|
},
|
|
48713
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48714
|
+
capName: "pipeline-analytics",
|
|
48715
|
+
capScope: "device",
|
|
48716
|
+
addonId: null,
|
|
48717
|
+
access: "delete"
|
|
48718
|
+
},
|
|
47258
48719
|
"pipelineAnalytics.deleteTracks": {
|
|
47259
48720
|
capName: "pipeline-analytics",
|
|
47260
48721
|
capScope: "device",
|
|
@@ -47477,6 +48938,12 @@ Object.freeze({
|
|
|
47477
48938
|
addonId: null,
|
|
47478
48939
|
access: "view"
|
|
47479
48940
|
},
|
|
48941
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48942
|
+
capName: "pipeline-analytics",
|
|
48943
|
+
capScope: "device",
|
|
48944
|
+
addonId: null,
|
|
48945
|
+
access: "view"
|
|
48946
|
+
},
|
|
47480
48947
|
"pipelineAnalytics.listRetrainFrames": {
|
|
47481
48948
|
capName: "pipeline-analytics",
|
|
47482
48949
|
capScope: "device",
|
|
@@ -47507,6 +48974,12 @@ Object.freeze({
|
|
|
47507
48974
|
addonId: null,
|
|
47508
48975
|
access: "view"
|
|
47509
48976
|
},
|
|
48977
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48978
|
+
capName: "pipeline-analytics",
|
|
48979
|
+
capScope: "device",
|
|
48980
|
+
addonId: null,
|
|
48981
|
+
access: "create"
|
|
48982
|
+
},
|
|
47510
48983
|
"pipelineAnalytics.ownersWithMedia": {
|
|
47511
48984
|
capName: "pipeline-analytics",
|
|
47512
48985
|
capScope: "device",
|
|
@@ -47519,6 +48992,12 @@ Object.freeze({
|
|
|
47519
48992
|
addonId: null,
|
|
47520
48993
|
access: "create"
|
|
47521
48994
|
},
|
|
48995
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48996
|
+
capName: "pipeline-analytics",
|
|
48997
|
+
capScope: "device",
|
|
48998
|
+
addonId: null,
|
|
48999
|
+
access: "view"
|
|
49000
|
+
},
|
|
47522
49001
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
47523
49002
|
capName: "pipeline-analytics",
|
|
47524
49003
|
capScope: "device",
|
|
@@ -47657,6 +49136,12 @@ Object.freeze({
|
|
|
47657
49136
|
addonId: null,
|
|
47658
49137
|
access: "create"
|
|
47659
49138
|
},
|
|
49139
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49140
|
+
capName: "pipeline-analytics",
|
|
49141
|
+
capScope: "device",
|
|
49142
|
+
addonId: null,
|
|
49143
|
+
access: "view"
|
|
49144
|
+
},
|
|
47660
49145
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
47661
49146
|
capName: "pipeline-analytics",
|
|
47662
49147
|
capScope: "device",
|
|
@@ -50033,6 +51518,174 @@ Object.freeze({
|
|
|
50033
51518
|
addonId: null,
|
|
50034
51519
|
access: "view"
|
|
50035
51520
|
},
|
|
51521
|
+
"training.canaryResult": {
|
|
51522
|
+
capName: "training",
|
|
51523
|
+
capScope: "system",
|
|
51524
|
+
addonId: null,
|
|
51525
|
+
access: "create"
|
|
51526
|
+
},
|
|
51527
|
+
"training.cancelJob": {
|
|
51528
|
+
capName: "training",
|
|
51529
|
+
capScope: "system",
|
|
51530
|
+
addonId: null,
|
|
51531
|
+
access: "create"
|
|
51532
|
+
},
|
|
51533
|
+
"training.discardResult": {
|
|
51534
|
+
capName: "training",
|
|
51535
|
+
capScope: "system",
|
|
51536
|
+
addonId: null,
|
|
51537
|
+
access: "create"
|
|
51538
|
+
},
|
|
51539
|
+
"training.findDatasetVersionIdByName": {
|
|
51540
|
+
capName: "training",
|
|
51541
|
+
capScope: "system",
|
|
51542
|
+
addonId: null,
|
|
51543
|
+
access: "view"
|
|
51544
|
+
},
|
|
51545
|
+
"training.getDatasetVersion": {
|
|
51546
|
+
capName: "training",
|
|
51547
|
+
capScope: "system",
|
|
51548
|
+
addonId: null,
|
|
51549
|
+
access: "view"
|
|
51550
|
+
},
|
|
51551
|
+
"training.getJob": {
|
|
51552
|
+
capName: "training",
|
|
51553
|
+
capScope: "system",
|
|
51554
|
+
addonId: null,
|
|
51555
|
+
access: "view"
|
|
51556
|
+
},
|
|
51557
|
+
"training.getJobResult": {
|
|
51558
|
+
capName: "training",
|
|
51559
|
+
capScope: "system",
|
|
51560
|
+
addonId: null,
|
|
51561
|
+
access: "view"
|
|
51562
|
+
},
|
|
51563
|
+
"training.listBaseModels": {
|
|
51564
|
+
capName: "training",
|
|
51565
|
+
capScope: "system",
|
|
51566
|
+
addonId: null,
|
|
51567
|
+
access: "view"
|
|
51568
|
+
},
|
|
51569
|
+
"training.listDatasetVersions": {
|
|
51570
|
+
capName: "training",
|
|
51571
|
+
capScope: "system",
|
|
51572
|
+
addonId: null,
|
|
51573
|
+
access: "view"
|
|
51574
|
+
},
|
|
51575
|
+
"training.listJobs": {
|
|
51576
|
+
capName: "training",
|
|
51577
|
+
capScope: "system",
|
|
51578
|
+
addonId: null,
|
|
51579
|
+
access: "view"
|
|
51580
|
+
},
|
|
51581
|
+
"training.planJob": {
|
|
51582
|
+
capName: "training",
|
|
51583
|
+
capScope: "system",
|
|
51584
|
+
addonId: null,
|
|
51585
|
+
access: "view"
|
|
51586
|
+
},
|
|
51587
|
+
"training.putDatasetVersion": {
|
|
51588
|
+
capName: "training",
|
|
51589
|
+
capScope: "system",
|
|
51590
|
+
addonId: null,
|
|
51591
|
+
access: "create"
|
|
51592
|
+
},
|
|
51593
|
+
"training.registerResult": {
|
|
51594
|
+
capName: "training",
|
|
51595
|
+
capScope: "system",
|
|
51596
|
+
addonId: null,
|
|
51597
|
+
access: "create"
|
|
51598
|
+
},
|
|
51599
|
+
"training.removeDatasetVersion": {
|
|
51600
|
+
capName: "training",
|
|
51601
|
+
capScope: "system",
|
|
51602
|
+
addonId: null,
|
|
51603
|
+
access: "delete"
|
|
51604
|
+
},
|
|
51605
|
+
"training.rollbackCanary": {
|
|
51606
|
+
capName: "training",
|
|
51607
|
+
capScope: "system",
|
|
51608
|
+
addonId: null,
|
|
51609
|
+
access: "create"
|
|
51610
|
+
},
|
|
51611
|
+
"training.startJob": {
|
|
51612
|
+
capName: "training",
|
|
51613
|
+
capScope: "system",
|
|
51614
|
+
addonId: null,
|
|
51615
|
+
access: "create"
|
|
51616
|
+
},
|
|
51617
|
+
"trainingProvider.cancelJob": {
|
|
51618
|
+
capName: "training-provider",
|
|
51619
|
+
capScope: "system",
|
|
51620
|
+
addonId: null,
|
|
51621
|
+
access: "create"
|
|
51622
|
+
},
|
|
51623
|
+
"trainingProvider.cleanupJob": {
|
|
51624
|
+
capName: "training-provider",
|
|
51625
|
+
capScope: "system",
|
|
51626
|
+
addonId: null,
|
|
51627
|
+
access: "create"
|
|
51628
|
+
},
|
|
51629
|
+
"trainingProvider.describe": {
|
|
51630
|
+
capName: "training-provider",
|
|
51631
|
+
capScope: "system",
|
|
51632
|
+
addonId: null,
|
|
51633
|
+
access: "view"
|
|
51634
|
+
},
|
|
51635
|
+
"trainingProvider.estimateJob": {
|
|
51636
|
+
capName: "training-provider",
|
|
51637
|
+
capScope: "system",
|
|
51638
|
+
addonId: null,
|
|
51639
|
+
access: "view"
|
|
51640
|
+
},
|
|
51641
|
+
"trainingProvider.getJob": {
|
|
51642
|
+
capName: "training-provider",
|
|
51643
|
+
capScope: "system",
|
|
51644
|
+
addonId: null,
|
|
51645
|
+
access: "view"
|
|
51646
|
+
},
|
|
51647
|
+
"trainingProvider.listJobEvents": {
|
|
51648
|
+
capName: "training-provider",
|
|
51649
|
+
capScope: "system",
|
|
51650
|
+
addonId: null,
|
|
51651
|
+
access: "view"
|
|
51652
|
+
},
|
|
51653
|
+
"trainingProvider.listJobs": {
|
|
51654
|
+
capName: "training-provider",
|
|
51655
|
+
capScope: "system",
|
|
51656
|
+
addonId: null,
|
|
51657
|
+
access: "view"
|
|
51658
|
+
},
|
|
51659
|
+
"trainingProvider.offerArtifact": {
|
|
51660
|
+
capName: "training-provider",
|
|
51661
|
+
capScope: "system",
|
|
51662
|
+
addonId: null,
|
|
51663
|
+
access: "create"
|
|
51664
|
+
},
|
|
51665
|
+
"trainingProvider.readResult": {
|
|
51666
|
+
capName: "training-provider",
|
|
51667
|
+
capScope: "system",
|
|
51668
|
+
addonId: null,
|
|
51669
|
+
access: "create"
|
|
51670
|
+
},
|
|
51671
|
+
"trainingProvider.submitJob": {
|
|
51672
|
+
capName: "training-provider",
|
|
51673
|
+
capScope: "system",
|
|
51674
|
+
addonId: null,
|
|
51675
|
+
access: "create"
|
|
51676
|
+
},
|
|
51677
|
+
"trainingProvider.uploadDataset": {
|
|
51678
|
+
capName: "training-provider",
|
|
51679
|
+
capScope: "system",
|
|
51680
|
+
addonId: null,
|
|
51681
|
+
access: "create"
|
|
51682
|
+
},
|
|
51683
|
+
"trainingProvider.validateCredentials": {
|
|
51684
|
+
capName: "training-provider",
|
|
51685
|
+
capScope: "system",
|
|
51686
|
+
addonId: null,
|
|
51687
|
+
access: "create"
|
|
51688
|
+
},
|
|
50036
51689
|
"turnProvider.getTurnServers": {
|
|
50037
51690
|
capName: "turn-provider",
|
|
50038
51691
|
capScope: "system",
|
|
@@ -50057,12 +51710,6 @@ Object.freeze({
|
|
|
50057
51710
|
addonId: null,
|
|
50058
51711
|
access: "create"
|
|
50059
51712
|
},
|
|
50060
|
-
"userManagement.createApiKey": {
|
|
50061
|
-
capName: "user-management",
|
|
50062
|
-
capScope: "system",
|
|
50063
|
-
addonId: null,
|
|
50064
|
-
access: "create"
|
|
50065
|
-
},
|
|
50066
51713
|
"userManagement.createScopedToken": {
|
|
50067
51714
|
capName: "user-management",
|
|
50068
51715
|
capScope: "system",
|
|
@@ -50099,12 +51746,6 @@ Object.freeze({
|
|
|
50099
51746
|
addonId: null,
|
|
50100
51747
|
access: "view"
|
|
50101
51748
|
},
|
|
50102
|
-
"userManagement.linkExternalIdentity": {
|
|
50103
|
-
capName: "user-management",
|
|
50104
|
-
capScope: "system",
|
|
50105
|
-
addonId: null,
|
|
50106
|
-
access: "create"
|
|
50107
|
-
},
|
|
50108
51749
|
"userManagement.listApiKeys": {
|
|
50109
51750
|
capName: "user-management",
|
|
50110
51751
|
capScope: "system",
|
|
@@ -50207,12 +51848,6 @@ Object.freeze({
|
|
|
50207
51848
|
addonId: null,
|
|
50208
51849
|
access: "create"
|
|
50209
51850
|
},
|
|
50210
|
-
"userManagement.validateApiKey": {
|
|
50211
|
-
capName: "user-management",
|
|
50212
|
-
capScope: "system",
|
|
50213
|
-
addonId: null,
|
|
50214
|
-
access: "view"
|
|
50215
|
-
},
|
|
50216
51851
|
"userManagement.validateCredentials": {
|
|
50217
51852
|
capName: "user-management",
|
|
50218
51853
|
capScope: "system",
|
|
@@ -54326,6 +55961,11 @@ Object.freeze({
|
|
|
54326
55961
|
form: "single",
|
|
54327
55962
|
optional: false
|
|
54328
55963
|
}],
|
|
55964
|
+
"training.canaryResult": [{
|
|
55965
|
+
name: "deviceIds",
|
|
55966
|
+
form: "array",
|
|
55967
|
+
optional: false
|
|
55968
|
+
}],
|
|
54329
55969
|
"update.getStatus": [{
|
|
54330
55970
|
name: "deviceId",
|
|
54331
55971
|
form: "single",
|