@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
|
@@ -5404,7 +5404,7 @@ var ZodIssueCode = {
|
|
|
5404
5404
|
var ZodFirstPartyTypeKind;
|
|
5405
5405
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5406
5406
|
//#endregion
|
|
5407
|
-
//#region ../types/dist/sleep-
|
|
5407
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5408
5408
|
/**
|
|
5409
5409
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5410
5410
|
* window to float samples (D455).
|
|
@@ -5521,7 +5521,7 @@ function isKeychainStoredField(field) {
|
|
|
5521
5521
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5522
5522
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5523
5523
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5524
|
-
function isRecord$
|
|
5524
|
+
function isRecord$2(value) {
|
|
5525
5525
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5526
5526
|
}
|
|
5527
5527
|
function makeSecretMarker(ref) {
|
|
@@ -5532,12 +5532,12 @@ function makeSecretMarker(ref) {
|
|
|
5532
5532
|
}
|
|
5533
5533
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5534
5534
|
function isSecretMarker(value) {
|
|
5535
|
-
if (!isRecord$
|
|
5535
|
+
if (!isRecord$2(value)) return false;
|
|
5536
5536
|
const ref = value["$secret"];
|
|
5537
5537
|
return typeof ref === "string" && ref.length > 0;
|
|
5538
5538
|
}
|
|
5539
5539
|
function isSecretClear(value) {
|
|
5540
|
-
return isRecord$
|
|
5540
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5541
5541
|
}
|
|
5542
5542
|
/**
|
|
5543
5543
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6053,6 +6053,13 @@ function globalSecretScope() {
|
|
|
6053
6053
|
function encodeSegment(value) {
|
|
6054
6054
|
return encodeURIComponent(value);
|
|
6055
6055
|
}
|
|
6056
|
+
function decodeSegment(value) {
|
|
6057
|
+
try {
|
|
6058
|
+
return decodeURIComponent(value);
|
|
6059
|
+
} catch {
|
|
6060
|
+
return null;
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6056
6063
|
/**
|
|
6057
6064
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6058
6065
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6061,6 +6068,75 @@ function encodeSegment(value) {
|
|
|
6061
6068
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6062
6069
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6063
6070
|
}
|
|
6071
|
+
function parseScope(segments) {
|
|
6072
|
+
switch (segments[0]) {
|
|
6073
|
+
case "global": return {
|
|
6074
|
+
scope: GLOBAL_SCOPE,
|
|
6075
|
+
used: 1
|
|
6076
|
+
};
|
|
6077
|
+
case "node": {
|
|
6078
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6079
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6080
|
+
scope: {
|
|
6081
|
+
kind: "node",
|
|
6082
|
+
nodeId
|
|
6083
|
+
},
|
|
6084
|
+
used: 2
|
|
6085
|
+
};
|
|
6086
|
+
}
|
|
6087
|
+
case "device": {
|
|
6088
|
+
const raw = segments[1];
|
|
6089
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6090
|
+
return {
|
|
6091
|
+
scope: {
|
|
6092
|
+
kind: "device",
|
|
6093
|
+
deviceId: Number(raw)
|
|
6094
|
+
},
|
|
6095
|
+
used: 2
|
|
6096
|
+
};
|
|
6097
|
+
}
|
|
6098
|
+
case "integration": {
|
|
6099
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6100
|
+
return id === null || id.length === 0 ? null : {
|
|
6101
|
+
scope: {
|
|
6102
|
+
kind: "integration",
|
|
6103
|
+
integrationId: id
|
|
6104
|
+
},
|
|
6105
|
+
used: 2
|
|
6106
|
+
};
|
|
6107
|
+
}
|
|
6108
|
+
case "row": {
|
|
6109
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6110
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6111
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6112
|
+
return {
|
|
6113
|
+
scope: {
|
|
6114
|
+
kind: "row",
|
|
6115
|
+
collection,
|
|
6116
|
+
rowId
|
|
6117
|
+
},
|
|
6118
|
+
used: 3
|
|
6119
|
+
};
|
|
6120
|
+
}
|
|
6121
|
+
default: return null;
|
|
6122
|
+
}
|
|
6123
|
+
}
|
|
6124
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6125
|
+
function parseSecretRef(ref) {
|
|
6126
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6127
|
+
const segments = ref.slice(9).split("/");
|
|
6128
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6129
|
+
if (owner === null || owner.length === 0) return null;
|
|
6130
|
+
const parsed = parseScope(segments.slice(1));
|
|
6131
|
+
if (parsed === null) return null;
|
|
6132
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6133
|
+
if (fieldPath.length === 0) return null;
|
|
6134
|
+
return {
|
|
6135
|
+
owner,
|
|
6136
|
+
scope: parsed.scope,
|
|
6137
|
+
fieldPath
|
|
6138
|
+
};
|
|
6139
|
+
}
|
|
6064
6140
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6065
6141
|
var KeychainWriteRefusedError = class extends Error {
|
|
6066
6142
|
fieldPath;
|
|
@@ -6071,7 +6147,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6071
6147
|
}
|
|
6072
6148
|
};
|
|
6073
6149
|
var KEEP = { kind: "keep" };
|
|
6074
|
-
function isRecord(value) {
|
|
6150
|
+
function isRecord$1(value) {
|
|
6075
6151
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6076
6152
|
}
|
|
6077
6153
|
function defaultMintId() {
|
|
@@ -6084,7 +6160,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6084
6160
|
return out;
|
|
6085
6161
|
}
|
|
6086
6162
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6087
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6163
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6088
6164
|
return out;
|
|
6089
6165
|
}
|
|
6090
6166
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6139,7 +6215,7 @@ function rowId(row, idKey) {
|
|
|
6139
6215
|
return null;
|
|
6140
6216
|
}
|
|
6141
6217
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6142
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6218
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6143
6219
|
if (!Array.isArray(incoming)) {
|
|
6144
6220
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6145
6221
|
return {
|
|
@@ -6155,7 +6231,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6155
6231
|
const kept = /* @__PURE__ */ new Set();
|
|
6156
6232
|
const rows = [];
|
|
6157
6233
|
for (const row of incoming) {
|
|
6158
|
-
if (!isRecord(row)) {
|
|
6234
|
+
if (!isRecord$1(row)) {
|
|
6159
6235
|
rows.push(row);
|
|
6160
6236
|
continue;
|
|
6161
6237
|
}
|
|
@@ -6180,7 +6256,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6180
6256
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6181
6257
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6182
6258
|
case "object": {
|
|
6183
|
-
if (!isRecord(incoming)) {
|
|
6259
|
+
if (!isRecord$1(incoming)) {
|
|
6184
6260
|
if (incoming === void 0) return KEEP;
|
|
6185
6261
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6186
6262
|
return {
|
|
@@ -6188,7 +6264,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6188
6264
|
value: incoming
|
|
6189
6265
|
};
|
|
6190
6266
|
}
|
|
6191
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6267
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6192
6268
|
return {
|
|
6193
6269
|
kind: "value",
|
|
6194
6270
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6247,12 +6323,19 @@ async function transformSecretWrite(input) {
|
|
|
6247
6323
|
}
|
|
6248
6324
|
};
|
|
6249
6325
|
}
|
|
6326
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6327
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6328
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6329
|
+
}
|
|
6250
6330
|
/**
|
|
6251
6331
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6252
6332
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6253
6333
|
*/
|
|
6254
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6255
|
-
const
|
|
6334
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6335
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6336
|
+
const owner = options.ownedBy;
|
|
6337
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6338
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6256
6339
|
if (refs.length === 0) return {
|
|
6257
6340
|
value,
|
|
6258
6341
|
unresolved: []
|
|
@@ -6276,10 +6359,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6276
6359
|
}
|
|
6277
6360
|
const substitute = (v) => {
|
|
6278
6361
|
if (isSecretMarker(v)) {
|
|
6362
|
+
if (!inScope(v.$secret)) return {
|
|
6363
|
+
keep: true,
|
|
6364
|
+
value: v
|
|
6365
|
+
};
|
|
6279
6366
|
const answer = answers[v.$secret];
|
|
6280
|
-
|
|
6367
|
+
if (answer?.kind === "value") return {
|
|
6281
6368
|
keep: true,
|
|
6282
6369
|
value: answer.value
|
|
6370
|
+
};
|
|
6371
|
+
return keepMarker ? {
|
|
6372
|
+
keep: true,
|
|
6373
|
+
value: v
|
|
6283
6374
|
} : {
|
|
6284
6375
|
keep: false,
|
|
6285
6376
|
value: void 0
|
|
@@ -6296,7 +6387,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6296
6387
|
value: items
|
|
6297
6388
|
};
|
|
6298
6389
|
}
|
|
6299
|
-
if (isRecord(v)) {
|
|
6390
|
+
if (isRecord$1(v)) {
|
|
6300
6391
|
const out = {};
|
|
6301
6392
|
for (const [k, child] of Object.entries(v)) {
|
|
6302
6393
|
const s = substitute(child);
|
|
@@ -6317,14 +6408,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6317
6408
|
unresolved
|
|
6318
6409
|
};
|
|
6319
6410
|
}
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6411
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6412
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6413
|
+
ref;
|
|
6414
|
+
reason;
|
|
6415
|
+
constructor(ref, reason) {
|
|
6416
|
+
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.`);
|
|
6417
|
+
this.ref = ref;
|
|
6418
|
+
this.reason = reason;
|
|
6419
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6420
|
+
}
|
|
6421
|
+
};
|
|
6422
|
+
function isRecord(value) {
|
|
6423
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6424
|
+
}
|
|
6425
|
+
function resolvedValue(pass, marker) {
|
|
6426
|
+
const answer = pass.answers[marker.$secret];
|
|
6427
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6428
|
+
}
|
|
6429
|
+
async function atMarker(pass, incoming, stored) {
|
|
6430
|
+
if (incoming === null) return stored;
|
|
6431
|
+
if (typeof incoming !== "string") return incoming;
|
|
6432
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6433
|
+
const intent = classifySecretWrite(incoming);
|
|
6434
|
+
if (intent.kind !== "set") return stored;
|
|
6435
|
+
const ref = stored.$secret;
|
|
6436
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6437
|
+
const answer = pass.answers[ref];
|
|
6438
|
+
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);
|
|
6439
|
+
try {
|
|
6440
|
+
await pass.secrets.put(ref, intent.value);
|
|
6441
|
+
} catch (err) {
|
|
6442
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6443
|
+
}
|
|
6444
|
+
pass.changedRefs.push(ref);
|
|
6445
|
+
return stored;
|
|
6446
|
+
}
|
|
6447
|
+
function inArray(pass, incoming, stored) {
|
|
6448
|
+
return incoming.map((item, index) => {
|
|
6449
|
+
const twin = stored[index];
|
|
6450
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6451
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6452
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6453
|
+
return item;
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6457
|
+
const out = { ...incoming };
|
|
6458
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6459
|
+
const twin = stored[key];
|
|
6460
|
+
if (isSecretMarker(twin)) {
|
|
6461
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6462
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6463
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6464
|
+
}
|
|
6465
|
+
return out;
|
|
6466
|
+
}
|
|
6467
|
+
async function walk(pass, incoming, stored) {
|
|
6468
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6469
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6470
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6471
|
+
const out = { ...incoming };
|
|
6472
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6473
|
+
return out;
|
|
6474
|
+
}
|
|
6475
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6476
|
+
async function restoreUnchangedSecrets(input) {
|
|
6477
|
+
const refs = [];
|
|
6478
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6479
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6480
|
+
if (owned.length === 0) return {
|
|
6481
|
+
patch: input.patch,
|
|
6482
|
+
changedRefs: []
|
|
6483
|
+
};
|
|
6484
|
+
const pass = {
|
|
6485
|
+
secrets: input.secrets,
|
|
6486
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6487
|
+
operatorWrite: input.operatorWrite,
|
|
6488
|
+
changedRefs: []
|
|
6489
|
+
};
|
|
6490
|
+
const out = {};
|
|
6491
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6492
|
+
return {
|
|
6493
|
+
patch: out,
|
|
6494
|
+
changedRefs: pass.changedRefs
|
|
6495
|
+
};
|
|
6496
|
+
}
|
|
6497
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6498
|
+
function isJsonEqual(a, b) {
|
|
6499
|
+
if (Object.is(a, b)) return true;
|
|
6500
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6501
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6502
|
+
const keys = Object.keys(a);
|
|
6503
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6504
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6325
6505
|
}
|
|
6326
6506
|
return false;
|
|
6327
6507
|
}
|
|
6508
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6509
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6510
|
+
const out = {};
|
|
6511
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6512
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6513
|
+
out[key] = value;
|
|
6514
|
+
}
|
|
6515
|
+
return out;
|
|
6516
|
+
}
|
|
6517
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6518
|
+
function markerKeysOf(blob, owner) {
|
|
6519
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6520
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6521
|
+
return keys;
|
|
6522
|
+
}
|
|
6523
|
+
function nodeFromStored(value, owner) {
|
|
6524
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6525
|
+
if (!isRecord(value)) return null;
|
|
6526
|
+
const children = /* @__PURE__ */ new Map();
|
|
6527
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6528
|
+
const node = nodeFromStored(child, owner);
|
|
6529
|
+
if (node !== null) children.set(key, node);
|
|
6530
|
+
}
|
|
6531
|
+
return children.size > 0 ? {
|
|
6532
|
+
kind: "object",
|
|
6533
|
+
children
|
|
6534
|
+
} : null;
|
|
6535
|
+
}
|
|
6536
|
+
/**
|
|
6537
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6538
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6539
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6540
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6541
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6542
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6543
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6544
|
+
* over.
|
|
6545
|
+
*/
|
|
6546
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6547
|
+
const added = /* @__PURE__ */ new Map();
|
|
6548
|
+
for (const key of keys) {
|
|
6549
|
+
const at = key.indexOf("@");
|
|
6550
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6551
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6552
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6553
|
+
if (node !== null) added.set(base, node);
|
|
6554
|
+
}
|
|
6555
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6556
|
+
}
|
|
6328
6557
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6329
6558
|
async function readStoredAddonBlob(raw) {
|
|
6330
6559
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6333,7 +6562,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6333
6562
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6334
6563
|
return result.kind === "missing" ? {} : result.value;
|
|
6335
6564
|
}
|
|
6336
|
-
function
|
|
6565
|
+
function touchesTree(tree, patch) {
|
|
6566
|
+
if (tree.size === 0) return false;
|
|
6567
|
+
for (const key of Object.keys(patch)) {
|
|
6568
|
+
const at = key.indexOf("@");
|
|
6569
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6570
|
+
}
|
|
6571
|
+
return false;
|
|
6572
|
+
}
|
|
6573
|
+
/**
|
|
6574
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6575
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6576
|
+
*/
|
|
6577
|
+
var MarkerKeyIndex = class {
|
|
6578
|
+
owner;
|
|
6579
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6580
|
+
constructor(owner) {
|
|
6581
|
+
this.owner = owner;
|
|
6582
|
+
}
|
|
6583
|
+
seen(store, blob) {
|
|
6584
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6585
|
+
}
|
|
6586
|
+
wrote(store, patch) {
|
|
6587
|
+
const keys = this.byStore.get(store);
|
|
6588
|
+
if (keys === void 0) return;
|
|
6589
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6590
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6591
|
+
else keys.delete(key);
|
|
6592
|
+
}
|
|
6593
|
+
mayHoldMarkers(store, patch) {
|
|
6594
|
+
const keys = this.byStore.get(store);
|
|
6595
|
+
if (keys === void 0) return true;
|
|
6596
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6597
|
+
}
|
|
6598
|
+
};
|
|
6599
|
+
function createHandle(raw, opts) {
|
|
6337
6600
|
const chains = /* @__PURE__ */ new Map();
|
|
6338
6601
|
const serialize = (key, fn) => {
|
|
6339
6602
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6344,46 +6607,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6344
6607
|
});
|
|
6345
6608
|
return next;
|
|
6346
6609
|
};
|
|
6347
|
-
const
|
|
6348
|
-
|
|
6349
|
-
|
|
6610
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6611
|
+
const resolveRead = async (store, blob) => {
|
|
6612
|
+
index.seen(store, blob);
|
|
6613
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6614
|
+
unresolved: "keep-marker",
|
|
6615
|
+
ownedBy: opts.secrets.owner
|
|
6616
|
+
});
|
|
6617
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6618
|
+
return value;
|
|
6619
|
+
};
|
|
6620
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6621
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6622
|
+
await rawWrite(patch);
|
|
6623
|
+
index.wrote(store, patch);
|
|
6624
|
+
return { changed: true };
|
|
6625
|
+
}
|
|
6626
|
+
return serialize(store, async () => {
|
|
6350
6627
|
const stored = await readStored();
|
|
6628
|
+
index.seen(store, stored);
|
|
6629
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6630
|
+
const restored = await restoreUnchangedSecrets({
|
|
6631
|
+
patch,
|
|
6632
|
+
stored,
|
|
6633
|
+
secrets: opts.secrets,
|
|
6634
|
+
operatorWrite
|
|
6635
|
+
});
|
|
6351
6636
|
const result = await transformSecretWrite({
|
|
6352
|
-
tree,
|
|
6637
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6353
6638
|
secrets: opts.secrets,
|
|
6354
|
-
patch,
|
|
6639
|
+
patch: restored.patch,
|
|
6355
6640
|
stored,
|
|
6356
6641
|
...scope !== void 0 ? { scope } : {},
|
|
6357
|
-
operatorWrite
|
|
6642
|
+
operatorWrite
|
|
6358
6643
|
});
|
|
6359
|
-
|
|
6644
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6645
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6646
|
+
if (wroteBlob) {
|
|
6647
|
+
await rawWrite(effective);
|
|
6648
|
+
index.wrote(store, effective);
|
|
6649
|
+
}
|
|
6360
6650
|
const { orphaned } = await result.afterWrite();
|
|
6361
6651
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6652
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6362
6653
|
});
|
|
6363
6654
|
};
|
|
6364
|
-
const
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6655
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6656
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6657
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6658
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6659
|
+
const overrides = {
|
|
6660
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6661
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6662
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6663
|
+
return result.kind === "value" ? {
|
|
6664
|
+
kind: "value",
|
|
6665
|
+
value: await resolveRead("addon", result.value)
|
|
6666
|
+
} : result;
|
|
6667
|
+
} } : {},
|
|
6668
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6669
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6670
|
+
if (result.kind !== "present") return result;
|
|
6671
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6672
|
+
unresolved: "keep-marker",
|
|
6673
|
+
ownedBy: opts.secrets.owner
|
|
6674
|
+
});
|
|
6675
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6676
|
+
return {
|
|
6677
|
+
kind: "present",
|
|
6678
|
+
value: value[key]
|
|
6679
|
+
};
|
|
6680
|
+
} } : {},
|
|
6681
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6682
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6683
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6684
|
+
const out = /* @__PURE__ */ new Map();
|
|
6685
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6686
|
+
return out;
|
|
6687
|
+
} } : {},
|
|
6688
|
+
writeAddonStore: async (patch) => {
|
|
6689
|
+
await writeAddon(patch);
|
|
6690
|
+
},
|
|
6691
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6692
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6693
|
+
kind: "device",
|
|
6694
|
+
deviceId
|
|
6695
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6696
|
+
}
|
|
6697
|
+
};
|
|
6698
|
+
return {
|
|
6699
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6700
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6701
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6702
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6703
|
+
} }),
|
|
6704
|
+
raw: {
|
|
6705
|
+
readAddonStore: async () => {
|
|
6706
|
+
const blob = await raw.readAddonStore();
|
|
6707
|
+
index.seen("addon", blob);
|
|
6708
|
+
return blob;
|
|
6709
|
+
},
|
|
6710
|
+
readDeviceStore: async (deviceId) => {
|
|
6711
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6712
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6713
|
+
return blob;
|
|
6714
|
+
}
|
|
6715
|
+
},
|
|
6716
|
+
writeAddonStore: writeAddon
|
|
6370
6717
|
};
|
|
6371
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6372
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6373
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6374
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6375
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6376
|
-
} });
|
|
6377
6718
|
}
|
|
6378
|
-
/** The context the addon sees
|
|
6379
|
-
function
|
|
6719
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6720
|
+
function createSecretAwareContext(context, opts) {
|
|
6380
6721
|
const raw = context.settings;
|
|
6381
|
-
if (raw === void 0) return
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6722
|
+
if (raw === void 0) return {
|
|
6723
|
+
context,
|
|
6724
|
+
handle: null
|
|
6725
|
+
};
|
|
6726
|
+
const handle = createHandle(raw, opts);
|
|
6727
|
+
return {
|
|
6728
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6729
|
+
if (prop === "settings") return handle.settings;
|
|
6730
|
+
return Reflect.get(target, prop, receiver);
|
|
6731
|
+
} }),
|
|
6732
|
+
handle
|
|
6733
|
+
};
|
|
6387
6734
|
}
|
|
6388
6735
|
var LEAF = { kind: "leaf" };
|
|
6389
6736
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6558,6 +6905,14 @@ var BaseAddon = class {
|
|
|
6558
6905
|
_secretChangeUnsub = null;
|
|
6559
6906
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6560
6907
|
_operatorWriteDepth = 0;
|
|
6908
|
+
/**
|
|
6909
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6910
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6911
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6912
|
+
*/
|
|
6913
|
+
_secretSettings = null;
|
|
6914
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6915
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6561
6916
|
constructor(defaults) {
|
|
6562
6917
|
this.defaults = defaults;
|
|
6563
6918
|
this._config = { ...defaults };
|
|
@@ -6594,13 +6949,21 @@ var BaseAddon = class {
|
|
|
6594
6949
|
}
|
|
6595
6950
|
async initialize(context) {
|
|
6596
6951
|
const secrets = context.secrets;
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6952
|
+
if (secrets !== void 0) {
|
|
6953
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6954
|
+
secrets,
|
|
6955
|
+
addonTree: () => this.addonSecretTree(),
|
|
6956
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6957
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6958
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6959
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6960
|
+
});
|
|
6961
|
+
this._ctx = wrapped;
|
|
6962
|
+
this._secretSettings = handle;
|
|
6963
|
+
} else {
|
|
6964
|
+
this._ctx = context;
|
|
6965
|
+
this._secretSettings = null;
|
|
6966
|
+
}
|
|
6604
6967
|
await this.resolveConfig();
|
|
6605
6968
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6606
6969
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6717,11 +7080,8 @@ var BaseAddon = class {
|
|
|
6717
7080
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6718
7081
|
const schema = this.globalSettingsSchema(cap);
|
|
6719
7082
|
if (!schema) return { sections: [] };
|
|
6720
|
-
const projected = await this.
|
|
6721
|
-
return hydrateSchema(schema, overlay ? {
|
|
6722
|
-
...projected,
|
|
6723
|
-
...overlay
|
|
6724
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7083
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7084
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6725
7085
|
}
|
|
6726
7086
|
/**
|
|
6727
7087
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6766,7 +7126,7 @@ var BaseAddon = class {
|
|
|
6766
7126
|
});
|
|
6767
7127
|
}
|
|
6768
7128
|
if (sections.length === 0) return null;
|
|
6769
|
-
const projected = await this.
|
|
7129
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6770
7130
|
return hydrateSchema({
|
|
6771
7131
|
...schema,
|
|
6772
7132
|
sections
|
|
@@ -6783,12 +7143,50 @@ var BaseAddon = class {
|
|
|
6783
7143
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6784
7144
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6785
7145
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7146
|
+
*
|
|
7147
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7148
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7149
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7150
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7151
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7152
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6786
7153
|
*/
|
|
6787
7154
|
async resolveGlobalStore(nodeId, cap) {
|
|
6788
7155
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7156
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7157
|
+
}
|
|
7158
|
+
projectForNode(store, nodeId, cap) {
|
|
6789
7159
|
const keys = this.perNodeKeys(cap);
|
|
6790
7160
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6791
|
-
return keys.size > 0 ? projectStore(
|
|
7161
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7162
|
+
}
|
|
7163
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7164
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7165
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7166
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7167
|
+
}
|
|
7168
|
+
/**
|
|
7169
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7170
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7171
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7172
|
+
* its value.
|
|
7173
|
+
*/
|
|
7174
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7175
|
+
const secrets = this._ctx?.secrets;
|
|
7176
|
+
const merged = {
|
|
7177
|
+
...stored,
|
|
7178
|
+
...overlay
|
|
7179
|
+
};
|
|
7180
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7181
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7182
|
+
unresolved: "keep-marker",
|
|
7183
|
+
ownedBy: secrets.owner
|
|
7184
|
+
});
|
|
7185
|
+
for (const key of Object.keys(overlay)) {
|
|
7186
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7187
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7188
|
+
}
|
|
7189
|
+
return merged;
|
|
6792
7190
|
}
|
|
6793
7191
|
/**
|
|
6794
7192
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6853,8 +7251,12 @@ var BaseAddon = class {
|
|
|
6853
7251
|
async clearSecrets(keys, nodeId) {
|
|
6854
7252
|
const tree = this.addonSecretTree();
|
|
6855
7253
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7254
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6856
7255
|
const patch = {};
|
|
6857
|
-
for (const key of keys)
|
|
7256
|
+
for (const key of keys) {
|
|
7257
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7258
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7259
|
+
}
|
|
6858
7260
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6859
7261
|
}
|
|
6860
7262
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6862,7 +7264,11 @@ var BaseAddon = class {
|
|
|
6862
7264
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6863
7265
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6864
7266
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6865
|
-
|
|
7267
|
+
const handle = this._secretSettings;
|
|
7268
|
+
if (handle !== null) {
|
|
7269
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7270
|
+
if (!changed) return;
|
|
7271
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6866
7272
|
if (target !== localNode) return;
|
|
6867
7273
|
await this.resolveConfig();
|
|
6868
7274
|
await this.onConfigChanged();
|
|
@@ -6915,7 +7321,7 @@ var BaseAddon = class {
|
|
|
6915
7321
|
async getDeviceSettings(deviceId) {
|
|
6916
7322
|
const schema = this.deviceSettingsSchema();
|
|
6917
7323
|
if (!schema) return { sections: [] };
|
|
6918
|
-
return hydrateSchema(schema, await this.
|
|
7324
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6919
7325
|
}
|
|
6920
7326
|
async updateDeviceSettings(deviceId, patch) {
|
|
6921
7327
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7087,7 +7493,7 @@ var BaseAddon = class {
|
|
|
7087
7493
|
key,
|
|
7088
7494
|
schema,
|
|
7089
7495
|
fallback,
|
|
7090
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7496
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7091
7497
|
write: async (patch) => {
|
|
7092
7498
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7093
7499
|
},
|
|
@@ -7149,6 +7555,23 @@ var BaseAddon = class {
|
|
|
7149
7555
|
}
|
|
7150
7556
|
return value;
|
|
7151
7557
|
}
|
|
7558
|
+
/**
|
|
7559
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7560
|
+
* keychain the context's own view is already raw.
|
|
7561
|
+
*/
|
|
7562
|
+
rawSettings() {
|
|
7563
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7564
|
+
}
|
|
7565
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7566
|
+
logUnresolvedRead(unresolved) {
|
|
7567
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7568
|
+
if (fresh.length === 0) return;
|
|
7569
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7570
|
+
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) => ({
|
|
7571
|
+
ref: u.ref,
|
|
7572
|
+
reason: u.reason
|
|
7573
|
+
})) } });
|
|
7574
|
+
}
|
|
7152
7575
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7153
7576
|
scheduleSecretReresolve(delayMs) {
|
|
7154
7577
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7175,7 +7598,7 @@ var BaseAddon = class {
|
|
|
7175
7598
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7176
7599
|
*/
|
|
7177
7600
|
async readAddonStoreWithRetry() {
|
|
7178
|
-
const settings = this.
|
|
7601
|
+
const settings = this.rawSettings();
|
|
7179
7602
|
if (!settings) return {};
|
|
7180
7603
|
const delaysMs = [
|
|
7181
7604
|
150,
|
|
@@ -9435,6 +9858,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9435
9858
|
fetchedAt: number()
|
|
9436
9859
|
});
|
|
9437
9860
|
/**
|
|
9861
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9862
|
+
* gets back (cloud training, D805+).
|
|
9863
|
+
*
|
|
9864
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9865
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9866
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9867
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9868
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9869
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9870
|
+
* change there, in the same piece of work.
|
|
9871
|
+
*
|
|
9872
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9873
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9874
|
+
*/
|
|
9875
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9876
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9877
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9878
|
+
var TrainingExportSchema = _enum([
|
|
9879
|
+
"onnx",
|
|
9880
|
+
"openvino-fp16",
|
|
9881
|
+
"openvino-int8",
|
|
9882
|
+
"coreml-fp16"
|
|
9883
|
+
]);
|
|
9884
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9885
|
+
object({
|
|
9886
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9887
|
+
jobKey: string().uuid(),
|
|
9888
|
+
target: object({
|
|
9889
|
+
kind: literal("detector"),
|
|
9890
|
+
step: literal("object-detection")
|
|
9891
|
+
}),
|
|
9892
|
+
base: object({
|
|
9893
|
+
modelId: string().min(1),
|
|
9894
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9895
|
+
weights: string().min(1),
|
|
9896
|
+
imgsz: number().int().positive()
|
|
9897
|
+
}),
|
|
9898
|
+
baseline: object({
|
|
9899
|
+
modelId: string().min(1),
|
|
9900
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9901
|
+
onnxUrl: string().url(),
|
|
9902
|
+
imgsz: number().int().positive(),
|
|
9903
|
+
floors: FloorsSchema
|
|
9904
|
+
}),
|
|
9905
|
+
dataset: object({
|
|
9906
|
+
versionId: string().min(1),
|
|
9907
|
+
annotationHash: string(),
|
|
9908
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9909
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9910
|
+
}),
|
|
9911
|
+
split: object({
|
|
9912
|
+
holdoutCameras: array(number().int()),
|
|
9913
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9914
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9915
|
+
valFraction: number().min(0).max(.5),
|
|
9916
|
+
seed: number().int()
|
|
9917
|
+
}),
|
|
9918
|
+
hyper: object({
|
|
9919
|
+
epochs: number().int().positive(),
|
|
9920
|
+
batch: number().int().positive(),
|
|
9921
|
+
lr0: number().positive(),
|
|
9922
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9923
|
+
freeze: number().int().nonnegative(),
|
|
9924
|
+
patience: number().int().nonnegative(),
|
|
9925
|
+
seed: number().int()
|
|
9926
|
+
}),
|
|
9927
|
+
replay: object({
|
|
9928
|
+
source: literal("coco2017"),
|
|
9929
|
+
count: number().int().nonnegative()
|
|
9930
|
+
}),
|
|
9931
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9932
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9933
|
+
floors: object({
|
|
9934
|
+
minSupport: number().int().positive(),
|
|
9935
|
+
clamp: number().min(0).max(1)
|
|
9936
|
+
}),
|
|
9937
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9938
|
+
catalog: object({
|
|
9939
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9940
|
+
name: string().min(1).max(160)
|
|
9941
|
+
})
|
|
9942
|
+
});
|
|
9943
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9944
|
+
var TrainingResultFileSchema = object({
|
|
9945
|
+
path: string().min(1),
|
|
9946
|
+
bytes: number().int().nonnegative(),
|
|
9947
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9948
|
+
format: _enum([
|
|
9949
|
+
"onnx",
|
|
9950
|
+
"openvino",
|
|
9951
|
+
"coreml",
|
|
9952
|
+
"pt"
|
|
9953
|
+
]),
|
|
9954
|
+
variant: _enum(["base", "int8"])
|
|
9955
|
+
});
|
|
9956
|
+
var DraftFormatSchema = object({
|
|
9957
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9958
|
+
url: string().min(1),
|
|
9959
|
+
sizeMB: number().nonnegative(),
|
|
9960
|
+
isDirectory: boolean().optional(),
|
|
9961
|
+
files: array(string()).optional(),
|
|
9962
|
+
runtimes: array(literal("python")).optional(),
|
|
9963
|
+
revision: string().min(1)
|
|
9964
|
+
});
|
|
9965
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9966
|
+
var TrainingCatalogDraftSchema = object({
|
|
9967
|
+
id: string().min(1),
|
|
9968
|
+
name: string().min(1),
|
|
9969
|
+
description: string(),
|
|
9970
|
+
labels: array(unknown()),
|
|
9971
|
+
inputSize: object({
|
|
9972
|
+
width: number().int().positive(),
|
|
9973
|
+
height: number().int().positive()
|
|
9974
|
+
}),
|
|
9975
|
+
preprocessMode: literal("letterbox"),
|
|
9976
|
+
defaultClassFloors: FloorsSchema,
|
|
9977
|
+
formats: object({
|
|
9978
|
+
onnx: DraftFormatSchema.optional(),
|
|
9979
|
+
openvino: DraftFormatSchema.optional(),
|
|
9980
|
+
coreml: DraftFormatSchema.optional()
|
|
9981
|
+
})
|
|
9982
|
+
});
|
|
9983
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
9984
|
+
var TrainingEvalClassSchema = object({
|
|
9985
|
+
positives: number().int(),
|
|
9986
|
+
floor: number().nullable(),
|
|
9987
|
+
tp: number().int(),
|
|
9988
|
+
fp: number().int(),
|
|
9989
|
+
fn: number().int(),
|
|
9990
|
+
precision: number().nullable(),
|
|
9991
|
+
recall: number().nullable(),
|
|
9992
|
+
ap50: number().nullable(),
|
|
9993
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
9994
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
9995
|
+
fpByCamera: record(string(), number()).optional(),
|
|
9996
|
+
smallFound: number().int().optional(),
|
|
9997
|
+
smallTotal: number().int().optional()
|
|
9998
|
+
}).passthrough();
|
|
9999
|
+
var TrainingEvalReportSchema = object({
|
|
10000
|
+
frames: number().int(),
|
|
10001
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10002
|
+
}).passthrough();
|
|
10003
|
+
/**
|
|
10004
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10005
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10006
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10007
|
+
*/
|
|
10008
|
+
var TrainingResultSchema = object({
|
|
10009
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10010
|
+
jobKey: string(),
|
|
10011
|
+
status: _enum(["succeeded", "failed"]),
|
|
10012
|
+
error: object({
|
|
10013
|
+
stage: string(),
|
|
10014
|
+
code: string(),
|
|
10015
|
+
message: string()
|
|
10016
|
+
}).nullable(),
|
|
10017
|
+
trainer: object({
|
|
10018
|
+
version: string(),
|
|
10019
|
+
revision: string()
|
|
10020
|
+
}),
|
|
10021
|
+
toolchain: record(string(), string().nullable()),
|
|
10022
|
+
dataset: object({
|
|
10023
|
+
versionId: string(),
|
|
10024
|
+
annotationHash: string(),
|
|
10025
|
+
sha256: string(),
|
|
10026
|
+
frames: object({
|
|
10027
|
+
train: number().int(),
|
|
10028
|
+
val: number().int(),
|
|
10029
|
+
holdout: number().int()
|
|
10030
|
+
}),
|
|
10031
|
+
holdoutCameras: array(number().int()),
|
|
10032
|
+
replayImages: number().int()
|
|
10033
|
+
}).optional(),
|
|
10034
|
+
training: object({
|
|
10035
|
+
epochsRun: number().int(),
|
|
10036
|
+
bestEpoch: number().int(),
|
|
10037
|
+
bestMap50: number(),
|
|
10038
|
+
bestMap50_95: number(),
|
|
10039
|
+
seconds: number()
|
|
10040
|
+
}).optional(),
|
|
10041
|
+
evaluation: object({
|
|
10042
|
+
holdoutFrames: number().int(),
|
|
10043
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10044
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10045
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10046
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10047
|
+
map50: record(string(), number().nullable())
|
|
10048
|
+
}).optional(),
|
|
10049
|
+
floors: object({
|
|
10050
|
+
baseline: FloorsSchema,
|
|
10051
|
+
candidate: FloorsSchema,
|
|
10052
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10053
|
+
notes: array(string())
|
|
10054
|
+
}).optional(),
|
|
10055
|
+
int8: object({
|
|
10056
|
+
kept: boolean(),
|
|
10057
|
+
map50Fp16: number().nullable(),
|
|
10058
|
+
map50Int8: number().nullable(),
|
|
10059
|
+
reason: string().nullable()
|
|
10060
|
+
}).optional(),
|
|
10061
|
+
exportsDropped: array(object({
|
|
10062
|
+
export: string(),
|
|
10063
|
+
reason: string()
|
|
10064
|
+
})).optional(),
|
|
10065
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10066
|
+
bundle: object({
|
|
10067
|
+
path: literal("bundle.tar"),
|
|
10068
|
+
bytes: number().int().nonnegative(),
|
|
10069
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10070
|
+
}).nullable().optional(),
|
|
10071
|
+
catalogDraft: object({
|
|
10072
|
+
base: TrainingCatalogDraftSchema,
|
|
10073
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10074
|
+
}).nullable().optional(),
|
|
10075
|
+
licence: string()
|
|
10076
|
+
});
|
|
10077
|
+
var TrainingStageSchema = _enum([
|
|
10078
|
+
"prepare",
|
|
10079
|
+
"replay",
|
|
10080
|
+
"train",
|
|
10081
|
+
"eval",
|
|
10082
|
+
"export",
|
|
10083
|
+
"package"
|
|
10084
|
+
]);
|
|
10085
|
+
var EventBase = {
|
|
10086
|
+
v: literal(1),
|
|
10087
|
+
ts: number()
|
|
10088
|
+
};
|
|
10089
|
+
discriminatedUnion("type", [
|
|
10090
|
+
object({
|
|
10091
|
+
...EventBase,
|
|
10092
|
+
type: literal("stage"),
|
|
10093
|
+
stage: TrainingStageSchema
|
|
10094
|
+
}),
|
|
10095
|
+
object({
|
|
10096
|
+
...EventBase,
|
|
10097
|
+
type: literal("epoch"),
|
|
10098
|
+
epoch: number().int(),
|
|
10099
|
+
epochs: number().int(),
|
|
10100
|
+
boxLoss: number().nullable().optional(),
|
|
10101
|
+
map50: number().nullable().optional(),
|
|
10102
|
+
map50_95: number().nullable().optional(),
|
|
10103
|
+
etaSec: number().nullable().optional()
|
|
10104
|
+
}),
|
|
10105
|
+
object({
|
|
10106
|
+
...EventBase,
|
|
10107
|
+
type: literal("metric"),
|
|
10108
|
+
name: string(),
|
|
10109
|
+
value: number()
|
|
10110
|
+
}),
|
|
10111
|
+
object({
|
|
10112
|
+
...EventBase,
|
|
10113
|
+
type: literal("artifact"),
|
|
10114
|
+
path: string(),
|
|
10115
|
+
bytes: number(),
|
|
10116
|
+
sha256: string()
|
|
10117
|
+
}),
|
|
10118
|
+
object({
|
|
10119
|
+
...EventBase,
|
|
10120
|
+
type: literal("done"),
|
|
10121
|
+
status: _enum(["succeeded", "failed"]),
|
|
10122
|
+
resultSha256: string().nullable().optional()
|
|
10123
|
+
}),
|
|
10124
|
+
object({
|
|
10125
|
+
...EventBase,
|
|
10126
|
+
type: literal("error"),
|
|
10127
|
+
stage: string(),
|
|
10128
|
+
code: string(),
|
|
10129
|
+
message: string()
|
|
10130
|
+
})
|
|
10131
|
+
]);
|
|
10132
|
+
/**
|
|
9438
10133
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9439
10134
|
*
|
|
9440
10135
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11762,7 +12457,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11762
12457
|
"authenticated",
|
|
11763
12458
|
"admin"
|
|
11764
12459
|
]).optional(),
|
|
11765
|
-
description: string().optional()
|
|
12460
|
+
description: string().optional(),
|
|
12461
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12462
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11766
12463
|
});
|
|
11767
12464
|
/**
|
|
11768
12465
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12467,6 +13164,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12467
13164
|
lastError: string().optional()
|
|
12468
13165
|
});
|
|
12469
13166
|
/**
|
|
13167
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13168
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13169
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13170
|
+
* with it off — which restores without a key.
|
|
13171
|
+
*/
|
|
13172
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13173
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13174
|
+
scheme: string(),
|
|
13175
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13176
|
+
keyId: string()
|
|
13177
|
+
});
|
|
13178
|
+
/**
|
|
13179
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13180
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13181
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13182
|
+
*/
|
|
13183
|
+
var BackupEncryptionStatusSchema = object({
|
|
13184
|
+
enabled: boolean(),
|
|
13185
|
+
active: object({
|
|
13186
|
+
keyId: string(),
|
|
13187
|
+
publicKey: string(),
|
|
13188
|
+
createdAt: number()
|
|
13189
|
+
}).nullable(),
|
|
13190
|
+
/** Every key ever set up, newest first. */
|
|
13191
|
+
keys: array(object({
|
|
13192
|
+
keyId: string(),
|
|
13193
|
+
createdAt: number(),
|
|
13194
|
+
retiredAt: number().nullable()
|
|
13195
|
+
})).readonly()
|
|
13196
|
+
});
|
|
13197
|
+
/**
|
|
12470
13198
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12471
13199
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12472
13200
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12478,7 +13206,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12478
13206
|
sizeBytes: number(),
|
|
12479
13207
|
label: string().optional(),
|
|
12480
13208
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12481
|
-
locations: array(string()).readonly()
|
|
13209
|
+
locations: array(string()).readonly(),
|
|
13210
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13211
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12482
13212
|
});
|
|
12483
13213
|
var BackupEntrySchema = object({
|
|
12484
13214
|
id: string(),
|
|
@@ -12487,7 +13217,8 @@ var BackupEntrySchema = object({
|
|
|
12487
13217
|
label: string().optional(),
|
|
12488
13218
|
createdAt: number(),
|
|
12489
13219
|
sizeBytes: number(),
|
|
12490
|
-
locations: array(string()).optional()
|
|
13220
|
+
locations: array(string()).optional(),
|
|
13221
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12491
13222
|
});
|
|
12492
13223
|
var ArchiveEntrySchema = object({
|
|
12493
13224
|
path: string(),
|
|
@@ -12676,10 +13407,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12676
13407
|
* this list and skips entries whose path doesn't start with
|
|
12677
13408
|
* any of them.
|
|
12678
13409
|
*/
|
|
12679
|
-
locations: array(string()).optional()
|
|
13410
|
+
locations: array(string()).optional(),
|
|
13411
|
+
/**
|
|
13412
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13413
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13414
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13415
|
+
* is refused before the archive is downloaded.
|
|
13416
|
+
*/
|
|
13417
|
+
backupSecretKey: string().optional()
|
|
12680
13418
|
}), _void(), {
|
|
12681
13419
|
kind: "mutation",
|
|
12682
13420
|
auth: "admin"
|
|
13421
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13422
|
+
keyId: string(),
|
|
13423
|
+
secretKey: string(),
|
|
13424
|
+
publicKey: string(),
|
|
13425
|
+
createdAt: number(),
|
|
13426
|
+
replacedKeyId: string().nullable()
|
|
13427
|
+
}), {
|
|
13428
|
+
kind: "mutation",
|
|
13429
|
+
auth: "admin"
|
|
13430
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13431
|
+
kind: "mutation",
|
|
13432
|
+
auth: "admin"
|
|
13433
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13434
|
+
valid: boolean(),
|
|
13435
|
+
keyId: string().nullable(),
|
|
13436
|
+
/** The hub knows this key (active or retired). */
|
|
13437
|
+
known: boolean(),
|
|
13438
|
+
/** It is the key new archives are encrypted to. */
|
|
13439
|
+
active: boolean(),
|
|
13440
|
+
error: string().optional()
|
|
13441
|
+
}), {
|
|
13442
|
+
kind: "mutation",
|
|
13443
|
+
auth: "admin"
|
|
12683
13444
|
}), method(object({
|
|
12684
13445
|
destinationId: string(),
|
|
12685
13446
|
backupId: string()
|
|
@@ -14303,7 +15064,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14303
15064
|
stepId: string(),
|
|
14304
15065
|
entry: ModelCatalogEntrySchema
|
|
14305
15066
|
});
|
|
14306
|
-
|
|
15067
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15068
|
+
var ModelBundleFileSchema = object({
|
|
15069
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15070
|
+
path: string().min(1),
|
|
15071
|
+
bytes: number().int().nonnegative(),
|
|
15072
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15073
|
+
});
|
|
15074
|
+
var ImportModelBundleInputSchema = object({
|
|
15075
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15076
|
+
addonId: string(),
|
|
15077
|
+
stepId: string().min(1),
|
|
15078
|
+
/**
|
|
15079
|
+
* The catalog rows to register, complete, every format URL already
|
|
15080
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15081
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15082
|
+
*/
|
|
15083
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15084
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15085
|
+
bundle: object({
|
|
15086
|
+
ticket: PeerBytesTicketSchema,
|
|
15087
|
+
bytes: number().int().positive(),
|
|
15088
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15089
|
+
}),
|
|
15090
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15091
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15092
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15093
|
+
distribute: boolean()
|
|
15094
|
+
});
|
|
15095
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15096
|
+
kind: literal("imported"),
|
|
15097
|
+
modelIds: array(string()).readonly(),
|
|
15098
|
+
distributed: array(object({
|
|
15099
|
+
modelId: string(),
|
|
15100
|
+
nodeId: string(),
|
|
15101
|
+
format: _enum(MODEL_FORMATS),
|
|
15102
|
+
ok: boolean(),
|
|
15103
|
+
error: string().optional()
|
|
15104
|
+
})).readonly()
|
|
15105
|
+
}), object({
|
|
15106
|
+
kind: literal("refused"),
|
|
15107
|
+
reason: _enum([
|
|
15108
|
+
"transfer-failed",
|
|
15109
|
+
"checksum-mismatch",
|
|
15110
|
+
"bundle-mismatch",
|
|
15111
|
+
"invalid-entry",
|
|
15112
|
+
"id-taken"
|
|
15113
|
+
]),
|
|
15114
|
+
detail: string()
|
|
15115
|
+
})]);
|
|
15116
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15117
|
+
kind: "mutation",
|
|
15118
|
+
auth: "admin",
|
|
15119
|
+
timeoutMs: 30 * 6e4
|
|
15120
|
+
});
|
|
14307
15121
|
/**
|
|
14308
15122
|
* Query filter for settings-store collections.
|
|
14309
15123
|
*/
|
|
@@ -14782,6 +15596,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14782
15596
|
*/
|
|
14783
15597
|
sharesBackupWithDatabase: boolean()
|
|
14784
15598
|
});
|
|
15599
|
+
/**
|
|
15600
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15601
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15602
|
+
*/
|
|
15603
|
+
var KeychainResetRecordSchema = object({
|
|
15604
|
+
id: string(),
|
|
15605
|
+
at: number(),
|
|
15606
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15607
|
+
actor: string(),
|
|
15608
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15609
|
+
lockedReason: string().nullable(),
|
|
15610
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15611
|
+
archived: number().int(),
|
|
15612
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15613
|
+
archivedCollection: string().nullable(),
|
|
15614
|
+
/**
|
|
15615
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15616
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15617
|
+
*/
|
|
15618
|
+
archivedKeysCollection: string().nullable(),
|
|
15619
|
+
/**
|
|
15620
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15621
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15622
|
+
* agent forever (D797).
|
|
15623
|
+
*/
|
|
15624
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15625
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15626
|
+
acknowledgedAt: number().nullable()
|
|
15627
|
+
});
|
|
14785
15628
|
var KeychainStatusSchema = object({
|
|
14786
15629
|
keychain: KeychainStateSchema,
|
|
14787
15630
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14799,7 +15642,9 @@ var KeychainStatusSchema = object({
|
|
|
14799
15642
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14800
15643
|
retiredWraps: number().int(),
|
|
14801
15644
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14802
|
-
secretCount: number().int()
|
|
15645
|
+
secretCount: number().int(),
|
|
15646
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15647
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14803
15648
|
});
|
|
14804
15649
|
/**
|
|
14805
15650
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -14821,17 +15666,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
14821
15666
|
"download-recovery-key",
|
|
14822
15667
|
"delete-orphans",
|
|
14823
15668
|
"reset",
|
|
15669
|
+
"acknowledge-reset",
|
|
14824
15670
|
"initialize"
|
|
14825
15671
|
]);
|
|
14826
15672
|
var KeychainAuditEntrySchema = object({
|
|
14827
15673
|
id: string(),
|
|
14828
15674
|
at: number(),
|
|
14829
15675
|
action: KeychainAuditActionSchema,
|
|
14830
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15676
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
14831
15677
|
actor: string(),
|
|
14832
15678
|
ref: string().nullable(),
|
|
14833
15679
|
detail: string().nullable()
|
|
14834
15680
|
});
|
|
15681
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15682
|
+
/**
|
|
15683
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15684
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15685
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15686
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15687
|
+
*/
|
|
15688
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
14835
15689
|
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({
|
|
14836
15690
|
value: string(),
|
|
14837
15691
|
version: number().int()
|
|
@@ -14839,6 +15693,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
14839
15693
|
kind: "mutation",
|
|
14840
15694
|
auth: "admin",
|
|
14841
15695
|
caller: "required"
|
|
15696
|
+
}), method(object({
|
|
15697
|
+
name: SystemHeldSecretNameSchema,
|
|
15698
|
+
value: string().min(16)
|
|
15699
|
+
}), object({
|
|
15700
|
+
ref: string(),
|
|
15701
|
+
version: number().int()
|
|
15702
|
+
}), {
|
|
15703
|
+
kind: "mutation",
|
|
15704
|
+
auth: "admin",
|
|
15705
|
+
caller: "required"
|
|
14842
15706
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14843
15707
|
deleted: array(string()).readonly(),
|
|
14844
15708
|
kept: array(object({
|
|
@@ -14868,13 +15732,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
14868
15732
|
kind: "mutation",
|
|
14869
15733
|
auth: "admin",
|
|
14870
15734
|
caller: "required"
|
|
14871
|
-
}), method(object({ confirm: literal(
|
|
15735
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
14872
15736
|
archivedCollection: string().nullable(),
|
|
14873
15737
|
archived: number().int()
|
|
14874
15738
|
}), {
|
|
14875
15739
|
kind: "mutation",
|
|
14876
15740
|
auth: "admin",
|
|
14877
15741
|
caller: "required"
|
|
15742
|
+
}), method(object({}), object({
|
|
15743
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15744
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15745
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15746
|
+
kind: "mutation",
|
|
15747
|
+
auth: "admin",
|
|
15748
|
+
caller: "required"
|
|
14878
15749
|
});
|
|
14879
15750
|
method(_void(), object({
|
|
14880
15751
|
id: string(),
|
|
@@ -17520,7 +18391,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17520
18391
|
* `login-method` — collection cap through which auth addons contribute
|
|
17521
18392
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17522
18393
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17523
|
-
* every auth addon (OIDC,
|
|
18394
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17524
18395
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17525
18396
|
* procedure aggregates them for the unauthenticated login page.
|
|
17526
18397
|
*
|
|
@@ -17528,8 +18399,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17528
18399
|
*
|
|
17529
18400
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17530
18401
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17531
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17532
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18402
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17533
18403
|
* login page needs NO change.
|
|
17534
18404
|
*
|
|
17535
18405
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17548,8 +18418,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17548
18418
|
* decision.
|
|
17549
18419
|
*
|
|
17550
18420
|
* Every contribution carries a `stage`:
|
|
17551
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17552
|
-
*
|
|
18421
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18422
|
+
* buttons; a usernameless passkey).
|
|
17553
18423
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17554
18424
|
* returned `factors` (passkey-as-2FA today).
|
|
17555
18425
|
*
|
|
@@ -17576,7 +18446,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17576
18446
|
* The provider names an external identity a signed-in user can link to
|
|
17577
18447
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17578
18448
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17579
|
-
* whatever their id. Absent / false — a login button only
|
|
18449
|
+
* whatever their id. Absent / false — a login button only.
|
|
17580
18450
|
*/
|
|
17581
18451
|
linkable: boolean().optional()
|
|
17582
18452
|
}),
|
|
@@ -21410,8 +22280,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21410
22280
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21411
22281
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21412
22282
|
* distinction was only ever used to route role-specific procedures
|
|
21413
|
-
* which we no longer have.
|
|
21414
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22283
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21415
22284
|
* with `isAdmin: false` + an explicit scope list.
|
|
21416
22285
|
*/
|
|
21417
22286
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23086,6 +23955,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23086
23955
|
frameIds: array(string()).max(2e4).optional(),
|
|
23087
23956
|
/** Only frames in at least one of these named collections. */
|
|
23088
23957
|
collectionIds: array(string()).max(200).optional(),
|
|
23958
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
23959
|
+
* unknown id selects nothing. */
|
|
23960
|
+
datasetVersionId: string().optional(),
|
|
23089
23961
|
batchId: string().optional(),
|
|
23090
23962
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23091
23963
|
completeOnly: boolean().optional()
|
|
@@ -23253,6 +24125,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23253
24125
|
]),
|
|
23254
24126
|
detail: string().optional()
|
|
23255
24127
|
})]);
|
|
24128
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24129
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24130
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24131
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24132
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24133
|
+
});
|
|
24134
|
+
/** The counts a dataset is judged by. */
|
|
24135
|
+
var RetrainDatasetStatsSchema = object({
|
|
24136
|
+
frames: number().int(),
|
|
24137
|
+
completeFrames: number().int(),
|
|
24138
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24139
|
+
completeness: number(),
|
|
24140
|
+
/** Boxes to learn (model errors excluded). */
|
|
24141
|
+
subjects: number().int(),
|
|
24142
|
+
modelErrors: number().int(),
|
|
24143
|
+
/** Complete frames with no subject. */
|
|
24144
|
+
hardNegatives: number().int(),
|
|
24145
|
+
/** Subjects per class × camera × day/night. */
|
|
24146
|
+
cells: array(object({
|
|
24147
|
+
macroClass: string(),
|
|
24148
|
+
deviceId: number(),
|
|
24149
|
+
lighting: _enum([
|
|
24150
|
+
"day",
|
|
24151
|
+
"night",
|
|
24152
|
+
"unknown"
|
|
24153
|
+
]),
|
|
24154
|
+
subjects: number().int(),
|
|
24155
|
+
frames: number().int()
|
|
24156
|
+
})).readonly(),
|
|
24157
|
+
cameras: array(object({
|
|
24158
|
+
deviceId: number(),
|
|
24159
|
+
frames: number().int(),
|
|
24160
|
+
completeFrames: number().int()
|
|
24161
|
+
})).readonly()
|
|
24162
|
+
});
|
|
24163
|
+
/** An immutable dataset version, without its frame list. */
|
|
24164
|
+
var RetrainDatasetVersionSchema = object({
|
|
24165
|
+
id: string(),
|
|
24166
|
+
name: string(),
|
|
24167
|
+
createdAt: number(),
|
|
24168
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24169
|
+
layout: RetrainExportLayoutSchema,
|
|
24170
|
+
completeOnly: boolean(),
|
|
24171
|
+
frameCount: number().int(),
|
|
24172
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24173
|
+
annotationHash: string(),
|
|
24174
|
+
/** The export manifest schema the version was cut under. */
|
|
24175
|
+
manifestSchema: string(),
|
|
24176
|
+
stats: RetrainDatasetStatsSchema
|
|
24177
|
+
});
|
|
24178
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24179
|
+
kind: literal("created"),
|
|
24180
|
+
version: RetrainDatasetVersionSchema
|
|
24181
|
+
}), object({
|
|
24182
|
+
kind: literal("refused"),
|
|
24183
|
+
reason: _enum([
|
|
24184
|
+
"empty-name",
|
|
24185
|
+
"duplicate-name",
|
|
24186
|
+
"no-frames"
|
|
24187
|
+
])
|
|
24188
|
+
})]);
|
|
23256
24189
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23257
24190
|
var RetrainTransitionResultSchema = object({
|
|
23258
24191
|
trackId: string(),
|
|
@@ -24042,6 +24975,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24042
24975
|
kind: "mutation",
|
|
24043
24976
|
auth: "admin",
|
|
24044
24977
|
timeoutMs: 60 * 6e4
|
|
24978
|
+
}), method(object({
|
|
24979
|
+
filter: RetrainExportFilterSchema,
|
|
24980
|
+
layout: RetrainExportLayoutSchema
|
|
24981
|
+
}), object({
|
|
24982
|
+
ticket: PeerBytesTicketSchema,
|
|
24983
|
+
frames: number().int(),
|
|
24984
|
+
annotations: number().int()
|
|
24985
|
+
}), {
|
|
24986
|
+
kind: "mutation",
|
|
24987
|
+
auth: "admin",
|
|
24988
|
+
timeoutMs: 12e4
|
|
24989
|
+
}), method(object({
|
|
24990
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24991
|
+
completeOnly: boolean().optional()
|
|
24992
|
+
}), RetrainDatasetStatsSchema, {
|
|
24993
|
+
kind: "query",
|
|
24994
|
+
auth: "admin"
|
|
24995
|
+
}), method(object({
|
|
24996
|
+
name: string().max(120),
|
|
24997
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24998
|
+
layout: RetrainExportLayoutSchema,
|
|
24999
|
+
completeOnly: boolean()
|
|
25000
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25001
|
+
kind: "mutation",
|
|
25002
|
+
auth: "admin",
|
|
25003
|
+
timeoutMs: 12e4
|
|
25004
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25005
|
+
kind: "query",
|
|
25006
|
+
auth: "admin"
|
|
25007
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25008
|
+
kind: "mutation",
|
|
25009
|
+
auth: "admin"
|
|
25010
|
+
}), method(object({ id: string() }), object({
|
|
25011
|
+
found: boolean(),
|
|
25012
|
+
annotationHash: string(),
|
|
25013
|
+
matches: boolean(),
|
|
25014
|
+
missingFrames: number().int()
|
|
25015
|
+
}), {
|
|
25016
|
+
kind: "query",
|
|
25017
|
+
auth: "admin",
|
|
25018
|
+
timeoutMs: 12e4
|
|
24045
25019
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24046
25020
|
kind: "query",
|
|
24047
25021
|
auth: "admin"
|
|
@@ -27580,8 +28554,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27580
28554
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27581
28555
|
*
|
|
27582
28556
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27583
|
-
* one for transactional / one for notifications). Consumers (
|
|
27584
|
-
*
|
|
28557
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28558
|
+
* addons, …) walk the collection and pick the first
|
|
27585
28559
|
* ready provider OR target a specific addonId.
|
|
27586
28560
|
*
|
|
27587
28561
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27760,7 +28734,7 @@ targets: array(object({
|
|
|
27760
28734
|
})));
|
|
27761
28735
|
/**
|
|
27762
28736
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27763
|
-
* providers (OIDC, SAML,
|
|
28737
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27764
28738
|
* carrying the post-callback claims before redirecting back to
|
|
27765
28739
|
* `/api/auth/sso/finish`.
|
|
27766
28740
|
*
|
|
@@ -27823,7 +28797,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27823
28797
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
27824
28798
|
* subject is unique only per issuer, so a link is bound to it.
|
|
27825
28799
|
*/
|
|
27826
|
-
issuer: string().optional()
|
|
28800
|
+
issuer: string().optional(),
|
|
28801
|
+
/**
|
|
28802
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
28803
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
28804
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
28805
|
+
* any other browser.
|
|
28806
|
+
*/
|
|
28807
|
+
browserBinding: string().optional()
|
|
27827
28808
|
});
|
|
27828
28809
|
method(object({
|
|
27829
28810
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -37804,16 +38785,6 @@ var ApiKeySummarySchema = object({
|
|
|
37804
38785
|
createdAt: number(),
|
|
37805
38786
|
lastUsedAt: number().optional()
|
|
37806
38787
|
});
|
|
37807
|
-
var CreateApiKeyInputSchema = object({
|
|
37808
|
-
label: string(),
|
|
37809
|
-
isAdmin: boolean().default(false),
|
|
37810
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
37811
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
37812
|
-
});
|
|
37813
|
-
var CreateApiKeyResultSchema = object({
|
|
37814
|
-
token: string(),
|
|
37815
|
-
record: ApiKeySummarySchema
|
|
37816
|
-
});
|
|
37817
38788
|
var ScopedTokenSummarySchema = object({
|
|
37818
38789
|
id: string(),
|
|
37819
38790
|
userId: string(),
|
|
@@ -37912,17 +38883,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
37912
38883
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
37913
38884
|
kind: "mutation",
|
|
37914
38885
|
access: "view"
|
|
37915
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
37916
|
-
kind: "mutation",
|
|
37917
|
-
auth: "admin",
|
|
37918
|
-
access: "create"
|
|
37919
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
38886
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
37920
38887
|
kind: "mutation",
|
|
37921
38888
|
auth: "admin",
|
|
37922
38889
|
access: "delete"
|
|
37923
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
37924
|
-
kind: "mutation",
|
|
37925
|
-
access: "view"
|
|
37926
38890
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
37927
38891
|
kind: "mutation",
|
|
37928
38892
|
auth: "admin",
|
|
@@ -37996,15 +38960,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
37996
38960
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
37997
38961
|
userId: string(),
|
|
37998
38962
|
issuer: string()
|
|
37999
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
38000
|
-
userId: string(),
|
|
38001
|
-
issuer: string().min(1),
|
|
38002
|
-
label: string().optional()
|
|
38003
|
-
}), object({ success: literal(true) }), {
|
|
38004
|
-
kind: "mutation",
|
|
38005
|
-
auth: "admin",
|
|
38006
|
-
access: "create"
|
|
38007
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38963
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38008
38964
|
kind: "mutation",
|
|
38009
38965
|
auth: "admin",
|
|
38010
38966
|
access: "delete"
|
|
@@ -38399,6 +39355,451 @@ DeviceType.Camera, method(object({
|
|
|
38399
39355
|
detection: array(ZoneRuleSchema).readonly(),
|
|
38400
39356
|
package: array(ZoneRuleSchema).readonly()
|
|
38401
39357
|
});
|
|
39358
|
+
/**
|
|
39359
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
39360
|
+
*
|
|
39361
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
39362
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
39363
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
39364
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
39365
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
39366
|
+
* manifest entry and nothing else.
|
|
39367
|
+
*
|
|
39368
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
39369
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
39370
|
+
* Every method is `admin`: these spend money.
|
|
39371
|
+
*
|
|
39372
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
39373
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
39374
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
39375
|
+
*
|
|
39376
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
39377
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
39378
|
+
* ticket the provider mints (D613).
|
|
39379
|
+
*/
|
|
39380
|
+
var TrainingGpuOptionSchema = object({
|
|
39381
|
+
id: string(),
|
|
39382
|
+
label: string(),
|
|
39383
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
39384
|
+
usdPerHour: number().nonnegative(),
|
|
39385
|
+
vramGb: number().nonnegative()
|
|
39386
|
+
});
|
|
39387
|
+
var TrainingRegionOptionSchema = object({
|
|
39388
|
+
/** `''` = any region (the provider's choice). */
|
|
39389
|
+
id: string(),
|
|
39390
|
+
label: string(),
|
|
39391
|
+
priceMultiplier: number().positive()
|
|
39392
|
+
});
|
|
39393
|
+
/**
|
|
39394
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
39395
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
39396
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
39397
|
+
*/
|
|
39398
|
+
var TrainingProviderDefaultsSchema = object({
|
|
39399
|
+
gpuType: string(),
|
|
39400
|
+
region: string(),
|
|
39401
|
+
costCapUsd: number().nonnegative(),
|
|
39402
|
+
maxRuntimeSec: number().int().positive(),
|
|
39403
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
39404
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
39405
|
+
});
|
|
39406
|
+
var TrainingProviderDescriptorSchema = object({
|
|
39407
|
+
addonId: string(),
|
|
39408
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
39409
|
+
kind: string(),
|
|
39410
|
+
label: string(),
|
|
39411
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
39412
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
39413
|
+
maxDatasetBytes: number().int().positive(),
|
|
39414
|
+
maxRuntimeSec: number().int().positive(),
|
|
39415
|
+
freeTierNote: string().optional(),
|
|
39416
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
39417
|
+
dataResidencyNote: string(),
|
|
39418
|
+
/** Credentials are present — never the values. */
|
|
39419
|
+
configured: boolean(),
|
|
39420
|
+
defaults: TrainingProviderDefaultsSchema
|
|
39421
|
+
});
|
|
39422
|
+
var TrainingCredentialCheckSchema = object({
|
|
39423
|
+
ok: boolean(),
|
|
39424
|
+
/** Workspace / account name, when the provider says. */
|
|
39425
|
+
account: string().optional(),
|
|
39426
|
+
reason: _enum([
|
|
39427
|
+
"missing",
|
|
39428
|
+
"invalid",
|
|
39429
|
+
"forbidden",
|
|
39430
|
+
"network",
|
|
39431
|
+
"quota"
|
|
39432
|
+
]).optional(),
|
|
39433
|
+
detail: string().optional()
|
|
39434
|
+
});
|
|
39435
|
+
var ProviderJobStateSchema = _enum([
|
|
39436
|
+
"pending",
|
|
39437
|
+
"starting",
|
|
39438
|
+
"running",
|
|
39439
|
+
"succeeded",
|
|
39440
|
+
"failed",
|
|
39441
|
+
"cancelled",
|
|
39442
|
+
"lost"
|
|
39443
|
+
]);
|
|
39444
|
+
var ProviderJobStatusSchema = object({
|
|
39445
|
+
jobKey: string(),
|
|
39446
|
+
providerJobId: string().optional(),
|
|
39447
|
+
state: ProviderJobStateSchema,
|
|
39448
|
+
startedAt: number().optional(),
|
|
39449
|
+
endedAt: number().optional(),
|
|
39450
|
+
exitCode: number().int().optional(),
|
|
39451
|
+
failureReason: string().optional(),
|
|
39452
|
+
gpuType: string(),
|
|
39453
|
+
region: string().optional(),
|
|
39454
|
+
billedSeconds: number().nonnegative(),
|
|
39455
|
+
costUsd: number().nonnegative(),
|
|
39456
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
39457
|
+
costIsEstimate: boolean(),
|
|
39458
|
+
lastFetchedAt: number()
|
|
39459
|
+
});
|
|
39460
|
+
/**
|
|
39461
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
39462
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
39463
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
39464
|
+
* in `result.json`.
|
|
39465
|
+
*/
|
|
39466
|
+
var TrainerSourceRefSchema = object({
|
|
39467
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
39468
|
+
repo: string().min(1),
|
|
39469
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
39470
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
39471
|
+
});
|
|
39472
|
+
var JobRef = {
|
|
39473
|
+
addonId: string(),
|
|
39474
|
+
jobKey: string().uuid()
|
|
39475
|
+
};
|
|
39476
|
+
var TrainingLogLineSchema = object({
|
|
39477
|
+
ts: number(),
|
|
39478
|
+
text: string()
|
|
39479
|
+
});
|
|
39480
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
39481
|
+
kind: "mutation",
|
|
39482
|
+
auth: "admin",
|
|
39483
|
+
timeoutMs: 3e4
|
|
39484
|
+
}), method(object({
|
|
39485
|
+
addonId: string(),
|
|
39486
|
+
gpuType: string(),
|
|
39487
|
+
region: string(),
|
|
39488
|
+
datasetBytes: number().int().nonnegative(),
|
|
39489
|
+
gpuSecondsLow: number().nonnegative(),
|
|
39490
|
+
gpuSecondsHigh: number().nonnegative()
|
|
39491
|
+
}), object({
|
|
39492
|
+
usdLow: number().nonnegative(),
|
|
39493
|
+
usdHigh: number().nonnegative(),
|
|
39494
|
+
notes: array(string()).readonly()
|
|
39495
|
+
}), { auth: "admin" }), method(object({
|
|
39496
|
+
...JobRef,
|
|
39497
|
+
ticket: PeerBytesTicketSchema
|
|
39498
|
+
}), object({
|
|
39499
|
+
bytes: number().int().nonnegative(),
|
|
39500
|
+
sha256: string()
|
|
39501
|
+
}), {
|
|
39502
|
+
kind: "mutation",
|
|
39503
|
+
auth: "admin",
|
|
39504
|
+
timeoutMs: 120 * 6e4
|
|
39505
|
+
}), method(object({
|
|
39506
|
+
...JobRef,
|
|
39507
|
+
trainer: TrainerSourceRefSchema,
|
|
39508
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
39509
|
+
gpuType: string(),
|
|
39510
|
+
region: string(),
|
|
39511
|
+
maxRuntimeSec: number().int().positive()
|
|
39512
|
+
}), ProviderJobStatusSchema, {
|
|
39513
|
+
kind: "mutation",
|
|
39514
|
+
auth: "admin",
|
|
39515
|
+
timeoutMs: 30 * 6e4
|
|
39516
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
39517
|
+
auth: "admin",
|
|
39518
|
+
timeoutMs: 6e4
|
|
39519
|
+
}), method(object({
|
|
39520
|
+
...JobRef,
|
|
39521
|
+
cursor: string().optional(),
|
|
39522
|
+
max: number().int().min(1).max(500)
|
|
39523
|
+
}), object({
|
|
39524
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
39525
|
+
cursor: string()
|
|
39526
|
+
}), {
|
|
39527
|
+
auth: "admin",
|
|
39528
|
+
timeoutMs: 6e4
|
|
39529
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
39530
|
+
kind: "mutation",
|
|
39531
|
+
auth: "admin",
|
|
39532
|
+
timeoutMs: 6e4
|
|
39533
|
+
}), method(object(JobRef), object({
|
|
39534
|
+
found: boolean(),
|
|
39535
|
+
text: string().optional()
|
|
39536
|
+
}), {
|
|
39537
|
+
kind: "mutation",
|
|
39538
|
+
auth: "admin",
|
|
39539
|
+
timeoutMs: 5 * 6e4
|
|
39540
|
+
}), method(object({
|
|
39541
|
+
...JobRef,
|
|
39542
|
+
path: _enum(["bundle.tar"])
|
|
39543
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
39544
|
+
kind: "mutation",
|
|
39545
|
+
auth: "admin",
|
|
39546
|
+
timeoutMs: 5 * 6e4
|
|
39547
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
39548
|
+
kind: "mutation",
|
|
39549
|
+
auth: "admin",
|
|
39550
|
+
timeoutMs: 5 * 6e4
|
|
39551
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
39552
|
+
auth: "admin",
|
|
39553
|
+
timeoutMs: 2 * 6e4
|
|
39554
|
+
});
|
|
39555
|
+
/**
|
|
39556
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
39557
|
+
* provided by `addon-training`.
|
|
39558
|
+
*
|
|
39559
|
+
* It owns what every provider must agree on, written once:
|
|
39560
|
+
*
|
|
39561
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
39562
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
39563
|
+
* the export plan) and reaches this store through the five row methods
|
|
39564
|
+
* below, so the Retrain page and the export did not change.
|
|
39565
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
39566
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
39567
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
39568
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
39569
|
+
* rollback. Nothing is ever registered automatically.
|
|
39570
|
+
*
|
|
39571
|
+
* Every method is `admin`.
|
|
39572
|
+
*/
|
|
39573
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
39574
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
39575
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
39576
|
+
var TrainingBaseModelSchema = object({
|
|
39577
|
+
modelId: string(),
|
|
39578
|
+
label: string(),
|
|
39579
|
+
weights: string(),
|
|
39580
|
+
imgsz: number().int(),
|
|
39581
|
+
baselineOnnxUrl: string(),
|
|
39582
|
+
baselineFloors: record(string(), number()),
|
|
39583
|
+
/** The base the fleet runs most — the UI's default. */
|
|
39584
|
+
recommended: boolean()
|
|
39585
|
+
});
|
|
39586
|
+
var TrainingPresetSchema = _enum([
|
|
39587
|
+
"quick",
|
|
39588
|
+
"standard",
|
|
39589
|
+
"thorough"
|
|
39590
|
+
]);
|
|
39591
|
+
var TrainingJobRequestSchema = object({
|
|
39592
|
+
datasetVersionId: string().min(1),
|
|
39593
|
+
/** The `training-provider` addon that runs it. */
|
|
39594
|
+
addonId: string().min(1),
|
|
39595
|
+
gpuType: string().min(1),
|
|
39596
|
+
region: string(),
|
|
39597
|
+
baseModelId: string().min(1),
|
|
39598
|
+
preset: TrainingPresetSchema,
|
|
39599
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
39600
|
+
freeze: number().int().nonnegative().nullable(),
|
|
39601
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
39602
|
+
holdoutCameras: array(number().int()).nullable()
|
|
39603
|
+
});
|
|
39604
|
+
var TrainingSplitPlanSchema = object({
|
|
39605
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
39606
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
39607
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
39608
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
39609
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
39610
|
+
trainSubjects: number().int()
|
|
39611
|
+
});
|
|
39612
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
39613
|
+
"unknown-dataset",
|
|
39614
|
+
"unknown-provider",
|
|
39615
|
+
"provider-not-configured",
|
|
39616
|
+
"unknown-base-model",
|
|
39617
|
+
"unknown-gpu",
|
|
39618
|
+
"dataset-too-large",
|
|
39619
|
+
"no-training-subjects",
|
|
39620
|
+
"job-already-running"
|
|
39621
|
+
]);
|
|
39622
|
+
var TrainingJobPlanSchema = object({
|
|
39623
|
+
refusal: object({
|
|
39624
|
+
reason: TrainingRefusalReasonSchema,
|
|
39625
|
+
detail: string()
|
|
39626
|
+
}).nullable(),
|
|
39627
|
+
warnings: array(string()).readonly(),
|
|
39628
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
39629
|
+
estimate: object({
|
|
39630
|
+
datasetBytes: number().int(),
|
|
39631
|
+
uploadMinutesAt20Mbps: number(),
|
|
39632
|
+
gpuSecondsLow: number(),
|
|
39633
|
+
gpuSecondsHigh: number(),
|
|
39634
|
+
usdLow: number(),
|
|
39635
|
+
usdHigh: number(),
|
|
39636
|
+
notes: array(string()).readonly()
|
|
39637
|
+
}).nullable(),
|
|
39638
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
39639
|
+
defaults: object({
|
|
39640
|
+
maxCostUsd: number(),
|
|
39641
|
+
maxRuntimeSec: number().int()
|
|
39642
|
+
}).nullable(),
|
|
39643
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
39644
|
+
dataNotice: string()
|
|
39645
|
+
});
|
|
39646
|
+
/**
|
|
39647
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
39648
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
39649
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
39650
|
+
* result lives after the operator acted on it.
|
|
39651
|
+
*/
|
|
39652
|
+
var TrainingJobStateSchema = _enum([
|
|
39653
|
+
"uploading",
|
|
39654
|
+
"submitted",
|
|
39655
|
+
"starting",
|
|
39656
|
+
"running",
|
|
39657
|
+
"collecting",
|
|
39658
|
+
"ready",
|
|
39659
|
+
"registered",
|
|
39660
|
+
"canary",
|
|
39661
|
+
"failed",
|
|
39662
|
+
"cancelling",
|
|
39663
|
+
"cancelled",
|
|
39664
|
+
"lost",
|
|
39665
|
+
"expired",
|
|
39666
|
+
"discarded"
|
|
39667
|
+
]);
|
|
39668
|
+
var TrainingFailureReasonSchema = _enum([
|
|
39669
|
+
"cost-cap",
|
|
39670
|
+
"runtime-cap",
|
|
39671
|
+
"upload-failed",
|
|
39672
|
+
"submit-failed",
|
|
39673
|
+
"trainer-failed",
|
|
39674
|
+
"result-invalid",
|
|
39675
|
+
"checksum-mismatch",
|
|
39676
|
+
"fetch-failed",
|
|
39677
|
+
"provider-error",
|
|
39678
|
+
"hub-restart-during-upload"
|
|
39679
|
+
]);
|
|
39680
|
+
var TrainingProgressPointSchema = object({
|
|
39681
|
+
epoch: number().int(),
|
|
39682
|
+
map50: number().nullable(),
|
|
39683
|
+
map50_95: number().nullable()
|
|
39684
|
+
});
|
|
39685
|
+
var TrainingCanarySchema = object({
|
|
39686
|
+
deviceIds: array(number().int()).readonly(),
|
|
39687
|
+
since: number(),
|
|
39688
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
39689
|
+
previous: array(object({
|
|
39690
|
+
deviceId: number().int(),
|
|
39691
|
+
nodeId: string(),
|
|
39692
|
+
deviceKey: string(),
|
|
39693
|
+
patch: object({
|
|
39694
|
+
modelId: string().optional(),
|
|
39695
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
39696
|
+
}).nullable()
|
|
39697
|
+
})).readonly()
|
|
39698
|
+
});
|
|
39699
|
+
var TrainingJobSchema = object({
|
|
39700
|
+
id: string(),
|
|
39701
|
+
idempotencyKey: string(),
|
|
39702
|
+
name: string(),
|
|
39703
|
+
createdAt: number(),
|
|
39704
|
+
updatedAt: number(),
|
|
39705
|
+
state: TrainingJobStateSchema,
|
|
39706
|
+
stage: TrainingStageSchema.nullable(),
|
|
39707
|
+
failure: object({
|
|
39708
|
+
reason: TrainingFailureReasonSchema,
|
|
39709
|
+
stage: string().nullable(),
|
|
39710
|
+
detail: string()
|
|
39711
|
+
}).nullable(),
|
|
39712
|
+
request: TrainingJobRequestSchema,
|
|
39713
|
+
maxCostUsd: number().nonnegative(),
|
|
39714
|
+
maxRuntimeSec: number().int().positive(),
|
|
39715
|
+
trainer: TrainerSourceRefSchema,
|
|
39716
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
39717
|
+
dataset: object({
|
|
39718
|
+
bytes: number().int(),
|
|
39719
|
+
sha256: string(),
|
|
39720
|
+
uploadedAt: number()
|
|
39721
|
+
}).nullable(),
|
|
39722
|
+
split: TrainingSplitPlanSchema,
|
|
39723
|
+
provider: object({
|
|
39724
|
+
state: ProviderJobStateSchema.nullable(),
|
|
39725
|
+
providerJobId: string().nullable(),
|
|
39726
|
+
startedAt: number().nullable(),
|
|
39727
|
+
endedAt: number().nullable(),
|
|
39728
|
+
billedSeconds: number(),
|
|
39729
|
+
costUsd: number(),
|
|
39730
|
+
costIsEstimate: boolean(),
|
|
39731
|
+
lastPolledAt: number().nullable()
|
|
39732
|
+
}),
|
|
39733
|
+
progress: object({
|
|
39734
|
+
epoch: number().int().nullable(),
|
|
39735
|
+
epochs: number().int().nullable(),
|
|
39736
|
+
etaSec: number().nullable(),
|
|
39737
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
39738
|
+
}),
|
|
39739
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
39740
|
+
logTail: array(string()).readonly(),
|
|
39741
|
+
logCursor: string().nullable(),
|
|
39742
|
+
artifacts: object({
|
|
39743
|
+
bundleBytes: number().int(),
|
|
39744
|
+
bundleSha256: string(),
|
|
39745
|
+
fetchedAt: number(),
|
|
39746
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
39747
|
+
expiresAt: number()
|
|
39748
|
+
}).nullable(),
|
|
39749
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
39750
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
39751
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
39752
|
+
cloudCleanupDueAt: number().nullable(),
|
|
39753
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
39754
|
+
registeredModelIds: array(string()).readonly(),
|
|
39755
|
+
canary: TrainingCanarySchema.nullable()
|
|
39756
|
+
});
|
|
39757
|
+
var IdInput = object({ id: string().min(1) });
|
|
39758
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
39759
|
+
kind: "mutation",
|
|
39760
|
+
auth: "admin"
|
|
39761
|
+
}), 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() }), {
|
|
39762
|
+
kind: "mutation",
|
|
39763
|
+
auth: "admin"
|
|
39764
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
39765
|
+
auth: "admin",
|
|
39766
|
+
timeoutMs: 6e4
|
|
39767
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
39768
|
+
name: string().min(1).max(120),
|
|
39769
|
+
maxCostUsd: number().positive(),
|
|
39770
|
+
maxRuntimeSec: number().int().positive(),
|
|
39771
|
+
idempotencyKey: string().min(8).max(80)
|
|
39772
|
+
}), discriminatedUnion("kind", [object({
|
|
39773
|
+
kind: literal("started"),
|
|
39774
|
+
job: TrainingJobSchema
|
|
39775
|
+
}), object({
|
|
39776
|
+
kind: literal("refused"),
|
|
39777
|
+
reason: TrainingRefusalReasonSchema,
|
|
39778
|
+
detail: string()
|
|
39779
|
+
})]), {
|
|
39780
|
+
kind: "mutation",
|
|
39781
|
+
auth: "admin",
|
|
39782
|
+
timeoutMs: 12e4
|
|
39783
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
39784
|
+
kind: "mutation",
|
|
39785
|
+
auth: "admin",
|
|
39786
|
+
timeoutMs: 12e4
|
|
39787
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
39788
|
+
kind: "mutation",
|
|
39789
|
+
auth: "admin",
|
|
39790
|
+
timeoutMs: 30 * 6e4
|
|
39791
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
39792
|
+
kind: "mutation",
|
|
39793
|
+
auth: "admin",
|
|
39794
|
+
timeoutMs: 12e4
|
|
39795
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39796
|
+
kind: "mutation",
|
|
39797
|
+
auth: "admin",
|
|
39798
|
+
timeoutMs: 12e4
|
|
39799
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39800
|
+
kind: "mutation",
|
|
39801
|
+
auth: "admin"
|
|
39802
|
+
});
|
|
38402
39803
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
38403
39804
|
Object.freeze({
|
|
38404
39805
|
person: .5,
|
|
@@ -39022,6 +40423,12 @@ Object.freeze({
|
|
|
39022
40423
|
addonId: null,
|
|
39023
40424
|
access: "create"
|
|
39024
40425
|
},
|
|
40426
|
+
"backup.checkBackupKey": {
|
|
40427
|
+
capName: "backup",
|
|
40428
|
+
capScope: "system",
|
|
40429
|
+
addonId: null,
|
|
40430
|
+
access: "create"
|
|
40431
|
+
},
|
|
39025
40432
|
"backup.delete": {
|
|
39026
40433
|
capName: "backup",
|
|
39027
40434
|
capScope: "system",
|
|
@@ -39034,6 +40441,18 @@ Object.freeze({
|
|
|
39034
40441
|
addonId: null,
|
|
39035
40442
|
access: "delete"
|
|
39036
40443
|
},
|
|
40444
|
+
"backup.disableEncryption": {
|
|
40445
|
+
capName: "backup",
|
|
40446
|
+
capScope: "system",
|
|
40447
|
+
addonId: null,
|
|
40448
|
+
access: "create"
|
|
40449
|
+
},
|
|
40450
|
+
"backup.getEncryption": {
|
|
40451
|
+
capName: "backup",
|
|
40452
|
+
capScope: "system",
|
|
40453
|
+
addonId: null,
|
|
40454
|
+
access: "view"
|
|
40455
|
+
},
|
|
39037
40456
|
"backup.getEntries": {
|
|
39038
40457
|
capName: "backup",
|
|
39039
40458
|
capScope: "system",
|
|
@@ -39088,6 +40507,12 @@ Object.freeze({
|
|
|
39088
40507
|
addonId: null,
|
|
39089
40508
|
access: "create"
|
|
39090
40509
|
},
|
|
40510
|
+
"backup.setupEncryption": {
|
|
40511
|
+
capName: "backup",
|
|
40512
|
+
capScope: "system",
|
|
40513
|
+
addonId: null,
|
|
40514
|
+
access: "create"
|
|
40515
|
+
},
|
|
39091
40516
|
"backup.trigger": {
|
|
39092
40517
|
capName: "backup",
|
|
39093
40518
|
capScope: "system",
|
|
@@ -39640,6 +41065,12 @@ Object.freeze({
|
|
|
39640
41065
|
addonId: null,
|
|
39641
41066
|
access: "create"
|
|
39642
41067
|
},
|
|
41068
|
+
"customModelRegistry.importModelBundle": {
|
|
41069
|
+
capName: "custom-model-registry",
|
|
41070
|
+
capScope: "system",
|
|
41071
|
+
addonId: null,
|
|
41072
|
+
access: "create"
|
|
41073
|
+
},
|
|
39643
41074
|
"customModelRegistry.listModels": {
|
|
39644
41075
|
capName: "custom-model-registry",
|
|
39645
41076
|
capScope: "system",
|
|
@@ -41080,6 +42511,12 @@ Object.freeze({
|
|
|
41080
42511
|
addonId: null,
|
|
41081
42512
|
access: "view"
|
|
41082
42513
|
},
|
|
42514
|
+
"keychainAdmin.acknowledgeReset": {
|
|
42515
|
+
capName: "keychain-admin",
|
|
42516
|
+
capScope: "system",
|
|
42517
|
+
addonId: null,
|
|
42518
|
+
access: "create"
|
|
42519
|
+
},
|
|
41083
42520
|
"keychainAdmin.deleteOrphans": {
|
|
41084
42521
|
capName: "keychain-admin",
|
|
41085
42522
|
capScope: "system",
|
|
@@ -41116,6 +42553,12 @@ Object.freeze({
|
|
|
41116
42553
|
addonId: null,
|
|
41117
42554
|
access: "delete"
|
|
41118
42555
|
},
|
|
42556
|
+
"keychainAdmin.resetReport": {
|
|
42557
|
+
capName: "keychain-admin",
|
|
42558
|
+
capScope: "system",
|
|
42559
|
+
addonId: null,
|
|
42560
|
+
access: "delete"
|
|
42561
|
+
},
|
|
41119
42562
|
"keychainAdmin.reveal": {
|
|
41120
42563
|
capName: "keychain-admin",
|
|
41121
42564
|
capScope: "system",
|
|
@@ -41128,6 +42571,12 @@ Object.freeze({
|
|
|
41128
42571
|
addonId: null,
|
|
41129
42572
|
access: "create"
|
|
41130
42573
|
},
|
|
42574
|
+
"keychainAdmin.setSystemSecret": {
|
|
42575
|
+
capName: "keychain-admin",
|
|
42576
|
+
capScope: "system",
|
|
42577
|
+
addonId: null,
|
|
42578
|
+
access: "create"
|
|
42579
|
+
},
|
|
41131
42580
|
"keychainAdmin.status": {
|
|
41132
42581
|
capName: "keychain-admin",
|
|
41133
42582
|
capScope: "system",
|
|
@@ -42574,6 +44023,12 @@ Object.freeze({
|
|
|
42574
44023
|
addonId: null,
|
|
42575
44024
|
access: "create"
|
|
42576
44025
|
},
|
|
44026
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
44027
|
+
capName: "pipeline-analytics",
|
|
44028
|
+
capScope: "device",
|
|
44029
|
+
addonId: null,
|
|
44030
|
+
access: "create"
|
|
44031
|
+
},
|
|
42577
44032
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
42578
44033
|
capName: "pipeline-analytics",
|
|
42579
44034
|
capScope: "device",
|
|
@@ -42586,6 +44041,12 @@ Object.freeze({
|
|
|
42586
44041
|
addonId: null,
|
|
42587
44042
|
access: "delete"
|
|
42588
44043
|
},
|
|
44044
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
44045
|
+
capName: "pipeline-analytics",
|
|
44046
|
+
capScope: "device",
|
|
44047
|
+
addonId: null,
|
|
44048
|
+
access: "delete"
|
|
44049
|
+
},
|
|
42589
44050
|
"pipelineAnalytics.deleteTracks": {
|
|
42590
44051
|
capName: "pipeline-analytics",
|
|
42591
44052
|
capScope: "device",
|
|
@@ -42808,6 +44269,12 @@ Object.freeze({
|
|
|
42808
44269
|
addonId: null,
|
|
42809
44270
|
access: "view"
|
|
42810
44271
|
},
|
|
44272
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
44273
|
+
capName: "pipeline-analytics",
|
|
44274
|
+
capScope: "device",
|
|
44275
|
+
addonId: null,
|
|
44276
|
+
access: "view"
|
|
44277
|
+
},
|
|
42811
44278
|
"pipelineAnalytics.listRetrainFrames": {
|
|
42812
44279
|
capName: "pipeline-analytics",
|
|
42813
44280
|
capScope: "device",
|
|
@@ -42838,6 +44305,12 @@ Object.freeze({
|
|
|
42838
44305
|
addonId: null,
|
|
42839
44306
|
access: "view"
|
|
42840
44307
|
},
|
|
44308
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
44309
|
+
capName: "pipeline-analytics",
|
|
44310
|
+
capScope: "device",
|
|
44311
|
+
addonId: null,
|
|
44312
|
+
access: "create"
|
|
44313
|
+
},
|
|
42841
44314
|
"pipelineAnalytics.ownersWithMedia": {
|
|
42842
44315
|
capName: "pipeline-analytics",
|
|
42843
44316
|
capScope: "device",
|
|
@@ -42850,6 +44323,12 @@ Object.freeze({
|
|
|
42850
44323
|
addonId: null,
|
|
42851
44324
|
access: "create"
|
|
42852
44325
|
},
|
|
44326
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
44327
|
+
capName: "pipeline-analytics",
|
|
44328
|
+
capScope: "device",
|
|
44329
|
+
addonId: null,
|
|
44330
|
+
access: "view"
|
|
44331
|
+
},
|
|
42853
44332
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
42854
44333
|
capName: "pipeline-analytics",
|
|
42855
44334
|
capScope: "device",
|
|
@@ -42988,6 +44467,12 @@ Object.freeze({
|
|
|
42988
44467
|
addonId: null,
|
|
42989
44468
|
access: "create"
|
|
42990
44469
|
},
|
|
44470
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
44471
|
+
capName: "pipeline-analytics",
|
|
44472
|
+
capScope: "device",
|
|
44473
|
+
addonId: null,
|
|
44474
|
+
access: "view"
|
|
44475
|
+
},
|
|
42991
44476
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
42992
44477
|
capName: "pipeline-analytics",
|
|
42993
44478
|
capScope: "device",
|
|
@@ -45364,6 +46849,174 @@ Object.freeze({
|
|
|
45364
46849
|
addonId: null,
|
|
45365
46850
|
access: "view"
|
|
45366
46851
|
},
|
|
46852
|
+
"training.canaryResult": {
|
|
46853
|
+
capName: "training",
|
|
46854
|
+
capScope: "system",
|
|
46855
|
+
addonId: null,
|
|
46856
|
+
access: "create"
|
|
46857
|
+
},
|
|
46858
|
+
"training.cancelJob": {
|
|
46859
|
+
capName: "training",
|
|
46860
|
+
capScope: "system",
|
|
46861
|
+
addonId: null,
|
|
46862
|
+
access: "create"
|
|
46863
|
+
},
|
|
46864
|
+
"training.discardResult": {
|
|
46865
|
+
capName: "training",
|
|
46866
|
+
capScope: "system",
|
|
46867
|
+
addonId: null,
|
|
46868
|
+
access: "create"
|
|
46869
|
+
},
|
|
46870
|
+
"training.findDatasetVersionIdByName": {
|
|
46871
|
+
capName: "training",
|
|
46872
|
+
capScope: "system",
|
|
46873
|
+
addonId: null,
|
|
46874
|
+
access: "view"
|
|
46875
|
+
},
|
|
46876
|
+
"training.getDatasetVersion": {
|
|
46877
|
+
capName: "training",
|
|
46878
|
+
capScope: "system",
|
|
46879
|
+
addonId: null,
|
|
46880
|
+
access: "view"
|
|
46881
|
+
},
|
|
46882
|
+
"training.getJob": {
|
|
46883
|
+
capName: "training",
|
|
46884
|
+
capScope: "system",
|
|
46885
|
+
addonId: null,
|
|
46886
|
+
access: "view"
|
|
46887
|
+
},
|
|
46888
|
+
"training.getJobResult": {
|
|
46889
|
+
capName: "training",
|
|
46890
|
+
capScope: "system",
|
|
46891
|
+
addonId: null,
|
|
46892
|
+
access: "view"
|
|
46893
|
+
},
|
|
46894
|
+
"training.listBaseModels": {
|
|
46895
|
+
capName: "training",
|
|
46896
|
+
capScope: "system",
|
|
46897
|
+
addonId: null,
|
|
46898
|
+
access: "view"
|
|
46899
|
+
},
|
|
46900
|
+
"training.listDatasetVersions": {
|
|
46901
|
+
capName: "training",
|
|
46902
|
+
capScope: "system",
|
|
46903
|
+
addonId: null,
|
|
46904
|
+
access: "view"
|
|
46905
|
+
},
|
|
46906
|
+
"training.listJobs": {
|
|
46907
|
+
capName: "training",
|
|
46908
|
+
capScope: "system",
|
|
46909
|
+
addonId: null,
|
|
46910
|
+
access: "view"
|
|
46911
|
+
},
|
|
46912
|
+
"training.planJob": {
|
|
46913
|
+
capName: "training",
|
|
46914
|
+
capScope: "system",
|
|
46915
|
+
addonId: null,
|
|
46916
|
+
access: "view"
|
|
46917
|
+
},
|
|
46918
|
+
"training.putDatasetVersion": {
|
|
46919
|
+
capName: "training",
|
|
46920
|
+
capScope: "system",
|
|
46921
|
+
addonId: null,
|
|
46922
|
+
access: "create"
|
|
46923
|
+
},
|
|
46924
|
+
"training.registerResult": {
|
|
46925
|
+
capName: "training",
|
|
46926
|
+
capScope: "system",
|
|
46927
|
+
addonId: null,
|
|
46928
|
+
access: "create"
|
|
46929
|
+
},
|
|
46930
|
+
"training.removeDatasetVersion": {
|
|
46931
|
+
capName: "training",
|
|
46932
|
+
capScope: "system",
|
|
46933
|
+
addonId: null,
|
|
46934
|
+
access: "delete"
|
|
46935
|
+
},
|
|
46936
|
+
"training.rollbackCanary": {
|
|
46937
|
+
capName: "training",
|
|
46938
|
+
capScope: "system",
|
|
46939
|
+
addonId: null,
|
|
46940
|
+
access: "create"
|
|
46941
|
+
},
|
|
46942
|
+
"training.startJob": {
|
|
46943
|
+
capName: "training",
|
|
46944
|
+
capScope: "system",
|
|
46945
|
+
addonId: null,
|
|
46946
|
+
access: "create"
|
|
46947
|
+
},
|
|
46948
|
+
"trainingProvider.cancelJob": {
|
|
46949
|
+
capName: "training-provider",
|
|
46950
|
+
capScope: "system",
|
|
46951
|
+
addonId: null,
|
|
46952
|
+
access: "create"
|
|
46953
|
+
},
|
|
46954
|
+
"trainingProvider.cleanupJob": {
|
|
46955
|
+
capName: "training-provider",
|
|
46956
|
+
capScope: "system",
|
|
46957
|
+
addonId: null,
|
|
46958
|
+
access: "create"
|
|
46959
|
+
},
|
|
46960
|
+
"trainingProvider.describe": {
|
|
46961
|
+
capName: "training-provider",
|
|
46962
|
+
capScope: "system",
|
|
46963
|
+
addonId: null,
|
|
46964
|
+
access: "view"
|
|
46965
|
+
},
|
|
46966
|
+
"trainingProvider.estimateJob": {
|
|
46967
|
+
capName: "training-provider",
|
|
46968
|
+
capScope: "system",
|
|
46969
|
+
addonId: null,
|
|
46970
|
+
access: "view"
|
|
46971
|
+
},
|
|
46972
|
+
"trainingProvider.getJob": {
|
|
46973
|
+
capName: "training-provider",
|
|
46974
|
+
capScope: "system",
|
|
46975
|
+
addonId: null,
|
|
46976
|
+
access: "view"
|
|
46977
|
+
},
|
|
46978
|
+
"trainingProvider.listJobEvents": {
|
|
46979
|
+
capName: "training-provider",
|
|
46980
|
+
capScope: "system",
|
|
46981
|
+
addonId: null,
|
|
46982
|
+
access: "view"
|
|
46983
|
+
},
|
|
46984
|
+
"trainingProvider.listJobs": {
|
|
46985
|
+
capName: "training-provider",
|
|
46986
|
+
capScope: "system",
|
|
46987
|
+
addonId: null,
|
|
46988
|
+
access: "view"
|
|
46989
|
+
},
|
|
46990
|
+
"trainingProvider.offerArtifact": {
|
|
46991
|
+
capName: "training-provider",
|
|
46992
|
+
capScope: "system",
|
|
46993
|
+
addonId: null,
|
|
46994
|
+
access: "create"
|
|
46995
|
+
},
|
|
46996
|
+
"trainingProvider.readResult": {
|
|
46997
|
+
capName: "training-provider",
|
|
46998
|
+
capScope: "system",
|
|
46999
|
+
addonId: null,
|
|
47000
|
+
access: "create"
|
|
47001
|
+
},
|
|
47002
|
+
"trainingProvider.submitJob": {
|
|
47003
|
+
capName: "training-provider",
|
|
47004
|
+
capScope: "system",
|
|
47005
|
+
addonId: null,
|
|
47006
|
+
access: "create"
|
|
47007
|
+
},
|
|
47008
|
+
"trainingProvider.uploadDataset": {
|
|
47009
|
+
capName: "training-provider",
|
|
47010
|
+
capScope: "system",
|
|
47011
|
+
addonId: null,
|
|
47012
|
+
access: "create"
|
|
47013
|
+
},
|
|
47014
|
+
"trainingProvider.validateCredentials": {
|
|
47015
|
+
capName: "training-provider",
|
|
47016
|
+
capScope: "system",
|
|
47017
|
+
addonId: null,
|
|
47018
|
+
access: "create"
|
|
47019
|
+
},
|
|
45367
47020
|
"turnProvider.getTurnServers": {
|
|
45368
47021
|
capName: "turn-provider",
|
|
45369
47022
|
capScope: "system",
|
|
@@ -45388,12 +47041,6 @@ Object.freeze({
|
|
|
45388
47041
|
addonId: null,
|
|
45389
47042
|
access: "create"
|
|
45390
47043
|
},
|
|
45391
|
-
"userManagement.createApiKey": {
|
|
45392
|
-
capName: "user-management",
|
|
45393
|
-
capScope: "system",
|
|
45394
|
-
addonId: null,
|
|
45395
|
-
access: "create"
|
|
45396
|
-
},
|
|
45397
47044
|
"userManagement.createScopedToken": {
|
|
45398
47045
|
capName: "user-management",
|
|
45399
47046
|
capScope: "system",
|
|
@@ -45430,12 +47077,6 @@ Object.freeze({
|
|
|
45430
47077
|
addonId: null,
|
|
45431
47078
|
access: "view"
|
|
45432
47079
|
},
|
|
45433
|
-
"userManagement.linkExternalIdentity": {
|
|
45434
|
-
capName: "user-management",
|
|
45435
|
-
capScope: "system",
|
|
45436
|
-
addonId: null,
|
|
45437
|
-
access: "create"
|
|
45438
|
-
},
|
|
45439
47080
|
"userManagement.listApiKeys": {
|
|
45440
47081
|
capName: "user-management",
|
|
45441
47082
|
capScope: "system",
|
|
@@ -45538,12 +47179,6 @@ Object.freeze({
|
|
|
45538
47179
|
addonId: null,
|
|
45539
47180
|
access: "create"
|
|
45540
47181
|
},
|
|
45541
|
-
"userManagement.validateApiKey": {
|
|
45542
|
-
capName: "user-management",
|
|
45543
|
-
capScope: "system",
|
|
45544
|
-
addonId: null,
|
|
45545
|
-
access: "view"
|
|
45546
|
-
},
|
|
45547
47182
|
"userManagement.validateCredentials": {
|
|
45548
47183
|
capName: "user-management",
|
|
45549
47184
|
capScope: "system",
|
|
@@ -49657,6 +51292,11 @@ Object.freeze({
|
|
|
49657
51292
|
form: "single",
|
|
49658
51293
|
optional: false
|
|
49659
51294
|
}],
|
|
51295
|
+
"training.canaryResult": [{
|
|
51296
|
+
name: "deviceIds",
|
|
51297
|
+
form: "array",
|
|
51298
|
+
optional: false
|
|
51299
|
+
}],
|
|
49660
51300
|
"update.getStatus": [{
|
|
49661
51301
|
name: "deviceId",
|
|
49662
51302
|
form: "single",
|