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