@camstack/addon-tailscale 1.2.120 → 1.2.121
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/{auth-key-file-nqbw3U3H.js → auth-key-file-Bh3STbNm.js} +1771 -131
- package/dist/{auth-key-file-Cuw3mylb.mjs → auth-key-file-DZtXVeVu.mjs} +1771 -131
- package/dist/client/tailscale.addon.js +1 -1
- package/dist/client/tailscale.addon.mjs +1 -1
- package/dist/ingress/tailscale-ingress.addon.js +1 -1
- package/dist/ingress/tailscale-ingress.addon.mjs +1 -1
- package/package.json +1 -1
|
@@ -5379,7 +5379,7 @@ var ZodIssueCode = {
|
|
|
5379
5379
|
var ZodFirstPartyTypeKind;
|
|
5380
5380
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5381
5381
|
//#endregion
|
|
5382
|
-
//#region ../types/dist/sleep-
|
|
5382
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5383
5383
|
/**
|
|
5384
5384
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5385
5385
|
* window to float samples (D455).
|
|
@@ -5496,7 +5496,7 @@ function isKeychainStoredField(field) {
|
|
|
5496
5496
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5497
5497
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5498
5498
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5499
|
-
function isRecord$
|
|
5499
|
+
function isRecord$2(value) {
|
|
5500
5500
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5501
5501
|
}
|
|
5502
5502
|
function makeSecretMarker(ref) {
|
|
@@ -5507,12 +5507,12 @@ function makeSecretMarker(ref) {
|
|
|
5507
5507
|
}
|
|
5508
5508
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5509
5509
|
function isSecretMarker(value) {
|
|
5510
|
-
if (!isRecord$
|
|
5510
|
+
if (!isRecord$2(value)) return false;
|
|
5511
5511
|
const ref = value["$secret"];
|
|
5512
5512
|
return typeof ref === "string" && ref.length > 0;
|
|
5513
5513
|
}
|
|
5514
5514
|
function isSecretClear(value) {
|
|
5515
|
-
return isRecord$
|
|
5515
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5516
5516
|
}
|
|
5517
5517
|
/**
|
|
5518
5518
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6028,6 +6028,13 @@ function globalSecretScope() {
|
|
|
6028
6028
|
function encodeSegment(value) {
|
|
6029
6029
|
return encodeURIComponent(value);
|
|
6030
6030
|
}
|
|
6031
|
+
function decodeSegment(value) {
|
|
6032
|
+
try {
|
|
6033
|
+
return decodeURIComponent(value);
|
|
6034
|
+
} catch {
|
|
6035
|
+
return null;
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
6031
6038
|
/**
|
|
6032
6039
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6033
6040
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6036,6 +6043,75 @@ function encodeSegment(value) {
|
|
|
6036
6043
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6037
6044
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6038
6045
|
}
|
|
6046
|
+
function parseScope(segments) {
|
|
6047
|
+
switch (segments[0]) {
|
|
6048
|
+
case "global": return {
|
|
6049
|
+
scope: GLOBAL_SCOPE,
|
|
6050
|
+
used: 1
|
|
6051
|
+
};
|
|
6052
|
+
case "node": {
|
|
6053
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6054
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6055
|
+
scope: {
|
|
6056
|
+
kind: "node",
|
|
6057
|
+
nodeId
|
|
6058
|
+
},
|
|
6059
|
+
used: 2
|
|
6060
|
+
};
|
|
6061
|
+
}
|
|
6062
|
+
case "device": {
|
|
6063
|
+
const raw = segments[1];
|
|
6064
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6065
|
+
return {
|
|
6066
|
+
scope: {
|
|
6067
|
+
kind: "device",
|
|
6068
|
+
deviceId: Number(raw)
|
|
6069
|
+
},
|
|
6070
|
+
used: 2
|
|
6071
|
+
};
|
|
6072
|
+
}
|
|
6073
|
+
case "integration": {
|
|
6074
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6075
|
+
return id === null || id.length === 0 ? null : {
|
|
6076
|
+
scope: {
|
|
6077
|
+
kind: "integration",
|
|
6078
|
+
integrationId: id
|
|
6079
|
+
},
|
|
6080
|
+
used: 2
|
|
6081
|
+
};
|
|
6082
|
+
}
|
|
6083
|
+
case "row": {
|
|
6084
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6085
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6086
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6087
|
+
return {
|
|
6088
|
+
scope: {
|
|
6089
|
+
kind: "row",
|
|
6090
|
+
collection,
|
|
6091
|
+
rowId
|
|
6092
|
+
},
|
|
6093
|
+
used: 3
|
|
6094
|
+
};
|
|
6095
|
+
}
|
|
6096
|
+
default: return null;
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6100
|
+
function parseSecretRef(ref) {
|
|
6101
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6102
|
+
const segments = ref.slice(9).split("/");
|
|
6103
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6104
|
+
if (owner === null || owner.length === 0) return null;
|
|
6105
|
+
const parsed = parseScope(segments.slice(1));
|
|
6106
|
+
if (parsed === null) return null;
|
|
6107
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6108
|
+
if (fieldPath.length === 0) return null;
|
|
6109
|
+
return {
|
|
6110
|
+
owner,
|
|
6111
|
+
scope: parsed.scope,
|
|
6112
|
+
fieldPath
|
|
6113
|
+
};
|
|
6114
|
+
}
|
|
6039
6115
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6040
6116
|
var KeychainWriteRefusedError = class extends Error {
|
|
6041
6117
|
fieldPath;
|
|
@@ -6046,7 +6122,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6046
6122
|
}
|
|
6047
6123
|
};
|
|
6048
6124
|
var KEEP = { kind: "keep" };
|
|
6049
|
-
function isRecord(value) {
|
|
6125
|
+
function isRecord$1(value) {
|
|
6050
6126
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6051
6127
|
}
|
|
6052
6128
|
function defaultMintId() {
|
|
@@ -6059,7 +6135,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6059
6135
|
return out;
|
|
6060
6136
|
}
|
|
6061
6137
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6062
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6138
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6063
6139
|
return out;
|
|
6064
6140
|
}
|
|
6065
6141
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6114,7 +6190,7 @@ function rowId(row, idKey) {
|
|
|
6114
6190
|
return null;
|
|
6115
6191
|
}
|
|
6116
6192
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6117
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6193
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6118
6194
|
if (!Array.isArray(incoming)) {
|
|
6119
6195
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6120
6196
|
return {
|
|
@@ -6130,7 +6206,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6130
6206
|
const kept = /* @__PURE__ */ new Set();
|
|
6131
6207
|
const rows = [];
|
|
6132
6208
|
for (const row of incoming) {
|
|
6133
|
-
if (!isRecord(row)) {
|
|
6209
|
+
if (!isRecord$1(row)) {
|
|
6134
6210
|
rows.push(row);
|
|
6135
6211
|
continue;
|
|
6136
6212
|
}
|
|
@@ -6155,7 +6231,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6155
6231
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6156
6232
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6157
6233
|
case "object": {
|
|
6158
|
-
if (!isRecord(incoming)) {
|
|
6234
|
+
if (!isRecord$1(incoming)) {
|
|
6159
6235
|
if (incoming === void 0) return KEEP;
|
|
6160
6236
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6161
6237
|
return {
|
|
@@ -6163,7 +6239,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6163
6239
|
value: incoming
|
|
6164
6240
|
};
|
|
6165
6241
|
}
|
|
6166
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6242
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6167
6243
|
return {
|
|
6168
6244
|
kind: "value",
|
|
6169
6245
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6222,12 +6298,19 @@ async function transformSecretWrite(input) {
|
|
|
6222
6298
|
}
|
|
6223
6299
|
};
|
|
6224
6300
|
}
|
|
6301
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6302
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6303
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6304
|
+
}
|
|
6225
6305
|
/**
|
|
6226
6306
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6227
6307
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6228
6308
|
*/
|
|
6229
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6230
|
-
const
|
|
6309
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6310
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6311
|
+
const owner = options.ownedBy;
|
|
6312
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6313
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6231
6314
|
if (refs.length === 0) return {
|
|
6232
6315
|
value,
|
|
6233
6316
|
unresolved: []
|
|
@@ -6251,10 +6334,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6251
6334
|
}
|
|
6252
6335
|
const substitute = (v) => {
|
|
6253
6336
|
if (isSecretMarker(v)) {
|
|
6337
|
+
if (!inScope(v.$secret)) return {
|
|
6338
|
+
keep: true,
|
|
6339
|
+
value: v
|
|
6340
|
+
};
|
|
6254
6341
|
const answer = answers[v.$secret];
|
|
6255
|
-
|
|
6342
|
+
if (answer?.kind === "value") return {
|
|
6256
6343
|
keep: true,
|
|
6257
6344
|
value: answer.value
|
|
6345
|
+
};
|
|
6346
|
+
return keepMarker ? {
|
|
6347
|
+
keep: true,
|
|
6348
|
+
value: v
|
|
6258
6349
|
} : {
|
|
6259
6350
|
keep: false,
|
|
6260
6351
|
value: void 0
|
|
@@ -6271,7 +6362,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6271
6362
|
value: items
|
|
6272
6363
|
};
|
|
6273
6364
|
}
|
|
6274
|
-
if (isRecord(v)) {
|
|
6365
|
+
if (isRecord$1(v)) {
|
|
6275
6366
|
const out = {};
|
|
6276
6367
|
for (const [k, child] of Object.entries(v)) {
|
|
6277
6368
|
const s = substitute(child);
|
|
@@ -6292,14 +6383,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6292
6383
|
unresolved
|
|
6293
6384
|
};
|
|
6294
6385
|
}
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6386
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6387
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6388
|
+
ref;
|
|
6389
|
+
reason;
|
|
6390
|
+
constructor(ref, reason) {
|
|
6391
|
+
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.`);
|
|
6392
|
+
this.ref = ref;
|
|
6393
|
+
this.reason = reason;
|
|
6394
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6395
|
+
}
|
|
6396
|
+
};
|
|
6397
|
+
function isRecord(value) {
|
|
6398
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6399
|
+
}
|
|
6400
|
+
function resolvedValue(pass, marker) {
|
|
6401
|
+
const answer = pass.answers[marker.$secret];
|
|
6402
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6403
|
+
}
|
|
6404
|
+
async function atMarker(pass, incoming, stored) {
|
|
6405
|
+
if (incoming === null) return stored;
|
|
6406
|
+
if (typeof incoming !== "string") return incoming;
|
|
6407
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6408
|
+
const intent = classifySecretWrite(incoming);
|
|
6409
|
+
if (intent.kind !== "set") return stored;
|
|
6410
|
+
const ref = stored.$secret;
|
|
6411
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6412
|
+
const answer = pass.answers[ref];
|
|
6413
|
+
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);
|
|
6414
|
+
try {
|
|
6415
|
+
await pass.secrets.put(ref, intent.value);
|
|
6416
|
+
} catch (err) {
|
|
6417
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6418
|
+
}
|
|
6419
|
+
pass.changedRefs.push(ref);
|
|
6420
|
+
return stored;
|
|
6421
|
+
}
|
|
6422
|
+
function inArray(pass, incoming, stored) {
|
|
6423
|
+
return incoming.map((item, index) => {
|
|
6424
|
+
const twin = stored[index];
|
|
6425
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6426
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6427
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6428
|
+
return item;
|
|
6429
|
+
});
|
|
6430
|
+
}
|
|
6431
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6432
|
+
const out = { ...incoming };
|
|
6433
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6434
|
+
const twin = stored[key];
|
|
6435
|
+
if (isSecretMarker(twin)) {
|
|
6436
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6437
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6438
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6439
|
+
}
|
|
6440
|
+
return out;
|
|
6441
|
+
}
|
|
6442
|
+
async function walk(pass, incoming, stored) {
|
|
6443
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6444
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6445
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6446
|
+
const out = { ...incoming };
|
|
6447
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6448
|
+
return out;
|
|
6449
|
+
}
|
|
6450
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6451
|
+
async function restoreUnchangedSecrets(input) {
|
|
6452
|
+
const refs = [];
|
|
6453
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6454
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6455
|
+
if (owned.length === 0) return {
|
|
6456
|
+
patch: input.patch,
|
|
6457
|
+
changedRefs: []
|
|
6458
|
+
};
|
|
6459
|
+
const pass = {
|
|
6460
|
+
secrets: input.secrets,
|
|
6461
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6462
|
+
operatorWrite: input.operatorWrite,
|
|
6463
|
+
changedRefs: []
|
|
6464
|
+
};
|
|
6465
|
+
const out = {};
|
|
6466
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6467
|
+
return {
|
|
6468
|
+
patch: out,
|
|
6469
|
+
changedRefs: pass.changedRefs
|
|
6470
|
+
};
|
|
6471
|
+
}
|
|
6472
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6473
|
+
function isJsonEqual(a, b) {
|
|
6474
|
+
if (Object.is(a, b)) return true;
|
|
6475
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6476
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6477
|
+
const keys = Object.keys(a);
|
|
6478
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6479
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6300
6480
|
}
|
|
6301
6481
|
return false;
|
|
6302
6482
|
}
|
|
6483
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6484
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6485
|
+
const out = {};
|
|
6486
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6487
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6488
|
+
out[key] = value;
|
|
6489
|
+
}
|
|
6490
|
+
return out;
|
|
6491
|
+
}
|
|
6492
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6493
|
+
function markerKeysOf(blob, owner) {
|
|
6494
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6495
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6496
|
+
return keys;
|
|
6497
|
+
}
|
|
6498
|
+
function nodeFromStored(value, owner) {
|
|
6499
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6500
|
+
if (!isRecord(value)) return null;
|
|
6501
|
+
const children = /* @__PURE__ */ new Map();
|
|
6502
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6503
|
+
const node = nodeFromStored(child, owner);
|
|
6504
|
+
if (node !== null) children.set(key, node);
|
|
6505
|
+
}
|
|
6506
|
+
return children.size > 0 ? {
|
|
6507
|
+
kind: "object",
|
|
6508
|
+
children
|
|
6509
|
+
} : null;
|
|
6510
|
+
}
|
|
6511
|
+
/**
|
|
6512
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6513
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6514
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6515
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6516
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6517
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6518
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6519
|
+
* over.
|
|
6520
|
+
*/
|
|
6521
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6522
|
+
const added = /* @__PURE__ */ new Map();
|
|
6523
|
+
for (const key of keys) {
|
|
6524
|
+
const at = key.indexOf("@");
|
|
6525
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6526
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6527
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6528
|
+
if (node !== null) added.set(base, node);
|
|
6529
|
+
}
|
|
6530
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6531
|
+
}
|
|
6303
6532
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6304
6533
|
async function readStoredAddonBlob(raw) {
|
|
6305
6534
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6308,7 +6537,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6308
6537
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6309
6538
|
return result.kind === "missing" ? {} : result.value;
|
|
6310
6539
|
}
|
|
6311
|
-
function
|
|
6540
|
+
function touchesTree(tree, patch) {
|
|
6541
|
+
if (tree.size === 0) return false;
|
|
6542
|
+
for (const key of Object.keys(patch)) {
|
|
6543
|
+
const at = key.indexOf("@");
|
|
6544
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6545
|
+
}
|
|
6546
|
+
return false;
|
|
6547
|
+
}
|
|
6548
|
+
/**
|
|
6549
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6550
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6551
|
+
*/
|
|
6552
|
+
var MarkerKeyIndex = class {
|
|
6553
|
+
owner;
|
|
6554
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6555
|
+
constructor(owner) {
|
|
6556
|
+
this.owner = owner;
|
|
6557
|
+
}
|
|
6558
|
+
seen(store, blob) {
|
|
6559
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6560
|
+
}
|
|
6561
|
+
wrote(store, patch) {
|
|
6562
|
+
const keys = this.byStore.get(store);
|
|
6563
|
+
if (keys === void 0) return;
|
|
6564
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6565
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6566
|
+
else keys.delete(key);
|
|
6567
|
+
}
|
|
6568
|
+
mayHoldMarkers(store, patch) {
|
|
6569
|
+
const keys = this.byStore.get(store);
|
|
6570
|
+
if (keys === void 0) return true;
|
|
6571
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6572
|
+
}
|
|
6573
|
+
};
|
|
6574
|
+
function createHandle(raw, opts) {
|
|
6312
6575
|
const chains = /* @__PURE__ */ new Map();
|
|
6313
6576
|
const serialize = (key, fn) => {
|
|
6314
6577
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6319,46 +6582,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6319
6582
|
});
|
|
6320
6583
|
return next;
|
|
6321
6584
|
};
|
|
6322
|
-
const
|
|
6323
|
-
|
|
6324
|
-
|
|
6585
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6586
|
+
const resolveRead = async (store, blob) => {
|
|
6587
|
+
index.seen(store, blob);
|
|
6588
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6589
|
+
unresolved: "keep-marker",
|
|
6590
|
+
ownedBy: opts.secrets.owner
|
|
6591
|
+
});
|
|
6592
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6593
|
+
return value;
|
|
6594
|
+
};
|
|
6595
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6596
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6597
|
+
await rawWrite(patch);
|
|
6598
|
+
index.wrote(store, patch);
|
|
6599
|
+
return { changed: true };
|
|
6600
|
+
}
|
|
6601
|
+
return serialize(store, async () => {
|
|
6325
6602
|
const stored = await readStored();
|
|
6603
|
+
index.seen(store, stored);
|
|
6604
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6605
|
+
const restored = await restoreUnchangedSecrets({
|
|
6606
|
+
patch,
|
|
6607
|
+
stored,
|
|
6608
|
+
secrets: opts.secrets,
|
|
6609
|
+
operatorWrite
|
|
6610
|
+
});
|
|
6326
6611
|
const result = await transformSecretWrite({
|
|
6327
|
-
tree,
|
|
6612
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6328
6613
|
secrets: opts.secrets,
|
|
6329
|
-
patch,
|
|
6614
|
+
patch: restored.patch,
|
|
6330
6615
|
stored,
|
|
6331
6616
|
...scope !== void 0 ? { scope } : {},
|
|
6332
|
-
operatorWrite
|
|
6617
|
+
operatorWrite
|
|
6333
6618
|
});
|
|
6334
|
-
|
|
6619
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6620
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6621
|
+
if (wroteBlob) {
|
|
6622
|
+
await rawWrite(effective);
|
|
6623
|
+
index.wrote(store, effective);
|
|
6624
|
+
}
|
|
6335
6625
|
const { orphaned } = await result.afterWrite();
|
|
6336
6626
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6627
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6337
6628
|
});
|
|
6338
6629
|
};
|
|
6339
|
-
const
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6630
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6631
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6632
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6633
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6634
|
+
const overrides = {
|
|
6635
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6636
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6637
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6638
|
+
return result.kind === "value" ? {
|
|
6639
|
+
kind: "value",
|
|
6640
|
+
value: await resolveRead("addon", result.value)
|
|
6641
|
+
} : result;
|
|
6642
|
+
} } : {},
|
|
6643
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6644
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6645
|
+
if (result.kind !== "present") return result;
|
|
6646
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6647
|
+
unresolved: "keep-marker",
|
|
6648
|
+
ownedBy: opts.secrets.owner
|
|
6649
|
+
});
|
|
6650
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6651
|
+
return {
|
|
6652
|
+
kind: "present",
|
|
6653
|
+
value: value[key]
|
|
6654
|
+
};
|
|
6655
|
+
} } : {},
|
|
6656
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6657
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6658
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6659
|
+
const out = /* @__PURE__ */ new Map();
|
|
6660
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6661
|
+
return out;
|
|
6662
|
+
} } : {},
|
|
6663
|
+
writeAddonStore: async (patch) => {
|
|
6664
|
+
await writeAddon(patch);
|
|
6665
|
+
},
|
|
6666
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6667
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6668
|
+
kind: "device",
|
|
6669
|
+
deviceId
|
|
6670
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6671
|
+
}
|
|
6672
|
+
};
|
|
6673
|
+
return {
|
|
6674
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6675
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6676
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6677
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6678
|
+
} }),
|
|
6679
|
+
raw: {
|
|
6680
|
+
readAddonStore: async () => {
|
|
6681
|
+
const blob = await raw.readAddonStore();
|
|
6682
|
+
index.seen("addon", blob);
|
|
6683
|
+
return blob;
|
|
6684
|
+
},
|
|
6685
|
+
readDeviceStore: async (deviceId) => {
|
|
6686
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6687
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6688
|
+
return blob;
|
|
6689
|
+
}
|
|
6690
|
+
},
|
|
6691
|
+
writeAddonStore: writeAddon
|
|
6345
6692
|
};
|
|
6346
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6347
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6348
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6349
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6350
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6351
|
-
} });
|
|
6352
6693
|
}
|
|
6353
|
-
/** The context the addon sees
|
|
6354
|
-
function
|
|
6694
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6695
|
+
function createSecretAwareContext(context, opts) {
|
|
6355
6696
|
const raw = context.settings;
|
|
6356
|
-
if (raw === void 0) return
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6697
|
+
if (raw === void 0) return {
|
|
6698
|
+
context,
|
|
6699
|
+
handle: null
|
|
6700
|
+
};
|
|
6701
|
+
const handle = createHandle(raw, opts);
|
|
6702
|
+
return {
|
|
6703
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6704
|
+
if (prop === "settings") return handle.settings;
|
|
6705
|
+
return Reflect.get(target, prop, receiver);
|
|
6706
|
+
} }),
|
|
6707
|
+
handle
|
|
6708
|
+
};
|
|
6362
6709
|
}
|
|
6363
6710
|
var LEAF = { kind: "leaf" };
|
|
6364
6711
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6533,6 +6880,14 @@ var BaseAddon = class {
|
|
|
6533
6880
|
_secretChangeUnsub = null;
|
|
6534
6881
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6535
6882
|
_operatorWriteDepth = 0;
|
|
6883
|
+
/**
|
|
6884
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6885
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6886
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6887
|
+
*/
|
|
6888
|
+
_secretSettings = null;
|
|
6889
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6890
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6536
6891
|
constructor(defaults) {
|
|
6537
6892
|
this.defaults = defaults;
|
|
6538
6893
|
this._config = { ...defaults };
|
|
@@ -6569,13 +6924,21 @@ var BaseAddon = class {
|
|
|
6569
6924
|
}
|
|
6570
6925
|
async initialize(context) {
|
|
6571
6926
|
const secrets = context.secrets;
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6927
|
+
if (secrets !== void 0) {
|
|
6928
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6929
|
+
secrets,
|
|
6930
|
+
addonTree: () => this.addonSecretTree(),
|
|
6931
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6932
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6933
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6934
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6935
|
+
});
|
|
6936
|
+
this._ctx = wrapped;
|
|
6937
|
+
this._secretSettings = handle;
|
|
6938
|
+
} else {
|
|
6939
|
+
this._ctx = context;
|
|
6940
|
+
this._secretSettings = null;
|
|
6941
|
+
}
|
|
6579
6942
|
await this.resolveConfig();
|
|
6580
6943
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6581
6944
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6692,11 +7055,8 @@ var BaseAddon = class {
|
|
|
6692
7055
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6693
7056
|
const schema = this.globalSettingsSchema(cap);
|
|
6694
7057
|
if (!schema) return { sections: [] };
|
|
6695
|
-
const projected = await this.
|
|
6696
|
-
return hydrateSchema(schema, overlay ? {
|
|
6697
|
-
...projected,
|
|
6698
|
-
...overlay
|
|
6699
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7058
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7059
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6700
7060
|
}
|
|
6701
7061
|
/**
|
|
6702
7062
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6741,7 +7101,7 @@ var BaseAddon = class {
|
|
|
6741
7101
|
});
|
|
6742
7102
|
}
|
|
6743
7103
|
if (sections.length === 0) return null;
|
|
6744
|
-
const projected = await this.
|
|
7104
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6745
7105
|
return hydrateSchema({
|
|
6746
7106
|
...schema,
|
|
6747
7107
|
sections
|
|
@@ -6758,12 +7118,50 @@ var BaseAddon = class {
|
|
|
6758
7118
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6759
7119
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6760
7120
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7121
|
+
*
|
|
7122
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7123
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7124
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7125
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7126
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7127
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6761
7128
|
*/
|
|
6762
7129
|
async resolveGlobalStore(nodeId, cap) {
|
|
6763
7130
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7131
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7132
|
+
}
|
|
7133
|
+
projectForNode(store, nodeId, cap) {
|
|
6764
7134
|
const keys = this.perNodeKeys(cap);
|
|
6765
7135
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6766
|
-
return keys.size > 0 ? projectStore(
|
|
7136
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7137
|
+
}
|
|
7138
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7139
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7140
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7141
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7142
|
+
}
|
|
7143
|
+
/**
|
|
7144
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7145
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7146
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7147
|
+
* its value.
|
|
7148
|
+
*/
|
|
7149
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7150
|
+
const secrets = this._ctx?.secrets;
|
|
7151
|
+
const merged = {
|
|
7152
|
+
...stored,
|
|
7153
|
+
...overlay
|
|
7154
|
+
};
|
|
7155
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7156
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7157
|
+
unresolved: "keep-marker",
|
|
7158
|
+
ownedBy: secrets.owner
|
|
7159
|
+
});
|
|
7160
|
+
for (const key of Object.keys(overlay)) {
|
|
7161
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7162
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7163
|
+
}
|
|
7164
|
+
return merged;
|
|
6767
7165
|
}
|
|
6768
7166
|
/**
|
|
6769
7167
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6828,8 +7226,12 @@ var BaseAddon = class {
|
|
|
6828
7226
|
async clearSecrets(keys, nodeId) {
|
|
6829
7227
|
const tree = this.addonSecretTree();
|
|
6830
7228
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7229
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6831
7230
|
const patch = {};
|
|
6832
|
-
for (const key of keys)
|
|
7231
|
+
for (const key of keys) {
|
|
7232
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7233
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7234
|
+
}
|
|
6833
7235
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6834
7236
|
}
|
|
6835
7237
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6837,7 +7239,11 @@ var BaseAddon = class {
|
|
|
6837
7239
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6838
7240
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6839
7241
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6840
|
-
|
|
7242
|
+
const handle = this._secretSettings;
|
|
7243
|
+
if (handle !== null) {
|
|
7244
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7245
|
+
if (!changed) return;
|
|
7246
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6841
7247
|
if (target !== localNode) return;
|
|
6842
7248
|
await this.resolveConfig();
|
|
6843
7249
|
await this.onConfigChanged();
|
|
@@ -6890,7 +7296,7 @@ var BaseAddon = class {
|
|
|
6890
7296
|
async getDeviceSettings(deviceId) {
|
|
6891
7297
|
const schema = this.deviceSettingsSchema();
|
|
6892
7298
|
if (!schema) return { sections: [] };
|
|
6893
|
-
return hydrateSchema(schema, await this.
|
|
7299
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6894
7300
|
}
|
|
6895
7301
|
async updateDeviceSettings(deviceId, patch) {
|
|
6896
7302
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7062,7 +7468,7 @@ var BaseAddon = class {
|
|
|
7062
7468
|
key,
|
|
7063
7469
|
schema,
|
|
7064
7470
|
fallback,
|
|
7065
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7471
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7066
7472
|
write: async (patch) => {
|
|
7067
7473
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7068
7474
|
},
|
|
@@ -7124,6 +7530,23 @@ var BaseAddon = class {
|
|
|
7124
7530
|
}
|
|
7125
7531
|
return value;
|
|
7126
7532
|
}
|
|
7533
|
+
/**
|
|
7534
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7535
|
+
* keychain the context's own view is already raw.
|
|
7536
|
+
*/
|
|
7537
|
+
rawSettings() {
|
|
7538
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7539
|
+
}
|
|
7540
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7541
|
+
logUnresolvedRead(unresolved) {
|
|
7542
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7543
|
+
if (fresh.length === 0) return;
|
|
7544
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7545
|
+
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) => ({
|
|
7546
|
+
ref: u.ref,
|
|
7547
|
+
reason: u.reason
|
|
7548
|
+
})) } });
|
|
7549
|
+
}
|
|
7127
7550
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7128
7551
|
scheduleSecretReresolve(delayMs) {
|
|
7129
7552
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7150,7 +7573,7 @@ var BaseAddon = class {
|
|
|
7150
7573
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7151
7574
|
*/
|
|
7152
7575
|
async readAddonStoreWithRetry() {
|
|
7153
|
-
const settings = this.
|
|
7576
|
+
const settings = this.rawSettings();
|
|
7154
7577
|
if (!settings) return {};
|
|
7155
7578
|
const delaysMs = [
|
|
7156
7579
|
150,
|
|
@@ -9410,6 +9833,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9410
9833
|
fetchedAt: number()
|
|
9411
9834
|
});
|
|
9412
9835
|
/**
|
|
9836
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9837
|
+
* gets back (cloud training, D805+).
|
|
9838
|
+
*
|
|
9839
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9840
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9841
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9842
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9843
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9844
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9845
|
+
* change there, in the same piece of work.
|
|
9846
|
+
*
|
|
9847
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9848
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9849
|
+
*/
|
|
9850
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9851
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9852
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9853
|
+
var TrainingExportSchema = _enum([
|
|
9854
|
+
"onnx",
|
|
9855
|
+
"openvino-fp16",
|
|
9856
|
+
"openvino-int8",
|
|
9857
|
+
"coreml-fp16"
|
|
9858
|
+
]);
|
|
9859
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9860
|
+
object({
|
|
9861
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9862
|
+
jobKey: string().uuid(),
|
|
9863
|
+
target: object({
|
|
9864
|
+
kind: literal("detector"),
|
|
9865
|
+
step: literal("object-detection")
|
|
9866
|
+
}),
|
|
9867
|
+
base: object({
|
|
9868
|
+
modelId: string().min(1),
|
|
9869
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9870
|
+
weights: string().min(1),
|
|
9871
|
+
imgsz: number().int().positive()
|
|
9872
|
+
}),
|
|
9873
|
+
baseline: object({
|
|
9874
|
+
modelId: string().min(1),
|
|
9875
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9876
|
+
onnxUrl: string().url(),
|
|
9877
|
+
imgsz: number().int().positive(),
|
|
9878
|
+
floors: FloorsSchema
|
|
9879
|
+
}),
|
|
9880
|
+
dataset: object({
|
|
9881
|
+
versionId: string().min(1),
|
|
9882
|
+
annotationHash: string(),
|
|
9883
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9884
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9885
|
+
}),
|
|
9886
|
+
split: object({
|
|
9887
|
+
holdoutCameras: array(number().int()),
|
|
9888
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9889
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9890
|
+
valFraction: number().min(0).max(.5),
|
|
9891
|
+
seed: number().int()
|
|
9892
|
+
}),
|
|
9893
|
+
hyper: object({
|
|
9894
|
+
epochs: number().int().positive(),
|
|
9895
|
+
batch: number().int().positive(),
|
|
9896
|
+
lr0: number().positive(),
|
|
9897
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9898
|
+
freeze: number().int().nonnegative(),
|
|
9899
|
+
patience: number().int().nonnegative(),
|
|
9900
|
+
seed: number().int()
|
|
9901
|
+
}),
|
|
9902
|
+
replay: object({
|
|
9903
|
+
source: literal("coco2017"),
|
|
9904
|
+
count: number().int().nonnegative()
|
|
9905
|
+
}),
|
|
9906
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9907
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9908
|
+
floors: object({
|
|
9909
|
+
minSupport: number().int().positive(),
|
|
9910
|
+
clamp: number().min(0).max(1)
|
|
9911
|
+
}),
|
|
9912
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9913
|
+
catalog: object({
|
|
9914
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9915
|
+
name: string().min(1).max(160)
|
|
9916
|
+
})
|
|
9917
|
+
});
|
|
9918
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9919
|
+
var TrainingResultFileSchema = object({
|
|
9920
|
+
path: string().min(1),
|
|
9921
|
+
bytes: number().int().nonnegative(),
|
|
9922
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9923
|
+
format: _enum([
|
|
9924
|
+
"onnx",
|
|
9925
|
+
"openvino",
|
|
9926
|
+
"coreml",
|
|
9927
|
+
"pt"
|
|
9928
|
+
]),
|
|
9929
|
+
variant: _enum(["base", "int8"])
|
|
9930
|
+
});
|
|
9931
|
+
var DraftFormatSchema = object({
|
|
9932
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9933
|
+
url: string().min(1),
|
|
9934
|
+
sizeMB: number().nonnegative(),
|
|
9935
|
+
isDirectory: boolean().optional(),
|
|
9936
|
+
files: array(string()).optional(),
|
|
9937
|
+
runtimes: array(literal("python")).optional(),
|
|
9938
|
+
revision: string().min(1)
|
|
9939
|
+
});
|
|
9940
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9941
|
+
var TrainingCatalogDraftSchema = object({
|
|
9942
|
+
id: string().min(1),
|
|
9943
|
+
name: string().min(1),
|
|
9944
|
+
description: string(),
|
|
9945
|
+
labels: array(unknown()),
|
|
9946
|
+
inputSize: object({
|
|
9947
|
+
width: number().int().positive(),
|
|
9948
|
+
height: number().int().positive()
|
|
9949
|
+
}),
|
|
9950
|
+
preprocessMode: literal("letterbox"),
|
|
9951
|
+
defaultClassFloors: FloorsSchema,
|
|
9952
|
+
formats: object({
|
|
9953
|
+
onnx: DraftFormatSchema.optional(),
|
|
9954
|
+
openvino: DraftFormatSchema.optional(),
|
|
9955
|
+
coreml: DraftFormatSchema.optional()
|
|
9956
|
+
})
|
|
9957
|
+
});
|
|
9958
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
9959
|
+
var TrainingEvalClassSchema = object({
|
|
9960
|
+
positives: number().int(),
|
|
9961
|
+
floor: number().nullable(),
|
|
9962
|
+
tp: number().int(),
|
|
9963
|
+
fp: number().int(),
|
|
9964
|
+
fn: number().int(),
|
|
9965
|
+
precision: number().nullable(),
|
|
9966
|
+
recall: number().nullable(),
|
|
9967
|
+
ap50: number().nullable(),
|
|
9968
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
9969
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
9970
|
+
fpByCamera: record(string(), number()).optional(),
|
|
9971
|
+
smallFound: number().int().optional(),
|
|
9972
|
+
smallTotal: number().int().optional()
|
|
9973
|
+
}).passthrough();
|
|
9974
|
+
var TrainingEvalReportSchema = object({
|
|
9975
|
+
frames: number().int(),
|
|
9976
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
9977
|
+
}).passthrough();
|
|
9978
|
+
/**
|
|
9979
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
9980
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
9981
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
9982
|
+
*/
|
|
9983
|
+
var TrainingResultSchema = object({
|
|
9984
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
9985
|
+
jobKey: string(),
|
|
9986
|
+
status: _enum(["succeeded", "failed"]),
|
|
9987
|
+
error: object({
|
|
9988
|
+
stage: string(),
|
|
9989
|
+
code: string(),
|
|
9990
|
+
message: string()
|
|
9991
|
+
}).nullable(),
|
|
9992
|
+
trainer: object({
|
|
9993
|
+
version: string(),
|
|
9994
|
+
revision: string()
|
|
9995
|
+
}),
|
|
9996
|
+
toolchain: record(string(), string().nullable()),
|
|
9997
|
+
dataset: object({
|
|
9998
|
+
versionId: string(),
|
|
9999
|
+
annotationHash: string(),
|
|
10000
|
+
sha256: string(),
|
|
10001
|
+
frames: object({
|
|
10002
|
+
train: number().int(),
|
|
10003
|
+
val: number().int(),
|
|
10004
|
+
holdout: number().int()
|
|
10005
|
+
}),
|
|
10006
|
+
holdoutCameras: array(number().int()),
|
|
10007
|
+
replayImages: number().int()
|
|
10008
|
+
}).optional(),
|
|
10009
|
+
training: object({
|
|
10010
|
+
epochsRun: number().int(),
|
|
10011
|
+
bestEpoch: number().int(),
|
|
10012
|
+
bestMap50: number(),
|
|
10013
|
+
bestMap50_95: number(),
|
|
10014
|
+
seconds: number()
|
|
10015
|
+
}).optional(),
|
|
10016
|
+
evaluation: object({
|
|
10017
|
+
holdoutFrames: number().int(),
|
|
10018
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10019
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10020
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10021
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10022
|
+
map50: record(string(), number().nullable())
|
|
10023
|
+
}).optional(),
|
|
10024
|
+
floors: object({
|
|
10025
|
+
baseline: FloorsSchema,
|
|
10026
|
+
candidate: FloorsSchema,
|
|
10027
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10028
|
+
notes: array(string())
|
|
10029
|
+
}).optional(),
|
|
10030
|
+
int8: object({
|
|
10031
|
+
kept: boolean(),
|
|
10032
|
+
map50Fp16: number().nullable(),
|
|
10033
|
+
map50Int8: number().nullable(),
|
|
10034
|
+
reason: string().nullable()
|
|
10035
|
+
}).optional(),
|
|
10036
|
+
exportsDropped: array(object({
|
|
10037
|
+
export: string(),
|
|
10038
|
+
reason: string()
|
|
10039
|
+
})).optional(),
|
|
10040
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10041
|
+
bundle: object({
|
|
10042
|
+
path: literal("bundle.tar"),
|
|
10043
|
+
bytes: number().int().nonnegative(),
|
|
10044
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10045
|
+
}).nullable().optional(),
|
|
10046
|
+
catalogDraft: object({
|
|
10047
|
+
base: TrainingCatalogDraftSchema,
|
|
10048
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10049
|
+
}).nullable().optional(),
|
|
10050
|
+
licence: string()
|
|
10051
|
+
});
|
|
10052
|
+
var TrainingStageSchema = _enum([
|
|
10053
|
+
"prepare",
|
|
10054
|
+
"replay",
|
|
10055
|
+
"train",
|
|
10056
|
+
"eval",
|
|
10057
|
+
"export",
|
|
10058
|
+
"package"
|
|
10059
|
+
]);
|
|
10060
|
+
var EventBase = {
|
|
10061
|
+
v: literal(1),
|
|
10062
|
+
ts: number()
|
|
10063
|
+
};
|
|
10064
|
+
discriminatedUnion("type", [
|
|
10065
|
+
object({
|
|
10066
|
+
...EventBase,
|
|
10067
|
+
type: literal("stage"),
|
|
10068
|
+
stage: TrainingStageSchema
|
|
10069
|
+
}),
|
|
10070
|
+
object({
|
|
10071
|
+
...EventBase,
|
|
10072
|
+
type: literal("epoch"),
|
|
10073
|
+
epoch: number().int(),
|
|
10074
|
+
epochs: number().int(),
|
|
10075
|
+
boxLoss: number().nullable().optional(),
|
|
10076
|
+
map50: number().nullable().optional(),
|
|
10077
|
+
map50_95: number().nullable().optional(),
|
|
10078
|
+
etaSec: number().nullable().optional()
|
|
10079
|
+
}),
|
|
10080
|
+
object({
|
|
10081
|
+
...EventBase,
|
|
10082
|
+
type: literal("metric"),
|
|
10083
|
+
name: string(),
|
|
10084
|
+
value: number()
|
|
10085
|
+
}),
|
|
10086
|
+
object({
|
|
10087
|
+
...EventBase,
|
|
10088
|
+
type: literal("artifact"),
|
|
10089
|
+
path: string(),
|
|
10090
|
+
bytes: number(),
|
|
10091
|
+
sha256: string()
|
|
10092
|
+
}),
|
|
10093
|
+
object({
|
|
10094
|
+
...EventBase,
|
|
10095
|
+
type: literal("done"),
|
|
10096
|
+
status: _enum(["succeeded", "failed"]),
|
|
10097
|
+
resultSha256: string().nullable().optional()
|
|
10098
|
+
}),
|
|
10099
|
+
object({
|
|
10100
|
+
...EventBase,
|
|
10101
|
+
type: literal("error"),
|
|
10102
|
+
stage: string(),
|
|
10103
|
+
code: string(),
|
|
10104
|
+
message: string()
|
|
10105
|
+
})
|
|
10106
|
+
]);
|
|
10107
|
+
/**
|
|
9413
10108
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9414
10109
|
*
|
|
9415
10110
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11737,7 +12432,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11737
12432
|
"authenticated",
|
|
11738
12433
|
"admin"
|
|
11739
12434
|
]).optional(),
|
|
11740
|
-
description: string().optional()
|
|
12435
|
+
description: string().optional(),
|
|
12436
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12437
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11741
12438
|
});
|
|
11742
12439
|
/**
|
|
11743
12440
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12442,6 +13139,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12442
13139
|
lastError: string().optional()
|
|
12443
13140
|
});
|
|
12444
13141
|
/**
|
|
13142
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13143
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13144
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13145
|
+
* with it off — which restores without a key.
|
|
13146
|
+
*/
|
|
13147
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13148
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13149
|
+
scheme: string(),
|
|
13150
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13151
|
+
keyId: string()
|
|
13152
|
+
});
|
|
13153
|
+
/**
|
|
13154
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13155
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13156
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13157
|
+
*/
|
|
13158
|
+
var BackupEncryptionStatusSchema = object({
|
|
13159
|
+
enabled: boolean(),
|
|
13160
|
+
active: object({
|
|
13161
|
+
keyId: string(),
|
|
13162
|
+
publicKey: string(),
|
|
13163
|
+
createdAt: number()
|
|
13164
|
+
}).nullable(),
|
|
13165
|
+
/** Every key ever set up, newest first. */
|
|
13166
|
+
keys: array(object({
|
|
13167
|
+
keyId: string(),
|
|
13168
|
+
createdAt: number(),
|
|
13169
|
+
retiredAt: number().nullable()
|
|
13170
|
+
})).readonly()
|
|
13171
|
+
});
|
|
13172
|
+
/**
|
|
12445
13173
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12446
13174
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12447
13175
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12453,7 +13181,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12453
13181
|
sizeBytes: number(),
|
|
12454
13182
|
label: string().optional(),
|
|
12455
13183
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12456
|
-
locations: array(string()).readonly()
|
|
13184
|
+
locations: array(string()).readonly(),
|
|
13185
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13186
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12457
13187
|
});
|
|
12458
13188
|
var BackupEntrySchema = object({
|
|
12459
13189
|
id: string(),
|
|
@@ -12462,7 +13192,8 @@ var BackupEntrySchema = object({
|
|
|
12462
13192
|
label: string().optional(),
|
|
12463
13193
|
createdAt: number(),
|
|
12464
13194
|
sizeBytes: number(),
|
|
12465
|
-
locations: array(string()).optional()
|
|
13195
|
+
locations: array(string()).optional(),
|
|
13196
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12466
13197
|
});
|
|
12467
13198
|
var ArchiveEntrySchema = object({
|
|
12468
13199
|
path: string(),
|
|
@@ -12651,10 +13382,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12651
13382
|
* this list and skips entries whose path doesn't start with
|
|
12652
13383
|
* any of them.
|
|
12653
13384
|
*/
|
|
12654
|
-
locations: array(string()).optional()
|
|
13385
|
+
locations: array(string()).optional(),
|
|
13386
|
+
/**
|
|
13387
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13388
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13389
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13390
|
+
* is refused before the archive is downloaded.
|
|
13391
|
+
*/
|
|
13392
|
+
backupSecretKey: string().optional()
|
|
12655
13393
|
}), _void(), {
|
|
12656
13394
|
kind: "mutation",
|
|
12657
13395
|
auth: "admin"
|
|
13396
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13397
|
+
keyId: string(),
|
|
13398
|
+
secretKey: string(),
|
|
13399
|
+
publicKey: string(),
|
|
13400
|
+
createdAt: number(),
|
|
13401
|
+
replacedKeyId: string().nullable()
|
|
13402
|
+
}), {
|
|
13403
|
+
kind: "mutation",
|
|
13404
|
+
auth: "admin"
|
|
13405
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13406
|
+
kind: "mutation",
|
|
13407
|
+
auth: "admin"
|
|
13408
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13409
|
+
valid: boolean(),
|
|
13410
|
+
keyId: string().nullable(),
|
|
13411
|
+
/** The hub knows this key (active or retired). */
|
|
13412
|
+
known: boolean(),
|
|
13413
|
+
/** It is the key new archives are encrypted to. */
|
|
13414
|
+
active: boolean(),
|
|
13415
|
+
error: string().optional()
|
|
13416
|
+
}), {
|
|
13417
|
+
kind: "mutation",
|
|
13418
|
+
auth: "admin"
|
|
12658
13419
|
}), method(object({
|
|
12659
13420
|
destinationId: string(),
|
|
12660
13421
|
backupId: string()
|
|
@@ -14278,7 +15039,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14278
15039
|
stepId: string(),
|
|
14279
15040
|
entry: ModelCatalogEntrySchema
|
|
14280
15041
|
});
|
|
14281
|
-
|
|
15042
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15043
|
+
var ModelBundleFileSchema = object({
|
|
15044
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15045
|
+
path: string().min(1),
|
|
15046
|
+
bytes: number().int().nonnegative(),
|
|
15047
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15048
|
+
});
|
|
15049
|
+
var ImportModelBundleInputSchema = object({
|
|
15050
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15051
|
+
addonId: string(),
|
|
15052
|
+
stepId: string().min(1),
|
|
15053
|
+
/**
|
|
15054
|
+
* The catalog rows to register, complete, every format URL already
|
|
15055
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15056
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15057
|
+
*/
|
|
15058
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15059
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15060
|
+
bundle: object({
|
|
15061
|
+
ticket: PeerBytesTicketSchema,
|
|
15062
|
+
bytes: number().int().positive(),
|
|
15063
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15064
|
+
}),
|
|
15065
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15066
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15067
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15068
|
+
distribute: boolean()
|
|
15069
|
+
});
|
|
15070
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15071
|
+
kind: literal("imported"),
|
|
15072
|
+
modelIds: array(string()).readonly(),
|
|
15073
|
+
distributed: array(object({
|
|
15074
|
+
modelId: string(),
|
|
15075
|
+
nodeId: string(),
|
|
15076
|
+
format: _enum(MODEL_FORMATS),
|
|
15077
|
+
ok: boolean(),
|
|
15078
|
+
error: string().optional()
|
|
15079
|
+
})).readonly()
|
|
15080
|
+
}), object({
|
|
15081
|
+
kind: literal("refused"),
|
|
15082
|
+
reason: _enum([
|
|
15083
|
+
"transfer-failed",
|
|
15084
|
+
"checksum-mismatch",
|
|
15085
|
+
"bundle-mismatch",
|
|
15086
|
+
"invalid-entry",
|
|
15087
|
+
"id-taken"
|
|
15088
|
+
]),
|
|
15089
|
+
detail: string()
|
|
15090
|
+
})]);
|
|
15091
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15092
|
+
kind: "mutation",
|
|
15093
|
+
auth: "admin",
|
|
15094
|
+
timeoutMs: 30 * 6e4
|
|
15095
|
+
});
|
|
14282
15096
|
/**
|
|
14283
15097
|
* Query filter for settings-store collections.
|
|
14284
15098
|
*/
|
|
@@ -14757,6 +15571,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14757
15571
|
*/
|
|
14758
15572
|
sharesBackupWithDatabase: boolean()
|
|
14759
15573
|
});
|
|
15574
|
+
/**
|
|
15575
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15576
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15577
|
+
*/
|
|
15578
|
+
var KeychainResetRecordSchema = object({
|
|
15579
|
+
id: string(),
|
|
15580
|
+
at: number(),
|
|
15581
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15582
|
+
actor: string(),
|
|
15583
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15584
|
+
lockedReason: string().nullable(),
|
|
15585
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15586
|
+
archived: number().int(),
|
|
15587
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15588
|
+
archivedCollection: string().nullable(),
|
|
15589
|
+
/**
|
|
15590
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15591
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15592
|
+
*/
|
|
15593
|
+
archivedKeysCollection: string().nullable(),
|
|
15594
|
+
/**
|
|
15595
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15596
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15597
|
+
* agent forever (D797).
|
|
15598
|
+
*/
|
|
15599
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15600
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15601
|
+
acknowledgedAt: number().nullable()
|
|
15602
|
+
});
|
|
14760
15603
|
var KeychainStatusSchema = object({
|
|
14761
15604
|
keychain: KeychainStateSchema,
|
|
14762
15605
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14774,7 +15617,9 @@ var KeychainStatusSchema = object({
|
|
|
14774
15617
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14775
15618
|
retiredWraps: number().int(),
|
|
14776
15619
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14777
|
-
secretCount: number().int()
|
|
15620
|
+
secretCount: number().int(),
|
|
15621
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15622
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14778
15623
|
});
|
|
14779
15624
|
/**
|
|
14780
15625
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -14796,17 +15641,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
14796
15641
|
"download-recovery-key",
|
|
14797
15642
|
"delete-orphans",
|
|
14798
15643
|
"reset",
|
|
15644
|
+
"acknowledge-reset",
|
|
14799
15645
|
"initialize"
|
|
14800
15646
|
]);
|
|
14801
15647
|
var KeychainAuditEntrySchema = object({
|
|
14802
15648
|
id: string(),
|
|
14803
15649
|
at: number(),
|
|
14804
15650
|
action: KeychainAuditActionSchema,
|
|
14805
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15651
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
14806
15652
|
actor: string(),
|
|
14807
15653
|
ref: string().nullable(),
|
|
14808
15654
|
detail: string().nullable()
|
|
14809
15655
|
});
|
|
15656
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15657
|
+
/**
|
|
15658
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15659
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15660
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15661
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15662
|
+
*/
|
|
15663
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
14810
15664
|
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({
|
|
14811
15665
|
value: string(),
|
|
14812
15666
|
version: number().int()
|
|
@@ -14814,6 +15668,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
14814
15668
|
kind: "mutation",
|
|
14815
15669
|
auth: "admin",
|
|
14816
15670
|
caller: "required"
|
|
15671
|
+
}), method(object({
|
|
15672
|
+
name: SystemHeldSecretNameSchema,
|
|
15673
|
+
value: string().min(16)
|
|
15674
|
+
}), object({
|
|
15675
|
+
ref: string(),
|
|
15676
|
+
version: number().int()
|
|
15677
|
+
}), {
|
|
15678
|
+
kind: "mutation",
|
|
15679
|
+
auth: "admin",
|
|
15680
|
+
caller: "required"
|
|
14817
15681
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14818
15682
|
deleted: array(string()).readonly(),
|
|
14819
15683
|
kept: array(object({
|
|
@@ -14843,13 +15707,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
14843
15707
|
kind: "mutation",
|
|
14844
15708
|
auth: "admin",
|
|
14845
15709
|
caller: "required"
|
|
14846
|
-
}), method(object({ confirm: literal(
|
|
15710
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
14847
15711
|
archivedCollection: string().nullable(),
|
|
14848
15712
|
archived: number().int()
|
|
14849
15713
|
}), {
|
|
14850
15714
|
kind: "mutation",
|
|
14851
15715
|
auth: "admin",
|
|
14852
15716
|
caller: "required"
|
|
15717
|
+
}), method(object({}), object({
|
|
15718
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15719
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15720
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15721
|
+
kind: "mutation",
|
|
15722
|
+
auth: "admin",
|
|
15723
|
+
caller: "required"
|
|
14853
15724
|
});
|
|
14854
15725
|
method(_void(), object({
|
|
14855
15726
|
id: string(),
|
|
@@ -17495,7 +18366,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17495
18366
|
* `login-method` — collection cap through which auth addons contribute
|
|
17496
18367
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17497
18368
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17498
|
-
* every auth addon (OIDC,
|
|
18369
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17499
18370
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17500
18371
|
* procedure aggregates them for the unauthenticated login page.
|
|
17501
18372
|
*
|
|
@@ -17503,8 +18374,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17503
18374
|
*
|
|
17504
18375
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17505
18376
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17506
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17507
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18377
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17508
18378
|
* login page needs NO change.
|
|
17509
18379
|
*
|
|
17510
18380
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17523,8 +18393,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17523
18393
|
* decision.
|
|
17524
18394
|
*
|
|
17525
18395
|
* Every contribution carries a `stage`:
|
|
17526
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17527
|
-
*
|
|
18396
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18397
|
+
* buttons; a usernameless passkey).
|
|
17528
18398
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17529
18399
|
* returned `factors` (passkey-as-2FA today).
|
|
17530
18400
|
*
|
|
@@ -17551,7 +18421,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17551
18421
|
* The provider names an external identity a signed-in user can link to
|
|
17552
18422
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17553
18423
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17554
|
-
* whatever their id. Absent / false — a login button only
|
|
18424
|
+
* whatever their id. Absent / false — a login button only.
|
|
17555
18425
|
*/
|
|
17556
18426
|
linkable: boolean().optional()
|
|
17557
18427
|
}),
|
|
@@ -21385,8 +22255,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21385
22255
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21386
22256
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21387
22257
|
* distinction was only ever used to route role-specific procedures
|
|
21388
|
-
* which we no longer have.
|
|
21389
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22258
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21390
22259
|
* with `isAdmin: false` + an explicit scope list.
|
|
21391
22260
|
*/
|
|
21392
22261
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23061,6 +23930,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23061
23930
|
frameIds: array(string()).max(2e4).optional(),
|
|
23062
23931
|
/** Only frames in at least one of these named collections. */
|
|
23063
23932
|
collectionIds: array(string()).max(200).optional(),
|
|
23933
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
23934
|
+
* unknown id selects nothing. */
|
|
23935
|
+
datasetVersionId: string().optional(),
|
|
23064
23936
|
batchId: string().optional(),
|
|
23065
23937
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23066
23938
|
completeOnly: boolean().optional()
|
|
@@ -23228,6 +24100,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23228
24100
|
]),
|
|
23229
24101
|
detail: string().optional()
|
|
23230
24102
|
})]);
|
|
24103
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24104
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24105
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24106
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24107
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24108
|
+
});
|
|
24109
|
+
/** The counts a dataset is judged by. */
|
|
24110
|
+
var RetrainDatasetStatsSchema = object({
|
|
24111
|
+
frames: number().int(),
|
|
24112
|
+
completeFrames: number().int(),
|
|
24113
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24114
|
+
completeness: number(),
|
|
24115
|
+
/** Boxes to learn (model errors excluded). */
|
|
24116
|
+
subjects: number().int(),
|
|
24117
|
+
modelErrors: number().int(),
|
|
24118
|
+
/** Complete frames with no subject. */
|
|
24119
|
+
hardNegatives: number().int(),
|
|
24120
|
+
/** Subjects per class × camera × day/night. */
|
|
24121
|
+
cells: array(object({
|
|
24122
|
+
macroClass: string(),
|
|
24123
|
+
deviceId: number(),
|
|
24124
|
+
lighting: _enum([
|
|
24125
|
+
"day",
|
|
24126
|
+
"night",
|
|
24127
|
+
"unknown"
|
|
24128
|
+
]),
|
|
24129
|
+
subjects: number().int(),
|
|
24130
|
+
frames: number().int()
|
|
24131
|
+
})).readonly(),
|
|
24132
|
+
cameras: array(object({
|
|
24133
|
+
deviceId: number(),
|
|
24134
|
+
frames: number().int(),
|
|
24135
|
+
completeFrames: number().int()
|
|
24136
|
+
})).readonly()
|
|
24137
|
+
});
|
|
24138
|
+
/** An immutable dataset version, without its frame list. */
|
|
24139
|
+
var RetrainDatasetVersionSchema = object({
|
|
24140
|
+
id: string(),
|
|
24141
|
+
name: string(),
|
|
24142
|
+
createdAt: number(),
|
|
24143
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24144
|
+
layout: RetrainExportLayoutSchema,
|
|
24145
|
+
completeOnly: boolean(),
|
|
24146
|
+
frameCount: number().int(),
|
|
24147
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24148
|
+
annotationHash: string(),
|
|
24149
|
+
/** The export manifest schema the version was cut under. */
|
|
24150
|
+
manifestSchema: string(),
|
|
24151
|
+
stats: RetrainDatasetStatsSchema
|
|
24152
|
+
});
|
|
24153
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24154
|
+
kind: literal("created"),
|
|
24155
|
+
version: RetrainDatasetVersionSchema
|
|
24156
|
+
}), object({
|
|
24157
|
+
kind: literal("refused"),
|
|
24158
|
+
reason: _enum([
|
|
24159
|
+
"empty-name",
|
|
24160
|
+
"duplicate-name",
|
|
24161
|
+
"no-frames"
|
|
24162
|
+
])
|
|
24163
|
+
})]);
|
|
23231
24164
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23232
24165
|
var RetrainTransitionResultSchema = object({
|
|
23233
24166
|
trackId: string(),
|
|
@@ -24017,6 +24950,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24017
24950
|
kind: "mutation",
|
|
24018
24951
|
auth: "admin",
|
|
24019
24952
|
timeoutMs: 60 * 6e4
|
|
24953
|
+
}), method(object({
|
|
24954
|
+
filter: RetrainExportFilterSchema,
|
|
24955
|
+
layout: RetrainExportLayoutSchema
|
|
24956
|
+
}), object({
|
|
24957
|
+
ticket: PeerBytesTicketSchema,
|
|
24958
|
+
frames: number().int(),
|
|
24959
|
+
annotations: number().int()
|
|
24960
|
+
}), {
|
|
24961
|
+
kind: "mutation",
|
|
24962
|
+
auth: "admin",
|
|
24963
|
+
timeoutMs: 12e4
|
|
24964
|
+
}), method(object({
|
|
24965
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24966
|
+
completeOnly: boolean().optional()
|
|
24967
|
+
}), RetrainDatasetStatsSchema, {
|
|
24968
|
+
kind: "query",
|
|
24969
|
+
auth: "admin"
|
|
24970
|
+
}), method(object({
|
|
24971
|
+
name: string().max(120),
|
|
24972
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24973
|
+
layout: RetrainExportLayoutSchema,
|
|
24974
|
+
completeOnly: boolean()
|
|
24975
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
24976
|
+
kind: "mutation",
|
|
24977
|
+
auth: "admin",
|
|
24978
|
+
timeoutMs: 12e4
|
|
24979
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
24980
|
+
kind: "query",
|
|
24981
|
+
auth: "admin"
|
|
24982
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
24983
|
+
kind: "mutation",
|
|
24984
|
+
auth: "admin"
|
|
24985
|
+
}), method(object({ id: string() }), object({
|
|
24986
|
+
found: boolean(),
|
|
24987
|
+
annotationHash: string(),
|
|
24988
|
+
matches: boolean(),
|
|
24989
|
+
missingFrames: number().int()
|
|
24990
|
+
}), {
|
|
24991
|
+
kind: "query",
|
|
24992
|
+
auth: "admin",
|
|
24993
|
+
timeoutMs: 12e4
|
|
24020
24994
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24021
24995
|
kind: "query",
|
|
24022
24996
|
auth: "admin"
|
|
@@ -27555,8 +28529,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27555
28529
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27556
28530
|
*
|
|
27557
28531
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27558
|
-
* one for transactional / one for notifications). Consumers (
|
|
27559
|
-
*
|
|
28532
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28533
|
+
* addons, …) walk the collection and pick the first
|
|
27560
28534
|
* ready provider OR target a specific addonId.
|
|
27561
28535
|
*
|
|
27562
28536
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27735,7 +28709,7 @@ targets: array(object({
|
|
|
27735
28709
|
})));
|
|
27736
28710
|
/**
|
|
27737
28711
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27738
|
-
* providers (OIDC, SAML,
|
|
28712
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27739
28713
|
* carrying the post-callback claims before redirecting back to
|
|
27740
28714
|
* `/api/auth/sso/finish`.
|
|
27741
28715
|
*
|
|
@@ -27798,7 +28772,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27798
28772
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
27799
28773
|
* subject is unique only per issuer, so a link is bound to it.
|
|
27800
28774
|
*/
|
|
27801
|
-
issuer: string().optional()
|
|
28775
|
+
issuer: string().optional(),
|
|
28776
|
+
/**
|
|
28777
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
28778
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
28779
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
28780
|
+
* any other browser.
|
|
28781
|
+
*/
|
|
28782
|
+
browserBinding: string().optional()
|
|
27802
28783
|
});
|
|
27803
28784
|
method(object({
|
|
27804
28785
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -37779,16 +38760,6 @@ var ApiKeySummarySchema = object({
|
|
|
37779
38760
|
createdAt: number(),
|
|
37780
38761
|
lastUsedAt: number().optional()
|
|
37781
38762
|
});
|
|
37782
|
-
var CreateApiKeyInputSchema = object({
|
|
37783
|
-
label: string(),
|
|
37784
|
-
isAdmin: boolean().default(false),
|
|
37785
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
37786
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
37787
|
-
});
|
|
37788
|
-
var CreateApiKeyResultSchema = object({
|
|
37789
|
-
token: string(),
|
|
37790
|
-
record: ApiKeySummarySchema
|
|
37791
|
-
});
|
|
37792
38763
|
var ScopedTokenSummarySchema = object({
|
|
37793
38764
|
id: string(),
|
|
37794
38765
|
userId: string(),
|
|
@@ -37887,17 +38858,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
37887
38858
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
37888
38859
|
kind: "mutation",
|
|
37889
38860
|
access: "view"
|
|
37890
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
37891
|
-
kind: "mutation",
|
|
37892
|
-
auth: "admin",
|
|
37893
|
-
access: "create"
|
|
37894
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
38861
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
37895
38862
|
kind: "mutation",
|
|
37896
38863
|
auth: "admin",
|
|
37897
38864
|
access: "delete"
|
|
37898
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
37899
|
-
kind: "mutation",
|
|
37900
|
-
access: "view"
|
|
37901
38865
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
37902
38866
|
kind: "mutation",
|
|
37903
38867
|
auth: "admin",
|
|
@@ -37971,15 +38935,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
37971
38935
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
37972
38936
|
userId: string(),
|
|
37973
38937
|
issuer: string()
|
|
37974
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
37975
|
-
userId: string(),
|
|
37976
|
-
issuer: string().min(1),
|
|
37977
|
-
label: string().optional()
|
|
37978
|
-
}), object({ success: literal(true) }), {
|
|
37979
|
-
kind: "mutation",
|
|
37980
|
-
auth: "admin",
|
|
37981
|
-
access: "create"
|
|
37982
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38938
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
37983
38939
|
kind: "mutation",
|
|
37984
38940
|
auth: "admin",
|
|
37985
38941
|
access: "delete"
|
|
@@ -38374,6 +39330,451 @@ DeviceType.Camera, method(object({
|
|
|
38374
39330
|
detection: array(ZoneRuleSchema).readonly(),
|
|
38375
39331
|
package: array(ZoneRuleSchema).readonly()
|
|
38376
39332
|
});
|
|
39333
|
+
/**
|
|
39334
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
39335
|
+
*
|
|
39336
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
39337
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
39338
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
39339
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
39340
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
39341
|
+
* manifest entry and nothing else.
|
|
39342
|
+
*
|
|
39343
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
39344
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
39345
|
+
* Every method is `admin`: these spend money.
|
|
39346
|
+
*
|
|
39347
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
39348
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
39349
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
39350
|
+
*
|
|
39351
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
39352
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
39353
|
+
* ticket the provider mints (D613).
|
|
39354
|
+
*/
|
|
39355
|
+
var TrainingGpuOptionSchema = object({
|
|
39356
|
+
id: string(),
|
|
39357
|
+
label: string(),
|
|
39358
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
39359
|
+
usdPerHour: number().nonnegative(),
|
|
39360
|
+
vramGb: number().nonnegative()
|
|
39361
|
+
});
|
|
39362
|
+
var TrainingRegionOptionSchema = object({
|
|
39363
|
+
/** `''` = any region (the provider's choice). */
|
|
39364
|
+
id: string(),
|
|
39365
|
+
label: string(),
|
|
39366
|
+
priceMultiplier: number().positive()
|
|
39367
|
+
});
|
|
39368
|
+
/**
|
|
39369
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
39370
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
39371
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
39372
|
+
*/
|
|
39373
|
+
var TrainingProviderDefaultsSchema = object({
|
|
39374
|
+
gpuType: string(),
|
|
39375
|
+
region: string(),
|
|
39376
|
+
costCapUsd: number().nonnegative(),
|
|
39377
|
+
maxRuntimeSec: number().int().positive(),
|
|
39378
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
39379
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
39380
|
+
});
|
|
39381
|
+
var TrainingProviderDescriptorSchema = object({
|
|
39382
|
+
addonId: string(),
|
|
39383
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
39384
|
+
kind: string(),
|
|
39385
|
+
label: string(),
|
|
39386
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
39387
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
39388
|
+
maxDatasetBytes: number().int().positive(),
|
|
39389
|
+
maxRuntimeSec: number().int().positive(),
|
|
39390
|
+
freeTierNote: string().optional(),
|
|
39391
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
39392
|
+
dataResidencyNote: string(),
|
|
39393
|
+
/** Credentials are present — never the values. */
|
|
39394
|
+
configured: boolean(),
|
|
39395
|
+
defaults: TrainingProviderDefaultsSchema
|
|
39396
|
+
});
|
|
39397
|
+
var TrainingCredentialCheckSchema = object({
|
|
39398
|
+
ok: boolean(),
|
|
39399
|
+
/** Workspace / account name, when the provider says. */
|
|
39400
|
+
account: string().optional(),
|
|
39401
|
+
reason: _enum([
|
|
39402
|
+
"missing",
|
|
39403
|
+
"invalid",
|
|
39404
|
+
"forbidden",
|
|
39405
|
+
"network",
|
|
39406
|
+
"quota"
|
|
39407
|
+
]).optional(),
|
|
39408
|
+
detail: string().optional()
|
|
39409
|
+
});
|
|
39410
|
+
var ProviderJobStateSchema = _enum([
|
|
39411
|
+
"pending",
|
|
39412
|
+
"starting",
|
|
39413
|
+
"running",
|
|
39414
|
+
"succeeded",
|
|
39415
|
+
"failed",
|
|
39416
|
+
"cancelled",
|
|
39417
|
+
"lost"
|
|
39418
|
+
]);
|
|
39419
|
+
var ProviderJobStatusSchema = object({
|
|
39420
|
+
jobKey: string(),
|
|
39421
|
+
providerJobId: string().optional(),
|
|
39422
|
+
state: ProviderJobStateSchema,
|
|
39423
|
+
startedAt: number().optional(),
|
|
39424
|
+
endedAt: number().optional(),
|
|
39425
|
+
exitCode: number().int().optional(),
|
|
39426
|
+
failureReason: string().optional(),
|
|
39427
|
+
gpuType: string(),
|
|
39428
|
+
region: string().optional(),
|
|
39429
|
+
billedSeconds: number().nonnegative(),
|
|
39430
|
+
costUsd: number().nonnegative(),
|
|
39431
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
39432
|
+
costIsEstimate: boolean(),
|
|
39433
|
+
lastFetchedAt: number()
|
|
39434
|
+
});
|
|
39435
|
+
/**
|
|
39436
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
39437
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
39438
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
39439
|
+
* in `result.json`.
|
|
39440
|
+
*/
|
|
39441
|
+
var TrainerSourceRefSchema = object({
|
|
39442
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
39443
|
+
repo: string().min(1),
|
|
39444
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
39445
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
39446
|
+
});
|
|
39447
|
+
var JobRef = {
|
|
39448
|
+
addonId: string(),
|
|
39449
|
+
jobKey: string().uuid()
|
|
39450
|
+
};
|
|
39451
|
+
var TrainingLogLineSchema = object({
|
|
39452
|
+
ts: number(),
|
|
39453
|
+
text: string()
|
|
39454
|
+
});
|
|
39455
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
39456
|
+
kind: "mutation",
|
|
39457
|
+
auth: "admin",
|
|
39458
|
+
timeoutMs: 3e4
|
|
39459
|
+
}), method(object({
|
|
39460
|
+
addonId: string(),
|
|
39461
|
+
gpuType: string(),
|
|
39462
|
+
region: string(),
|
|
39463
|
+
datasetBytes: number().int().nonnegative(),
|
|
39464
|
+
gpuSecondsLow: number().nonnegative(),
|
|
39465
|
+
gpuSecondsHigh: number().nonnegative()
|
|
39466
|
+
}), object({
|
|
39467
|
+
usdLow: number().nonnegative(),
|
|
39468
|
+
usdHigh: number().nonnegative(),
|
|
39469
|
+
notes: array(string()).readonly()
|
|
39470
|
+
}), { auth: "admin" }), method(object({
|
|
39471
|
+
...JobRef,
|
|
39472
|
+
ticket: PeerBytesTicketSchema
|
|
39473
|
+
}), object({
|
|
39474
|
+
bytes: number().int().nonnegative(),
|
|
39475
|
+
sha256: string()
|
|
39476
|
+
}), {
|
|
39477
|
+
kind: "mutation",
|
|
39478
|
+
auth: "admin",
|
|
39479
|
+
timeoutMs: 120 * 6e4
|
|
39480
|
+
}), method(object({
|
|
39481
|
+
...JobRef,
|
|
39482
|
+
trainer: TrainerSourceRefSchema,
|
|
39483
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
39484
|
+
gpuType: string(),
|
|
39485
|
+
region: string(),
|
|
39486
|
+
maxRuntimeSec: number().int().positive()
|
|
39487
|
+
}), ProviderJobStatusSchema, {
|
|
39488
|
+
kind: "mutation",
|
|
39489
|
+
auth: "admin",
|
|
39490
|
+
timeoutMs: 30 * 6e4
|
|
39491
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
39492
|
+
auth: "admin",
|
|
39493
|
+
timeoutMs: 6e4
|
|
39494
|
+
}), method(object({
|
|
39495
|
+
...JobRef,
|
|
39496
|
+
cursor: string().optional(),
|
|
39497
|
+
max: number().int().min(1).max(500)
|
|
39498
|
+
}), object({
|
|
39499
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
39500
|
+
cursor: string()
|
|
39501
|
+
}), {
|
|
39502
|
+
auth: "admin",
|
|
39503
|
+
timeoutMs: 6e4
|
|
39504
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
39505
|
+
kind: "mutation",
|
|
39506
|
+
auth: "admin",
|
|
39507
|
+
timeoutMs: 6e4
|
|
39508
|
+
}), method(object(JobRef), object({
|
|
39509
|
+
found: boolean(),
|
|
39510
|
+
text: string().optional()
|
|
39511
|
+
}), {
|
|
39512
|
+
kind: "mutation",
|
|
39513
|
+
auth: "admin",
|
|
39514
|
+
timeoutMs: 5 * 6e4
|
|
39515
|
+
}), method(object({
|
|
39516
|
+
...JobRef,
|
|
39517
|
+
path: _enum(["bundle.tar"])
|
|
39518
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
39519
|
+
kind: "mutation",
|
|
39520
|
+
auth: "admin",
|
|
39521
|
+
timeoutMs: 5 * 6e4
|
|
39522
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
39523
|
+
kind: "mutation",
|
|
39524
|
+
auth: "admin",
|
|
39525
|
+
timeoutMs: 5 * 6e4
|
|
39526
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
39527
|
+
auth: "admin",
|
|
39528
|
+
timeoutMs: 2 * 6e4
|
|
39529
|
+
});
|
|
39530
|
+
/**
|
|
39531
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
39532
|
+
* provided by `addon-training`.
|
|
39533
|
+
*
|
|
39534
|
+
* It owns what every provider must agree on, written once:
|
|
39535
|
+
*
|
|
39536
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
39537
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
39538
|
+
* the export plan) and reaches this store through the five row methods
|
|
39539
|
+
* below, so the Retrain page and the export did not change.
|
|
39540
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
39541
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
39542
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
39543
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
39544
|
+
* rollback. Nothing is ever registered automatically.
|
|
39545
|
+
*
|
|
39546
|
+
* Every method is `admin`.
|
|
39547
|
+
*/
|
|
39548
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
39549
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
39550
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
39551
|
+
var TrainingBaseModelSchema = object({
|
|
39552
|
+
modelId: string(),
|
|
39553
|
+
label: string(),
|
|
39554
|
+
weights: string(),
|
|
39555
|
+
imgsz: number().int(),
|
|
39556
|
+
baselineOnnxUrl: string(),
|
|
39557
|
+
baselineFloors: record(string(), number()),
|
|
39558
|
+
/** The base the fleet runs most — the UI's default. */
|
|
39559
|
+
recommended: boolean()
|
|
39560
|
+
});
|
|
39561
|
+
var TrainingPresetSchema = _enum([
|
|
39562
|
+
"quick",
|
|
39563
|
+
"standard",
|
|
39564
|
+
"thorough"
|
|
39565
|
+
]);
|
|
39566
|
+
var TrainingJobRequestSchema = object({
|
|
39567
|
+
datasetVersionId: string().min(1),
|
|
39568
|
+
/** The `training-provider` addon that runs it. */
|
|
39569
|
+
addonId: string().min(1),
|
|
39570
|
+
gpuType: string().min(1),
|
|
39571
|
+
region: string(),
|
|
39572
|
+
baseModelId: string().min(1),
|
|
39573
|
+
preset: TrainingPresetSchema,
|
|
39574
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
39575
|
+
freeze: number().int().nonnegative().nullable(),
|
|
39576
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
39577
|
+
holdoutCameras: array(number().int()).nullable()
|
|
39578
|
+
});
|
|
39579
|
+
var TrainingSplitPlanSchema = object({
|
|
39580
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
39581
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
39582
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
39583
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
39584
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
39585
|
+
trainSubjects: number().int()
|
|
39586
|
+
});
|
|
39587
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
39588
|
+
"unknown-dataset",
|
|
39589
|
+
"unknown-provider",
|
|
39590
|
+
"provider-not-configured",
|
|
39591
|
+
"unknown-base-model",
|
|
39592
|
+
"unknown-gpu",
|
|
39593
|
+
"dataset-too-large",
|
|
39594
|
+
"no-training-subjects",
|
|
39595
|
+
"job-already-running"
|
|
39596
|
+
]);
|
|
39597
|
+
var TrainingJobPlanSchema = object({
|
|
39598
|
+
refusal: object({
|
|
39599
|
+
reason: TrainingRefusalReasonSchema,
|
|
39600
|
+
detail: string()
|
|
39601
|
+
}).nullable(),
|
|
39602
|
+
warnings: array(string()).readonly(),
|
|
39603
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
39604
|
+
estimate: object({
|
|
39605
|
+
datasetBytes: number().int(),
|
|
39606
|
+
uploadMinutesAt20Mbps: number(),
|
|
39607
|
+
gpuSecondsLow: number(),
|
|
39608
|
+
gpuSecondsHigh: number(),
|
|
39609
|
+
usdLow: number(),
|
|
39610
|
+
usdHigh: number(),
|
|
39611
|
+
notes: array(string()).readonly()
|
|
39612
|
+
}).nullable(),
|
|
39613
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
39614
|
+
defaults: object({
|
|
39615
|
+
maxCostUsd: number(),
|
|
39616
|
+
maxRuntimeSec: number().int()
|
|
39617
|
+
}).nullable(),
|
|
39618
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
39619
|
+
dataNotice: string()
|
|
39620
|
+
});
|
|
39621
|
+
/**
|
|
39622
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
39623
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
39624
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
39625
|
+
* result lives after the operator acted on it.
|
|
39626
|
+
*/
|
|
39627
|
+
var TrainingJobStateSchema = _enum([
|
|
39628
|
+
"uploading",
|
|
39629
|
+
"submitted",
|
|
39630
|
+
"starting",
|
|
39631
|
+
"running",
|
|
39632
|
+
"collecting",
|
|
39633
|
+
"ready",
|
|
39634
|
+
"registered",
|
|
39635
|
+
"canary",
|
|
39636
|
+
"failed",
|
|
39637
|
+
"cancelling",
|
|
39638
|
+
"cancelled",
|
|
39639
|
+
"lost",
|
|
39640
|
+
"expired",
|
|
39641
|
+
"discarded"
|
|
39642
|
+
]);
|
|
39643
|
+
var TrainingFailureReasonSchema = _enum([
|
|
39644
|
+
"cost-cap",
|
|
39645
|
+
"runtime-cap",
|
|
39646
|
+
"upload-failed",
|
|
39647
|
+
"submit-failed",
|
|
39648
|
+
"trainer-failed",
|
|
39649
|
+
"result-invalid",
|
|
39650
|
+
"checksum-mismatch",
|
|
39651
|
+
"fetch-failed",
|
|
39652
|
+
"provider-error",
|
|
39653
|
+
"hub-restart-during-upload"
|
|
39654
|
+
]);
|
|
39655
|
+
var TrainingProgressPointSchema = object({
|
|
39656
|
+
epoch: number().int(),
|
|
39657
|
+
map50: number().nullable(),
|
|
39658
|
+
map50_95: number().nullable()
|
|
39659
|
+
});
|
|
39660
|
+
var TrainingCanarySchema = object({
|
|
39661
|
+
deviceIds: array(number().int()).readonly(),
|
|
39662
|
+
since: number(),
|
|
39663
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
39664
|
+
previous: array(object({
|
|
39665
|
+
deviceId: number().int(),
|
|
39666
|
+
nodeId: string(),
|
|
39667
|
+
deviceKey: string(),
|
|
39668
|
+
patch: object({
|
|
39669
|
+
modelId: string().optional(),
|
|
39670
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
39671
|
+
}).nullable()
|
|
39672
|
+
})).readonly()
|
|
39673
|
+
});
|
|
39674
|
+
var TrainingJobSchema = object({
|
|
39675
|
+
id: string(),
|
|
39676
|
+
idempotencyKey: string(),
|
|
39677
|
+
name: string(),
|
|
39678
|
+
createdAt: number(),
|
|
39679
|
+
updatedAt: number(),
|
|
39680
|
+
state: TrainingJobStateSchema,
|
|
39681
|
+
stage: TrainingStageSchema.nullable(),
|
|
39682
|
+
failure: object({
|
|
39683
|
+
reason: TrainingFailureReasonSchema,
|
|
39684
|
+
stage: string().nullable(),
|
|
39685
|
+
detail: string()
|
|
39686
|
+
}).nullable(),
|
|
39687
|
+
request: TrainingJobRequestSchema,
|
|
39688
|
+
maxCostUsd: number().nonnegative(),
|
|
39689
|
+
maxRuntimeSec: number().int().positive(),
|
|
39690
|
+
trainer: TrainerSourceRefSchema,
|
|
39691
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
39692
|
+
dataset: object({
|
|
39693
|
+
bytes: number().int(),
|
|
39694
|
+
sha256: string(),
|
|
39695
|
+
uploadedAt: number()
|
|
39696
|
+
}).nullable(),
|
|
39697
|
+
split: TrainingSplitPlanSchema,
|
|
39698
|
+
provider: object({
|
|
39699
|
+
state: ProviderJobStateSchema.nullable(),
|
|
39700
|
+
providerJobId: string().nullable(),
|
|
39701
|
+
startedAt: number().nullable(),
|
|
39702
|
+
endedAt: number().nullable(),
|
|
39703
|
+
billedSeconds: number(),
|
|
39704
|
+
costUsd: number(),
|
|
39705
|
+
costIsEstimate: boolean(),
|
|
39706
|
+
lastPolledAt: number().nullable()
|
|
39707
|
+
}),
|
|
39708
|
+
progress: object({
|
|
39709
|
+
epoch: number().int().nullable(),
|
|
39710
|
+
epochs: number().int().nullable(),
|
|
39711
|
+
etaSec: number().nullable(),
|
|
39712
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
39713
|
+
}),
|
|
39714
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
39715
|
+
logTail: array(string()).readonly(),
|
|
39716
|
+
logCursor: string().nullable(),
|
|
39717
|
+
artifacts: object({
|
|
39718
|
+
bundleBytes: number().int(),
|
|
39719
|
+
bundleSha256: string(),
|
|
39720
|
+
fetchedAt: number(),
|
|
39721
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
39722
|
+
expiresAt: number()
|
|
39723
|
+
}).nullable(),
|
|
39724
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
39725
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
39726
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
39727
|
+
cloudCleanupDueAt: number().nullable(),
|
|
39728
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
39729
|
+
registeredModelIds: array(string()).readonly(),
|
|
39730
|
+
canary: TrainingCanarySchema.nullable()
|
|
39731
|
+
});
|
|
39732
|
+
var IdInput = object({ id: string().min(1) });
|
|
39733
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
39734
|
+
kind: "mutation",
|
|
39735
|
+
auth: "admin"
|
|
39736
|
+
}), 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() }), {
|
|
39737
|
+
kind: "mutation",
|
|
39738
|
+
auth: "admin"
|
|
39739
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
39740
|
+
auth: "admin",
|
|
39741
|
+
timeoutMs: 6e4
|
|
39742
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
39743
|
+
name: string().min(1).max(120),
|
|
39744
|
+
maxCostUsd: number().positive(),
|
|
39745
|
+
maxRuntimeSec: number().int().positive(),
|
|
39746
|
+
idempotencyKey: string().min(8).max(80)
|
|
39747
|
+
}), discriminatedUnion("kind", [object({
|
|
39748
|
+
kind: literal("started"),
|
|
39749
|
+
job: TrainingJobSchema
|
|
39750
|
+
}), object({
|
|
39751
|
+
kind: literal("refused"),
|
|
39752
|
+
reason: TrainingRefusalReasonSchema,
|
|
39753
|
+
detail: string()
|
|
39754
|
+
})]), {
|
|
39755
|
+
kind: "mutation",
|
|
39756
|
+
auth: "admin",
|
|
39757
|
+
timeoutMs: 12e4
|
|
39758
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
39759
|
+
kind: "mutation",
|
|
39760
|
+
auth: "admin",
|
|
39761
|
+
timeoutMs: 12e4
|
|
39762
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
39763
|
+
kind: "mutation",
|
|
39764
|
+
auth: "admin",
|
|
39765
|
+
timeoutMs: 30 * 6e4
|
|
39766
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
39767
|
+
kind: "mutation",
|
|
39768
|
+
auth: "admin",
|
|
39769
|
+
timeoutMs: 12e4
|
|
39770
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39771
|
+
kind: "mutation",
|
|
39772
|
+
auth: "admin",
|
|
39773
|
+
timeoutMs: 12e4
|
|
39774
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39775
|
+
kind: "mutation",
|
|
39776
|
+
auth: "admin"
|
|
39777
|
+
});
|
|
38377
39778
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
38378
39779
|
Object.freeze({
|
|
38379
39780
|
person: .5,
|
|
@@ -38997,6 +40398,12 @@ Object.freeze({
|
|
|
38997
40398
|
addonId: null,
|
|
38998
40399
|
access: "create"
|
|
38999
40400
|
},
|
|
40401
|
+
"backup.checkBackupKey": {
|
|
40402
|
+
capName: "backup",
|
|
40403
|
+
capScope: "system",
|
|
40404
|
+
addonId: null,
|
|
40405
|
+
access: "create"
|
|
40406
|
+
},
|
|
39000
40407
|
"backup.delete": {
|
|
39001
40408
|
capName: "backup",
|
|
39002
40409
|
capScope: "system",
|
|
@@ -39009,6 +40416,18 @@ Object.freeze({
|
|
|
39009
40416
|
addonId: null,
|
|
39010
40417
|
access: "delete"
|
|
39011
40418
|
},
|
|
40419
|
+
"backup.disableEncryption": {
|
|
40420
|
+
capName: "backup",
|
|
40421
|
+
capScope: "system",
|
|
40422
|
+
addonId: null,
|
|
40423
|
+
access: "create"
|
|
40424
|
+
},
|
|
40425
|
+
"backup.getEncryption": {
|
|
40426
|
+
capName: "backup",
|
|
40427
|
+
capScope: "system",
|
|
40428
|
+
addonId: null,
|
|
40429
|
+
access: "view"
|
|
40430
|
+
},
|
|
39012
40431
|
"backup.getEntries": {
|
|
39013
40432
|
capName: "backup",
|
|
39014
40433
|
capScope: "system",
|
|
@@ -39063,6 +40482,12 @@ Object.freeze({
|
|
|
39063
40482
|
addonId: null,
|
|
39064
40483
|
access: "create"
|
|
39065
40484
|
},
|
|
40485
|
+
"backup.setupEncryption": {
|
|
40486
|
+
capName: "backup",
|
|
40487
|
+
capScope: "system",
|
|
40488
|
+
addonId: null,
|
|
40489
|
+
access: "create"
|
|
40490
|
+
},
|
|
39066
40491
|
"backup.trigger": {
|
|
39067
40492
|
capName: "backup",
|
|
39068
40493
|
capScope: "system",
|
|
@@ -39615,6 +41040,12 @@ Object.freeze({
|
|
|
39615
41040
|
addonId: null,
|
|
39616
41041
|
access: "create"
|
|
39617
41042
|
},
|
|
41043
|
+
"customModelRegistry.importModelBundle": {
|
|
41044
|
+
capName: "custom-model-registry",
|
|
41045
|
+
capScope: "system",
|
|
41046
|
+
addonId: null,
|
|
41047
|
+
access: "create"
|
|
41048
|
+
},
|
|
39618
41049
|
"customModelRegistry.listModels": {
|
|
39619
41050
|
capName: "custom-model-registry",
|
|
39620
41051
|
capScope: "system",
|
|
@@ -41055,6 +42486,12 @@ Object.freeze({
|
|
|
41055
42486
|
addonId: null,
|
|
41056
42487
|
access: "view"
|
|
41057
42488
|
},
|
|
42489
|
+
"keychainAdmin.acknowledgeReset": {
|
|
42490
|
+
capName: "keychain-admin",
|
|
42491
|
+
capScope: "system",
|
|
42492
|
+
addonId: null,
|
|
42493
|
+
access: "create"
|
|
42494
|
+
},
|
|
41058
42495
|
"keychainAdmin.deleteOrphans": {
|
|
41059
42496
|
capName: "keychain-admin",
|
|
41060
42497
|
capScope: "system",
|
|
@@ -41091,6 +42528,12 @@ Object.freeze({
|
|
|
41091
42528
|
addonId: null,
|
|
41092
42529
|
access: "delete"
|
|
41093
42530
|
},
|
|
42531
|
+
"keychainAdmin.resetReport": {
|
|
42532
|
+
capName: "keychain-admin",
|
|
42533
|
+
capScope: "system",
|
|
42534
|
+
addonId: null,
|
|
42535
|
+
access: "delete"
|
|
42536
|
+
},
|
|
41094
42537
|
"keychainAdmin.reveal": {
|
|
41095
42538
|
capName: "keychain-admin",
|
|
41096
42539
|
capScope: "system",
|
|
@@ -41103,6 +42546,12 @@ Object.freeze({
|
|
|
41103
42546
|
addonId: null,
|
|
41104
42547
|
access: "create"
|
|
41105
42548
|
},
|
|
42549
|
+
"keychainAdmin.setSystemSecret": {
|
|
42550
|
+
capName: "keychain-admin",
|
|
42551
|
+
capScope: "system",
|
|
42552
|
+
addonId: null,
|
|
42553
|
+
access: "create"
|
|
42554
|
+
},
|
|
41106
42555
|
"keychainAdmin.status": {
|
|
41107
42556
|
capName: "keychain-admin",
|
|
41108
42557
|
capScope: "system",
|
|
@@ -42549,6 +43998,12 @@ Object.freeze({
|
|
|
42549
43998
|
addonId: null,
|
|
42550
43999
|
access: "create"
|
|
42551
44000
|
},
|
|
44001
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
44002
|
+
capName: "pipeline-analytics",
|
|
44003
|
+
capScope: "device",
|
|
44004
|
+
addonId: null,
|
|
44005
|
+
access: "create"
|
|
44006
|
+
},
|
|
42552
44007
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
42553
44008
|
capName: "pipeline-analytics",
|
|
42554
44009
|
capScope: "device",
|
|
@@ -42561,6 +44016,12 @@ Object.freeze({
|
|
|
42561
44016
|
addonId: null,
|
|
42562
44017
|
access: "delete"
|
|
42563
44018
|
},
|
|
44019
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
44020
|
+
capName: "pipeline-analytics",
|
|
44021
|
+
capScope: "device",
|
|
44022
|
+
addonId: null,
|
|
44023
|
+
access: "delete"
|
|
44024
|
+
},
|
|
42564
44025
|
"pipelineAnalytics.deleteTracks": {
|
|
42565
44026
|
capName: "pipeline-analytics",
|
|
42566
44027
|
capScope: "device",
|
|
@@ -42783,6 +44244,12 @@ Object.freeze({
|
|
|
42783
44244
|
addonId: null,
|
|
42784
44245
|
access: "view"
|
|
42785
44246
|
},
|
|
44247
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
44248
|
+
capName: "pipeline-analytics",
|
|
44249
|
+
capScope: "device",
|
|
44250
|
+
addonId: null,
|
|
44251
|
+
access: "view"
|
|
44252
|
+
},
|
|
42786
44253
|
"pipelineAnalytics.listRetrainFrames": {
|
|
42787
44254
|
capName: "pipeline-analytics",
|
|
42788
44255
|
capScope: "device",
|
|
@@ -42813,6 +44280,12 @@ Object.freeze({
|
|
|
42813
44280
|
addonId: null,
|
|
42814
44281
|
access: "view"
|
|
42815
44282
|
},
|
|
44283
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
44284
|
+
capName: "pipeline-analytics",
|
|
44285
|
+
capScope: "device",
|
|
44286
|
+
addonId: null,
|
|
44287
|
+
access: "create"
|
|
44288
|
+
},
|
|
42816
44289
|
"pipelineAnalytics.ownersWithMedia": {
|
|
42817
44290
|
capName: "pipeline-analytics",
|
|
42818
44291
|
capScope: "device",
|
|
@@ -42825,6 +44298,12 @@ Object.freeze({
|
|
|
42825
44298
|
addonId: null,
|
|
42826
44299
|
access: "create"
|
|
42827
44300
|
},
|
|
44301
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
44302
|
+
capName: "pipeline-analytics",
|
|
44303
|
+
capScope: "device",
|
|
44304
|
+
addonId: null,
|
|
44305
|
+
access: "view"
|
|
44306
|
+
},
|
|
42828
44307
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
42829
44308
|
capName: "pipeline-analytics",
|
|
42830
44309
|
capScope: "device",
|
|
@@ -42963,6 +44442,12 @@ Object.freeze({
|
|
|
42963
44442
|
addonId: null,
|
|
42964
44443
|
access: "create"
|
|
42965
44444
|
},
|
|
44445
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
44446
|
+
capName: "pipeline-analytics",
|
|
44447
|
+
capScope: "device",
|
|
44448
|
+
addonId: null,
|
|
44449
|
+
access: "view"
|
|
44450
|
+
},
|
|
42966
44451
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
42967
44452
|
capName: "pipeline-analytics",
|
|
42968
44453
|
capScope: "device",
|
|
@@ -45339,6 +46824,174 @@ Object.freeze({
|
|
|
45339
46824
|
addonId: null,
|
|
45340
46825
|
access: "view"
|
|
45341
46826
|
},
|
|
46827
|
+
"training.canaryResult": {
|
|
46828
|
+
capName: "training",
|
|
46829
|
+
capScope: "system",
|
|
46830
|
+
addonId: null,
|
|
46831
|
+
access: "create"
|
|
46832
|
+
},
|
|
46833
|
+
"training.cancelJob": {
|
|
46834
|
+
capName: "training",
|
|
46835
|
+
capScope: "system",
|
|
46836
|
+
addonId: null,
|
|
46837
|
+
access: "create"
|
|
46838
|
+
},
|
|
46839
|
+
"training.discardResult": {
|
|
46840
|
+
capName: "training",
|
|
46841
|
+
capScope: "system",
|
|
46842
|
+
addonId: null,
|
|
46843
|
+
access: "create"
|
|
46844
|
+
},
|
|
46845
|
+
"training.findDatasetVersionIdByName": {
|
|
46846
|
+
capName: "training",
|
|
46847
|
+
capScope: "system",
|
|
46848
|
+
addonId: null,
|
|
46849
|
+
access: "view"
|
|
46850
|
+
},
|
|
46851
|
+
"training.getDatasetVersion": {
|
|
46852
|
+
capName: "training",
|
|
46853
|
+
capScope: "system",
|
|
46854
|
+
addonId: null,
|
|
46855
|
+
access: "view"
|
|
46856
|
+
},
|
|
46857
|
+
"training.getJob": {
|
|
46858
|
+
capName: "training",
|
|
46859
|
+
capScope: "system",
|
|
46860
|
+
addonId: null,
|
|
46861
|
+
access: "view"
|
|
46862
|
+
},
|
|
46863
|
+
"training.getJobResult": {
|
|
46864
|
+
capName: "training",
|
|
46865
|
+
capScope: "system",
|
|
46866
|
+
addonId: null,
|
|
46867
|
+
access: "view"
|
|
46868
|
+
},
|
|
46869
|
+
"training.listBaseModels": {
|
|
46870
|
+
capName: "training",
|
|
46871
|
+
capScope: "system",
|
|
46872
|
+
addonId: null,
|
|
46873
|
+
access: "view"
|
|
46874
|
+
},
|
|
46875
|
+
"training.listDatasetVersions": {
|
|
46876
|
+
capName: "training",
|
|
46877
|
+
capScope: "system",
|
|
46878
|
+
addonId: null,
|
|
46879
|
+
access: "view"
|
|
46880
|
+
},
|
|
46881
|
+
"training.listJobs": {
|
|
46882
|
+
capName: "training",
|
|
46883
|
+
capScope: "system",
|
|
46884
|
+
addonId: null,
|
|
46885
|
+
access: "view"
|
|
46886
|
+
},
|
|
46887
|
+
"training.planJob": {
|
|
46888
|
+
capName: "training",
|
|
46889
|
+
capScope: "system",
|
|
46890
|
+
addonId: null,
|
|
46891
|
+
access: "view"
|
|
46892
|
+
},
|
|
46893
|
+
"training.putDatasetVersion": {
|
|
46894
|
+
capName: "training",
|
|
46895
|
+
capScope: "system",
|
|
46896
|
+
addonId: null,
|
|
46897
|
+
access: "create"
|
|
46898
|
+
},
|
|
46899
|
+
"training.registerResult": {
|
|
46900
|
+
capName: "training",
|
|
46901
|
+
capScope: "system",
|
|
46902
|
+
addonId: null,
|
|
46903
|
+
access: "create"
|
|
46904
|
+
},
|
|
46905
|
+
"training.removeDatasetVersion": {
|
|
46906
|
+
capName: "training",
|
|
46907
|
+
capScope: "system",
|
|
46908
|
+
addonId: null,
|
|
46909
|
+
access: "delete"
|
|
46910
|
+
},
|
|
46911
|
+
"training.rollbackCanary": {
|
|
46912
|
+
capName: "training",
|
|
46913
|
+
capScope: "system",
|
|
46914
|
+
addonId: null,
|
|
46915
|
+
access: "create"
|
|
46916
|
+
},
|
|
46917
|
+
"training.startJob": {
|
|
46918
|
+
capName: "training",
|
|
46919
|
+
capScope: "system",
|
|
46920
|
+
addonId: null,
|
|
46921
|
+
access: "create"
|
|
46922
|
+
},
|
|
46923
|
+
"trainingProvider.cancelJob": {
|
|
46924
|
+
capName: "training-provider",
|
|
46925
|
+
capScope: "system",
|
|
46926
|
+
addonId: null,
|
|
46927
|
+
access: "create"
|
|
46928
|
+
},
|
|
46929
|
+
"trainingProvider.cleanupJob": {
|
|
46930
|
+
capName: "training-provider",
|
|
46931
|
+
capScope: "system",
|
|
46932
|
+
addonId: null,
|
|
46933
|
+
access: "create"
|
|
46934
|
+
},
|
|
46935
|
+
"trainingProvider.describe": {
|
|
46936
|
+
capName: "training-provider",
|
|
46937
|
+
capScope: "system",
|
|
46938
|
+
addonId: null,
|
|
46939
|
+
access: "view"
|
|
46940
|
+
},
|
|
46941
|
+
"trainingProvider.estimateJob": {
|
|
46942
|
+
capName: "training-provider",
|
|
46943
|
+
capScope: "system",
|
|
46944
|
+
addonId: null,
|
|
46945
|
+
access: "view"
|
|
46946
|
+
},
|
|
46947
|
+
"trainingProvider.getJob": {
|
|
46948
|
+
capName: "training-provider",
|
|
46949
|
+
capScope: "system",
|
|
46950
|
+
addonId: null,
|
|
46951
|
+
access: "view"
|
|
46952
|
+
},
|
|
46953
|
+
"trainingProvider.listJobEvents": {
|
|
46954
|
+
capName: "training-provider",
|
|
46955
|
+
capScope: "system",
|
|
46956
|
+
addonId: null,
|
|
46957
|
+
access: "view"
|
|
46958
|
+
},
|
|
46959
|
+
"trainingProvider.listJobs": {
|
|
46960
|
+
capName: "training-provider",
|
|
46961
|
+
capScope: "system",
|
|
46962
|
+
addonId: null,
|
|
46963
|
+
access: "view"
|
|
46964
|
+
},
|
|
46965
|
+
"trainingProvider.offerArtifact": {
|
|
46966
|
+
capName: "training-provider",
|
|
46967
|
+
capScope: "system",
|
|
46968
|
+
addonId: null,
|
|
46969
|
+
access: "create"
|
|
46970
|
+
},
|
|
46971
|
+
"trainingProvider.readResult": {
|
|
46972
|
+
capName: "training-provider",
|
|
46973
|
+
capScope: "system",
|
|
46974
|
+
addonId: null,
|
|
46975
|
+
access: "create"
|
|
46976
|
+
},
|
|
46977
|
+
"trainingProvider.submitJob": {
|
|
46978
|
+
capName: "training-provider",
|
|
46979
|
+
capScope: "system",
|
|
46980
|
+
addonId: null,
|
|
46981
|
+
access: "create"
|
|
46982
|
+
},
|
|
46983
|
+
"trainingProvider.uploadDataset": {
|
|
46984
|
+
capName: "training-provider",
|
|
46985
|
+
capScope: "system",
|
|
46986
|
+
addonId: null,
|
|
46987
|
+
access: "create"
|
|
46988
|
+
},
|
|
46989
|
+
"trainingProvider.validateCredentials": {
|
|
46990
|
+
capName: "training-provider",
|
|
46991
|
+
capScope: "system",
|
|
46992
|
+
addonId: null,
|
|
46993
|
+
access: "create"
|
|
46994
|
+
},
|
|
45342
46995
|
"turnProvider.getTurnServers": {
|
|
45343
46996
|
capName: "turn-provider",
|
|
45344
46997
|
capScope: "system",
|
|
@@ -45363,12 +47016,6 @@ Object.freeze({
|
|
|
45363
47016
|
addonId: null,
|
|
45364
47017
|
access: "create"
|
|
45365
47018
|
},
|
|
45366
|
-
"userManagement.createApiKey": {
|
|
45367
|
-
capName: "user-management",
|
|
45368
|
-
capScope: "system",
|
|
45369
|
-
addonId: null,
|
|
45370
|
-
access: "create"
|
|
45371
|
-
},
|
|
45372
47019
|
"userManagement.createScopedToken": {
|
|
45373
47020
|
capName: "user-management",
|
|
45374
47021
|
capScope: "system",
|
|
@@ -45405,12 +47052,6 @@ Object.freeze({
|
|
|
45405
47052
|
addonId: null,
|
|
45406
47053
|
access: "view"
|
|
45407
47054
|
},
|
|
45408
|
-
"userManagement.linkExternalIdentity": {
|
|
45409
|
-
capName: "user-management",
|
|
45410
|
-
capScope: "system",
|
|
45411
|
-
addonId: null,
|
|
45412
|
-
access: "create"
|
|
45413
|
-
},
|
|
45414
47055
|
"userManagement.listApiKeys": {
|
|
45415
47056
|
capName: "user-management",
|
|
45416
47057
|
capScope: "system",
|
|
@@ -45513,12 +47154,6 @@ Object.freeze({
|
|
|
45513
47154
|
addonId: null,
|
|
45514
47155
|
access: "create"
|
|
45515
47156
|
},
|
|
45516
|
-
"userManagement.validateApiKey": {
|
|
45517
|
-
capName: "user-management",
|
|
45518
|
-
capScope: "system",
|
|
45519
|
-
addonId: null,
|
|
45520
|
-
access: "view"
|
|
45521
|
-
},
|
|
45522
47157
|
"userManagement.validateCredentials": {
|
|
45523
47158
|
capName: "user-management",
|
|
45524
47159
|
capScope: "system",
|
|
@@ -49632,6 +51267,11 @@ Object.freeze({
|
|
|
49632
51267
|
form: "single",
|
|
49633
51268
|
optional: false
|
|
49634
51269
|
}],
|
|
51270
|
+
"training.canaryResult": [{
|
|
51271
|
+
name: "deviceIds",
|
|
51272
|
+
form: "array",
|
|
51273
|
+
optional: false
|
|
51274
|
+
}],
|
|
49635
51275
|
"update.getStatus": [{
|
|
49636
51276
|
name: "deviceId",
|
|
49637
51277
|
form: "single",
|