@camstack/addon-provider-rademacher 0.2.124 → 0.2.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1771 -131
- package/dist/addon.mjs +1771 -131
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -6362,7 +6362,7 @@ var ZodIssueCode = {
|
|
|
6362
6362
|
var ZodFirstPartyTypeKind;
|
|
6363
6363
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6364
6364
|
//#endregion
|
|
6365
|
-
//#region ../types/dist/sleep-
|
|
6365
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6366
6366
|
/**
|
|
6367
6367
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6368
6368
|
* window to float samples (D455).
|
|
@@ -6479,7 +6479,7 @@ function isKeychainStoredField(field) {
|
|
|
6479
6479
|
var SECRET_CLEAR = { $secretClear: true };
|
|
6480
6480
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6481
6481
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
6482
|
-
function isRecord$
|
|
6482
|
+
function isRecord$2(value) {
|
|
6483
6483
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6484
6484
|
}
|
|
6485
6485
|
function makeSecretMarker(ref) {
|
|
@@ -6490,12 +6490,12 @@ function makeSecretMarker(ref) {
|
|
|
6490
6490
|
}
|
|
6491
6491
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6492
6492
|
function isSecretMarker(value) {
|
|
6493
|
-
if (!isRecord$
|
|
6493
|
+
if (!isRecord$2(value)) return false;
|
|
6494
6494
|
const ref = value["$secret"];
|
|
6495
6495
|
return typeof ref === "string" && ref.length > 0;
|
|
6496
6496
|
}
|
|
6497
6497
|
function isSecretClear(value) {
|
|
6498
|
-
return isRecord$
|
|
6498
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6499
6499
|
}
|
|
6500
6500
|
/**
|
|
6501
6501
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -7011,6 +7011,13 @@ function globalSecretScope() {
|
|
|
7011
7011
|
function encodeSegment(value) {
|
|
7012
7012
|
return encodeURIComponent(value);
|
|
7013
7013
|
}
|
|
7014
|
+
function decodeSegment(value) {
|
|
7015
|
+
try {
|
|
7016
|
+
return decodeURIComponent(value);
|
|
7017
|
+
} catch {
|
|
7018
|
+
return null;
|
|
7019
|
+
}
|
|
7020
|
+
}
|
|
7014
7021
|
/**
|
|
7015
7022
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
7016
7023
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -7019,6 +7026,75 @@ function encodeSegment(value) {
|
|
|
7019
7026
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
7020
7027
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
7021
7028
|
}
|
|
7029
|
+
function parseScope(segments) {
|
|
7030
|
+
switch (segments[0]) {
|
|
7031
|
+
case "global": return {
|
|
7032
|
+
scope: GLOBAL_SCOPE,
|
|
7033
|
+
used: 1
|
|
7034
|
+
};
|
|
7035
|
+
case "node": {
|
|
7036
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7037
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
7038
|
+
scope: {
|
|
7039
|
+
kind: "node",
|
|
7040
|
+
nodeId
|
|
7041
|
+
},
|
|
7042
|
+
used: 2
|
|
7043
|
+
};
|
|
7044
|
+
}
|
|
7045
|
+
case "device": {
|
|
7046
|
+
const raw = segments[1];
|
|
7047
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
7048
|
+
return {
|
|
7049
|
+
scope: {
|
|
7050
|
+
kind: "device",
|
|
7051
|
+
deviceId: Number(raw)
|
|
7052
|
+
},
|
|
7053
|
+
used: 2
|
|
7054
|
+
};
|
|
7055
|
+
}
|
|
7056
|
+
case "integration": {
|
|
7057
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7058
|
+
return id === null || id.length === 0 ? null : {
|
|
7059
|
+
scope: {
|
|
7060
|
+
kind: "integration",
|
|
7061
|
+
integrationId: id
|
|
7062
|
+
},
|
|
7063
|
+
used: 2
|
|
7064
|
+
};
|
|
7065
|
+
}
|
|
7066
|
+
case "row": {
|
|
7067
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7068
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
7069
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
7070
|
+
return {
|
|
7071
|
+
scope: {
|
|
7072
|
+
kind: "row",
|
|
7073
|
+
collection,
|
|
7074
|
+
rowId
|
|
7075
|
+
},
|
|
7076
|
+
used: 3
|
|
7077
|
+
};
|
|
7078
|
+
}
|
|
7079
|
+
default: return null;
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
7083
|
+
function parseSecretRef(ref) {
|
|
7084
|
+
if (!ref.startsWith("secret://")) return null;
|
|
7085
|
+
const segments = ref.slice(9).split("/");
|
|
7086
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
7087
|
+
if (owner === null || owner.length === 0) return null;
|
|
7088
|
+
const parsed = parseScope(segments.slice(1));
|
|
7089
|
+
if (parsed === null) return null;
|
|
7090
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
7091
|
+
if (fieldPath.length === 0) return null;
|
|
7092
|
+
return {
|
|
7093
|
+
owner,
|
|
7094
|
+
scope: parsed.scope,
|
|
7095
|
+
fieldPath
|
|
7096
|
+
};
|
|
7097
|
+
}
|
|
7022
7098
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7023
7099
|
var KeychainWriteRefusedError = class extends Error {
|
|
7024
7100
|
fieldPath;
|
|
@@ -7029,7 +7105,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
7029
7105
|
}
|
|
7030
7106
|
};
|
|
7031
7107
|
var KEEP = { kind: "keep" };
|
|
7032
|
-
function isRecord(value) {
|
|
7108
|
+
function isRecord$1(value) {
|
|
7033
7109
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7034
7110
|
}
|
|
7035
7111
|
function defaultMintId() {
|
|
@@ -7042,7 +7118,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
7042
7118
|
return out;
|
|
7043
7119
|
}
|
|
7044
7120
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
7045
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7121
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7046
7122
|
return out;
|
|
7047
7123
|
}
|
|
7048
7124
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -7097,7 +7173,7 @@ function rowId(row, idKey) {
|
|
|
7097
7173
|
return null;
|
|
7098
7174
|
}
|
|
7099
7175
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7100
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
7176
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
7101
7177
|
if (!Array.isArray(incoming)) {
|
|
7102
7178
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7103
7179
|
return {
|
|
@@ -7113,7 +7189,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
7113
7189
|
const kept = /* @__PURE__ */ new Set();
|
|
7114
7190
|
const rows = [];
|
|
7115
7191
|
for (const row of incoming) {
|
|
7116
|
-
if (!isRecord(row)) {
|
|
7192
|
+
if (!isRecord$1(row)) {
|
|
7117
7193
|
rows.push(row);
|
|
7118
7194
|
continue;
|
|
7119
7195
|
}
|
|
@@ -7138,7 +7214,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7138
7214
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7139
7215
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7140
7216
|
case "object": {
|
|
7141
|
-
if (!isRecord(incoming)) {
|
|
7217
|
+
if (!isRecord$1(incoming)) {
|
|
7142
7218
|
if (incoming === void 0) return KEEP;
|
|
7143
7219
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7144
7220
|
return {
|
|
@@ -7146,7 +7222,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7146
7222
|
value: incoming
|
|
7147
7223
|
};
|
|
7148
7224
|
}
|
|
7149
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
7225
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
7150
7226
|
return {
|
|
7151
7227
|
kind: "value",
|
|
7152
7228
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7205,12 +7281,19 @@ async function transformSecretWrite(input) {
|
|
|
7205
7281
|
}
|
|
7206
7282
|
};
|
|
7207
7283
|
}
|
|
7284
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7285
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7286
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7287
|
+
}
|
|
7208
7288
|
/**
|
|
7209
7289
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7210
7290
|
* reference when there is no marker (no allocation, no keychain call).
|
|
7211
7291
|
*/
|
|
7212
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
7213
|
-
const
|
|
7292
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7293
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7294
|
+
const owner = options.ownedBy;
|
|
7295
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7296
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7214
7297
|
if (refs.length === 0) return {
|
|
7215
7298
|
value,
|
|
7216
7299
|
unresolved: []
|
|
@@ -7234,10 +7317,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7234
7317
|
}
|
|
7235
7318
|
const substitute = (v) => {
|
|
7236
7319
|
if (isSecretMarker(v)) {
|
|
7320
|
+
if (!inScope(v.$secret)) return {
|
|
7321
|
+
keep: true,
|
|
7322
|
+
value: v
|
|
7323
|
+
};
|
|
7237
7324
|
const answer = answers[v.$secret];
|
|
7238
|
-
|
|
7325
|
+
if (answer?.kind === "value") return {
|
|
7239
7326
|
keep: true,
|
|
7240
7327
|
value: answer.value
|
|
7328
|
+
};
|
|
7329
|
+
return keepMarker ? {
|
|
7330
|
+
keep: true,
|
|
7331
|
+
value: v
|
|
7241
7332
|
} : {
|
|
7242
7333
|
keep: false,
|
|
7243
7334
|
value: void 0
|
|
@@ -7254,7 +7345,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7254
7345
|
value: items
|
|
7255
7346
|
};
|
|
7256
7347
|
}
|
|
7257
|
-
if (isRecord(v)) {
|
|
7348
|
+
if (isRecord$1(v)) {
|
|
7258
7349
|
const out = {};
|
|
7259
7350
|
for (const [k, child] of Object.entries(v)) {
|
|
7260
7351
|
const s = substitute(child);
|
|
@@ -7275,14 +7366,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7275
7366
|
unresolved
|
|
7276
7367
|
};
|
|
7277
7368
|
}
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7369
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7370
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7371
|
+
ref;
|
|
7372
|
+
reason;
|
|
7373
|
+
constructor(ref, reason) {
|
|
7374
|
+
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.`);
|
|
7375
|
+
this.ref = ref;
|
|
7376
|
+
this.reason = reason;
|
|
7377
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7378
|
+
}
|
|
7379
|
+
};
|
|
7380
|
+
function isRecord(value) {
|
|
7381
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7382
|
+
}
|
|
7383
|
+
function resolvedValue(pass, marker) {
|
|
7384
|
+
const answer = pass.answers[marker.$secret];
|
|
7385
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7386
|
+
}
|
|
7387
|
+
async function atMarker(pass, incoming, stored) {
|
|
7388
|
+
if (incoming === null) return stored;
|
|
7389
|
+
if (typeof incoming !== "string") return incoming;
|
|
7390
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7391
|
+
const intent = classifySecretWrite(incoming);
|
|
7392
|
+
if (intent.kind !== "set") return stored;
|
|
7393
|
+
const ref = stored.$secret;
|
|
7394
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7395
|
+
const answer = pass.answers[ref];
|
|
7396
|
+
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);
|
|
7397
|
+
try {
|
|
7398
|
+
await pass.secrets.put(ref, intent.value);
|
|
7399
|
+
} catch (err) {
|
|
7400
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7401
|
+
}
|
|
7402
|
+
pass.changedRefs.push(ref);
|
|
7403
|
+
return stored;
|
|
7404
|
+
}
|
|
7405
|
+
function inArray(pass, incoming, stored) {
|
|
7406
|
+
return incoming.map((item, index) => {
|
|
7407
|
+
const twin = stored[index];
|
|
7408
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7409
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7410
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7411
|
+
return item;
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7414
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7415
|
+
const out = { ...incoming };
|
|
7416
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7417
|
+
const twin = stored[key];
|
|
7418
|
+
if (isSecretMarker(twin)) {
|
|
7419
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7420
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7421
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7422
|
+
}
|
|
7423
|
+
return out;
|
|
7424
|
+
}
|
|
7425
|
+
async function walk(pass, incoming, stored) {
|
|
7426
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7427
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7428
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7429
|
+
const out = { ...incoming };
|
|
7430
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7431
|
+
return out;
|
|
7432
|
+
}
|
|
7433
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7434
|
+
async function restoreUnchangedSecrets(input) {
|
|
7435
|
+
const refs = [];
|
|
7436
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7437
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7438
|
+
if (owned.length === 0) return {
|
|
7439
|
+
patch: input.patch,
|
|
7440
|
+
changedRefs: []
|
|
7441
|
+
};
|
|
7442
|
+
const pass = {
|
|
7443
|
+
secrets: input.secrets,
|
|
7444
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7445
|
+
operatorWrite: input.operatorWrite,
|
|
7446
|
+
changedRefs: []
|
|
7447
|
+
};
|
|
7448
|
+
const out = {};
|
|
7449
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7450
|
+
return {
|
|
7451
|
+
patch: out,
|
|
7452
|
+
changedRefs: pass.changedRefs
|
|
7453
|
+
};
|
|
7454
|
+
}
|
|
7455
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7456
|
+
function isJsonEqual(a, b) {
|
|
7457
|
+
if (Object.is(a, b)) return true;
|
|
7458
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7459
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7460
|
+
const keys = Object.keys(a);
|
|
7461
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7462
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7283
7463
|
}
|
|
7284
7464
|
return false;
|
|
7285
7465
|
}
|
|
7466
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7467
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7468
|
+
const out = {};
|
|
7469
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7470
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7471
|
+
out[key] = value;
|
|
7472
|
+
}
|
|
7473
|
+
return out;
|
|
7474
|
+
}
|
|
7475
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7476
|
+
function markerKeysOf(blob, owner) {
|
|
7477
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7478
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7479
|
+
return keys;
|
|
7480
|
+
}
|
|
7481
|
+
function nodeFromStored(value, owner) {
|
|
7482
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7483
|
+
if (!isRecord(value)) return null;
|
|
7484
|
+
const children = /* @__PURE__ */ new Map();
|
|
7485
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7486
|
+
const node = nodeFromStored(child, owner);
|
|
7487
|
+
if (node !== null) children.set(key, node);
|
|
7488
|
+
}
|
|
7489
|
+
return children.size > 0 ? {
|
|
7490
|
+
kind: "object",
|
|
7491
|
+
children
|
|
7492
|
+
} : null;
|
|
7493
|
+
}
|
|
7494
|
+
/**
|
|
7495
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7496
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7497
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7498
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7499
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7500
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7501
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7502
|
+
* over.
|
|
7503
|
+
*/
|
|
7504
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7505
|
+
const added = /* @__PURE__ */ new Map();
|
|
7506
|
+
for (const key of keys) {
|
|
7507
|
+
const at = key.indexOf("@");
|
|
7508
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7509
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7510
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7511
|
+
if (node !== null) added.set(base, node);
|
|
7512
|
+
}
|
|
7513
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7514
|
+
}
|
|
7286
7515
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7287
7516
|
async function readStoredAddonBlob(raw) {
|
|
7288
7517
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -7291,7 +7520,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
7291
7520
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7292
7521
|
return result.kind === "missing" ? {} : result.value;
|
|
7293
7522
|
}
|
|
7294
|
-
function
|
|
7523
|
+
function touchesTree(tree, patch) {
|
|
7524
|
+
if (tree.size === 0) return false;
|
|
7525
|
+
for (const key of Object.keys(patch)) {
|
|
7526
|
+
const at = key.indexOf("@");
|
|
7527
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7528
|
+
}
|
|
7529
|
+
return false;
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7533
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7534
|
+
*/
|
|
7535
|
+
var MarkerKeyIndex = class {
|
|
7536
|
+
owner;
|
|
7537
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7538
|
+
constructor(owner) {
|
|
7539
|
+
this.owner = owner;
|
|
7540
|
+
}
|
|
7541
|
+
seen(store, blob) {
|
|
7542
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7543
|
+
}
|
|
7544
|
+
wrote(store, patch) {
|
|
7545
|
+
const keys = this.byStore.get(store);
|
|
7546
|
+
if (keys === void 0) return;
|
|
7547
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7548
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7549
|
+
else keys.delete(key);
|
|
7550
|
+
}
|
|
7551
|
+
mayHoldMarkers(store, patch) {
|
|
7552
|
+
const keys = this.byStore.get(store);
|
|
7553
|
+
if (keys === void 0) return true;
|
|
7554
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7555
|
+
}
|
|
7556
|
+
};
|
|
7557
|
+
function createHandle(raw, opts) {
|
|
7295
7558
|
const chains = /* @__PURE__ */ new Map();
|
|
7296
7559
|
const serialize = (key, fn) => {
|
|
7297
7560
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -7302,46 +7565,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
7302
7565
|
});
|
|
7303
7566
|
return next;
|
|
7304
7567
|
};
|
|
7305
|
-
const
|
|
7306
|
-
|
|
7307
|
-
|
|
7568
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7569
|
+
const resolveRead = async (store, blob) => {
|
|
7570
|
+
index.seen(store, blob);
|
|
7571
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7572
|
+
unresolved: "keep-marker",
|
|
7573
|
+
ownedBy: opts.secrets.owner
|
|
7574
|
+
});
|
|
7575
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7576
|
+
return value;
|
|
7577
|
+
};
|
|
7578
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7579
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7580
|
+
await rawWrite(patch);
|
|
7581
|
+
index.wrote(store, patch);
|
|
7582
|
+
return { changed: true };
|
|
7583
|
+
}
|
|
7584
|
+
return serialize(store, async () => {
|
|
7308
7585
|
const stored = await readStored();
|
|
7586
|
+
index.seen(store, stored);
|
|
7587
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7588
|
+
const restored = await restoreUnchangedSecrets({
|
|
7589
|
+
patch,
|
|
7590
|
+
stored,
|
|
7591
|
+
secrets: opts.secrets,
|
|
7592
|
+
operatorWrite
|
|
7593
|
+
});
|
|
7309
7594
|
const result = await transformSecretWrite({
|
|
7310
|
-
tree,
|
|
7595
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7311
7596
|
secrets: opts.secrets,
|
|
7312
|
-
patch,
|
|
7597
|
+
patch: restored.patch,
|
|
7313
7598
|
stored,
|
|
7314
7599
|
...scope !== void 0 ? { scope } : {},
|
|
7315
|
-
operatorWrite
|
|
7600
|
+
operatorWrite
|
|
7316
7601
|
});
|
|
7317
|
-
|
|
7602
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7603
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7604
|
+
if (wroteBlob) {
|
|
7605
|
+
await rawWrite(effective);
|
|
7606
|
+
index.wrote(store, effective);
|
|
7607
|
+
}
|
|
7318
7608
|
const { orphaned } = await result.afterWrite();
|
|
7319
7609
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7610
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7320
7611
|
});
|
|
7321
7612
|
};
|
|
7322
|
-
const
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7613
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7614
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7615
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7616
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7617
|
+
const overrides = {
|
|
7618
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7619
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7620
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7621
|
+
return result.kind === "value" ? {
|
|
7622
|
+
kind: "value",
|
|
7623
|
+
value: await resolveRead("addon", result.value)
|
|
7624
|
+
} : result;
|
|
7625
|
+
} } : {},
|
|
7626
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7627
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7628
|
+
if (result.kind !== "present") return result;
|
|
7629
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7630
|
+
unresolved: "keep-marker",
|
|
7631
|
+
ownedBy: opts.secrets.owner
|
|
7632
|
+
});
|
|
7633
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7634
|
+
return {
|
|
7635
|
+
kind: "present",
|
|
7636
|
+
value: value[key]
|
|
7637
|
+
};
|
|
7638
|
+
} } : {},
|
|
7639
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7640
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7641
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7642
|
+
const out = /* @__PURE__ */ new Map();
|
|
7643
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7644
|
+
return out;
|
|
7645
|
+
} } : {},
|
|
7646
|
+
writeAddonStore: async (patch) => {
|
|
7647
|
+
await writeAddon(patch);
|
|
7648
|
+
},
|
|
7649
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7650
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7651
|
+
kind: "device",
|
|
7652
|
+
deviceId
|
|
7653
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7654
|
+
}
|
|
7655
|
+
};
|
|
7656
|
+
return {
|
|
7657
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7658
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7659
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7660
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7661
|
+
} }),
|
|
7662
|
+
raw: {
|
|
7663
|
+
readAddonStore: async () => {
|
|
7664
|
+
const blob = await raw.readAddonStore();
|
|
7665
|
+
index.seen("addon", blob);
|
|
7666
|
+
return blob;
|
|
7667
|
+
},
|
|
7668
|
+
readDeviceStore: async (deviceId) => {
|
|
7669
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7670
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7671
|
+
return blob;
|
|
7672
|
+
}
|
|
7673
|
+
},
|
|
7674
|
+
writeAddonStore: writeAddon
|
|
7328
7675
|
};
|
|
7329
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
7330
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
7331
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
7332
|
-
const value = Reflect.get(target, prop, receiver);
|
|
7333
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
7334
|
-
} });
|
|
7335
7676
|
}
|
|
7336
|
-
/** The context the addon sees
|
|
7337
|
-
function
|
|
7677
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7678
|
+
function createSecretAwareContext(context, opts) {
|
|
7338
7679
|
const raw = context.settings;
|
|
7339
|
-
if (raw === void 0) return
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7680
|
+
if (raw === void 0) return {
|
|
7681
|
+
context,
|
|
7682
|
+
handle: null
|
|
7683
|
+
};
|
|
7684
|
+
const handle = createHandle(raw, opts);
|
|
7685
|
+
return {
|
|
7686
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7687
|
+
if (prop === "settings") return handle.settings;
|
|
7688
|
+
return Reflect.get(target, prop, receiver);
|
|
7689
|
+
} }),
|
|
7690
|
+
handle
|
|
7691
|
+
};
|
|
7345
7692
|
}
|
|
7346
7693
|
var LEAF = { kind: "leaf" };
|
|
7347
7694
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -7516,6 +7863,14 @@ var BaseAddon = class {
|
|
|
7516
7863
|
_secretChangeUnsub = null;
|
|
7517
7864
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7518
7865
|
_operatorWriteDepth = 0;
|
|
7866
|
+
/**
|
|
7867
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7868
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7869
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7870
|
+
*/
|
|
7871
|
+
_secretSettings = null;
|
|
7872
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7873
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
7519
7874
|
constructor(defaults) {
|
|
7520
7875
|
this.defaults = defaults;
|
|
7521
7876
|
this._config = { ...defaults };
|
|
@@ -7552,13 +7907,21 @@ var BaseAddon = class {
|
|
|
7552
7907
|
}
|
|
7553
7908
|
async initialize(context) {
|
|
7554
7909
|
const secrets = context.secrets;
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7910
|
+
if (secrets !== void 0) {
|
|
7911
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7912
|
+
secrets,
|
|
7913
|
+
addonTree: () => this.addonSecretTree(),
|
|
7914
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7915
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7916
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7917
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7918
|
+
});
|
|
7919
|
+
this._ctx = wrapped;
|
|
7920
|
+
this._secretSettings = handle;
|
|
7921
|
+
} else {
|
|
7922
|
+
this._ctx = context;
|
|
7923
|
+
this._secretSettings = null;
|
|
7924
|
+
}
|
|
7562
7925
|
await this.resolveConfig();
|
|
7563
7926
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7564
7927
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7675,11 +8038,8 @@ var BaseAddon = class {
|
|
|
7675
8038
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7676
8039
|
const schema = this.globalSettingsSchema(cap);
|
|
7677
8040
|
if (!schema) return { sections: [] };
|
|
7678
|
-
const projected = await this.
|
|
7679
|
-
return hydrateSchema(schema, overlay ? {
|
|
7680
|
-
...projected,
|
|
7681
|
-
...overlay
|
|
7682
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
8041
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8042
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7683
8043
|
}
|
|
7684
8044
|
/**
|
|
7685
8045
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7724,7 +8084,7 @@ var BaseAddon = class {
|
|
|
7724
8084
|
});
|
|
7725
8085
|
}
|
|
7726
8086
|
if (sections.length === 0) return null;
|
|
7727
|
-
const projected = await this.
|
|
8087
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7728
8088
|
return hydrateSchema({
|
|
7729
8089
|
...schema,
|
|
7730
8090
|
sections
|
|
@@ -7741,12 +8101,50 @@ var BaseAddon = class {
|
|
|
7741
8101
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7742
8102
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7743
8103
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8104
|
+
*
|
|
8105
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
8106
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
8107
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
8108
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
8109
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
8110
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7744
8111
|
*/
|
|
7745
8112
|
async resolveGlobalStore(nodeId, cap) {
|
|
7746
8113
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8114
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8115
|
+
}
|
|
8116
|
+
projectForNode(store, nodeId, cap) {
|
|
7747
8117
|
const keys = this.perNodeKeys(cap);
|
|
7748
8118
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7749
|
-
return keys.size > 0 ? projectStore(
|
|
8119
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
8120
|
+
}
|
|
8121
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8122
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
8123
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8124
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8125
|
+
}
|
|
8126
|
+
/**
|
|
8127
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
8128
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
8129
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
8130
|
+
* its value.
|
|
8131
|
+
*/
|
|
8132
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
8133
|
+
const secrets = this._ctx?.secrets;
|
|
8134
|
+
const merged = {
|
|
8135
|
+
...stored,
|
|
8136
|
+
...overlay
|
|
8137
|
+
};
|
|
8138
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
8139
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
8140
|
+
unresolved: "keep-marker",
|
|
8141
|
+
ownedBy: secrets.owner
|
|
8142
|
+
});
|
|
8143
|
+
for (const key of Object.keys(overlay)) {
|
|
8144
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
8145
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
8146
|
+
}
|
|
8147
|
+
return merged;
|
|
7750
8148
|
}
|
|
7751
8149
|
/**
|
|
7752
8150
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7811,8 +8209,12 @@ var BaseAddon = class {
|
|
|
7811
8209
|
async clearSecrets(keys, nodeId) {
|
|
7812
8210
|
const tree = this.addonSecretTree();
|
|
7813
8211
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8212
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7814
8213
|
const patch = {};
|
|
7815
|
-
for (const key of keys)
|
|
8214
|
+
for (const key of keys) {
|
|
8215
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8216
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8217
|
+
}
|
|
7816
8218
|
await this.applyGlobalPatch(patch, nodeId);
|
|
7817
8219
|
}
|
|
7818
8220
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -7820,7 +8222,11 @@ var BaseAddon = class {
|
|
|
7820
8222
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7821
8223
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7822
8224
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7823
|
-
|
|
8225
|
+
const handle = this._secretSettings;
|
|
8226
|
+
if (handle !== null) {
|
|
8227
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8228
|
+
if (!changed) return;
|
|
8229
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7824
8230
|
if (target !== localNode) return;
|
|
7825
8231
|
await this.resolveConfig();
|
|
7826
8232
|
await this.onConfigChanged();
|
|
@@ -7873,7 +8279,7 @@ var BaseAddon = class {
|
|
|
7873
8279
|
async getDeviceSettings(deviceId) {
|
|
7874
8280
|
const schema = this.deviceSettingsSchema();
|
|
7875
8281
|
if (!schema) return { sections: [] };
|
|
7876
|
-
return hydrateSchema(schema, await this.
|
|
8282
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7877
8283
|
}
|
|
7878
8284
|
async updateDeviceSettings(deviceId, patch) {
|
|
7879
8285
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -8045,7 +8451,7 @@ var BaseAddon = class {
|
|
|
8045
8451
|
key,
|
|
8046
8452
|
schema,
|
|
8047
8453
|
fallback,
|
|
8048
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
8454
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
8049
8455
|
write: async (patch) => {
|
|
8050
8456
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
8051
8457
|
},
|
|
@@ -8107,6 +8513,23 @@ var BaseAddon = class {
|
|
|
8107
8513
|
}
|
|
8108
8514
|
return value;
|
|
8109
8515
|
}
|
|
8516
|
+
/**
|
|
8517
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8518
|
+
* keychain the context's own view is already raw.
|
|
8519
|
+
*/
|
|
8520
|
+
rawSettings() {
|
|
8521
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8522
|
+
}
|
|
8523
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8524
|
+
logUnresolvedRead(unresolved) {
|
|
8525
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8526
|
+
if (fresh.length === 0) return;
|
|
8527
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8528
|
+
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) => ({
|
|
8529
|
+
ref: u.ref,
|
|
8530
|
+
reason: u.reason
|
|
8531
|
+
})) } });
|
|
8532
|
+
}
|
|
8110
8533
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8111
8534
|
scheduleSecretReresolve(delayMs) {
|
|
8112
8535
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -8133,7 +8556,7 @@ var BaseAddon = class {
|
|
|
8133
8556
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
8134
8557
|
*/
|
|
8135
8558
|
async readAddonStoreWithRetry() {
|
|
8136
|
-
const settings = this.
|
|
8559
|
+
const settings = this.rawSettings();
|
|
8137
8560
|
if (!settings) return {};
|
|
8138
8561
|
const delaysMs = [
|
|
8139
8562
|
150,
|
|
@@ -10436,6 +10859,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10436
10859
|
fetchedAt: number()
|
|
10437
10860
|
});
|
|
10438
10861
|
/**
|
|
10862
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10863
|
+
* gets back (cloud training, D805+).
|
|
10864
|
+
*
|
|
10865
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10866
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10867
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10868
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10869
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10870
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10871
|
+
* change there, in the same piece of work.
|
|
10872
|
+
*
|
|
10873
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10874
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10875
|
+
*/
|
|
10876
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10877
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10878
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10879
|
+
var TrainingExportSchema = _enum([
|
|
10880
|
+
"onnx",
|
|
10881
|
+
"openvino-fp16",
|
|
10882
|
+
"openvino-int8",
|
|
10883
|
+
"coreml-fp16"
|
|
10884
|
+
]);
|
|
10885
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10886
|
+
object({
|
|
10887
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10888
|
+
jobKey: string().uuid(),
|
|
10889
|
+
target: object({
|
|
10890
|
+
kind: literal("detector"),
|
|
10891
|
+
step: literal("object-detection")
|
|
10892
|
+
}),
|
|
10893
|
+
base: object({
|
|
10894
|
+
modelId: string().min(1),
|
|
10895
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10896
|
+
weights: string().min(1),
|
|
10897
|
+
imgsz: number().int().positive()
|
|
10898
|
+
}),
|
|
10899
|
+
baseline: object({
|
|
10900
|
+
modelId: string().min(1),
|
|
10901
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10902
|
+
onnxUrl: string().url(),
|
|
10903
|
+
imgsz: number().int().positive(),
|
|
10904
|
+
floors: FloorsSchema
|
|
10905
|
+
}),
|
|
10906
|
+
dataset: object({
|
|
10907
|
+
versionId: string().min(1),
|
|
10908
|
+
annotationHash: string(),
|
|
10909
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10910
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10911
|
+
}),
|
|
10912
|
+
split: object({
|
|
10913
|
+
holdoutCameras: array(number().int()),
|
|
10914
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10915
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10916
|
+
valFraction: number().min(0).max(.5),
|
|
10917
|
+
seed: number().int()
|
|
10918
|
+
}),
|
|
10919
|
+
hyper: object({
|
|
10920
|
+
epochs: number().int().positive(),
|
|
10921
|
+
batch: number().int().positive(),
|
|
10922
|
+
lr0: number().positive(),
|
|
10923
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10924
|
+
freeze: number().int().nonnegative(),
|
|
10925
|
+
patience: number().int().nonnegative(),
|
|
10926
|
+
seed: number().int()
|
|
10927
|
+
}),
|
|
10928
|
+
replay: object({
|
|
10929
|
+
source: literal("coco2017"),
|
|
10930
|
+
count: number().int().nonnegative()
|
|
10931
|
+
}),
|
|
10932
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10933
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10934
|
+
floors: object({
|
|
10935
|
+
minSupport: number().int().positive(),
|
|
10936
|
+
clamp: number().min(0).max(1)
|
|
10937
|
+
}),
|
|
10938
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10939
|
+
catalog: object({
|
|
10940
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10941
|
+
name: string().min(1).max(160)
|
|
10942
|
+
})
|
|
10943
|
+
});
|
|
10944
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10945
|
+
var TrainingResultFileSchema = object({
|
|
10946
|
+
path: string().min(1),
|
|
10947
|
+
bytes: number().int().nonnegative(),
|
|
10948
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10949
|
+
format: _enum([
|
|
10950
|
+
"onnx",
|
|
10951
|
+
"openvino",
|
|
10952
|
+
"coreml",
|
|
10953
|
+
"pt"
|
|
10954
|
+
]),
|
|
10955
|
+
variant: _enum(["base", "int8"])
|
|
10956
|
+
});
|
|
10957
|
+
var DraftFormatSchema = object({
|
|
10958
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10959
|
+
url: string().min(1),
|
|
10960
|
+
sizeMB: number().nonnegative(),
|
|
10961
|
+
isDirectory: boolean().optional(),
|
|
10962
|
+
files: array(string()).optional(),
|
|
10963
|
+
runtimes: array(literal("python")).optional(),
|
|
10964
|
+
revision: string().min(1)
|
|
10965
|
+
});
|
|
10966
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10967
|
+
var TrainingCatalogDraftSchema = object({
|
|
10968
|
+
id: string().min(1),
|
|
10969
|
+
name: string().min(1),
|
|
10970
|
+
description: string(),
|
|
10971
|
+
labels: array(unknown()),
|
|
10972
|
+
inputSize: object({
|
|
10973
|
+
width: number().int().positive(),
|
|
10974
|
+
height: number().int().positive()
|
|
10975
|
+
}),
|
|
10976
|
+
preprocessMode: literal("letterbox"),
|
|
10977
|
+
defaultClassFloors: FloorsSchema,
|
|
10978
|
+
formats: object({
|
|
10979
|
+
onnx: DraftFormatSchema.optional(),
|
|
10980
|
+
openvino: DraftFormatSchema.optional(),
|
|
10981
|
+
coreml: DraftFormatSchema.optional()
|
|
10982
|
+
})
|
|
10983
|
+
});
|
|
10984
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10985
|
+
var TrainingEvalClassSchema = object({
|
|
10986
|
+
positives: number().int(),
|
|
10987
|
+
floor: number().nullable(),
|
|
10988
|
+
tp: number().int(),
|
|
10989
|
+
fp: number().int(),
|
|
10990
|
+
fn: number().int(),
|
|
10991
|
+
precision: number().nullable(),
|
|
10992
|
+
recall: number().nullable(),
|
|
10993
|
+
ap50: number().nullable(),
|
|
10994
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10995
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10996
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10997
|
+
smallFound: number().int().optional(),
|
|
10998
|
+
smallTotal: number().int().optional()
|
|
10999
|
+
}).passthrough();
|
|
11000
|
+
var TrainingEvalReportSchema = object({
|
|
11001
|
+
frames: number().int(),
|
|
11002
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
11003
|
+
}).passthrough();
|
|
11004
|
+
/**
|
|
11005
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
11006
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
11007
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
11008
|
+
*/
|
|
11009
|
+
var TrainingResultSchema = object({
|
|
11010
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
11011
|
+
jobKey: string(),
|
|
11012
|
+
status: _enum(["succeeded", "failed"]),
|
|
11013
|
+
error: object({
|
|
11014
|
+
stage: string(),
|
|
11015
|
+
code: string(),
|
|
11016
|
+
message: string()
|
|
11017
|
+
}).nullable(),
|
|
11018
|
+
trainer: object({
|
|
11019
|
+
version: string(),
|
|
11020
|
+
revision: string()
|
|
11021
|
+
}),
|
|
11022
|
+
toolchain: record(string(), string().nullable()),
|
|
11023
|
+
dataset: object({
|
|
11024
|
+
versionId: string(),
|
|
11025
|
+
annotationHash: string(),
|
|
11026
|
+
sha256: string(),
|
|
11027
|
+
frames: object({
|
|
11028
|
+
train: number().int(),
|
|
11029
|
+
val: number().int(),
|
|
11030
|
+
holdout: number().int()
|
|
11031
|
+
}),
|
|
11032
|
+
holdoutCameras: array(number().int()),
|
|
11033
|
+
replayImages: number().int()
|
|
11034
|
+
}).optional(),
|
|
11035
|
+
training: object({
|
|
11036
|
+
epochsRun: number().int(),
|
|
11037
|
+
bestEpoch: number().int(),
|
|
11038
|
+
bestMap50: number(),
|
|
11039
|
+
bestMap50_95: number(),
|
|
11040
|
+
seconds: number()
|
|
11041
|
+
}).optional(),
|
|
11042
|
+
evaluation: object({
|
|
11043
|
+
holdoutFrames: number().int(),
|
|
11044
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
11045
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
11046
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
11047
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
11048
|
+
map50: record(string(), number().nullable())
|
|
11049
|
+
}).optional(),
|
|
11050
|
+
floors: object({
|
|
11051
|
+
baseline: FloorsSchema,
|
|
11052
|
+
candidate: FloorsSchema,
|
|
11053
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
11054
|
+
notes: array(string())
|
|
11055
|
+
}).optional(),
|
|
11056
|
+
int8: object({
|
|
11057
|
+
kept: boolean(),
|
|
11058
|
+
map50Fp16: number().nullable(),
|
|
11059
|
+
map50Int8: number().nullable(),
|
|
11060
|
+
reason: string().nullable()
|
|
11061
|
+
}).optional(),
|
|
11062
|
+
exportsDropped: array(object({
|
|
11063
|
+
export: string(),
|
|
11064
|
+
reason: string()
|
|
11065
|
+
})).optional(),
|
|
11066
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
11067
|
+
bundle: object({
|
|
11068
|
+
path: literal("bundle.tar"),
|
|
11069
|
+
bytes: number().int().nonnegative(),
|
|
11070
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11071
|
+
}).nullable().optional(),
|
|
11072
|
+
catalogDraft: object({
|
|
11073
|
+
base: TrainingCatalogDraftSchema,
|
|
11074
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
11075
|
+
}).nullable().optional(),
|
|
11076
|
+
licence: string()
|
|
11077
|
+
});
|
|
11078
|
+
var TrainingStageSchema = _enum([
|
|
11079
|
+
"prepare",
|
|
11080
|
+
"replay",
|
|
11081
|
+
"train",
|
|
11082
|
+
"eval",
|
|
11083
|
+
"export",
|
|
11084
|
+
"package"
|
|
11085
|
+
]);
|
|
11086
|
+
var EventBase = {
|
|
11087
|
+
v: literal(1),
|
|
11088
|
+
ts: number()
|
|
11089
|
+
};
|
|
11090
|
+
discriminatedUnion("type", [
|
|
11091
|
+
object({
|
|
11092
|
+
...EventBase,
|
|
11093
|
+
type: literal("stage"),
|
|
11094
|
+
stage: TrainingStageSchema
|
|
11095
|
+
}),
|
|
11096
|
+
object({
|
|
11097
|
+
...EventBase,
|
|
11098
|
+
type: literal("epoch"),
|
|
11099
|
+
epoch: number().int(),
|
|
11100
|
+
epochs: number().int(),
|
|
11101
|
+
boxLoss: number().nullable().optional(),
|
|
11102
|
+
map50: number().nullable().optional(),
|
|
11103
|
+
map50_95: number().nullable().optional(),
|
|
11104
|
+
etaSec: number().nullable().optional()
|
|
11105
|
+
}),
|
|
11106
|
+
object({
|
|
11107
|
+
...EventBase,
|
|
11108
|
+
type: literal("metric"),
|
|
11109
|
+
name: string(),
|
|
11110
|
+
value: number()
|
|
11111
|
+
}),
|
|
11112
|
+
object({
|
|
11113
|
+
...EventBase,
|
|
11114
|
+
type: literal("artifact"),
|
|
11115
|
+
path: string(),
|
|
11116
|
+
bytes: number(),
|
|
11117
|
+
sha256: string()
|
|
11118
|
+
}),
|
|
11119
|
+
object({
|
|
11120
|
+
...EventBase,
|
|
11121
|
+
type: literal("done"),
|
|
11122
|
+
status: _enum(["succeeded", "failed"]),
|
|
11123
|
+
resultSha256: string().nullable().optional()
|
|
11124
|
+
}),
|
|
11125
|
+
object({
|
|
11126
|
+
...EventBase,
|
|
11127
|
+
type: literal("error"),
|
|
11128
|
+
stage: string(),
|
|
11129
|
+
code: string(),
|
|
11130
|
+
message: string()
|
|
11131
|
+
})
|
|
11132
|
+
]);
|
|
11133
|
+
/**
|
|
10439
11134
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
10440
11135
|
*
|
|
10441
11136
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12763,7 +13458,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12763
13458
|
"authenticated",
|
|
12764
13459
|
"admin"
|
|
12765
13460
|
]).optional(),
|
|
12766
|
-
description: string().optional()
|
|
13461
|
+
description: string().optional(),
|
|
13462
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13463
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12767
13464
|
});
|
|
12768
13465
|
/**
|
|
12769
13466
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13468,6 +14165,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13468
14165
|
lastError: string().optional()
|
|
13469
14166
|
});
|
|
13470
14167
|
/**
|
|
14168
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14169
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14170
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14171
|
+
* with it off — which restores without a key.
|
|
14172
|
+
*/
|
|
14173
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14174
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14175
|
+
scheme: string(),
|
|
14176
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14177
|
+
keyId: string()
|
|
14178
|
+
});
|
|
14179
|
+
/**
|
|
14180
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14181
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14182
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14183
|
+
*/
|
|
14184
|
+
var BackupEncryptionStatusSchema = object({
|
|
14185
|
+
enabled: boolean(),
|
|
14186
|
+
active: object({
|
|
14187
|
+
keyId: string(),
|
|
14188
|
+
publicKey: string(),
|
|
14189
|
+
createdAt: number()
|
|
14190
|
+
}).nullable(),
|
|
14191
|
+
/** Every key ever set up, newest first. */
|
|
14192
|
+
keys: array(object({
|
|
14193
|
+
keyId: string(),
|
|
14194
|
+
createdAt: number(),
|
|
14195
|
+
retiredAt: number().nullable()
|
|
14196
|
+
})).readonly()
|
|
14197
|
+
});
|
|
14198
|
+
/**
|
|
13471
14199
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13472
14200
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13473
14201
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13479,7 +14207,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13479
14207
|
sizeBytes: number(),
|
|
13480
14208
|
label: string().optional(),
|
|
13481
14209
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13482
|
-
locations: array(string()).readonly()
|
|
14210
|
+
locations: array(string()).readonly(),
|
|
14211
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14212
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13483
14213
|
});
|
|
13484
14214
|
var BackupEntrySchema = object({
|
|
13485
14215
|
id: string(),
|
|
@@ -13488,7 +14218,8 @@ var BackupEntrySchema = object({
|
|
|
13488
14218
|
label: string().optional(),
|
|
13489
14219
|
createdAt: number(),
|
|
13490
14220
|
sizeBytes: number(),
|
|
13491
|
-
locations: array(string()).optional()
|
|
14221
|
+
locations: array(string()).optional(),
|
|
14222
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13492
14223
|
});
|
|
13493
14224
|
var ArchiveEntrySchema = object({
|
|
13494
14225
|
path: string(),
|
|
@@ -13677,10 +14408,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13677
14408
|
* this list and skips entries whose path doesn't start with
|
|
13678
14409
|
* any of them.
|
|
13679
14410
|
*/
|
|
13680
|
-
locations: array(string()).optional()
|
|
14411
|
+
locations: array(string()).optional(),
|
|
14412
|
+
/**
|
|
14413
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14414
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14415
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14416
|
+
* is refused before the archive is downloaded.
|
|
14417
|
+
*/
|
|
14418
|
+
backupSecretKey: string().optional()
|
|
13681
14419
|
}), _void(), {
|
|
13682
14420
|
kind: "mutation",
|
|
13683
14421
|
auth: "admin"
|
|
14422
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14423
|
+
keyId: string(),
|
|
14424
|
+
secretKey: string(),
|
|
14425
|
+
publicKey: string(),
|
|
14426
|
+
createdAt: number(),
|
|
14427
|
+
replacedKeyId: string().nullable()
|
|
14428
|
+
}), {
|
|
14429
|
+
kind: "mutation",
|
|
14430
|
+
auth: "admin"
|
|
14431
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14432
|
+
kind: "mutation",
|
|
14433
|
+
auth: "admin"
|
|
14434
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14435
|
+
valid: boolean(),
|
|
14436
|
+
keyId: string().nullable(),
|
|
14437
|
+
/** The hub knows this key (active or retired). */
|
|
14438
|
+
known: boolean(),
|
|
14439
|
+
/** It is the key new archives are encrypted to. */
|
|
14440
|
+
active: boolean(),
|
|
14441
|
+
error: string().optional()
|
|
14442
|
+
}), {
|
|
14443
|
+
kind: "mutation",
|
|
14444
|
+
auth: "admin"
|
|
13684
14445
|
}), method(object({
|
|
13685
14446
|
destinationId: string(),
|
|
13686
14447
|
backupId: string()
|
|
@@ -15406,7 +16167,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
15406
16167
|
stepId: string(),
|
|
15407
16168
|
entry: ModelCatalogEntrySchema
|
|
15408
16169
|
});
|
|
15409
|
-
|
|
16170
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16171
|
+
var ModelBundleFileSchema = object({
|
|
16172
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16173
|
+
path: string().min(1),
|
|
16174
|
+
bytes: number().int().nonnegative(),
|
|
16175
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16176
|
+
});
|
|
16177
|
+
var ImportModelBundleInputSchema = object({
|
|
16178
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16179
|
+
addonId: string(),
|
|
16180
|
+
stepId: string().min(1),
|
|
16181
|
+
/**
|
|
16182
|
+
* The catalog rows to register, complete, every format URL already
|
|
16183
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16184
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16185
|
+
*/
|
|
16186
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16187
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16188
|
+
bundle: object({
|
|
16189
|
+
ticket: PeerBytesTicketSchema,
|
|
16190
|
+
bytes: number().int().positive(),
|
|
16191
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16192
|
+
}),
|
|
16193
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16194
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16195
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16196
|
+
distribute: boolean()
|
|
16197
|
+
});
|
|
16198
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16199
|
+
kind: literal("imported"),
|
|
16200
|
+
modelIds: array(string()).readonly(),
|
|
16201
|
+
distributed: array(object({
|
|
16202
|
+
modelId: string(),
|
|
16203
|
+
nodeId: string(),
|
|
16204
|
+
format: _enum(MODEL_FORMATS),
|
|
16205
|
+
ok: boolean(),
|
|
16206
|
+
error: string().optional()
|
|
16207
|
+
})).readonly()
|
|
16208
|
+
}), object({
|
|
16209
|
+
kind: literal("refused"),
|
|
16210
|
+
reason: _enum([
|
|
16211
|
+
"transfer-failed",
|
|
16212
|
+
"checksum-mismatch",
|
|
16213
|
+
"bundle-mismatch",
|
|
16214
|
+
"invalid-entry",
|
|
16215
|
+
"id-taken"
|
|
16216
|
+
]),
|
|
16217
|
+
detail: string()
|
|
16218
|
+
})]);
|
|
16219
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16220
|
+
kind: "mutation",
|
|
16221
|
+
auth: "admin",
|
|
16222
|
+
timeoutMs: 30 * 6e4
|
|
16223
|
+
});
|
|
15410
16224
|
/**
|
|
15411
16225
|
* Query filter for settings-store collections.
|
|
15412
16226
|
*/
|
|
@@ -15885,6 +16699,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15885
16699
|
*/
|
|
15886
16700
|
sharesBackupWithDatabase: boolean()
|
|
15887
16701
|
});
|
|
16702
|
+
/**
|
|
16703
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16704
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16705
|
+
*/
|
|
16706
|
+
var KeychainResetRecordSchema = object({
|
|
16707
|
+
id: string(),
|
|
16708
|
+
at: number(),
|
|
16709
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16710
|
+
actor: string(),
|
|
16711
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16712
|
+
lockedReason: string().nullable(),
|
|
16713
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16714
|
+
archived: number().int(),
|
|
16715
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16716
|
+
archivedCollection: string().nullable(),
|
|
16717
|
+
/**
|
|
16718
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16719
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16720
|
+
*/
|
|
16721
|
+
archivedKeysCollection: string().nullable(),
|
|
16722
|
+
/**
|
|
16723
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16724
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16725
|
+
* agent forever (D797).
|
|
16726
|
+
*/
|
|
16727
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16728
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16729
|
+
acknowledgedAt: number().nullable()
|
|
16730
|
+
});
|
|
15888
16731
|
var KeychainStatusSchema = object({
|
|
15889
16732
|
keychain: KeychainStateSchema,
|
|
15890
16733
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15902,7 +16745,9 @@ var KeychainStatusSchema = object({
|
|
|
15902
16745
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15903
16746
|
retiredWraps: number().int(),
|
|
15904
16747
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15905
|
-
secretCount: number().int()
|
|
16748
|
+
secretCount: number().int(),
|
|
16749
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16750
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15906
16751
|
});
|
|
15907
16752
|
/**
|
|
15908
16753
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15924,17 +16769,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15924
16769
|
"download-recovery-key",
|
|
15925
16770
|
"delete-orphans",
|
|
15926
16771
|
"reset",
|
|
16772
|
+
"acknowledge-reset",
|
|
15927
16773
|
"initialize"
|
|
15928
16774
|
]);
|
|
15929
16775
|
var KeychainAuditEntrySchema = object({
|
|
15930
16776
|
id: string(),
|
|
15931
16777
|
at: number(),
|
|
15932
16778
|
action: KeychainAuditActionSchema,
|
|
15933
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16779
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15934
16780
|
actor: string(),
|
|
15935
16781
|
ref: string().nullable(),
|
|
15936
16782
|
detail: string().nullable()
|
|
15937
16783
|
});
|
|
16784
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16785
|
+
/**
|
|
16786
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16787
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16788
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16789
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16790
|
+
*/
|
|
16791
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15938
16792
|
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({
|
|
15939
16793
|
value: string(),
|
|
15940
16794
|
version: number().int()
|
|
@@ -15942,6 +16796,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15942
16796
|
kind: "mutation",
|
|
15943
16797
|
auth: "admin",
|
|
15944
16798
|
caller: "required"
|
|
16799
|
+
}), method(object({
|
|
16800
|
+
name: SystemHeldSecretNameSchema,
|
|
16801
|
+
value: string().min(16)
|
|
16802
|
+
}), object({
|
|
16803
|
+
ref: string(),
|
|
16804
|
+
version: number().int()
|
|
16805
|
+
}), {
|
|
16806
|
+
kind: "mutation",
|
|
16807
|
+
auth: "admin",
|
|
16808
|
+
caller: "required"
|
|
15945
16809
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15946
16810
|
deleted: array(string()).readonly(),
|
|
15947
16811
|
kept: array(object({
|
|
@@ -15971,13 +16835,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15971
16835
|
kind: "mutation",
|
|
15972
16836
|
auth: "admin",
|
|
15973
16837
|
caller: "required"
|
|
15974
|
-
}), method(object({ confirm: literal(
|
|
16838
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15975
16839
|
archivedCollection: string().nullable(),
|
|
15976
16840
|
archived: number().int()
|
|
15977
16841
|
}), {
|
|
15978
16842
|
kind: "mutation",
|
|
15979
16843
|
auth: "admin",
|
|
15980
16844
|
caller: "required"
|
|
16845
|
+
}), method(object({}), object({
|
|
16846
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16847
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16848
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16849
|
+
kind: "mutation",
|
|
16850
|
+
auth: "admin",
|
|
16851
|
+
caller: "required"
|
|
15981
16852
|
});
|
|
15982
16853
|
method(_void(), object({
|
|
15983
16854
|
id: string(),
|
|
@@ -18924,7 +19795,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18924
19795
|
* `login-method` — collection cap through which auth addons contribute
|
|
18925
19796
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18926
19797
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18927
|
-
* every auth addon (OIDC,
|
|
19798
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18928
19799
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18929
19800
|
* procedure aggregates them for the unauthenticated login page.
|
|
18930
19801
|
*
|
|
@@ -18932,8 +19803,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18932
19803
|
*
|
|
18933
19804
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18934
19805
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18935
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18936
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19806
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18937
19807
|
* login page needs NO change.
|
|
18938
19808
|
*
|
|
18939
19809
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18952,8 +19822,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18952
19822
|
* decision.
|
|
18953
19823
|
*
|
|
18954
19824
|
* Every contribution carries a `stage`:
|
|
18955
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18956
|
-
*
|
|
19825
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19826
|
+
* buttons; a usernameless passkey).
|
|
18957
19827
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18958
19828
|
* returned `factors` (passkey-as-2FA today).
|
|
18959
19829
|
*
|
|
@@ -18980,7 +19850,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18980
19850
|
* The provider names an external identity a signed-in user can link to
|
|
18981
19851
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18982
19852
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18983
|
-
* whatever their id. Absent / false — a login button only
|
|
19853
|
+
* whatever their id. Absent / false — a login button only.
|
|
18984
19854
|
*/
|
|
18985
19855
|
linkable: boolean().optional()
|
|
18986
19856
|
}),
|
|
@@ -22835,8 +23705,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22835
23705
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22836
23706
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22837
23707
|
* distinction was only ever used to route role-specific procedures
|
|
22838
|
-
* which we no longer have.
|
|
22839
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23708
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22840
23709
|
* with `isAdmin: false` + an explicit scope list.
|
|
22841
23710
|
*/
|
|
22842
23711
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24511,6 +25380,9 @@ var RetrainExportFilterSchema = object({
|
|
|
24511
25380
|
frameIds: array(string()).max(2e4).optional(),
|
|
24512
25381
|
/** Only frames in at least one of these named collections. */
|
|
24513
25382
|
collectionIds: array(string()).max(200).optional(),
|
|
25383
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25384
|
+
* unknown id selects nothing. */
|
|
25385
|
+
datasetVersionId: string().optional(),
|
|
24514
25386
|
batchId: string().optional(),
|
|
24515
25387
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24516
25388
|
completeOnly: boolean().optional()
|
|
@@ -24678,6 +25550,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24678
25550
|
]),
|
|
24679
25551
|
detail: string().optional()
|
|
24680
25552
|
})]);
|
|
25553
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25554
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25555
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25556
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25557
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25558
|
+
});
|
|
25559
|
+
/** The counts a dataset is judged by. */
|
|
25560
|
+
var RetrainDatasetStatsSchema = object({
|
|
25561
|
+
frames: number().int(),
|
|
25562
|
+
completeFrames: number().int(),
|
|
25563
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25564
|
+
completeness: number(),
|
|
25565
|
+
/** Boxes to learn (model errors excluded). */
|
|
25566
|
+
subjects: number().int(),
|
|
25567
|
+
modelErrors: number().int(),
|
|
25568
|
+
/** Complete frames with no subject. */
|
|
25569
|
+
hardNegatives: number().int(),
|
|
25570
|
+
/** Subjects per class × camera × day/night. */
|
|
25571
|
+
cells: array(object({
|
|
25572
|
+
macroClass: string(),
|
|
25573
|
+
deviceId: number(),
|
|
25574
|
+
lighting: _enum([
|
|
25575
|
+
"day",
|
|
25576
|
+
"night",
|
|
25577
|
+
"unknown"
|
|
25578
|
+
]),
|
|
25579
|
+
subjects: number().int(),
|
|
25580
|
+
frames: number().int()
|
|
25581
|
+
})).readonly(),
|
|
25582
|
+
cameras: array(object({
|
|
25583
|
+
deviceId: number(),
|
|
25584
|
+
frames: number().int(),
|
|
25585
|
+
completeFrames: number().int()
|
|
25586
|
+
})).readonly()
|
|
25587
|
+
});
|
|
25588
|
+
/** An immutable dataset version, without its frame list. */
|
|
25589
|
+
var RetrainDatasetVersionSchema = object({
|
|
25590
|
+
id: string(),
|
|
25591
|
+
name: string(),
|
|
25592
|
+
createdAt: number(),
|
|
25593
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25594
|
+
layout: RetrainExportLayoutSchema,
|
|
25595
|
+
completeOnly: boolean(),
|
|
25596
|
+
frameCount: number().int(),
|
|
25597
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25598
|
+
annotationHash: string(),
|
|
25599
|
+
/** The export manifest schema the version was cut under. */
|
|
25600
|
+
manifestSchema: string(),
|
|
25601
|
+
stats: RetrainDatasetStatsSchema
|
|
25602
|
+
});
|
|
25603
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25604
|
+
kind: literal("created"),
|
|
25605
|
+
version: RetrainDatasetVersionSchema
|
|
25606
|
+
}), object({
|
|
25607
|
+
kind: literal("refused"),
|
|
25608
|
+
reason: _enum([
|
|
25609
|
+
"empty-name",
|
|
25610
|
+
"duplicate-name",
|
|
25611
|
+
"no-frames"
|
|
25612
|
+
])
|
|
25613
|
+
})]);
|
|
24681
25614
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24682
25615
|
var RetrainTransitionResultSchema = object({
|
|
24683
25616
|
trackId: string(),
|
|
@@ -25467,6 +26400,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
25467
26400
|
kind: "mutation",
|
|
25468
26401
|
auth: "admin",
|
|
25469
26402
|
timeoutMs: 60 * 6e4
|
|
26403
|
+
}), method(object({
|
|
26404
|
+
filter: RetrainExportFilterSchema,
|
|
26405
|
+
layout: RetrainExportLayoutSchema
|
|
26406
|
+
}), object({
|
|
26407
|
+
ticket: PeerBytesTicketSchema,
|
|
26408
|
+
frames: number().int(),
|
|
26409
|
+
annotations: number().int()
|
|
26410
|
+
}), {
|
|
26411
|
+
kind: "mutation",
|
|
26412
|
+
auth: "admin",
|
|
26413
|
+
timeoutMs: 12e4
|
|
26414
|
+
}), method(object({
|
|
26415
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26416
|
+
completeOnly: boolean().optional()
|
|
26417
|
+
}), RetrainDatasetStatsSchema, {
|
|
26418
|
+
kind: "query",
|
|
26419
|
+
auth: "admin"
|
|
26420
|
+
}), method(object({
|
|
26421
|
+
name: string().max(120),
|
|
26422
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26423
|
+
layout: RetrainExportLayoutSchema,
|
|
26424
|
+
completeOnly: boolean()
|
|
26425
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26426
|
+
kind: "mutation",
|
|
26427
|
+
auth: "admin",
|
|
26428
|
+
timeoutMs: 12e4
|
|
26429
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26430
|
+
kind: "query",
|
|
26431
|
+
auth: "admin"
|
|
26432
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26433
|
+
kind: "mutation",
|
|
26434
|
+
auth: "admin"
|
|
26435
|
+
}), method(object({ id: string() }), object({
|
|
26436
|
+
found: boolean(),
|
|
26437
|
+
annotationHash: string(),
|
|
26438
|
+
matches: boolean(),
|
|
26439
|
+
missingFrames: number().int()
|
|
26440
|
+
}), {
|
|
26441
|
+
kind: "query",
|
|
26442
|
+
auth: "admin",
|
|
26443
|
+
timeoutMs: 12e4
|
|
25470
26444
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25471
26445
|
kind: "query",
|
|
25472
26446
|
auth: "admin"
|
|
@@ -29045,8 +30019,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
29045
30019
|
* `smtp-provider` — pluggable email delivery surface.
|
|
29046
30020
|
*
|
|
29047
30021
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
29048
|
-
* one for transactional / one for notifications). Consumers (
|
|
29049
|
-
*
|
|
30022
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
30023
|
+
* addons, …) walk the collection and pick the first
|
|
29050
30024
|
* ready provider OR target a specific addonId.
|
|
29051
30025
|
*
|
|
29052
30026
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -29225,7 +30199,7 @@ targets: array(object({
|
|
|
29225
30199
|
})));
|
|
29226
30200
|
/**
|
|
29227
30201
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
29228
|
-
* providers (OIDC, SAML,
|
|
30202
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
29229
30203
|
* carrying the post-callback claims before redirecting back to
|
|
29230
30204
|
* `/api/auth/sso/finish`.
|
|
29231
30205
|
*
|
|
@@ -29288,7 +30262,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
29288
30262
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29289
30263
|
* subject is unique only per issuer, so a link is bound to it.
|
|
29290
30264
|
*/
|
|
29291
|
-
issuer: string().optional()
|
|
30265
|
+
issuer: string().optional(),
|
|
30266
|
+
/**
|
|
30267
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30268
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30269
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30270
|
+
* any other browser.
|
|
30271
|
+
*/
|
|
30272
|
+
browserBinding: string().optional()
|
|
29292
30273
|
});
|
|
29293
30274
|
method(object({
|
|
29294
30275
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -41547,16 +42528,6 @@ var ApiKeySummarySchema = object({
|
|
|
41547
42528
|
createdAt: number(),
|
|
41548
42529
|
lastUsedAt: number().optional()
|
|
41549
42530
|
});
|
|
41550
|
-
var CreateApiKeyInputSchema = object({
|
|
41551
|
-
label: string(),
|
|
41552
|
-
isAdmin: boolean().default(false),
|
|
41553
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
41554
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
41555
|
-
});
|
|
41556
|
-
var CreateApiKeyResultSchema = object({
|
|
41557
|
-
token: string(),
|
|
41558
|
-
record: ApiKeySummarySchema
|
|
41559
|
-
});
|
|
41560
42531
|
var ScopedTokenSummarySchema = object({
|
|
41561
42532
|
id: string(),
|
|
41562
42533
|
userId: string(),
|
|
@@ -41655,17 +42626,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41655
42626
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
41656
42627
|
kind: "mutation",
|
|
41657
42628
|
access: "view"
|
|
41658
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
41659
|
-
kind: "mutation",
|
|
41660
|
-
auth: "admin",
|
|
41661
|
-
access: "create"
|
|
41662
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42629
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41663
42630
|
kind: "mutation",
|
|
41664
42631
|
auth: "admin",
|
|
41665
42632
|
access: "delete"
|
|
41666
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
41667
|
-
kind: "mutation",
|
|
41668
|
-
access: "view"
|
|
41669
42633
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
41670
42634
|
kind: "mutation",
|
|
41671
42635
|
auth: "admin",
|
|
@@ -41739,15 +42703,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41739
42703
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
41740
42704
|
userId: string(),
|
|
41741
42705
|
issuer: string()
|
|
41742
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
41743
|
-
userId: string(),
|
|
41744
|
-
issuer: string().min(1),
|
|
41745
|
-
label: string().optional()
|
|
41746
|
-
}), object({ success: literal(true) }), {
|
|
41747
|
-
kind: "mutation",
|
|
41748
|
-
auth: "admin",
|
|
41749
|
-
access: "create"
|
|
41750
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42706
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41751
42707
|
kind: "mutation",
|
|
41752
42708
|
auth: "admin",
|
|
41753
42709
|
access: "delete"
|
|
@@ -42452,6 +43408,451 @@ var zoneRulesCapability = {
|
|
|
42452
43408
|
*/
|
|
42453
43409
|
durability: "restored"
|
|
42454
43410
|
};
|
|
43411
|
+
/**
|
|
43412
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43413
|
+
*
|
|
43414
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43415
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43416
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43417
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43418
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43419
|
+
* manifest entry and nothing else.
|
|
43420
|
+
*
|
|
43421
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43422
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43423
|
+
* Every method is `admin`: these spend money.
|
|
43424
|
+
*
|
|
43425
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43426
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43427
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43428
|
+
*
|
|
43429
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43430
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43431
|
+
* ticket the provider mints (D613).
|
|
43432
|
+
*/
|
|
43433
|
+
var TrainingGpuOptionSchema = object({
|
|
43434
|
+
id: string(),
|
|
43435
|
+
label: string(),
|
|
43436
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43437
|
+
usdPerHour: number().nonnegative(),
|
|
43438
|
+
vramGb: number().nonnegative()
|
|
43439
|
+
});
|
|
43440
|
+
var TrainingRegionOptionSchema = object({
|
|
43441
|
+
/** `''` = any region (the provider's choice). */
|
|
43442
|
+
id: string(),
|
|
43443
|
+
label: string(),
|
|
43444
|
+
priceMultiplier: number().positive()
|
|
43445
|
+
});
|
|
43446
|
+
/**
|
|
43447
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43448
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43449
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43450
|
+
*/
|
|
43451
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43452
|
+
gpuType: string(),
|
|
43453
|
+
region: string(),
|
|
43454
|
+
costCapUsd: number().nonnegative(),
|
|
43455
|
+
maxRuntimeSec: number().int().positive(),
|
|
43456
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43457
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43458
|
+
});
|
|
43459
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43460
|
+
addonId: string(),
|
|
43461
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43462
|
+
kind: string(),
|
|
43463
|
+
label: string(),
|
|
43464
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43465
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43466
|
+
maxDatasetBytes: number().int().positive(),
|
|
43467
|
+
maxRuntimeSec: number().int().positive(),
|
|
43468
|
+
freeTierNote: string().optional(),
|
|
43469
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43470
|
+
dataResidencyNote: string(),
|
|
43471
|
+
/** Credentials are present — never the values. */
|
|
43472
|
+
configured: boolean(),
|
|
43473
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43474
|
+
});
|
|
43475
|
+
var TrainingCredentialCheckSchema = object({
|
|
43476
|
+
ok: boolean(),
|
|
43477
|
+
/** Workspace / account name, when the provider says. */
|
|
43478
|
+
account: string().optional(),
|
|
43479
|
+
reason: _enum([
|
|
43480
|
+
"missing",
|
|
43481
|
+
"invalid",
|
|
43482
|
+
"forbidden",
|
|
43483
|
+
"network",
|
|
43484
|
+
"quota"
|
|
43485
|
+
]).optional(),
|
|
43486
|
+
detail: string().optional()
|
|
43487
|
+
});
|
|
43488
|
+
var ProviderJobStateSchema = _enum([
|
|
43489
|
+
"pending",
|
|
43490
|
+
"starting",
|
|
43491
|
+
"running",
|
|
43492
|
+
"succeeded",
|
|
43493
|
+
"failed",
|
|
43494
|
+
"cancelled",
|
|
43495
|
+
"lost"
|
|
43496
|
+
]);
|
|
43497
|
+
var ProviderJobStatusSchema = object({
|
|
43498
|
+
jobKey: string(),
|
|
43499
|
+
providerJobId: string().optional(),
|
|
43500
|
+
state: ProviderJobStateSchema,
|
|
43501
|
+
startedAt: number().optional(),
|
|
43502
|
+
endedAt: number().optional(),
|
|
43503
|
+
exitCode: number().int().optional(),
|
|
43504
|
+
failureReason: string().optional(),
|
|
43505
|
+
gpuType: string(),
|
|
43506
|
+
region: string().optional(),
|
|
43507
|
+
billedSeconds: number().nonnegative(),
|
|
43508
|
+
costUsd: number().nonnegative(),
|
|
43509
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43510
|
+
costIsEstimate: boolean(),
|
|
43511
|
+
lastFetchedAt: number()
|
|
43512
|
+
});
|
|
43513
|
+
/**
|
|
43514
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43515
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43516
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43517
|
+
* in `result.json`.
|
|
43518
|
+
*/
|
|
43519
|
+
var TrainerSourceRefSchema = object({
|
|
43520
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43521
|
+
repo: string().min(1),
|
|
43522
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43523
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43524
|
+
});
|
|
43525
|
+
var JobRef = {
|
|
43526
|
+
addonId: string(),
|
|
43527
|
+
jobKey: string().uuid()
|
|
43528
|
+
};
|
|
43529
|
+
var TrainingLogLineSchema = object({
|
|
43530
|
+
ts: number(),
|
|
43531
|
+
text: string()
|
|
43532
|
+
});
|
|
43533
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43534
|
+
kind: "mutation",
|
|
43535
|
+
auth: "admin",
|
|
43536
|
+
timeoutMs: 3e4
|
|
43537
|
+
}), method(object({
|
|
43538
|
+
addonId: string(),
|
|
43539
|
+
gpuType: string(),
|
|
43540
|
+
region: string(),
|
|
43541
|
+
datasetBytes: number().int().nonnegative(),
|
|
43542
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43543
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43544
|
+
}), object({
|
|
43545
|
+
usdLow: number().nonnegative(),
|
|
43546
|
+
usdHigh: number().nonnegative(),
|
|
43547
|
+
notes: array(string()).readonly()
|
|
43548
|
+
}), { auth: "admin" }), method(object({
|
|
43549
|
+
...JobRef,
|
|
43550
|
+
ticket: PeerBytesTicketSchema
|
|
43551
|
+
}), object({
|
|
43552
|
+
bytes: number().int().nonnegative(),
|
|
43553
|
+
sha256: string()
|
|
43554
|
+
}), {
|
|
43555
|
+
kind: "mutation",
|
|
43556
|
+
auth: "admin",
|
|
43557
|
+
timeoutMs: 120 * 6e4
|
|
43558
|
+
}), method(object({
|
|
43559
|
+
...JobRef,
|
|
43560
|
+
trainer: TrainerSourceRefSchema,
|
|
43561
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43562
|
+
gpuType: string(),
|
|
43563
|
+
region: string(),
|
|
43564
|
+
maxRuntimeSec: number().int().positive()
|
|
43565
|
+
}), ProviderJobStatusSchema, {
|
|
43566
|
+
kind: "mutation",
|
|
43567
|
+
auth: "admin",
|
|
43568
|
+
timeoutMs: 30 * 6e4
|
|
43569
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43570
|
+
auth: "admin",
|
|
43571
|
+
timeoutMs: 6e4
|
|
43572
|
+
}), method(object({
|
|
43573
|
+
...JobRef,
|
|
43574
|
+
cursor: string().optional(),
|
|
43575
|
+
max: number().int().min(1).max(500)
|
|
43576
|
+
}), object({
|
|
43577
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43578
|
+
cursor: string()
|
|
43579
|
+
}), {
|
|
43580
|
+
auth: "admin",
|
|
43581
|
+
timeoutMs: 6e4
|
|
43582
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43583
|
+
kind: "mutation",
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 6e4
|
|
43586
|
+
}), method(object(JobRef), object({
|
|
43587
|
+
found: boolean(),
|
|
43588
|
+
text: string().optional()
|
|
43589
|
+
}), {
|
|
43590
|
+
kind: "mutation",
|
|
43591
|
+
auth: "admin",
|
|
43592
|
+
timeoutMs: 5 * 6e4
|
|
43593
|
+
}), method(object({
|
|
43594
|
+
...JobRef,
|
|
43595
|
+
path: _enum(["bundle.tar"])
|
|
43596
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43597
|
+
kind: "mutation",
|
|
43598
|
+
auth: "admin",
|
|
43599
|
+
timeoutMs: 5 * 6e4
|
|
43600
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43601
|
+
kind: "mutation",
|
|
43602
|
+
auth: "admin",
|
|
43603
|
+
timeoutMs: 5 * 6e4
|
|
43604
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43605
|
+
auth: "admin",
|
|
43606
|
+
timeoutMs: 2 * 6e4
|
|
43607
|
+
});
|
|
43608
|
+
/**
|
|
43609
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43610
|
+
* provided by `addon-training`.
|
|
43611
|
+
*
|
|
43612
|
+
* It owns what every provider must agree on, written once:
|
|
43613
|
+
*
|
|
43614
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43615
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43616
|
+
* the export plan) and reaches this store through the five row methods
|
|
43617
|
+
* below, so the Retrain page and the export did not change.
|
|
43618
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43619
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43620
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43621
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43622
|
+
* rollback. Nothing is ever registered automatically.
|
|
43623
|
+
*
|
|
43624
|
+
* Every method is `admin`.
|
|
43625
|
+
*/
|
|
43626
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43627
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43628
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43629
|
+
var TrainingBaseModelSchema = object({
|
|
43630
|
+
modelId: string(),
|
|
43631
|
+
label: string(),
|
|
43632
|
+
weights: string(),
|
|
43633
|
+
imgsz: number().int(),
|
|
43634
|
+
baselineOnnxUrl: string(),
|
|
43635
|
+
baselineFloors: record(string(), number()),
|
|
43636
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43637
|
+
recommended: boolean()
|
|
43638
|
+
});
|
|
43639
|
+
var TrainingPresetSchema = _enum([
|
|
43640
|
+
"quick",
|
|
43641
|
+
"standard",
|
|
43642
|
+
"thorough"
|
|
43643
|
+
]);
|
|
43644
|
+
var TrainingJobRequestSchema = object({
|
|
43645
|
+
datasetVersionId: string().min(1),
|
|
43646
|
+
/** The `training-provider` addon that runs it. */
|
|
43647
|
+
addonId: string().min(1),
|
|
43648
|
+
gpuType: string().min(1),
|
|
43649
|
+
region: string(),
|
|
43650
|
+
baseModelId: string().min(1),
|
|
43651
|
+
preset: TrainingPresetSchema,
|
|
43652
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43653
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43654
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43655
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43656
|
+
});
|
|
43657
|
+
var TrainingSplitPlanSchema = object({
|
|
43658
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43659
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43660
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43661
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43662
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43663
|
+
trainSubjects: number().int()
|
|
43664
|
+
});
|
|
43665
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43666
|
+
"unknown-dataset",
|
|
43667
|
+
"unknown-provider",
|
|
43668
|
+
"provider-not-configured",
|
|
43669
|
+
"unknown-base-model",
|
|
43670
|
+
"unknown-gpu",
|
|
43671
|
+
"dataset-too-large",
|
|
43672
|
+
"no-training-subjects",
|
|
43673
|
+
"job-already-running"
|
|
43674
|
+
]);
|
|
43675
|
+
var TrainingJobPlanSchema = object({
|
|
43676
|
+
refusal: object({
|
|
43677
|
+
reason: TrainingRefusalReasonSchema,
|
|
43678
|
+
detail: string()
|
|
43679
|
+
}).nullable(),
|
|
43680
|
+
warnings: array(string()).readonly(),
|
|
43681
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43682
|
+
estimate: object({
|
|
43683
|
+
datasetBytes: number().int(),
|
|
43684
|
+
uploadMinutesAt20Mbps: number(),
|
|
43685
|
+
gpuSecondsLow: number(),
|
|
43686
|
+
gpuSecondsHigh: number(),
|
|
43687
|
+
usdLow: number(),
|
|
43688
|
+
usdHigh: number(),
|
|
43689
|
+
notes: array(string()).readonly()
|
|
43690
|
+
}).nullable(),
|
|
43691
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43692
|
+
defaults: object({
|
|
43693
|
+
maxCostUsd: number(),
|
|
43694
|
+
maxRuntimeSec: number().int()
|
|
43695
|
+
}).nullable(),
|
|
43696
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43697
|
+
dataNotice: string()
|
|
43698
|
+
});
|
|
43699
|
+
/**
|
|
43700
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43701
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43702
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43703
|
+
* result lives after the operator acted on it.
|
|
43704
|
+
*/
|
|
43705
|
+
var TrainingJobStateSchema = _enum([
|
|
43706
|
+
"uploading",
|
|
43707
|
+
"submitted",
|
|
43708
|
+
"starting",
|
|
43709
|
+
"running",
|
|
43710
|
+
"collecting",
|
|
43711
|
+
"ready",
|
|
43712
|
+
"registered",
|
|
43713
|
+
"canary",
|
|
43714
|
+
"failed",
|
|
43715
|
+
"cancelling",
|
|
43716
|
+
"cancelled",
|
|
43717
|
+
"lost",
|
|
43718
|
+
"expired",
|
|
43719
|
+
"discarded"
|
|
43720
|
+
]);
|
|
43721
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43722
|
+
"cost-cap",
|
|
43723
|
+
"runtime-cap",
|
|
43724
|
+
"upload-failed",
|
|
43725
|
+
"submit-failed",
|
|
43726
|
+
"trainer-failed",
|
|
43727
|
+
"result-invalid",
|
|
43728
|
+
"checksum-mismatch",
|
|
43729
|
+
"fetch-failed",
|
|
43730
|
+
"provider-error",
|
|
43731
|
+
"hub-restart-during-upload"
|
|
43732
|
+
]);
|
|
43733
|
+
var TrainingProgressPointSchema = object({
|
|
43734
|
+
epoch: number().int(),
|
|
43735
|
+
map50: number().nullable(),
|
|
43736
|
+
map50_95: number().nullable()
|
|
43737
|
+
});
|
|
43738
|
+
var TrainingCanarySchema = object({
|
|
43739
|
+
deviceIds: array(number().int()).readonly(),
|
|
43740
|
+
since: number(),
|
|
43741
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43742
|
+
previous: array(object({
|
|
43743
|
+
deviceId: number().int(),
|
|
43744
|
+
nodeId: string(),
|
|
43745
|
+
deviceKey: string(),
|
|
43746
|
+
patch: object({
|
|
43747
|
+
modelId: string().optional(),
|
|
43748
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43749
|
+
}).nullable()
|
|
43750
|
+
})).readonly()
|
|
43751
|
+
});
|
|
43752
|
+
var TrainingJobSchema = object({
|
|
43753
|
+
id: string(),
|
|
43754
|
+
idempotencyKey: string(),
|
|
43755
|
+
name: string(),
|
|
43756
|
+
createdAt: number(),
|
|
43757
|
+
updatedAt: number(),
|
|
43758
|
+
state: TrainingJobStateSchema,
|
|
43759
|
+
stage: TrainingStageSchema.nullable(),
|
|
43760
|
+
failure: object({
|
|
43761
|
+
reason: TrainingFailureReasonSchema,
|
|
43762
|
+
stage: string().nullable(),
|
|
43763
|
+
detail: string()
|
|
43764
|
+
}).nullable(),
|
|
43765
|
+
request: TrainingJobRequestSchema,
|
|
43766
|
+
maxCostUsd: number().nonnegative(),
|
|
43767
|
+
maxRuntimeSec: number().int().positive(),
|
|
43768
|
+
trainer: TrainerSourceRefSchema,
|
|
43769
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43770
|
+
dataset: object({
|
|
43771
|
+
bytes: number().int(),
|
|
43772
|
+
sha256: string(),
|
|
43773
|
+
uploadedAt: number()
|
|
43774
|
+
}).nullable(),
|
|
43775
|
+
split: TrainingSplitPlanSchema,
|
|
43776
|
+
provider: object({
|
|
43777
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43778
|
+
providerJobId: string().nullable(),
|
|
43779
|
+
startedAt: number().nullable(),
|
|
43780
|
+
endedAt: number().nullable(),
|
|
43781
|
+
billedSeconds: number(),
|
|
43782
|
+
costUsd: number(),
|
|
43783
|
+
costIsEstimate: boolean(),
|
|
43784
|
+
lastPolledAt: number().nullable()
|
|
43785
|
+
}),
|
|
43786
|
+
progress: object({
|
|
43787
|
+
epoch: number().int().nullable(),
|
|
43788
|
+
epochs: number().int().nullable(),
|
|
43789
|
+
etaSec: number().nullable(),
|
|
43790
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43791
|
+
}),
|
|
43792
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43793
|
+
logTail: array(string()).readonly(),
|
|
43794
|
+
logCursor: string().nullable(),
|
|
43795
|
+
artifacts: object({
|
|
43796
|
+
bundleBytes: number().int(),
|
|
43797
|
+
bundleSha256: string(),
|
|
43798
|
+
fetchedAt: number(),
|
|
43799
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43800
|
+
expiresAt: number()
|
|
43801
|
+
}).nullable(),
|
|
43802
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43803
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43804
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43805
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43806
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43807
|
+
registeredModelIds: array(string()).readonly(),
|
|
43808
|
+
canary: TrainingCanarySchema.nullable()
|
|
43809
|
+
});
|
|
43810
|
+
var IdInput = object({ id: string().min(1) });
|
|
43811
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43812
|
+
kind: "mutation",
|
|
43813
|
+
auth: "admin"
|
|
43814
|
+
}), 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() }), {
|
|
43815
|
+
kind: "mutation",
|
|
43816
|
+
auth: "admin"
|
|
43817
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43818
|
+
auth: "admin",
|
|
43819
|
+
timeoutMs: 6e4
|
|
43820
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43821
|
+
name: string().min(1).max(120),
|
|
43822
|
+
maxCostUsd: number().positive(),
|
|
43823
|
+
maxRuntimeSec: number().int().positive(),
|
|
43824
|
+
idempotencyKey: string().min(8).max(80)
|
|
43825
|
+
}), discriminatedUnion("kind", [object({
|
|
43826
|
+
kind: literal("started"),
|
|
43827
|
+
job: TrainingJobSchema
|
|
43828
|
+
}), object({
|
|
43829
|
+
kind: literal("refused"),
|
|
43830
|
+
reason: TrainingRefusalReasonSchema,
|
|
43831
|
+
detail: string()
|
|
43832
|
+
})]), {
|
|
43833
|
+
kind: "mutation",
|
|
43834
|
+
auth: "admin",
|
|
43835
|
+
timeoutMs: 12e4
|
|
43836
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43837
|
+
kind: "mutation",
|
|
43838
|
+
auth: "admin",
|
|
43839
|
+
timeoutMs: 12e4
|
|
43840
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43841
|
+
kind: "mutation",
|
|
43842
|
+
auth: "admin",
|
|
43843
|
+
timeoutMs: 30 * 6e4
|
|
43844
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43845
|
+
kind: "mutation",
|
|
43846
|
+
auth: "admin",
|
|
43847
|
+
timeoutMs: 12e4
|
|
43848
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43849
|
+
kind: "mutation",
|
|
43850
|
+
auth: "admin",
|
|
43851
|
+
timeoutMs: 12e4
|
|
43852
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43853
|
+
kind: "mutation",
|
|
43854
|
+
auth: "admin"
|
|
43855
|
+
});
|
|
42455
43856
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
42456
43857
|
Object.freeze({
|
|
42457
43858
|
person: .5,
|
|
@@ -44600,6 +46001,12 @@ Object.freeze({
|
|
|
44600
46001
|
addonId: null,
|
|
44601
46002
|
access: "create"
|
|
44602
46003
|
},
|
|
46004
|
+
"backup.checkBackupKey": {
|
|
46005
|
+
capName: "backup",
|
|
46006
|
+
capScope: "system",
|
|
46007
|
+
addonId: null,
|
|
46008
|
+
access: "create"
|
|
46009
|
+
},
|
|
44603
46010
|
"backup.delete": {
|
|
44604
46011
|
capName: "backup",
|
|
44605
46012
|
capScope: "system",
|
|
@@ -44612,6 +46019,18 @@ Object.freeze({
|
|
|
44612
46019
|
addonId: null,
|
|
44613
46020
|
access: "delete"
|
|
44614
46021
|
},
|
|
46022
|
+
"backup.disableEncryption": {
|
|
46023
|
+
capName: "backup",
|
|
46024
|
+
capScope: "system",
|
|
46025
|
+
addonId: null,
|
|
46026
|
+
access: "create"
|
|
46027
|
+
},
|
|
46028
|
+
"backup.getEncryption": {
|
|
46029
|
+
capName: "backup",
|
|
46030
|
+
capScope: "system",
|
|
46031
|
+
addonId: null,
|
|
46032
|
+
access: "view"
|
|
46033
|
+
},
|
|
44615
46034
|
"backup.getEntries": {
|
|
44616
46035
|
capName: "backup",
|
|
44617
46036
|
capScope: "system",
|
|
@@ -44666,6 +46085,12 @@ Object.freeze({
|
|
|
44666
46085
|
addonId: null,
|
|
44667
46086
|
access: "create"
|
|
44668
46087
|
},
|
|
46088
|
+
"backup.setupEncryption": {
|
|
46089
|
+
capName: "backup",
|
|
46090
|
+
capScope: "system",
|
|
46091
|
+
addonId: null,
|
|
46092
|
+
access: "create"
|
|
46093
|
+
},
|
|
44669
46094
|
"backup.trigger": {
|
|
44670
46095
|
capName: "backup",
|
|
44671
46096
|
capScope: "system",
|
|
@@ -45218,6 +46643,12 @@ Object.freeze({
|
|
|
45218
46643
|
addonId: null,
|
|
45219
46644
|
access: "create"
|
|
45220
46645
|
},
|
|
46646
|
+
"customModelRegistry.importModelBundle": {
|
|
46647
|
+
capName: "custom-model-registry",
|
|
46648
|
+
capScope: "system",
|
|
46649
|
+
addonId: null,
|
|
46650
|
+
access: "create"
|
|
46651
|
+
},
|
|
45221
46652
|
"customModelRegistry.listModels": {
|
|
45222
46653
|
capName: "custom-model-registry",
|
|
45223
46654
|
capScope: "system",
|
|
@@ -46658,6 +48089,12 @@ Object.freeze({
|
|
|
46658
48089
|
addonId: null,
|
|
46659
48090
|
access: "view"
|
|
46660
48091
|
},
|
|
48092
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48093
|
+
capName: "keychain-admin",
|
|
48094
|
+
capScope: "system",
|
|
48095
|
+
addonId: null,
|
|
48096
|
+
access: "create"
|
|
48097
|
+
},
|
|
46661
48098
|
"keychainAdmin.deleteOrphans": {
|
|
46662
48099
|
capName: "keychain-admin",
|
|
46663
48100
|
capScope: "system",
|
|
@@ -46694,6 +48131,12 @@ Object.freeze({
|
|
|
46694
48131
|
addonId: null,
|
|
46695
48132
|
access: "delete"
|
|
46696
48133
|
},
|
|
48134
|
+
"keychainAdmin.resetReport": {
|
|
48135
|
+
capName: "keychain-admin",
|
|
48136
|
+
capScope: "system",
|
|
48137
|
+
addonId: null,
|
|
48138
|
+
access: "delete"
|
|
48139
|
+
},
|
|
46697
48140
|
"keychainAdmin.reveal": {
|
|
46698
48141
|
capName: "keychain-admin",
|
|
46699
48142
|
capScope: "system",
|
|
@@ -46706,6 +48149,12 @@ Object.freeze({
|
|
|
46706
48149
|
addonId: null,
|
|
46707
48150
|
access: "create"
|
|
46708
48151
|
},
|
|
48152
|
+
"keychainAdmin.setSystemSecret": {
|
|
48153
|
+
capName: "keychain-admin",
|
|
48154
|
+
capScope: "system",
|
|
48155
|
+
addonId: null,
|
|
48156
|
+
access: "create"
|
|
48157
|
+
},
|
|
46709
48158
|
"keychainAdmin.status": {
|
|
46710
48159
|
capName: "keychain-admin",
|
|
46711
48160
|
capScope: "system",
|
|
@@ -48152,6 +49601,12 @@ Object.freeze({
|
|
|
48152
49601
|
addonId: null,
|
|
48153
49602
|
access: "create"
|
|
48154
49603
|
},
|
|
49604
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49605
|
+
capName: "pipeline-analytics",
|
|
49606
|
+
capScope: "device",
|
|
49607
|
+
addonId: null,
|
|
49608
|
+
access: "create"
|
|
49609
|
+
},
|
|
48155
49610
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
48156
49611
|
capName: "pipeline-analytics",
|
|
48157
49612
|
capScope: "device",
|
|
@@ -48164,6 +49619,12 @@ Object.freeze({
|
|
|
48164
49619
|
addonId: null,
|
|
48165
49620
|
access: "delete"
|
|
48166
49621
|
},
|
|
49622
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49623
|
+
capName: "pipeline-analytics",
|
|
49624
|
+
capScope: "device",
|
|
49625
|
+
addonId: null,
|
|
49626
|
+
access: "delete"
|
|
49627
|
+
},
|
|
48167
49628
|
"pipelineAnalytics.deleteTracks": {
|
|
48168
49629
|
capName: "pipeline-analytics",
|
|
48169
49630
|
capScope: "device",
|
|
@@ -48386,6 +49847,12 @@ Object.freeze({
|
|
|
48386
49847
|
addonId: null,
|
|
48387
49848
|
access: "view"
|
|
48388
49849
|
},
|
|
49850
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49851
|
+
capName: "pipeline-analytics",
|
|
49852
|
+
capScope: "device",
|
|
49853
|
+
addonId: null,
|
|
49854
|
+
access: "view"
|
|
49855
|
+
},
|
|
48389
49856
|
"pipelineAnalytics.listRetrainFrames": {
|
|
48390
49857
|
capName: "pipeline-analytics",
|
|
48391
49858
|
capScope: "device",
|
|
@@ -48416,6 +49883,12 @@ Object.freeze({
|
|
|
48416
49883
|
addonId: null,
|
|
48417
49884
|
access: "view"
|
|
48418
49885
|
},
|
|
49886
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49887
|
+
capName: "pipeline-analytics",
|
|
49888
|
+
capScope: "device",
|
|
49889
|
+
addonId: null,
|
|
49890
|
+
access: "create"
|
|
49891
|
+
},
|
|
48419
49892
|
"pipelineAnalytics.ownersWithMedia": {
|
|
48420
49893
|
capName: "pipeline-analytics",
|
|
48421
49894
|
capScope: "device",
|
|
@@ -48428,6 +49901,12 @@ Object.freeze({
|
|
|
48428
49901
|
addonId: null,
|
|
48429
49902
|
access: "create"
|
|
48430
49903
|
},
|
|
49904
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49905
|
+
capName: "pipeline-analytics",
|
|
49906
|
+
capScope: "device",
|
|
49907
|
+
addonId: null,
|
|
49908
|
+
access: "view"
|
|
49909
|
+
},
|
|
48431
49910
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
48432
49911
|
capName: "pipeline-analytics",
|
|
48433
49912
|
capScope: "device",
|
|
@@ -48566,6 +50045,12 @@ Object.freeze({
|
|
|
48566
50045
|
addonId: null,
|
|
48567
50046
|
access: "create"
|
|
48568
50047
|
},
|
|
50048
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50049
|
+
capName: "pipeline-analytics",
|
|
50050
|
+
capScope: "device",
|
|
50051
|
+
addonId: null,
|
|
50052
|
+
access: "view"
|
|
50053
|
+
},
|
|
48569
50054
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
48570
50055
|
capName: "pipeline-analytics",
|
|
48571
50056
|
capScope: "device",
|
|
@@ -50942,6 +52427,174 @@ Object.freeze({
|
|
|
50942
52427
|
addonId: null,
|
|
50943
52428
|
access: "view"
|
|
50944
52429
|
},
|
|
52430
|
+
"training.canaryResult": {
|
|
52431
|
+
capName: "training",
|
|
52432
|
+
capScope: "system",
|
|
52433
|
+
addonId: null,
|
|
52434
|
+
access: "create"
|
|
52435
|
+
},
|
|
52436
|
+
"training.cancelJob": {
|
|
52437
|
+
capName: "training",
|
|
52438
|
+
capScope: "system",
|
|
52439
|
+
addonId: null,
|
|
52440
|
+
access: "create"
|
|
52441
|
+
},
|
|
52442
|
+
"training.discardResult": {
|
|
52443
|
+
capName: "training",
|
|
52444
|
+
capScope: "system",
|
|
52445
|
+
addonId: null,
|
|
52446
|
+
access: "create"
|
|
52447
|
+
},
|
|
52448
|
+
"training.findDatasetVersionIdByName": {
|
|
52449
|
+
capName: "training",
|
|
52450
|
+
capScope: "system",
|
|
52451
|
+
addonId: null,
|
|
52452
|
+
access: "view"
|
|
52453
|
+
},
|
|
52454
|
+
"training.getDatasetVersion": {
|
|
52455
|
+
capName: "training",
|
|
52456
|
+
capScope: "system",
|
|
52457
|
+
addonId: null,
|
|
52458
|
+
access: "view"
|
|
52459
|
+
},
|
|
52460
|
+
"training.getJob": {
|
|
52461
|
+
capName: "training",
|
|
52462
|
+
capScope: "system",
|
|
52463
|
+
addonId: null,
|
|
52464
|
+
access: "view"
|
|
52465
|
+
},
|
|
52466
|
+
"training.getJobResult": {
|
|
52467
|
+
capName: "training",
|
|
52468
|
+
capScope: "system",
|
|
52469
|
+
addonId: null,
|
|
52470
|
+
access: "view"
|
|
52471
|
+
},
|
|
52472
|
+
"training.listBaseModels": {
|
|
52473
|
+
capName: "training",
|
|
52474
|
+
capScope: "system",
|
|
52475
|
+
addonId: null,
|
|
52476
|
+
access: "view"
|
|
52477
|
+
},
|
|
52478
|
+
"training.listDatasetVersions": {
|
|
52479
|
+
capName: "training",
|
|
52480
|
+
capScope: "system",
|
|
52481
|
+
addonId: null,
|
|
52482
|
+
access: "view"
|
|
52483
|
+
},
|
|
52484
|
+
"training.listJobs": {
|
|
52485
|
+
capName: "training",
|
|
52486
|
+
capScope: "system",
|
|
52487
|
+
addonId: null,
|
|
52488
|
+
access: "view"
|
|
52489
|
+
},
|
|
52490
|
+
"training.planJob": {
|
|
52491
|
+
capName: "training",
|
|
52492
|
+
capScope: "system",
|
|
52493
|
+
addonId: null,
|
|
52494
|
+
access: "view"
|
|
52495
|
+
},
|
|
52496
|
+
"training.putDatasetVersion": {
|
|
52497
|
+
capName: "training",
|
|
52498
|
+
capScope: "system",
|
|
52499
|
+
addonId: null,
|
|
52500
|
+
access: "create"
|
|
52501
|
+
},
|
|
52502
|
+
"training.registerResult": {
|
|
52503
|
+
capName: "training",
|
|
52504
|
+
capScope: "system",
|
|
52505
|
+
addonId: null,
|
|
52506
|
+
access: "create"
|
|
52507
|
+
},
|
|
52508
|
+
"training.removeDatasetVersion": {
|
|
52509
|
+
capName: "training",
|
|
52510
|
+
capScope: "system",
|
|
52511
|
+
addonId: null,
|
|
52512
|
+
access: "delete"
|
|
52513
|
+
},
|
|
52514
|
+
"training.rollbackCanary": {
|
|
52515
|
+
capName: "training",
|
|
52516
|
+
capScope: "system",
|
|
52517
|
+
addonId: null,
|
|
52518
|
+
access: "create"
|
|
52519
|
+
},
|
|
52520
|
+
"training.startJob": {
|
|
52521
|
+
capName: "training",
|
|
52522
|
+
capScope: "system",
|
|
52523
|
+
addonId: null,
|
|
52524
|
+
access: "create"
|
|
52525
|
+
},
|
|
52526
|
+
"trainingProvider.cancelJob": {
|
|
52527
|
+
capName: "training-provider",
|
|
52528
|
+
capScope: "system",
|
|
52529
|
+
addonId: null,
|
|
52530
|
+
access: "create"
|
|
52531
|
+
},
|
|
52532
|
+
"trainingProvider.cleanupJob": {
|
|
52533
|
+
capName: "training-provider",
|
|
52534
|
+
capScope: "system",
|
|
52535
|
+
addonId: null,
|
|
52536
|
+
access: "create"
|
|
52537
|
+
},
|
|
52538
|
+
"trainingProvider.describe": {
|
|
52539
|
+
capName: "training-provider",
|
|
52540
|
+
capScope: "system",
|
|
52541
|
+
addonId: null,
|
|
52542
|
+
access: "view"
|
|
52543
|
+
},
|
|
52544
|
+
"trainingProvider.estimateJob": {
|
|
52545
|
+
capName: "training-provider",
|
|
52546
|
+
capScope: "system",
|
|
52547
|
+
addonId: null,
|
|
52548
|
+
access: "view"
|
|
52549
|
+
},
|
|
52550
|
+
"trainingProvider.getJob": {
|
|
52551
|
+
capName: "training-provider",
|
|
52552
|
+
capScope: "system",
|
|
52553
|
+
addonId: null,
|
|
52554
|
+
access: "view"
|
|
52555
|
+
},
|
|
52556
|
+
"trainingProvider.listJobEvents": {
|
|
52557
|
+
capName: "training-provider",
|
|
52558
|
+
capScope: "system",
|
|
52559
|
+
addonId: null,
|
|
52560
|
+
access: "view"
|
|
52561
|
+
},
|
|
52562
|
+
"trainingProvider.listJobs": {
|
|
52563
|
+
capName: "training-provider",
|
|
52564
|
+
capScope: "system",
|
|
52565
|
+
addonId: null,
|
|
52566
|
+
access: "view"
|
|
52567
|
+
},
|
|
52568
|
+
"trainingProvider.offerArtifact": {
|
|
52569
|
+
capName: "training-provider",
|
|
52570
|
+
capScope: "system",
|
|
52571
|
+
addonId: null,
|
|
52572
|
+
access: "create"
|
|
52573
|
+
},
|
|
52574
|
+
"trainingProvider.readResult": {
|
|
52575
|
+
capName: "training-provider",
|
|
52576
|
+
capScope: "system",
|
|
52577
|
+
addonId: null,
|
|
52578
|
+
access: "create"
|
|
52579
|
+
},
|
|
52580
|
+
"trainingProvider.submitJob": {
|
|
52581
|
+
capName: "training-provider",
|
|
52582
|
+
capScope: "system",
|
|
52583
|
+
addonId: null,
|
|
52584
|
+
access: "create"
|
|
52585
|
+
},
|
|
52586
|
+
"trainingProvider.uploadDataset": {
|
|
52587
|
+
capName: "training-provider",
|
|
52588
|
+
capScope: "system",
|
|
52589
|
+
addonId: null,
|
|
52590
|
+
access: "create"
|
|
52591
|
+
},
|
|
52592
|
+
"trainingProvider.validateCredentials": {
|
|
52593
|
+
capName: "training-provider",
|
|
52594
|
+
capScope: "system",
|
|
52595
|
+
addonId: null,
|
|
52596
|
+
access: "create"
|
|
52597
|
+
},
|
|
50945
52598
|
"turnProvider.getTurnServers": {
|
|
50946
52599
|
capName: "turn-provider",
|
|
50947
52600
|
capScope: "system",
|
|
@@ -50966,12 +52619,6 @@ Object.freeze({
|
|
|
50966
52619
|
addonId: null,
|
|
50967
52620
|
access: "create"
|
|
50968
52621
|
},
|
|
50969
|
-
"userManagement.createApiKey": {
|
|
50970
|
-
capName: "user-management",
|
|
50971
|
-
capScope: "system",
|
|
50972
|
-
addonId: null,
|
|
50973
|
-
access: "create"
|
|
50974
|
-
},
|
|
50975
52622
|
"userManagement.createScopedToken": {
|
|
50976
52623
|
capName: "user-management",
|
|
50977
52624
|
capScope: "system",
|
|
@@ -51008,12 +52655,6 @@ Object.freeze({
|
|
|
51008
52655
|
addonId: null,
|
|
51009
52656
|
access: "view"
|
|
51010
52657
|
},
|
|
51011
|
-
"userManagement.linkExternalIdentity": {
|
|
51012
|
-
capName: "user-management",
|
|
51013
|
-
capScope: "system",
|
|
51014
|
-
addonId: null,
|
|
51015
|
-
access: "create"
|
|
51016
|
-
},
|
|
51017
52658
|
"userManagement.listApiKeys": {
|
|
51018
52659
|
capName: "user-management",
|
|
51019
52660
|
capScope: "system",
|
|
@@ -51116,12 +52757,6 @@ Object.freeze({
|
|
|
51116
52757
|
addonId: null,
|
|
51117
52758
|
access: "create"
|
|
51118
52759
|
},
|
|
51119
|
-
"userManagement.validateApiKey": {
|
|
51120
|
-
capName: "user-management",
|
|
51121
|
-
capScope: "system",
|
|
51122
|
-
addonId: null,
|
|
51123
|
-
access: "view"
|
|
51124
|
-
},
|
|
51125
52760
|
"userManagement.validateCredentials": {
|
|
51126
52761
|
capName: "user-management",
|
|
51127
52762
|
capScope: "system",
|
|
@@ -55235,6 +56870,11 @@ Object.freeze({
|
|
|
55235
56870
|
form: "single",
|
|
55236
56871
|
optional: false
|
|
55237
56872
|
}],
|
|
56873
|
+
"training.canaryResult": [{
|
|
56874
|
+
name: "deviceIds",
|
|
56875
|
+
form: "array",
|
|
56876
|
+
optional: false
|
|
56877
|
+
}],
|
|
55238
56878
|
"update.getStatus": [{
|
|
55239
56879
|
name: "deviceId",
|
|
55240
56880
|
form: "single",
|