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