@camstack/addon-provider-dreo 0.2.123 → 0.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1771 -131
- package/dist/addon.mjs +1771 -131
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -5413,7 +5413,7 @@ var ZodIssueCode = {
|
|
|
5413
5413
|
var ZodFirstPartyTypeKind;
|
|
5414
5414
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5415
5415
|
//#endregion
|
|
5416
|
-
//#region ../types/dist/sleep-
|
|
5416
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5417
5417
|
/**
|
|
5418
5418
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5419
5419
|
* window to float samples (D455).
|
|
@@ -5530,7 +5530,7 @@ function isKeychainStoredField(field) {
|
|
|
5530
5530
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5531
5531
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5532
5532
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5533
|
-
function isRecord$
|
|
5533
|
+
function isRecord$2(value) {
|
|
5534
5534
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5535
5535
|
}
|
|
5536
5536
|
function makeSecretMarker(ref) {
|
|
@@ -5541,12 +5541,12 @@ function makeSecretMarker(ref) {
|
|
|
5541
5541
|
}
|
|
5542
5542
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5543
5543
|
function isSecretMarker(value) {
|
|
5544
|
-
if (!isRecord$
|
|
5544
|
+
if (!isRecord$2(value)) return false;
|
|
5545
5545
|
const ref = value["$secret"];
|
|
5546
5546
|
return typeof ref === "string" && ref.length > 0;
|
|
5547
5547
|
}
|
|
5548
5548
|
function isSecretClear(value) {
|
|
5549
|
-
return isRecord$
|
|
5549
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5550
5550
|
}
|
|
5551
5551
|
/**
|
|
5552
5552
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6062,6 +6062,13 @@ function globalSecretScope() {
|
|
|
6062
6062
|
function encodeSegment(value) {
|
|
6063
6063
|
return encodeURIComponent(value);
|
|
6064
6064
|
}
|
|
6065
|
+
function decodeSegment(value) {
|
|
6066
|
+
try {
|
|
6067
|
+
return decodeURIComponent(value);
|
|
6068
|
+
} catch {
|
|
6069
|
+
return null;
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6065
6072
|
/**
|
|
6066
6073
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6067
6074
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6070,6 +6077,75 @@ function encodeSegment(value) {
|
|
|
6070
6077
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6071
6078
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6072
6079
|
}
|
|
6080
|
+
function parseScope(segments) {
|
|
6081
|
+
switch (segments[0]) {
|
|
6082
|
+
case "global": return {
|
|
6083
|
+
scope: GLOBAL_SCOPE,
|
|
6084
|
+
used: 1
|
|
6085
|
+
};
|
|
6086
|
+
case "node": {
|
|
6087
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6088
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6089
|
+
scope: {
|
|
6090
|
+
kind: "node",
|
|
6091
|
+
nodeId
|
|
6092
|
+
},
|
|
6093
|
+
used: 2
|
|
6094
|
+
};
|
|
6095
|
+
}
|
|
6096
|
+
case "device": {
|
|
6097
|
+
const raw = segments[1];
|
|
6098
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6099
|
+
return {
|
|
6100
|
+
scope: {
|
|
6101
|
+
kind: "device",
|
|
6102
|
+
deviceId: Number(raw)
|
|
6103
|
+
},
|
|
6104
|
+
used: 2
|
|
6105
|
+
};
|
|
6106
|
+
}
|
|
6107
|
+
case "integration": {
|
|
6108
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6109
|
+
return id === null || id.length === 0 ? null : {
|
|
6110
|
+
scope: {
|
|
6111
|
+
kind: "integration",
|
|
6112
|
+
integrationId: id
|
|
6113
|
+
},
|
|
6114
|
+
used: 2
|
|
6115
|
+
};
|
|
6116
|
+
}
|
|
6117
|
+
case "row": {
|
|
6118
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6119
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6120
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6121
|
+
return {
|
|
6122
|
+
scope: {
|
|
6123
|
+
kind: "row",
|
|
6124
|
+
collection,
|
|
6125
|
+
rowId
|
|
6126
|
+
},
|
|
6127
|
+
used: 3
|
|
6128
|
+
};
|
|
6129
|
+
}
|
|
6130
|
+
default: return null;
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6133
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6134
|
+
function parseSecretRef(ref) {
|
|
6135
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6136
|
+
const segments = ref.slice(9).split("/");
|
|
6137
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6138
|
+
if (owner === null || owner.length === 0) return null;
|
|
6139
|
+
const parsed = parseScope(segments.slice(1));
|
|
6140
|
+
if (parsed === null) return null;
|
|
6141
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6142
|
+
if (fieldPath.length === 0) return null;
|
|
6143
|
+
return {
|
|
6144
|
+
owner,
|
|
6145
|
+
scope: parsed.scope,
|
|
6146
|
+
fieldPath
|
|
6147
|
+
};
|
|
6148
|
+
}
|
|
6073
6149
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6074
6150
|
var KeychainWriteRefusedError = class extends Error {
|
|
6075
6151
|
fieldPath;
|
|
@@ -6080,7 +6156,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6080
6156
|
}
|
|
6081
6157
|
};
|
|
6082
6158
|
var KEEP = { kind: "keep" };
|
|
6083
|
-
function isRecord(value) {
|
|
6159
|
+
function isRecord$1(value) {
|
|
6084
6160
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6085
6161
|
}
|
|
6086
6162
|
function defaultMintId() {
|
|
@@ -6093,7 +6169,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6093
6169
|
return out;
|
|
6094
6170
|
}
|
|
6095
6171
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6096
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6172
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6097
6173
|
return out;
|
|
6098
6174
|
}
|
|
6099
6175
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6148,7 +6224,7 @@ function rowId(row, idKey) {
|
|
|
6148
6224
|
return null;
|
|
6149
6225
|
}
|
|
6150
6226
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6151
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6227
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6152
6228
|
if (!Array.isArray(incoming)) {
|
|
6153
6229
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6154
6230
|
return {
|
|
@@ -6164,7 +6240,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6164
6240
|
const kept = /* @__PURE__ */ new Set();
|
|
6165
6241
|
const rows = [];
|
|
6166
6242
|
for (const row of incoming) {
|
|
6167
|
-
if (!isRecord(row)) {
|
|
6243
|
+
if (!isRecord$1(row)) {
|
|
6168
6244
|
rows.push(row);
|
|
6169
6245
|
continue;
|
|
6170
6246
|
}
|
|
@@ -6189,7 +6265,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6189
6265
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6190
6266
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6191
6267
|
case "object": {
|
|
6192
|
-
if (!isRecord(incoming)) {
|
|
6268
|
+
if (!isRecord$1(incoming)) {
|
|
6193
6269
|
if (incoming === void 0) return KEEP;
|
|
6194
6270
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6195
6271
|
return {
|
|
@@ -6197,7 +6273,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6197
6273
|
value: incoming
|
|
6198
6274
|
};
|
|
6199
6275
|
}
|
|
6200
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6276
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6201
6277
|
return {
|
|
6202
6278
|
kind: "value",
|
|
6203
6279
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6256,12 +6332,19 @@ async function transformSecretWrite(input) {
|
|
|
6256
6332
|
}
|
|
6257
6333
|
};
|
|
6258
6334
|
}
|
|
6335
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6336
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6337
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6338
|
+
}
|
|
6259
6339
|
/**
|
|
6260
6340
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6261
6341
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6262
6342
|
*/
|
|
6263
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6264
|
-
const
|
|
6343
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6344
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6345
|
+
const owner = options.ownedBy;
|
|
6346
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6347
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6265
6348
|
if (refs.length === 0) return {
|
|
6266
6349
|
value,
|
|
6267
6350
|
unresolved: []
|
|
@@ -6285,10 +6368,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6285
6368
|
}
|
|
6286
6369
|
const substitute = (v) => {
|
|
6287
6370
|
if (isSecretMarker(v)) {
|
|
6371
|
+
if (!inScope(v.$secret)) return {
|
|
6372
|
+
keep: true,
|
|
6373
|
+
value: v
|
|
6374
|
+
};
|
|
6288
6375
|
const answer = answers[v.$secret];
|
|
6289
|
-
|
|
6376
|
+
if (answer?.kind === "value") return {
|
|
6290
6377
|
keep: true,
|
|
6291
6378
|
value: answer.value
|
|
6379
|
+
};
|
|
6380
|
+
return keepMarker ? {
|
|
6381
|
+
keep: true,
|
|
6382
|
+
value: v
|
|
6292
6383
|
} : {
|
|
6293
6384
|
keep: false,
|
|
6294
6385
|
value: void 0
|
|
@@ -6305,7 +6396,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6305
6396
|
value: items
|
|
6306
6397
|
};
|
|
6307
6398
|
}
|
|
6308
|
-
if (isRecord(v)) {
|
|
6399
|
+
if (isRecord$1(v)) {
|
|
6309
6400
|
const out = {};
|
|
6310
6401
|
for (const [k, child] of Object.entries(v)) {
|
|
6311
6402
|
const s = substitute(child);
|
|
@@ -6326,14 +6417,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6326
6417
|
unresolved
|
|
6327
6418
|
};
|
|
6328
6419
|
}
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6420
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6421
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6422
|
+
ref;
|
|
6423
|
+
reason;
|
|
6424
|
+
constructor(ref, reason) {
|
|
6425
|
+
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.`);
|
|
6426
|
+
this.ref = ref;
|
|
6427
|
+
this.reason = reason;
|
|
6428
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6429
|
+
}
|
|
6430
|
+
};
|
|
6431
|
+
function isRecord(value) {
|
|
6432
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6433
|
+
}
|
|
6434
|
+
function resolvedValue(pass, marker) {
|
|
6435
|
+
const answer = pass.answers[marker.$secret];
|
|
6436
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6437
|
+
}
|
|
6438
|
+
async function atMarker(pass, incoming, stored) {
|
|
6439
|
+
if (incoming === null) return stored;
|
|
6440
|
+
if (typeof incoming !== "string") return incoming;
|
|
6441
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6442
|
+
const intent = classifySecretWrite(incoming);
|
|
6443
|
+
if (intent.kind !== "set") return stored;
|
|
6444
|
+
const ref = stored.$secret;
|
|
6445
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6446
|
+
const answer = pass.answers[ref];
|
|
6447
|
+
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);
|
|
6448
|
+
try {
|
|
6449
|
+
await pass.secrets.put(ref, intent.value);
|
|
6450
|
+
} catch (err) {
|
|
6451
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6452
|
+
}
|
|
6453
|
+
pass.changedRefs.push(ref);
|
|
6454
|
+
return stored;
|
|
6455
|
+
}
|
|
6456
|
+
function inArray(pass, incoming, stored) {
|
|
6457
|
+
return incoming.map((item, index) => {
|
|
6458
|
+
const twin = stored[index];
|
|
6459
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6460
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6461
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6462
|
+
return item;
|
|
6463
|
+
});
|
|
6464
|
+
}
|
|
6465
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6466
|
+
const out = { ...incoming };
|
|
6467
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6468
|
+
const twin = stored[key];
|
|
6469
|
+
if (isSecretMarker(twin)) {
|
|
6470
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6471
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6472
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6473
|
+
}
|
|
6474
|
+
return out;
|
|
6475
|
+
}
|
|
6476
|
+
async function walk(pass, incoming, stored) {
|
|
6477
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6478
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6479
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6480
|
+
const out = { ...incoming };
|
|
6481
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6482
|
+
return out;
|
|
6483
|
+
}
|
|
6484
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6485
|
+
async function restoreUnchangedSecrets(input) {
|
|
6486
|
+
const refs = [];
|
|
6487
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6488
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6489
|
+
if (owned.length === 0) return {
|
|
6490
|
+
patch: input.patch,
|
|
6491
|
+
changedRefs: []
|
|
6492
|
+
};
|
|
6493
|
+
const pass = {
|
|
6494
|
+
secrets: input.secrets,
|
|
6495
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6496
|
+
operatorWrite: input.operatorWrite,
|
|
6497
|
+
changedRefs: []
|
|
6498
|
+
};
|
|
6499
|
+
const out = {};
|
|
6500
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6501
|
+
return {
|
|
6502
|
+
patch: out,
|
|
6503
|
+
changedRefs: pass.changedRefs
|
|
6504
|
+
};
|
|
6505
|
+
}
|
|
6506
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6507
|
+
function isJsonEqual(a, b) {
|
|
6508
|
+
if (Object.is(a, b)) return true;
|
|
6509
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6510
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6511
|
+
const keys = Object.keys(a);
|
|
6512
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6513
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6334
6514
|
}
|
|
6335
6515
|
return false;
|
|
6336
6516
|
}
|
|
6517
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6518
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6519
|
+
const out = {};
|
|
6520
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6521
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6522
|
+
out[key] = value;
|
|
6523
|
+
}
|
|
6524
|
+
return out;
|
|
6525
|
+
}
|
|
6526
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6527
|
+
function markerKeysOf(blob, owner) {
|
|
6528
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6529
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6530
|
+
return keys;
|
|
6531
|
+
}
|
|
6532
|
+
function nodeFromStored(value, owner) {
|
|
6533
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6534
|
+
if (!isRecord(value)) return null;
|
|
6535
|
+
const children = /* @__PURE__ */ new Map();
|
|
6536
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6537
|
+
const node = nodeFromStored(child, owner);
|
|
6538
|
+
if (node !== null) children.set(key, node);
|
|
6539
|
+
}
|
|
6540
|
+
return children.size > 0 ? {
|
|
6541
|
+
kind: "object",
|
|
6542
|
+
children
|
|
6543
|
+
} : null;
|
|
6544
|
+
}
|
|
6545
|
+
/**
|
|
6546
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6547
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6548
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6549
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6550
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6551
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6552
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6553
|
+
* over.
|
|
6554
|
+
*/
|
|
6555
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6556
|
+
const added = /* @__PURE__ */ new Map();
|
|
6557
|
+
for (const key of keys) {
|
|
6558
|
+
const at = key.indexOf("@");
|
|
6559
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6560
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6561
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6562
|
+
if (node !== null) added.set(base, node);
|
|
6563
|
+
}
|
|
6564
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6565
|
+
}
|
|
6337
6566
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6338
6567
|
async function readStoredAddonBlob(raw) {
|
|
6339
6568
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6342,7 +6571,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6342
6571
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6343
6572
|
return result.kind === "missing" ? {} : result.value;
|
|
6344
6573
|
}
|
|
6345
|
-
function
|
|
6574
|
+
function touchesTree(tree, patch) {
|
|
6575
|
+
if (tree.size === 0) return false;
|
|
6576
|
+
for (const key of Object.keys(patch)) {
|
|
6577
|
+
const at = key.indexOf("@");
|
|
6578
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6579
|
+
}
|
|
6580
|
+
return false;
|
|
6581
|
+
}
|
|
6582
|
+
/**
|
|
6583
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6584
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6585
|
+
*/
|
|
6586
|
+
var MarkerKeyIndex = class {
|
|
6587
|
+
owner;
|
|
6588
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6589
|
+
constructor(owner) {
|
|
6590
|
+
this.owner = owner;
|
|
6591
|
+
}
|
|
6592
|
+
seen(store, blob) {
|
|
6593
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6594
|
+
}
|
|
6595
|
+
wrote(store, patch) {
|
|
6596
|
+
const keys = this.byStore.get(store);
|
|
6597
|
+
if (keys === void 0) return;
|
|
6598
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6599
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6600
|
+
else keys.delete(key);
|
|
6601
|
+
}
|
|
6602
|
+
mayHoldMarkers(store, patch) {
|
|
6603
|
+
const keys = this.byStore.get(store);
|
|
6604
|
+
if (keys === void 0) return true;
|
|
6605
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6606
|
+
}
|
|
6607
|
+
};
|
|
6608
|
+
function createHandle(raw, opts) {
|
|
6346
6609
|
const chains = /* @__PURE__ */ new Map();
|
|
6347
6610
|
const serialize = (key, fn) => {
|
|
6348
6611
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6353,46 +6616,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6353
6616
|
});
|
|
6354
6617
|
return next;
|
|
6355
6618
|
};
|
|
6356
|
-
const
|
|
6357
|
-
|
|
6358
|
-
|
|
6619
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6620
|
+
const resolveRead = async (store, blob) => {
|
|
6621
|
+
index.seen(store, blob);
|
|
6622
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6623
|
+
unresolved: "keep-marker",
|
|
6624
|
+
ownedBy: opts.secrets.owner
|
|
6625
|
+
});
|
|
6626
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6627
|
+
return value;
|
|
6628
|
+
};
|
|
6629
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6630
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6631
|
+
await rawWrite(patch);
|
|
6632
|
+
index.wrote(store, patch);
|
|
6633
|
+
return { changed: true };
|
|
6634
|
+
}
|
|
6635
|
+
return serialize(store, async () => {
|
|
6359
6636
|
const stored = await readStored();
|
|
6637
|
+
index.seen(store, stored);
|
|
6638
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6639
|
+
const restored = await restoreUnchangedSecrets({
|
|
6640
|
+
patch,
|
|
6641
|
+
stored,
|
|
6642
|
+
secrets: opts.secrets,
|
|
6643
|
+
operatorWrite
|
|
6644
|
+
});
|
|
6360
6645
|
const result = await transformSecretWrite({
|
|
6361
|
-
tree,
|
|
6646
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6362
6647
|
secrets: opts.secrets,
|
|
6363
|
-
patch,
|
|
6648
|
+
patch: restored.patch,
|
|
6364
6649
|
stored,
|
|
6365
6650
|
...scope !== void 0 ? { scope } : {},
|
|
6366
|
-
operatorWrite
|
|
6651
|
+
operatorWrite
|
|
6367
6652
|
});
|
|
6368
|
-
|
|
6653
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6654
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6655
|
+
if (wroteBlob) {
|
|
6656
|
+
await rawWrite(effective);
|
|
6657
|
+
index.wrote(store, effective);
|
|
6658
|
+
}
|
|
6369
6659
|
const { orphaned } = await result.afterWrite();
|
|
6370
6660
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6661
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6371
6662
|
});
|
|
6372
6663
|
};
|
|
6373
|
-
const
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6664
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6665
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6666
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6667
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6668
|
+
const overrides = {
|
|
6669
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6670
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6671
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6672
|
+
return result.kind === "value" ? {
|
|
6673
|
+
kind: "value",
|
|
6674
|
+
value: await resolveRead("addon", result.value)
|
|
6675
|
+
} : result;
|
|
6676
|
+
} } : {},
|
|
6677
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6678
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6679
|
+
if (result.kind !== "present") return result;
|
|
6680
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6681
|
+
unresolved: "keep-marker",
|
|
6682
|
+
ownedBy: opts.secrets.owner
|
|
6683
|
+
});
|
|
6684
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6685
|
+
return {
|
|
6686
|
+
kind: "present",
|
|
6687
|
+
value: value[key]
|
|
6688
|
+
};
|
|
6689
|
+
} } : {},
|
|
6690
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6691
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6692
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6693
|
+
const out = /* @__PURE__ */ new Map();
|
|
6694
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6695
|
+
return out;
|
|
6696
|
+
} } : {},
|
|
6697
|
+
writeAddonStore: async (patch) => {
|
|
6698
|
+
await writeAddon(patch);
|
|
6699
|
+
},
|
|
6700
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6701
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6702
|
+
kind: "device",
|
|
6703
|
+
deviceId
|
|
6704
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6705
|
+
}
|
|
6706
|
+
};
|
|
6707
|
+
return {
|
|
6708
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6709
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6710
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6711
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6712
|
+
} }),
|
|
6713
|
+
raw: {
|
|
6714
|
+
readAddonStore: async () => {
|
|
6715
|
+
const blob = await raw.readAddonStore();
|
|
6716
|
+
index.seen("addon", blob);
|
|
6717
|
+
return blob;
|
|
6718
|
+
},
|
|
6719
|
+
readDeviceStore: async (deviceId) => {
|
|
6720
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6721
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6722
|
+
return blob;
|
|
6723
|
+
}
|
|
6724
|
+
},
|
|
6725
|
+
writeAddonStore: writeAddon
|
|
6379
6726
|
};
|
|
6380
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6381
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6382
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6383
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6384
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6385
|
-
} });
|
|
6386
6727
|
}
|
|
6387
|
-
/** The context the addon sees
|
|
6388
|
-
function
|
|
6728
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6729
|
+
function createSecretAwareContext(context, opts) {
|
|
6389
6730
|
const raw = context.settings;
|
|
6390
|
-
if (raw === void 0) return
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6731
|
+
if (raw === void 0) return {
|
|
6732
|
+
context,
|
|
6733
|
+
handle: null
|
|
6734
|
+
};
|
|
6735
|
+
const handle = createHandle(raw, opts);
|
|
6736
|
+
return {
|
|
6737
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6738
|
+
if (prop === "settings") return handle.settings;
|
|
6739
|
+
return Reflect.get(target, prop, receiver);
|
|
6740
|
+
} }),
|
|
6741
|
+
handle
|
|
6742
|
+
};
|
|
6396
6743
|
}
|
|
6397
6744
|
var LEAF = { kind: "leaf" };
|
|
6398
6745
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6567,6 +6914,14 @@ var BaseAddon = class {
|
|
|
6567
6914
|
_secretChangeUnsub = null;
|
|
6568
6915
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6569
6916
|
_operatorWriteDepth = 0;
|
|
6917
|
+
/**
|
|
6918
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6919
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6920
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6921
|
+
*/
|
|
6922
|
+
_secretSettings = null;
|
|
6923
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6924
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6570
6925
|
constructor(defaults) {
|
|
6571
6926
|
this.defaults = defaults;
|
|
6572
6927
|
this._config = { ...defaults };
|
|
@@ -6603,13 +6958,21 @@ var BaseAddon = class {
|
|
|
6603
6958
|
}
|
|
6604
6959
|
async initialize(context) {
|
|
6605
6960
|
const secrets = context.secrets;
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6961
|
+
if (secrets !== void 0) {
|
|
6962
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6963
|
+
secrets,
|
|
6964
|
+
addonTree: () => this.addonSecretTree(),
|
|
6965
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6966
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6967
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6968
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6969
|
+
});
|
|
6970
|
+
this._ctx = wrapped;
|
|
6971
|
+
this._secretSettings = handle;
|
|
6972
|
+
} else {
|
|
6973
|
+
this._ctx = context;
|
|
6974
|
+
this._secretSettings = null;
|
|
6975
|
+
}
|
|
6613
6976
|
await this.resolveConfig();
|
|
6614
6977
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6615
6978
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6726,11 +7089,8 @@ var BaseAddon = class {
|
|
|
6726
7089
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6727
7090
|
const schema = this.globalSettingsSchema(cap);
|
|
6728
7091
|
if (!schema) return { sections: [] };
|
|
6729
|
-
const projected = await this.
|
|
6730
|
-
return hydrateSchema(schema, overlay ? {
|
|
6731
|
-
...projected,
|
|
6732
|
-
...overlay
|
|
6733
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7092
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7093
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6734
7094
|
}
|
|
6735
7095
|
/**
|
|
6736
7096
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6775,7 +7135,7 @@ var BaseAddon = class {
|
|
|
6775
7135
|
});
|
|
6776
7136
|
}
|
|
6777
7137
|
if (sections.length === 0) return null;
|
|
6778
|
-
const projected = await this.
|
|
7138
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6779
7139
|
return hydrateSchema({
|
|
6780
7140
|
...schema,
|
|
6781
7141
|
sections
|
|
@@ -6792,12 +7152,50 @@ var BaseAddon = class {
|
|
|
6792
7152
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6793
7153
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6794
7154
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7155
|
+
*
|
|
7156
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7157
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7158
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7159
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7160
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7161
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6795
7162
|
*/
|
|
6796
7163
|
async resolveGlobalStore(nodeId, cap) {
|
|
6797
7164
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7165
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7166
|
+
}
|
|
7167
|
+
projectForNode(store, nodeId, cap) {
|
|
6798
7168
|
const keys = this.perNodeKeys(cap);
|
|
6799
7169
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6800
|
-
return keys.size > 0 ? projectStore(
|
|
7170
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7171
|
+
}
|
|
7172
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7173
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7174
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7175
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7176
|
+
}
|
|
7177
|
+
/**
|
|
7178
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7179
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7180
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7181
|
+
* its value.
|
|
7182
|
+
*/
|
|
7183
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7184
|
+
const secrets = this._ctx?.secrets;
|
|
7185
|
+
const merged = {
|
|
7186
|
+
...stored,
|
|
7187
|
+
...overlay
|
|
7188
|
+
};
|
|
7189
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7190
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7191
|
+
unresolved: "keep-marker",
|
|
7192
|
+
ownedBy: secrets.owner
|
|
7193
|
+
});
|
|
7194
|
+
for (const key of Object.keys(overlay)) {
|
|
7195
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7196
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7197
|
+
}
|
|
7198
|
+
return merged;
|
|
6801
7199
|
}
|
|
6802
7200
|
/**
|
|
6803
7201
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6862,8 +7260,12 @@ var BaseAddon = class {
|
|
|
6862
7260
|
async clearSecrets(keys, nodeId) {
|
|
6863
7261
|
const tree = this.addonSecretTree();
|
|
6864
7262
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7263
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6865
7264
|
const patch = {};
|
|
6866
|
-
for (const key of keys)
|
|
7265
|
+
for (const key of keys) {
|
|
7266
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7267
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7268
|
+
}
|
|
6867
7269
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6868
7270
|
}
|
|
6869
7271
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6871,7 +7273,11 @@ var BaseAddon = class {
|
|
|
6871
7273
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6872
7274
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6873
7275
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6874
|
-
|
|
7276
|
+
const handle = this._secretSettings;
|
|
7277
|
+
if (handle !== null) {
|
|
7278
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7279
|
+
if (!changed) return;
|
|
7280
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6875
7281
|
if (target !== localNode) return;
|
|
6876
7282
|
await this.resolveConfig();
|
|
6877
7283
|
await this.onConfigChanged();
|
|
@@ -6924,7 +7330,7 @@ var BaseAddon = class {
|
|
|
6924
7330
|
async getDeviceSettings(deviceId) {
|
|
6925
7331
|
const schema = this.deviceSettingsSchema();
|
|
6926
7332
|
if (!schema) return { sections: [] };
|
|
6927
|
-
return hydrateSchema(schema, await this.
|
|
7333
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6928
7334
|
}
|
|
6929
7335
|
async updateDeviceSettings(deviceId, patch) {
|
|
6930
7336
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7096,7 +7502,7 @@ var BaseAddon = class {
|
|
|
7096
7502
|
key,
|
|
7097
7503
|
schema,
|
|
7098
7504
|
fallback,
|
|
7099
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7505
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7100
7506
|
write: async (patch) => {
|
|
7101
7507
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7102
7508
|
},
|
|
@@ -7158,6 +7564,23 @@ var BaseAddon = class {
|
|
|
7158
7564
|
}
|
|
7159
7565
|
return value;
|
|
7160
7566
|
}
|
|
7567
|
+
/**
|
|
7568
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7569
|
+
* keychain the context's own view is already raw.
|
|
7570
|
+
*/
|
|
7571
|
+
rawSettings() {
|
|
7572
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7573
|
+
}
|
|
7574
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7575
|
+
logUnresolvedRead(unresolved) {
|
|
7576
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7577
|
+
if (fresh.length === 0) return;
|
|
7578
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7579
|
+
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) => ({
|
|
7580
|
+
ref: u.ref,
|
|
7581
|
+
reason: u.reason
|
|
7582
|
+
})) } });
|
|
7583
|
+
}
|
|
7161
7584
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7162
7585
|
scheduleSecretReresolve(delayMs) {
|
|
7163
7586
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7184,7 +7607,7 @@ var BaseAddon = class {
|
|
|
7184
7607
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7185
7608
|
*/
|
|
7186
7609
|
async readAddonStoreWithRetry() {
|
|
7187
|
-
const settings = this.
|
|
7610
|
+
const settings = this.rawSettings();
|
|
7188
7611
|
if (!settings) return {};
|
|
7189
7612
|
const delaysMs = [
|
|
7190
7613
|
150,
|
|
@@ -9487,6 +9910,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9487
9910
|
fetchedAt: number()
|
|
9488
9911
|
});
|
|
9489
9912
|
/**
|
|
9913
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9914
|
+
* gets back (cloud training, D805+).
|
|
9915
|
+
*
|
|
9916
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9917
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9918
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9919
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9920
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9921
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9922
|
+
* change there, in the same piece of work.
|
|
9923
|
+
*
|
|
9924
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9925
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9926
|
+
*/
|
|
9927
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9928
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9929
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9930
|
+
var TrainingExportSchema = _enum([
|
|
9931
|
+
"onnx",
|
|
9932
|
+
"openvino-fp16",
|
|
9933
|
+
"openvino-int8",
|
|
9934
|
+
"coreml-fp16"
|
|
9935
|
+
]);
|
|
9936
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9937
|
+
object({
|
|
9938
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9939
|
+
jobKey: string().uuid(),
|
|
9940
|
+
target: object({
|
|
9941
|
+
kind: literal("detector"),
|
|
9942
|
+
step: literal("object-detection")
|
|
9943
|
+
}),
|
|
9944
|
+
base: object({
|
|
9945
|
+
modelId: string().min(1),
|
|
9946
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9947
|
+
weights: string().min(1),
|
|
9948
|
+
imgsz: number().int().positive()
|
|
9949
|
+
}),
|
|
9950
|
+
baseline: object({
|
|
9951
|
+
modelId: string().min(1),
|
|
9952
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9953
|
+
onnxUrl: string().url(),
|
|
9954
|
+
imgsz: number().int().positive(),
|
|
9955
|
+
floors: FloorsSchema
|
|
9956
|
+
}),
|
|
9957
|
+
dataset: object({
|
|
9958
|
+
versionId: string().min(1),
|
|
9959
|
+
annotationHash: string(),
|
|
9960
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9961
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9962
|
+
}),
|
|
9963
|
+
split: object({
|
|
9964
|
+
holdoutCameras: array(number().int()),
|
|
9965
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9966
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9967
|
+
valFraction: number().min(0).max(.5),
|
|
9968
|
+
seed: number().int()
|
|
9969
|
+
}),
|
|
9970
|
+
hyper: object({
|
|
9971
|
+
epochs: number().int().positive(),
|
|
9972
|
+
batch: number().int().positive(),
|
|
9973
|
+
lr0: number().positive(),
|
|
9974
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9975
|
+
freeze: number().int().nonnegative(),
|
|
9976
|
+
patience: number().int().nonnegative(),
|
|
9977
|
+
seed: number().int()
|
|
9978
|
+
}),
|
|
9979
|
+
replay: object({
|
|
9980
|
+
source: literal("coco2017"),
|
|
9981
|
+
count: number().int().nonnegative()
|
|
9982
|
+
}),
|
|
9983
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9984
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9985
|
+
floors: object({
|
|
9986
|
+
minSupport: number().int().positive(),
|
|
9987
|
+
clamp: number().min(0).max(1)
|
|
9988
|
+
}),
|
|
9989
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9990
|
+
catalog: object({
|
|
9991
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9992
|
+
name: string().min(1).max(160)
|
|
9993
|
+
})
|
|
9994
|
+
});
|
|
9995
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9996
|
+
var TrainingResultFileSchema = object({
|
|
9997
|
+
path: string().min(1),
|
|
9998
|
+
bytes: number().int().nonnegative(),
|
|
9999
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10000
|
+
format: _enum([
|
|
10001
|
+
"onnx",
|
|
10002
|
+
"openvino",
|
|
10003
|
+
"coreml",
|
|
10004
|
+
"pt"
|
|
10005
|
+
]),
|
|
10006
|
+
variant: _enum(["base", "int8"])
|
|
10007
|
+
});
|
|
10008
|
+
var DraftFormatSchema = object({
|
|
10009
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10010
|
+
url: string().min(1),
|
|
10011
|
+
sizeMB: number().nonnegative(),
|
|
10012
|
+
isDirectory: boolean().optional(),
|
|
10013
|
+
files: array(string()).optional(),
|
|
10014
|
+
runtimes: array(literal("python")).optional(),
|
|
10015
|
+
revision: string().min(1)
|
|
10016
|
+
});
|
|
10017
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10018
|
+
var TrainingCatalogDraftSchema = object({
|
|
10019
|
+
id: string().min(1),
|
|
10020
|
+
name: string().min(1),
|
|
10021
|
+
description: string(),
|
|
10022
|
+
labels: array(unknown()),
|
|
10023
|
+
inputSize: object({
|
|
10024
|
+
width: number().int().positive(),
|
|
10025
|
+
height: number().int().positive()
|
|
10026
|
+
}),
|
|
10027
|
+
preprocessMode: literal("letterbox"),
|
|
10028
|
+
defaultClassFloors: FloorsSchema,
|
|
10029
|
+
formats: object({
|
|
10030
|
+
onnx: DraftFormatSchema.optional(),
|
|
10031
|
+
openvino: DraftFormatSchema.optional(),
|
|
10032
|
+
coreml: DraftFormatSchema.optional()
|
|
10033
|
+
})
|
|
10034
|
+
});
|
|
10035
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10036
|
+
var TrainingEvalClassSchema = object({
|
|
10037
|
+
positives: number().int(),
|
|
10038
|
+
floor: number().nullable(),
|
|
10039
|
+
tp: number().int(),
|
|
10040
|
+
fp: number().int(),
|
|
10041
|
+
fn: number().int(),
|
|
10042
|
+
precision: number().nullable(),
|
|
10043
|
+
recall: number().nullable(),
|
|
10044
|
+
ap50: number().nullable(),
|
|
10045
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10046
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10047
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10048
|
+
smallFound: number().int().optional(),
|
|
10049
|
+
smallTotal: number().int().optional()
|
|
10050
|
+
}).passthrough();
|
|
10051
|
+
var TrainingEvalReportSchema = object({
|
|
10052
|
+
frames: number().int(),
|
|
10053
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10054
|
+
}).passthrough();
|
|
10055
|
+
/**
|
|
10056
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10057
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10058
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10059
|
+
*/
|
|
10060
|
+
var TrainingResultSchema = object({
|
|
10061
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10062
|
+
jobKey: string(),
|
|
10063
|
+
status: _enum(["succeeded", "failed"]),
|
|
10064
|
+
error: object({
|
|
10065
|
+
stage: string(),
|
|
10066
|
+
code: string(),
|
|
10067
|
+
message: string()
|
|
10068
|
+
}).nullable(),
|
|
10069
|
+
trainer: object({
|
|
10070
|
+
version: string(),
|
|
10071
|
+
revision: string()
|
|
10072
|
+
}),
|
|
10073
|
+
toolchain: record(string(), string().nullable()),
|
|
10074
|
+
dataset: object({
|
|
10075
|
+
versionId: string(),
|
|
10076
|
+
annotationHash: string(),
|
|
10077
|
+
sha256: string(),
|
|
10078
|
+
frames: object({
|
|
10079
|
+
train: number().int(),
|
|
10080
|
+
val: number().int(),
|
|
10081
|
+
holdout: number().int()
|
|
10082
|
+
}),
|
|
10083
|
+
holdoutCameras: array(number().int()),
|
|
10084
|
+
replayImages: number().int()
|
|
10085
|
+
}).optional(),
|
|
10086
|
+
training: object({
|
|
10087
|
+
epochsRun: number().int(),
|
|
10088
|
+
bestEpoch: number().int(),
|
|
10089
|
+
bestMap50: number(),
|
|
10090
|
+
bestMap50_95: number(),
|
|
10091
|
+
seconds: number()
|
|
10092
|
+
}).optional(),
|
|
10093
|
+
evaluation: object({
|
|
10094
|
+
holdoutFrames: number().int(),
|
|
10095
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10096
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10097
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10098
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10099
|
+
map50: record(string(), number().nullable())
|
|
10100
|
+
}).optional(),
|
|
10101
|
+
floors: object({
|
|
10102
|
+
baseline: FloorsSchema,
|
|
10103
|
+
candidate: FloorsSchema,
|
|
10104
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10105
|
+
notes: array(string())
|
|
10106
|
+
}).optional(),
|
|
10107
|
+
int8: object({
|
|
10108
|
+
kept: boolean(),
|
|
10109
|
+
map50Fp16: number().nullable(),
|
|
10110
|
+
map50Int8: number().nullable(),
|
|
10111
|
+
reason: string().nullable()
|
|
10112
|
+
}).optional(),
|
|
10113
|
+
exportsDropped: array(object({
|
|
10114
|
+
export: string(),
|
|
10115
|
+
reason: string()
|
|
10116
|
+
})).optional(),
|
|
10117
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10118
|
+
bundle: object({
|
|
10119
|
+
path: literal("bundle.tar"),
|
|
10120
|
+
bytes: number().int().nonnegative(),
|
|
10121
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10122
|
+
}).nullable().optional(),
|
|
10123
|
+
catalogDraft: object({
|
|
10124
|
+
base: TrainingCatalogDraftSchema,
|
|
10125
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10126
|
+
}).nullable().optional(),
|
|
10127
|
+
licence: string()
|
|
10128
|
+
});
|
|
10129
|
+
var TrainingStageSchema = _enum([
|
|
10130
|
+
"prepare",
|
|
10131
|
+
"replay",
|
|
10132
|
+
"train",
|
|
10133
|
+
"eval",
|
|
10134
|
+
"export",
|
|
10135
|
+
"package"
|
|
10136
|
+
]);
|
|
10137
|
+
var EventBase = {
|
|
10138
|
+
v: literal(1),
|
|
10139
|
+
ts: number()
|
|
10140
|
+
};
|
|
10141
|
+
discriminatedUnion("type", [
|
|
10142
|
+
object({
|
|
10143
|
+
...EventBase,
|
|
10144
|
+
type: literal("stage"),
|
|
10145
|
+
stage: TrainingStageSchema
|
|
10146
|
+
}),
|
|
10147
|
+
object({
|
|
10148
|
+
...EventBase,
|
|
10149
|
+
type: literal("epoch"),
|
|
10150
|
+
epoch: number().int(),
|
|
10151
|
+
epochs: number().int(),
|
|
10152
|
+
boxLoss: number().nullable().optional(),
|
|
10153
|
+
map50: number().nullable().optional(),
|
|
10154
|
+
map50_95: number().nullable().optional(),
|
|
10155
|
+
etaSec: number().nullable().optional()
|
|
10156
|
+
}),
|
|
10157
|
+
object({
|
|
10158
|
+
...EventBase,
|
|
10159
|
+
type: literal("metric"),
|
|
10160
|
+
name: string(),
|
|
10161
|
+
value: number()
|
|
10162
|
+
}),
|
|
10163
|
+
object({
|
|
10164
|
+
...EventBase,
|
|
10165
|
+
type: literal("artifact"),
|
|
10166
|
+
path: string(),
|
|
10167
|
+
bytes: number(),
|
|
10168
|
+
sha256: string()
|
|
10169
|
+
}),
|
|
10170
|
+
object({
|
|
10171
|
+
...EventBase,
|
|
10172
|
+
type: literal("done"),
|
|
10173
|
+
status: _enum(["succeeded", "failed"]),
|
|
10174
|
+
resultSha256: string().nullable().optional()
|
|
10175
|
+
}),
|
|
10176
|
+
object({
|
|
10177
|
+
...EventBase,
|
|
10178
|
+
type: literal("error"),
|
|
10179
|
+
stage: string(),
|
|
10180
|
+
code: string(),
|
|
10181
|
+
message: string()
|
|
10182
|
+
})
|
|
10183
|
+
]);
|
|
10184
|
+
/**
|
|
9490
10185
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9491
10186
|
*
|
|
9492
10187
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11814,7 +12509,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11814
12509
|
"authenticated",
|
|
11815
12510
|
"admin"
|
|
11816
12511
|
]).optional(),
|
|
11817
|
-
description: string().optional()
|
|
12512
|
+
description: string().optional(),
|
|
12513
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12514
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11818
12515
|
});
|
|
11819
12516
|
/**
|
|
11820
12517
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12519,6 +13216,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12519
13216
|
lastError: string().optional()
|
|
12520
13217
|
});
|
|
12521
13218
|
/**
|
|
13219
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13220
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13221
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13222
|
+
* with it off — which restores without a key.
|
|
13223
|
+
*/
|
|
13224
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13225
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13226
|
+
scheme: string(),
|
|
13227
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13228
|
+
keyId: string()
|
|
13229
|
+
});
|
|
13230
|
+
/**
|
|
13231
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13232
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13233
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13234
|
+
*/
|
|
13235
|
+
var BackupEncryptionStatusSchema = object({
|
|
13236
|
+
enabled: boolean(),
|
|
13237
|
+
active: object({
|
|
13238
|
+
keyId: string(),
|
|
13239
|
+
publicKey: string(),
|
|
13240
|
+
createdAt: number()
|
|
13241
|
+
}).nullable(),
|
|
13242
|
+
/** Every key ever set up, newest first. */
|
|
13243
|
+
keys: array(object({
|
|
13244
|
+
keyId: string(),
|
|
13245
|
+
createdAt: number(),
|
|
13246
|
+
retiredAt: number().nullable()
|
|
13247
|
+
})).readonly()
|
|
13248
|
+
});
|
|
13249
|
+
/**
|
|
12522
13250
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12523
13251
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12524
13252
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12530,7 +13258,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12530
13258
|
sizeBytes: number(),
|
|
12531
13259
|
label: string().optional(),
|
|
12532
13260
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12533
|
-
locations: array(string()).readonly()
|
|
13261
|
+
locations: array(string()).readonly(),
|
|
13262
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13263
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12534
13264
|
});
|
|
12535
13265
|
var BackupEntrySchema = object({
|
|
12536
13266
|
id: string(),
|
|
@@ -12539,7 +13269,8 @@ var BackupEntrySchema = object({
|
|
|
12539
13269
|
label: string().optional(),
|
|
12540
13270
|
createdAt: number(),
|
|
12541
13271
|
sizeBytes: number(),
|
|
12542
|
-
locations: array(string()).optional()
|
|
13272
|
+
locations: array(string()).optional(),
|
|
13273
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12543
13274
|
});
|
|
12544
13275
|
var ArchiveEntrySchema = object({
|
|
12545
13276
|
path: string(),
|
|
@@ -12728,10 +13459,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12728
13459
|
* this list and skips entries whose path doesn't start with
|
|
12729
13460
|
* any of them.
|
|
12730
13461
|
*/
|
|
12731
|
-
locations: array(string()).optional()
|
|
13462
|
+
locations: array(string()).optional(),
|
|
13463
|
+
/**
|
|
13464
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13465
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13466
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13467
|
+
* is refused before the archive is downloaded.
|
|
13468
|
+
*/
|
|
13469
|
+
backupSecretKey: string().optional()
|
|
12732
13470
|
}), _void(), {
|
|
12733
13471
|
kind: "mutation",
|
|
12734
13472
|
auth: "admin"
|
|
13473
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13474
|
+
keyId: string(),
|
|
13475
|
+
secretKey: string(),
|
|
13476
|
+
publicKey: string(),
|
|
13477
|
+
createdAt: number(),
|
|
13478
|
+
replacedKeyId: string().nullable()
|
|
13479
|
+
}), {
|
|
13480
|
+
kind: "mutation",
|
|
13481
|
+
auth: "admin"
|
|
13482
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13483
|
+
kind: "mutation",
|
|
13484
|
+
auth: "admin"
|
|
13485
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13486
|
+
valid: boolean(),
|
|
13487
|
+
keyId: string().nullable(),
|
|
13488
|
+
/** The hub knows this key (active or retired). */
|
|
13489
|
+
known: boolean(),
|
|
13490
|
+
/** It is the key new archives are encrypted to. */
|
|
13491
|
+
active: boolean(),
|
|
13492
|
+
error: string().optional()
|
|
13493
|
+
}), {
|
|
13494
|
+
kind: "mutation",
|
|
13495
|
+
auth: "admin"
|
|
12735
13496
|
}), method(object({
|
|
12736
13497
|
destinationId: string(),
|
|
12737
13498
|
backupId: string()
|
|
@@ -14457,7 +15218,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14457
15218
|
stepId: string(),
|
|
14458
15219
|
entry: ModelCatalogEntrySchema
|
|
14459
15220
|
});
|
|
14460
|
-
|
|
15221
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15222
|
+
var ModelBundleFileSchema = object({
|
|
15223
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15224
|
+
path: string().min(1),
|
|
15225
|
+
bytes: number().int().nonnegative(),
|
|
15226
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15227
|
+
});
|
|
15228
|
+
var ImportModelBundleInputSchema = object({
|
|
15229
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15230
|
+
addonId: string(),
|
|
15231
|
+
stepId: string().min(1),
|
|
15232
|
+
/**
|
|
15233
|
+
* The catalog rows to register, complete, every format URL already
|
|
15234
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15235
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15236
|
+
*/
|
|
15237
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15238
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15239
|
+
bundle: object({
|
|
15240
|
+
ticket: PeerBytesTicketSchema,
|
|
15241
|
+
bytes: number().int().positive(),
|
|
15242
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15243
|
+
}),
|
|
15244
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15245
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15246
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15247
|
+
distribute: boolean()
|
|
15248
|
+
});
|
|
15249
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15250
|
+
kind: literal("imported"),
|
|
15251
|
+
modelIds: array(string()).readonly(),
|
|
15252
|
+
distributed: array(object({
|
|
15253
|
+
modelId: string(),
|
|
15254
|
+
nodeId: string(),
|
|
15255
|
+
format: _enum(MODEL_FORMATS),
|
|
15256
|
+
ok: boolean(),
|
|
15257
|
+
error: string().optional()
|
|
15258
|
+
})).readonly()
|
|
15259
|
+
}), object({
|
|
15260
|
+
kind: literal("refused"),
|
|
15261
|
+
reason: _enum([
|
|
15262
|
+
"transfer-failed",
|
|
15263
|
+
"checksum-mismatch",
|
|
15264
|
+
"bundle-mismatch",
|
|
15265
|
+
"invalid-entry",
|
|
15266
|
+
"id-taken"
|
|
15267
|
+
]),
|
|
15268
|
+
detail: string()
|
|
15269
|
+
})]);
|
|
15270
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15271
|
+
kind: "mutation",
|
|
15272
|
+
auth: "admin",
|
|
15273
|
+
timeoutMs: 30 * 6e4
|
|
15274
|
+
});
|
|
14461
15275
|
/**
|
|
14462
15276
|
* Query filter for settings-store collections.
|
|
14463
15277
|
*/
|
|
@@ -14936,6 +15750,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14936
15750
|
*/
|
|
14937
15751
|
sharesBackupWithDatabase: boolean()
|
|
14938
15752
|
});
|
|
15753
|
+
/**
|
|
15754
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15755
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15756
|
+
*/
|
|
15757
|
+
var KeychainResetRecordSchema = object({
|
|
15758
|
+
id: string(),
|
|
15759
|
+
at: number(),
|
|
15760
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15761
|
+
actor: string(),
|
|
15762
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15763
|
+
lockedReason: string().nullable(),
|
|
15764
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15765
|
+
archived: number().int(),
|
|
15766
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15767
|
+
archivedCollection: string().nullable(),
|
|
15768
|
+
/**
|
|
15769
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15770
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15771
|
+
*/
|
|
15772
|
+
archivedKeysCollection: string().nullable(),
|
|
15773
|
+
/**
|
|
15774
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15775
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15776
|
+
* agent forever (D797).
|
|
15777
|
+
*/
|
|
15778
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15779
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15780
|
+
acknowledgedAt: number().nullable()
|
|
15781
|
+
});
|
|
14939
15782
|
var KeychainStatusSchema = object({
|
|
14940
15783
|
keychain: KeychainStateSchema,
|
|
14941
15784
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14953,7 +15796,9 @@ var KeychainStatusSchema = object({
|
|
|
14953
15796
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14954
15797
|
retiredWraps: number().int(),
|
|
14955
15798
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14956
|
-
secretCount: number().int()
|
|
15799
|
+
secretCount: number().int(),
|
|
15800
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15801
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14957
15802
|
});
|
|
14958
15803
|
/**
|
|
14959
15804
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -14975,17 +15820,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
14975
15820
|
"download-recovery-key",
|
|
14976
15821
|
"delete-orphans",
|
|
14977
15822
|
"reset",
|
|
15823
|
+
"acknowledge-reset",
|
|
14978
15824
|
"initialize"
|
|
14979
15825
|
]);
|
|
14980
15826
|
var KeychainAuditEntrySchema = object({
|
|
14981
15827
|
id: string(),
|
|
14982
15828
|
at: number(),
|
|
14983
15829
|
action: KeychainAuditActionSchema,
|
|
14984
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15830
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
14985
15831
|
actor: string(),
|
|
14986
15832
|
ref: string().nullable(),
|
|
14987
15833
|
detail: string().nullable()
|
|
14988
15834
|
});
|
|
15835
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15836
|
+
/**
|
|
15837
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15838
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15839
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15840
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15841
|
+
*/
|
|
15842
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
14989
15843
|
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({
|
|
14990
15844
|
value: string(),
|
|
14991
15845
|
version: number().int()
|
|
@@ -14993,6 +15847,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
14993
15847
|
kind: "mutation",
|
|
14994
15848
|
auth: "admin",
|
|
14995
15849
|
caller: "required"
|
|
15850
|
+
}), method(object({
|
|
15851
|
+
name: SystemHeldSecretNameSchema,
|
|
15852
|
+
value: string().min(16)
|
|
15853
|
+
}), object({
|
|
15854
|
+
ref: string(),
|
|
15855
|
+
version: number().int()
|
|
15856
|
+
}), {
|
|
15857
|
+
kind: "mutation",
|
|
15858
|
+
auth: "admin",
|
|
15859
|
+
caller: "required"
|
|
14996
15860
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14997
15861
|
deleted: array(string()).readonly(),
|
|
14998
15862
|
kept: array(object({
|
|
@@ -15022,13 +15886,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15022
15886
|
kind: "mutation",
|
|
15023
15887
|
auth: "admin",
|
|
15024
15888
|
caller: "required"
|
|
15025
|
-
}), method(object({ confirm: literal(
|
|
15889
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15026
15890
|
archivedCollection: string().nullable(),
|
|
15027
15891
|
archived: number().int()
|
|
15028
15892
|
}), {
|
|
15029
15893
|
kind: "mutation",
|
|
15030
15894
|
auth: "admin",
|
|
15031
15895
|
caller: "required"
|
|
15896
|
+
}), method(object({}), object({
|
|
15897
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15898
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15899
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15900
|
+
kind: "mutation",
|
|
15901
|
+
auth: "admin",
|
|
15902
|
+
caller: "required"
|
|
15032
15903
|
});
|
|
15033
15904
|
method(_void(), object({
|
|
15034
15905
|
id: string(),
|
|
@@ -17879,7 +18750,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17879
18750
|
* `login-method` — collection cap through which auth addons contribute
|
|
17880
18751
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17881
18752
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17882
|
-
* every auth addon (OIDC,
|
|
18753
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17883
18754
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17884
18755
|
* procedure aggregates them for the unauthenticated login page.
|
|
17885
18756
|
*
|
|
@@ -17887,8 +18758,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17887
18758
|
*
|
|
17888
18759
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17889
18760
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17890
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17891
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18761
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17892
18762
|
* login page needs NO change.
|
|
17893
18763
|
*
|
|
17894
18764
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17907,8 +18777,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17907
18777
|
* decision.
|
|
17908
18778
|
*
|
|
17909
18779
|
* Every contribution carries a `stage`:
|
|
17910
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17911
|
-
*
|
|
18780
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18781
|
+
* buttons; a usernameless passkey).
|
|
17912
18782
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17913
18783
|
* returned `factors` (passkey-as-2FA today).
|
|
17914
18784
|
*
|
|
@@ -17935,7 +18805,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17935
18805
|
* The provider names an external identity a signed-in user can link to
|
|
17936
18806
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17937
18807
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17938
|
-
* whatever their id. Absent / false — a login button only
|
|
18808
|
+
* whatever their id. Absent / false — a login button only.
|
|
17939
18809
|
*/
|
|
17940
18810
|
linkable: boolean().optional()
|
|
17941
18811
|
}),
|
|
@@ -21790,8 +22660,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21790
22660
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21791
22661
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21792
22662
|
* distinction was only ever used to route role-specific procedures
|
|
21793
|
-
* which we no longer have.
|
|
21794
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22663
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21795
22664
|
* with `isAdmin: false` + an explicit scope list.
|
|
21796
22665
|
*/
|
|
21797
22666
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23466,6 +24335,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23466
24335
|
frameIds: array(string()).max(2e4).optional(),
|
|
23467
24336
|
/** Only frames in at least one of these named collections. */
|
|
23468
24337
|
collectionIds: array(string()).max(200).optional(),
|
|
24338
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24339
|
+
* unknown id selects nothing. */
|
|
24340
|
+
datasetVersionId: string().optional(),
|
|
23469
24341
|
batchId: string().optional(),
|
|
23470
24342
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23471
24343
|
completeOnly: boolean().optional()
|
|
@@ -23633,6 +24505,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23633
24505
|
]),
|
|
23634
24506
|
detail: string().optional()
|
|
23635
24507
|
})]);
|
|
24508
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24509
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24510
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24511
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24512
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24513
|
+
});
|
|
24514
|
+
/** The counts a dataset is judged by. */
|
|
24515
|
+
var RetrainDatasetStatsSchema = object({
|
|
24516
|
+
frames: number().int(),
|
|
24517
|
+
completeFrames: number().int(),
|
|
24518
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24519
|
+
completeness: number(),
|
|
24520
|
+
/** Boxes to learn (model errors excluded). */
|
|
24521
|
+
subjects: number().int(),
|
|
24522
|
+
modelErrors: number().int(),
|
|
24523
|
+
/** Complete frames with no subject. */
|
|
24524
|
+
hardNegatives: number().int(),
|
|
24525
|
+
/** Subjects per class × camera × day/night. */
|
|
24526
|
+
cells: array(object({
|
|
24527
|
+
macroClass: string(),
|
|
24528
|
+
deviceId: number(),
|
|
24529
|
+
lighting: _enum([
|
|
24530
|
+
"day",
|
|
24531
|
+
"night",
|
|
24532
|
+
"unknown"
|
|
24533
|
+
]),
|
|
24534
|
+
subjects: number().int(),
|
|
24535
|
+
frames: number().int()
|
|
24536
|
+
})).readonly(),
|
|
24537
|
+
cameras: array(object({
|
|
24538
|
+
deviceId: number(),
|
|
24539
|
+
frames: number().int(),
|
|
24540
|
+
completeFrames: number().int()
|
|
24541
|
+
})).readonly()
|
|
24542
|
+
});
|
|
24543
|
+
/** An immutable dataset version, without its frame list. */
|
|
24544
|
+
var RetrainDatasetVersionSchema = object({
|
|
24545
|
+
id: string(),
|
|
24546
|
+
name: string(),
|
|
24547
|
+
createdAt: number(),
|
|
24548
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24549
|
+
layout: RetrainExportLayoutSchema,
|
|
24550
|
+
completeOnly: boolean(),
|
|
24551
|
+
frameCount: number().int(),
|
|
24552
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24553
|
+
annotationHash: string(),
|
|
24554
|
+
/** The export manifest schema the version was cut under. */
|
|
24555
|
+
manifestSchema: string(),
|
|
24556
|
+
stats: RetrainDatasetStatsSchema
|
|
24557
|
+
});
|
|
24558
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24559
|
+
kind: literal("created"),
|
|
24560
|
+
version: RetrainDatasetVersionSchema
|
|
24561
|
+
}), object({
|
|
24562
|
+
kind: literal("refused"),
|
|
24563
|
+
reason: _enum([
|
|
24564
|
+
"empty-name",
|
|
24565
|
+
"duplicate-name",
|
|
24566
|
+
"no-frames"
|
|
24567
|
+
])
|
|
24568
|
+
})]);
|
|
23636
24569
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23637
24570
|
var RetrainTransitionResultSchema = object({
|
|
23638
24571
|
trackId: string(),
|
|
@@ -24422,6 +25355,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24422
25355
|
kind: "mutation",
|
|
24423
25356
|
auth: "admin",
|
|
24424
25357
|
timeoutMs: 60 * 6e4
|
|
25358
|
+
}), method(object({
|
|
25359
|
+
filter: RetrainExportFilterSchema,
|
|
25360
|
+
layout: RetrainExportLayoutSchema
|
|
25361
|
+
}), object({
|
|
25362
|
+
ticket: PeerBytesTicketSchema,
|
|
25363
|
+
frames: number().int(),
|
|
25364
|
+
annotations: number().int()
|
|
25365
|
+
}), {
|
|
25366
|
+
kind: "mutation",
|
|
25367
|
+
auth: "admin",
|
|
25368
|
+
timeoutMs: 12e4
|
|
25369
|
+
}), method(object({
|
|
25370
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25371
|
+
completeOnly: boolean().optional()
|
|
25372
|
+
}), RetrainDatasetStatsSchema, {
|
|
25373
|
+
kind: "query",
|
|
25374
|
+
auth: "admin"
|
|
25375
|
+
}), method(object({
|
|
25376
|
+
name: string().max(120),
|
|
25377
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25378
|
+
layout: RetrainExportLayoutSchema,
|
|
25379
|
+
completeOnly: boolean()
|
|
25380
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25381
|
+
kind: "mutation",
|
|
25382
|
+
auth: "admin",
|
|
25383
|
+
timeoutMs: 12e4
|
|
25384
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25385
|
+
kind: "query",
|
|
25386
|
+
auth: "admin"
|
|
25387
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25388
|
+
kind: "mutation",
|
|
25389
|
+
auth: "admin"
|
|
25390
|
+
}), method(object({ id: string() }), object({
|
|
25391
|
+
found: boolean(),
|
|
25392
|
+
annotationHash: string(),
|
|
25393
|
+
matches: boolean(),
|
|
25394
|
+
missingFrames: number().int()
|
|
25395
|
+
}), {
|
|
25396
|
+
kind: "query",
|
|
25397
|
+
auth: "admin",
|
|
25398
|
+
timeoutMs: 12e4
|
|
24425
25399
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24426
25400
|
kind: "query",
|
|
24427
25401
|
auth: "admin"
|
|
@@ -28000,8 +28974,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28000
28974
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28001
28975
|
*
|
|
28002
28976
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28003
|
-
* one for transactional / one for notifications). Consumers (
|
|
28004
|
-
*
|
|
28977
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28978
|
+
* addons, …) walk the collection and pick the first
|
|
28005
28979
|
* ready provider OR target a specific addonId.
|
|
28006
28980
|
*
|
|
28007
28981
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28180,7 +29154,7 @@ targets: array(object({
|
|
|
28180
29154
|
})));
|
|
28181
29155
|
/**
|
|
28182
29156
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28183
|
-
* providers (OIDC, SAML,
|
|
29157
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28184
29158
|
* carrying the post-callback claims before redirecting back to
|
|
28185
29159
|
* `/api/auth/sso/finish`.
|
|
28186
29160
|
*
|
|
@@ -28243,7 +29217,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28243
29217
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28244
29218
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28245
29219
|
*/
|
|
28246
|
-
issuer: string().optional()
|
|
29220
|
+
issuer: string().optional(),
|
|
29221
|
+
/**
|
|
29222
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29223
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29224
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29225
|
+
* any other browser.
|
|
29226
|
+
*/
|
|
29227
|
+
browserBinding: string().optional()
|
|
28247
29228
|
});
|
|
28248
29229
|
method(object({
|
|
28249
29230
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -40510,16 +41491,6 @@ var ApiKeySummarySchema = object({
|
|
|
40510
41491
|
createdAt: number(),
|
|
40511
41492
|
lastUsedAt: number().optional()
|
|
40512
41493
|
});
|
|
40513
|
-
var CreateApiKeyInputSchema = object({
|
|
40514
|
-
label: string(),
|
|
40515
|
-
isAdmin: boolean().default(false),
|
|
40516
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
40517
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
40518
|
-
});
|
|
40519
|
-
var CreateApiKeyResultSchema = object({
|
|
40520
|
-
token: string(),
|
|
40521
|
-
record: ApiKeySummarySchema
|
|
40522
|
-
});
|
|
40523
41494
|
var ScopedTokenSummarySchema = object({
|
|
40524
41495
|
id: string(),
|
|
40525
41496
|
userId: string(),
|
|
@@ -40618,17 +41589,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40618
41589
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40619
41590
|
kind: "mutation",
|
|
40620
41591
|
access: "view"
|
|
40621
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40622
|
-
kind: "mutation",
|
|
40623
|
-
auth: "admin",
|
|
40624
|
-
access: "create"
|
|
40625
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41592
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40626
41593
|
kind: "mutation",
|
|
40627
41594
|
auth: "admin",
|
|
40628
41595
|
access: "delete"
|
|
40629
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40630
|
-
kind: "mutation",
|
|
40631
|
-
access: "view"
|
|
40632
41596
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40633
41597
|
kind: "mutation",
|
|
40634
41598
|
auth: "admin",
|
|
@@ -40702,15 +41666,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40702
41666
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40703
41667
|
userId: string(),
|
|
40704
41668
|
issuer: string()
|
|
40705
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40706
|
-
userId: string(),
|
|
40707
|
-
issuer: string().min(1),
|
|
40708
|
-
label: string().optional()
|
|
40709
|
-
}), object({ success: literal(true) }), {
|
|
40710
|
-
kind: "mutation",
|
|
40711
|
-
auth: "admin",
|
|
40712
|
-
access: "create"
|
|
40713
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41669
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40714
41670
|
kind: "mutation",
|
|
40715
41671
|
auth: "admin",
|
|
40716
41672
|
access: "delete"
|
|
@@ -41415,6 +42371,451 @@ var zoneRulesCapability = {
|
|
|
41415
42371
|
*/
|
|
41416
42372
|
durability: "restored"
|
|
41417
42373
|
};
|
|
42374
|
+
/**
|
|
42375
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42376
|
+
*
|
|
42377
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42378
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42379
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42380
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42381
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42382
|
+
* manifest entry and nothing else.
|
|
42383
|
+
*
|
|
42384
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42385
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42386
|
+
* Every method is `admin`: these spend money.
|
|
42387
|
+
*
|
|
42388
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42389
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42390
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42391
|
+
*
|
|
42392
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42393
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42394
|
+
* ticket the provider mints (D613).
|
|
42395
|
+
*/
|
|
42396
|
+
var TrainingGpuOptionSchema = object({
|
|
42397
|
+
id: string(),
|
|
42398
|
+
label: string(),
|
|
42399
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42400
|
+
usdPerHour: number().nonnegative(),
|
|
42401
|
+
vramGb: number().nonnegative()
|
|
42402
|
+
});
|
|
42403
|
+
var TrainingRegionOptionSchema = object({
|
|
42404
|
+
/** `''` = any region (the provider's choice). */
|
|
42405
|
+
id: string(),
|
|
42406
|
+
label: string(),
|
|
42407
|
+
priceMultiplier: number().positive()
|
|
42408
|
+
});
|
|
42409
|
+
/**
|
|
42410
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42411
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42412
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42413
|
+
*/
|
|
42414
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42415
|
+
gpuType: string(),
|
|
42416
|
+
region: string(),
|
|
42417
|
+
costCapUsd: number().nonnegative(),
|
|
42418
|
+
maxRuntimeSec: number().int().positive(),
|
|
42419
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42420
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42421
|
+
});
|
|
42422
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42423
|
+
addonId: string(),
|
|
42424
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42425
|
+
kind: string(),
|
|
42426
|
+
label: string(),
|
|
42427
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42428
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42429
|
+
maxDatasetBytes: number().int().positive(),
|
|
42430
|
+
maxRuntimeSec: number().int().positive(),
|
|
42431
|
+
freeTierNote: string().optional(),
|
|
42432
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42433
|
+
dataResidencyNote: string(),
|
|
42434
|
+
/** Credentials are present — never the values. */
|
|
42435
|
+
configured: boolean(),
|
|
42436
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42437
|
+
});
|
|
42438
|
+
var TrainingCredentialCheckSchema = object({
|
|
42439
|
+
ok: boolean(),
|
|
42440
|
+
/** Workspace / account name, when the provider says. */
|
|
42441
|
+
account: string().optional(),
|
|
42442
|
+
reason: _enum([
|
|
42443
|
+
"missing",
|
|
42444
|
+
"invalid",
|
|
42445
|
+
"forbidden",
|
|
42446
|
+
"network",
|
|
42447
|
+
"quota"
|
|
42448
|
+
]).optional(),
|
|
42449
|
+
detail: string().optional()
|
|
42450
|
+
});
|
|
42451
|
+
var ProviderJobStateSchema = _enum([
|
|
42452
|
+
"pending",
|
|
42453
|
+
"starting",
|
|
42454
|
+
"running",
|
|
42455
|
+
"succeeded",
|
|
42456
|
+
"failed",
|
|
42457
|
+
"cancelled",
|
|
42458
|
+
"lost"
|
|
42459
|
+
]);
|
|
42460
|
+
var ProviderJobStatusSchema = object({
|
|
42461
|
+
jobKey: string(),
|
|
42462
|
+
providerJobId: string().optional(),
|
|
42463
|
+
state: ProviderJobStateSchema,
|
|
42464
|
+
startedAt: number().optional(),
|
|
42465
|
+
endedAt: number().optional(),
|
|
42466
|
+
exitCode: number().int().optional(),
|
|
42467
|
+
failureReason: string().optional(),
|
|
42468
|
+
gpuType: string(),
|
|
42469
|
+
region: string().optional(),
|
|
42470
|
+
billedSeconds: number().nonnegative(),
|
|
42471
|
+
costUsd: number().nonnegative(),
|
|
42472
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42473
|
+
costIsEstimate: boolean(),
|
|
42474
|
+
lastFetchedAt: number()
|
|
42475
|
+
});
|
|
42476
|
+
/**
|
|
42477
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42478
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42479
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42480
|
+
* in `result.json`.
|
|
42481
|
+
*/
|
|
42482
|
+
var TrainerSourceRefSchema = object({
|
|
42483
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42484
|
+
repo: string().min(1),
|
|
42485
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42486
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42487
|
+
});
|
|
42488
|
+
var JobRef = {
|
|
42489
|
+
addonId: string(),
|
|
42490
|
+
jobKey: string().uuid()
|
|
42491
|
+
};
|
|
42492
|
+
var TrainingLogLineSchema = object({
|
|
42493
|
+
ts: number(),
|
|
42494
|
+
text: string()
|
|
42495
|
+
});
|
|
42496
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42497
|
+
kind: "mutation",
|
|
42498
|
+
auth: "admin",
|
|
42499
|
+
timeoutMs: 3e4
|
|
42500
|
+
}), method(object({
|
|
42501
|
+
addonId: string(),
|
|
42502
|
+
gpuType: string(),
|
|
42503
|
+
region: string(),
|
|
42504
|
+
datasetBytes: number().int().nonnegative(),
|
|
42505
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42506
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42507
|
+
}), object({
|
|
42508
|
+
usdLow: number().nonnegative(),
|
|
42509
|
+
usdHigh: number().nonnegative(),
|
|
42510
|
+
notes: array(string()).readonly()
|
|
42511
|
+
}), { auth: "admin" }), method(object({
|
|
42512
|
+
...JobRef,
|
|
42513
|
+
ticket: PeerBytesTicketSchema
|
|
42514
|
+
}), object({
|
|
42515
|
+
bytes: number().int().nonnegative(),
|
|
42516
|
+
sha256: string()
|
|
42517
|
+
}), {
|
|
42518
|
+
kind: "mutation",
|
|
42519
|
+
auth: "admin",
|
|
42520
|
+
timeoutMs: 120 * 6e4
|
|
42521
|
+
}), method(object({
|
|
42522
|
+
...JobRef,
|
|
42523
|
+
trainer: TrainerSourceRefSchema,
|
|
42524
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42525
|
+
gpuType: string(),
|
|
42526
|
+
region: string(),
|
|
42527
|
+
maxRuntimeSec: number().int().positive()
|
|
42528
|
+
}), ProviderJobStatusSchema, {
|
|
42529
|
+
kind: "mutation",
|
|
42530
|
+
auth: "admin",
|
|
42531
|
+
timeoutMs: 30 * 6e4
|
|
42532
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42533
|
+
auth: "admin",
|
|
42534
|
+
timeoutMs: 6e4
|
|
42535
|
+
}), method(object({
|
|
42536
|
+
...JobRef,
|
|
42537
|
+
cursor: string().optional(),
|
|
42538
|
+
max: number().int().min(1).max(500)
|
|
42539
|
+
}), object({
|
|
42540
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42541
|
+
cursor: string()
|
|
42542
|
+
}), {
|
|
42543
|
+
auth: "admin",
|
|
42544
|
+
timeoutMs: 6e4
|
|
42545
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42546
|
+
kind: "mutation",
|
|
42547
|
+
auth: "admin",
|
|
42548
|
+
timeoutMs: 6e4
|
|
42549
|
+
}), method(object(JobRef), object({
|
|
42550
|
+
found: boolean(),
|
|
42551
|
+
text: string().optional()
|
|
42552
|
+
}), {
|
|
42553
|
+
kind: "mutation",
|
|
42554
|
+
auth: "admin",
|
|
42555
|
+
timeoutMs: 5 * 6e4
|
|
42556
|
+
}), method(object({
|
|
42557
|
+
...JobRef,
|
|
42558
|
+
path: _enum(["bundle.tar"])
|
|
42559
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42560
|
+
kind: "mutation",
|
|
42561
|
+
auth: "admin",
|
|
42562
|
+
timeoutMs: 5 * 6e4
|
|
42563
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42564
|
+
kind: "mutation",
|
|
42565
|
+
auth: "admin",
|
|
42566
|
+
timeoutMs: 5 * 6e4
|
|
42567
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42568
|
+
auth: "admin",
|
|
42569
|
+
timeoutMs: 2 * 6e4
|
|
42570
|
+
});
|
|
42571
|
+
/**
|
|
42572
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42573
|
+
* provided by `addon-training`.
|
|
42574
|
+
*
|
|
42575
|
+
* It owns what every provider must agree on, written once:
|
|
42576
|
+
*
|
|
42577
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42578
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42579
|
+
* the export plan) and reaches this store through the five row methods
|
|
42580
|
+
* below, so the Retrain page and the export did not change.
|
|
42581
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42582
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42583
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42584
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42585
|
+
* rollback. Nothing is ever registered automatically.
|
|
42586
|
+
*
|
|
42587
|
+
* Every method is `admin`.
|
|
42588
|
+
*/
|
|
42589
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42590
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42591
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42592
|
+
var TrainingBaseModelSchema = object({
|
|
42593
|
+
modelId: string(),
|
|
42594
|
+
label: string(),
|
|
42595
|
+
weights: string(),
|
|
42596
|
+
imgsz: number().int(),
|
|
42597
|
+
baselineOnnxUrl: string(),
|
|
42598
|
+
baselineFloors: record(string(), number()),
|
|
42599
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42600
|
+
recommended: boolean()
|
|
42601
|
+
});
|
|
42602
|
+
var TrainingPresetSchema = _enum([
|
|
42603
|
+
"quick",
|
|
42604
|
+
"standard",
|
|
42605
|
+
"thorough"
|
|
42606
|
+
]);
|
|
42607
|
+
var TrainingJobRequestSchema = object({
|
|
42608
|
+
datasetVersionId: string().min(1),
|
|
42609
|
+
/** The `training-provider` addon that runs it. */
|
|
42610
|
+
addonId: string().min(1),
|
|
42611
|
+
gpuType: string().min(1),
|
|
42612
|
+
region: string(),
|
|
42613
|
+
baseModelId: string().min(1),
|
|
42614
|
+
preset: TrainingPresetSchema,
|
|
42615
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42616
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42617
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42618
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42619
|
+
});
|
|
42620
|
+
var TrainingSplitPlanSchema = object({
|
|
42621
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42622
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42623
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42624
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42625
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42626
|
+
trainSubjects: number().int()
|
|
42627
|
+
});
|
|
42628
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42629
|
+
"unknown-dataset",
|
|
42630
|
+
"unknown-provider",
|
|
42631
|
+
"provider-not-configured",
|
|
42632
|
+
"unknown-base-model",
|
|
42633
|
+
"unknown-gpu",
|
|
42634
|
+
"dataset-too-large",
|
|
42635
|
+
"no-training-subjects",
|
|
42636
|
+
"job-already-running"
|
|
42637
|
+
]);
|
|
42638
|
+
var TrainingJobPlanSchema = object({
|
|
42639
|
+
refusal: object({
|
|
42640
|
+
reason: TrainingRefusalReasonSchema,
|
|
42641
|
+
detail: string()
|
|
42642
|
+
}).nullable(),
|
|
42643
|
+
warnings: array(string()).readonly(),
|
|
42644
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42645
|
+
estimate: object({
|
|
42646
|
+
datasetBytes: number().int(),
|
|
42647
|
+
uploadMinutesAt20Mbps: number(),
|
|
42648
|
+
gpuSecondsLow: number(),
|
|
42649
|
+
gpuSecondsHigh: number(),
|
|
42650
|
+
usdLow: number(),
|
|
42651
|
+
usdHigh: number(),
|
|
42652
|
+
notes: array(string()).readonly()
|
|
42653
|
+
}).nullable(),
|
|
42654
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42655
|
+
defaults: object({
|
|
42656
|
+
maxCostUsd: number(),
|
|
42657
|
+
maxRuntimeSec: number().int()
|
|
42658
|
+
}).nullable(),
|
|
42659
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42660
|
+
dataNotice: string()
|
|
42661
|
+
});
|
|
42662
|
+
/**
|
|
42663
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42664
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42665
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42666
|
+
* result lives after the operator acted on it.
|
|
42667
|
+
*/
|
|
42668
|
+
var TrainingJobStateSchema = _enum([
|
|
42669
|
+
"uploading",
|
|
42670
|
+
"submitted",
|
|
42671
|
+
"starting",
|
|
42672
|
+
"running",
|
|
42673
|
+
"collecting",
|
|
42674
|
+
"ready",
|
|
42675
|
+
"registered",
|
|
42676
|
+
"canary",
|
|
42677
|
+
"failed",
|
|
42678
|
+
"cancelling",
|
|
42679
|
+
"cancelled",
|
|
42680
|
+
"lost",
|
|
42681
|
+
"expired",
|
|
42682
|
+
"discarded"
|
|
42683
|
+
]);
|
|
42684
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42685
|
+
"cost-cap",
|
|
42686
|
+
"runtime-cap",
|
|
42687
|
+
"upload-failed",
|
|
42688
|
+
"submit-failed",
|
|
42689
|
+
"trainer-failed",
|
|
42690
|
+
"result-invalid",
|
|
42691
|
+
"checksum-mismatch",
|
|
42692
|
+
"fetch-failed",
|
|
42693
|
+
"provider-error",
|
|
42694
|
+
"hub-restart-during-upload"
|
|
42695
|
+
]);
|
|
42696
|
+
var TrainingProgressPointSchema = object({
|
|
42697
|
+
epoch: number().int(),
|
|
42698
|
+
map50: number().nullable(),
|
|
42699
|
+
map50_95: number().nullable()
|
|
42700
|
+
});
|
|
42701
|
+
var TrainingCanarySchema = object({
|
|
42702
|
+
deviceIds: array(number().int()).readonly(),
|
|
42703
|
+
since: number(),
|
|
42704
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42705
|
+
previous: array(object({
|
|
42706
|
+
deviceId: number().int(),
|
|
42707
|
+
nodeId: string(),
|
|
42708
|
+
deviceKey: string(),
|
|
42709
|
+
patch: object({
|
|
42710
|
+
modelId: string().optional(),
|
|
42711
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42712
|
+
}).nullable()
|
|
42713
|
+
})).readonly()
|
|
42714
|
+
});
|
|
42715
|
+
var TrainingJobSchema = object({
|
|
42716
|
+
id: string(),
|
|
42717
|
+
idempotencyKey: string(),
|
|
42718
|
+
name: string(),
|
|
42719
|
+
createdAt: number(),
|
|
42720
|
+
updatedAt: number(),
|
|
42721
|
+
state: TrainingJobStateSchema,
|
|
42722
|
+
stage: TrainingStageSchema.nullable(),
|
|
42723
|
+
failure: object({
|
|
42724
|
+
reason: TrainingFailureReasonSchema,
|
|
42725
|
+
stage: string().nullable(),
|
|
42726
|
+
detail: string()
|
|
42727
|
+
}).nullable(),
|
|
42728
|
+
request: TrainingJobRequestSchema,
|
|
42729
|
+
maxCostUsd: number().nonnegative(),
|
|
42730
|
+
maxRuntimeSec: number().int().positive(),
|
|
42731
|
+
trainer: TrainerSourceRefSchema,
|
|
42732
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42733
|
+
dataset: object({
|
|
42734
|
+
bytes: number().int(),
|
|
42735
|
+
sha256: string(),
|
|
42736
|
+
uploadedAt: number()
|
|
42737
|
+
}).nullable(),
|
|
42738
|
+
split: TrainingSplitPlanSchema,
|
|
42739
|
+
provider: object({
|
|
42740
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42741
|
+
providerJobId: string().nullable(),
|
|
42742
|
+
startedAt: number().nullable(),
|
|
42743
|
+
endedAt: number().nullable(),
|
|
42744
|
+
billedSeconds: number(),
|
|
42745
|
+
costUsd: number(),
|
|
42746
|
+
costIsEstimate: boolean(),
|
|
42747
|
+
lastPolledAt: number().nullable()
|
|
42748
|
+
}),
|
|
42749
|
+
progress: object({
|
|
42750
|
+
epoch: number().int().nullable(),
|
|
42751
|
+
epochs: number().int().nullable(),
|
|
42752
|
+
etaSec: number().nullable(),
|
|
42753
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42754
|
+
}),
|
|
42755
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42756
|
+
logTail: array(string()).readonly(),
|
|
42757
|
+
logCursor: string().nullable(),
|
|
42758
|
+
artifacts: object({
|
|
42759
|
+
bundleBytes: number().int(),
|
|
42760
|
+
bundleSha256: string(),
|
|
42761
|
+
fetchedAt: number(),
|
|
42762
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42763
|
+
expiresAt: number()
|
|
42764
|
+
}).nullable(),
|
|
42765
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42766
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42767
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42768
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42769
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42770
|
+
registeredModelIds: array(string()).readonly(),
|
|
42771
|
+
canary: TrainingCanarySchema.nullable()
|
|
42772
|
+
});
|
|
42773
|
+
var IdInput = object({ id: string().min(1) });
|
|
42774
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42775
|
+
kind: "mutation",
|
|
42776
|
+
auth: "admin"
|
|
42777
|
+
}), 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() }), {
|
|
42778
|
+
kind: "mutation",
|
|
42779
|
+
auth: "admin"
|
|
42780
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42781
|
+
auth: "admin",
|
|
42782
|
+
timeoutMs: 6e4
|
|
42783
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42784
|
+
name: string().min(1).max(120),
|
|
42785
|
+
maxCostUsd: number().positive(),
|
|
42786
|
+
maxRuntimeSec: number().int().positive(),
|
|
42787
|
+
idempotencyKey: string().min(8).max(80)
|
|
42788
|
+
}), discriminatedUnion("kind", [object({
|
|
42789
|
+
kind: literal("started"),
|
|
42790
|
+
job: TrainingJobSchema
|
|
42791
|
+
}), object({
|
|
42792
|
+
kind: literal("refused"),
|
|
42793
|
+
reason: TrainingRefusalReasonSchema,
|
|
42794
|
+
detail: string()
|
|
42795
|
+
})]), {
|
|
42796
|
+
kind: "mutation",
|
|
42797
|
+
auth: "admin",
|
|
42798
|
+
timeoutMs: 12e4
|
|
42799
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42800
|
+
kind: "mutation",
|
|
42801
|
+
auth: "admin",
|
|
42802
|
+
timeoutMs: 12e4
|
|
42803
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42804
|
+
kind: "mutation",
|
|
42805
|
+
auth: "admin",
|
|
42806
|
+
timeoutMs: 30 * 6e4
|
|
42807
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42808
|
+
kind: "mutation",
|
|
42809
|
+
auth: "admin",
|
|
42810
|
+
timeoutMs: 12e4
|
|
42811
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42812
|
+
kind: "mutation",
|
|
42813
|
+
auth: "admin",
|
|
42814
|
+
timeoutMs: 12e4
|
|
42815
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42816
|
+
kind: "mutation",
|
|
42817
|
+
auth: "admin"
|
|
42818
|
+
});
|
|
41418
42819
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
41419
42820
|
Object.freeze({
|
|
41420
42821
|
person: .5,
|
|
@@ -43563,6 +44964,12 @@ Object.freeze({
|
|
|
43563
44964
|
addonId: null,
|
|
43564
44965
|
access: "create"
|
|
43565
44966
|
},
|
|
44967
|
+
"backup.checkBackupKey": {
|
|
44968
|
+
capName: "backup",
|
|
44969
|
+
capScope: "system",
|
|
44970
|
+
addonId: null,
|
|
44971
|
+
access: "create"
|
|
44972
|
+
},
|
|
43566
44973
|
"backup.delete": {
|
|
43567
44974
|
capName: "backup",
|
|
43568
44975
|
capScope: "system",
|
|
@@ -43575,6 +44982,18 @@ Object.freeze({
|
|
|
43575
44982
|
addonId: null,
|
|
43576
44983
|
access: "delete"
|
|
43577
44984
|
},
|
|
44985
|
+
"backup.disableEncryption": {
|
|
44986
|
+
capName: "backup",
|
|
44987
|
+
capScope: "system",
|
|
44988
|
+
addonId: null,
|
|
44989
|
+
access: "create"
|
|
44990
|
+
},
|
|
44991
|
+
"backup.getEncryption": {
|
|
44992
|
+
capName: "backup",
|
|
44993
|
+
capScope: "system",
|
|
44994
|
+
addonId: null,
|
|
44995
|
+
access: "view"
|
|
44996
|
+
},
|
|
43578
44997
|
"backup.getEntries": {
|
|
43579
44998
|
capName: "backup",
|
|
43580
44999
|
capScope: "system",
|
|
@@ -43629,6 +45048,12 @@ Object.freeze({
|
|
|
43629
45048
|
addonId: null,
|
|
43630
45049
|
access: "create"
|
|
43631
45050
|
},
|
|
45051
|
+
"backup.setupEncryption": {
|
|
45052
|
+
capName: "backup",
|
|
45053
|
+
capScope: "system",
|
|
45054
|
+
addonId: null,
|
|
45055
|
+
access: "create"
|
|
45056
|
+
},
|
|
43632
45057
|
"backup.trigger": {
|
|
43633
45058
|
capName: "backup",
|
|
43634
45059
|
capScope: "system",
|
|
@@ -44181,6 +45606,12 @@ Object.freeze({
|
|
|
44181
45606
|
addonId: null,
|
|
44182
45607
|
access: "create"
|
|
44183
45608
|
},
|
|
45609
|
+
"customModelRegistry.importModelBundle": {
|
|
45610
|
+
capName: "custom-model-registry",
|
|
45611
|
+
capScope: "system",
|
|
45612
|
+
addonId: null,
|
|
45613
|
+
access: "create"
|
|
45614
|
+
},
|
|
44184
45615
|
"customModelRegistry.listModels": {
|
|
44185
45616
|
capName: "custom-model-registry",
|
|
44186
45617
|
capScope: "system",
|
|
@@ -45621,6 +47052,12 @@ Object.freeze({
|
|
|
45621
47052
|
addonId: null,
|
|
45622
47053
|
access: "view"
|
|
45623
47054
|
},
|
|
47055
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47056
|
+
capName: "keychain-admin",
|
|
47057
|
+
capScope: "system",
|
|
47058
|
+
addonId: null,
|
|
47059
|
+
access: "create"
|
|
47060
|
+
},
|
|
45624
47061
|
"keychainAdmin.deleteOrphans": {
|
|
45625
47062
|
capName: "keychain-admin",
|
|
45626
47063
|
capScope: "system",
|
|
@@ -45657,6 +47094,12 @@ Object.freeze({
|
|
|
45657
47094
|
addonId: null,
|
|
45658
47095
|
access: "delete"
|
|
45659
47096
|
},
|
|
47097
|
+
"keychainAdmin.resetReport": {
|
|
47098
|
+
capName: "keychain-admin",
|
|
47099
|
+
capScope: "system",
|
|
47100
|
+
addonId: null,
|
|
47101
|
+
access: "delete"
|
|
47102
|
+
},
|
|
45660
47103
|
"keychainAdmin.reveal": {
|
|
45661
47104
|
capName: "keychain-admin",
|
|
45662
47105
|
capScope: "system",
|
|
@@ -45669,6 +47112,12 @@ Object.freeze({
|
|
|
45669
47112
|
addonId: null,
|
|
45670
47113
|
access: "create"
|
|
45671
47114
|
},
|
|
47115
|
+
"keychainAdmin.setSystemSecret": {
|
|
47116
|
+
capName: "keychain-admin",
|
|
47117
|
+
capScope: "system",
|
|
47118
|
+
addonId: null,
|
|
47119
|
+
access: "create"
|
|
47120
|
+
},
|
|
45672
47121
|
"keychainAdmin.status": {
|
|
45673
47122
|
capName: "keychain-admin",
|
|
45674
47123
|
capScope: "system",
|
|
@@ -47115,6 +48564,12 @@ Object.freeze({
|
|
|
47115
48564
|
addonId: null,
|
|
47116
48565
|
access: "create"
|
|
47117
48566
|
},
|
|
48567
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48568
|
+
capName: "pipeline-analytics",
|
|
48569
|
+
capScope: "device",
|
|
48570
|
+
addonId: null,
|
|
48571
|
+
access: "create"
|
|
48572
|
+
},
|
|
47118
48573
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
47119
48574
|
capName: "pipeline-analytics",
|
|
47120
48575
|
capScope: "device",
|
|
@@ -47127,6 +48582,12 @@ Object.freeze({
|
|
|
47127
48582
|
addonId: null,
|
|
47128
48583
|
access: "delete"
|
|
47129
48584
|
},
|
|
48585
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48586
|
+
capName: "pipeline-analytics",
|
|
48587
|
+
capScope: "device",
|
|
48588
|
+
addonId: null,
|
|
48589
|
+
access: "delete"
|
|
48590
|
+
},
|
|
47130
48591
|
"pipelineAnalytics.deleteTracks": {
|
|
47131
48592
|
capName: "pipeline-analytics",
|
|
47132
48593
|
capScope: "device",
|
|
@@ -47349,6 +48810,12 @@ Object.freeze({
|
|
|
47349
48810
|
addonId: null,
|
|
47350
48811
|
access: "view"
|
|
47351
48812
|
},
|
|
48813
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48814
|
+
capName: "pipeline-analytics",
|
|
48815
|
+
capScope: "device",
|
|
48816
|
+
addonId: null,
|
|
48817
|
+
access: "view"
|
|
48818
|
+
},
|
|
47352
48819
|
"pipelineAnalytics.listRetrainFrames": {
|
|
47353
48820
|
capName: "pipeline-analytics",
|
|
47354
48821
|
capScope: "device",
|
|
@@ -47379,6 +48846,12 @@ Object.freeze({
|
|
|
47379
48846
|
addonId: null,
|
|
47380
48847
|
access: "view"
|
|
47381
48848
|
},
|
|
48849
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48850
|
+
capName: "pipeline-analytics",
|
|
48851
|
+
capScope: "device",
|
|
48852
|
+
addonId: null,
|
|
48853
|
+
access: "create"
|
|
48854
|
+
},
|
|
47382
48855
|
"pipelineAnalytics.ownersWithMedia": {
|
|
47383
48856
|
capName: "pipeline-analytics",
|
|
47384
48857
|
capScope: "device",
|
|
@@ -47391,6 +48864,12 @@ Object.freeze({
|
|
|
47391
48864
|
addonId: null,
|
|
47392
48865
|
access: "create"
|
|
47393
48866
|
},
|
|
48867
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48868
|
+
capName: "pipeline-analytics",
|
|
48869
|
+
capScope: "device",
|
|
48870
|
+
addonId: null,
|
|
48871
|
+
access: "view"
|
|
48872
|
+
},
|
|
47394
48873
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
47395
48874
|
capName: "pipeline-analytics",
|
|
47396
48875
|
capScope: "device",
|
|
@@ -47529,6 +49008,12 @@ Object.freeze({
|
|
|
47529
49008
|
addonId: null,
|
|
47530
49009
|
access: "create"
|
|
47531
49010
|
},
|
|
49011
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49012
|
+
capName: "pipeline-analytics",
|
|
49013
|
+
capScope: "device",
|
|
49014
|
+
addonId: null,
|
|
49015
|
+
access: "view"
|
|
49016
|
+
},
|
|
47532
49017
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
47533
49018
|
capName: "pipeline-analytics",
|
|
47534
49019
|
capScope: "device",
|
|
@@ -49905,6 +51390,174 @@ Object.freeze({
|
|
|
49905
51390
|
addonId: null,
|
|
49906
51391
|
access: "view"
|
|
49907
51392
|
},
|
|
51393
|
+
"training.canaryResult": {
|
|
51394
|
+
capName: "training",
|
|
51395
|
+
capScope: "system",
|
|
51396
|
+
addonId: null,
|
|
51397
|
+
access: "create"
|
|
51398
|
+
},
|
|
51399
|
+
"training.cancelJob": {
|
|
51400
|
+
capName: "training",
|
|
51401
|
+
capScope: "system",
|
|
51402
|
+
addonId: null,
|
|
51403
|
+
access: "create"
|
|
51404
|
+
},
|
|
51405
|
+
"training.discardResult": {
|
|
51406
|
+
capName: "training",
|
|
51407
|
+
capScope: "system",
|
|
51408
|
+
addonId: null,
|
|
51409
|
+
access: "create"
|
|
51410
|
+
},
|
|
51411
|
+
"training.findDatasetVersionIdByName": {
|
|
51412
|
+
capName: "training",
|
|
51413
|
+
capScope: "system",
|
|
51414
|
+
addonId: null,
|
|
51415
|
+
access: "view"
|
|
51416
|
+
},
|
|
51417
|
+
"training.getDatasetVersion": {
|
|
51418
|
+
capName: "training",
|
|
51419
|
+
capScope: "system",
|
|
51420
|
+
addonId: null,
|
|
51421
|
+
access: "view"
|
|
51422
|
+
},
|
|
51423
|
+
"training.getJob": {
|
|
51424
|
+
capName: "training",
|
|
51425
|
+
capScope: "system",
|
|
51426
|
+
addonId: null,
|
|
51427
|
+
access: "view"
|
|
51428
|
+
},
|
|
51429
|
+
"training.getJobResult": {
|
|
51430
|
+
capName: "training",
|
|
51431
|
+
capScope: "system",
|
|
51432
|
+
addonId: null,
|
|
51433
|
+
access: "view"
|
|
51434
|
+
},
|
|
51435
|
+
"training.listBaseModels": {
|
|
51436
|
+
capName: "training",
|
|
51437
|
+
capScope: "system",
|
|
51438
|
+
addonId: null,
|
|
51439
|
+
access: "view"
|
|
51440
|
+
},
|
|
51441
|
+
"training.listDatasetVersions": {
|
|
51442
|
+
capName: "training",
|
|
51443
|
+
capScope: "system",
|
|
51444
|
+
addonId: null,
|
|
51445
|
+
access: "view"
|
|
51446
|
+
},
|
|
51447
|
+
"training.listJobs": {
|
|
51448
|
+
capName: "training",
|
|
51449
|
+
capScope: "system",
|
|
51450
|
+
addonId: null,
|
|
51451
|
+
access: "view"
|
|
51452
|
+
},
|
|
51453
|
+
"training.planJob": {
|
|
51454
|
+
capName: "training",
|
|
51455
|
+
capScope: "system",
|
|
51456
|
+
addonId: null,
|
|
51457
|
+
access: "view"
|
|
51458
|
+
},
|
|
51459
|
+
"training.putDatasetVersion": {
|
|
51460
|
+
capName: "training",
|
|
51461
|
+
capScope: "system",
|
|
51462
|
+
addonId: null,
|
|
51463
|
+
access: "create"
|
|
51464
|
+
},
|
|
51465
|
+
"training.registerResult": {
|
|
51466
|
+
capName: "training",
|
|
51467
|
+
capScope: "system",
|
|
51468
|
+
addonId: null,
|
|
51469
|
+
access: "create"
|
|
51470
|
+
},
|
|
51471
|
+
"training.removeDatasetVersion": {
|
|
51472
|
+
capName: "training",
|
|
51473
|
+
capScope: "system",
|
|
51474
|
+
addonId: null,
|
|
51475
|
+
access: "delete"
|
|
51476
|
+
},
|
|
51477
|
+
"training.rollbackCanary": {
|
|
51478
|
+
capName: "training",
|
|
51479
|
+
capScope: "system",
|
|
51480
|
+
addonId: null,
|
|
51481
|
+
access: "create"
|
|
51482
|
+
},
|
|
51483
|
+
"training.startJob": {
|
|
51484
|
+
capName: "training",
|
|
51485
|
+
capScope: "system",
|
|
51486
|
+
addonId: null,
|
|
51487
|
+
access: "create"
|
|
51488
|
+
},
|
|
51489
|
+
"trainingProvider.cancelJob": {
|
|
51490
|
+
capName: "training-provider",
|
|
51491
|
+
capScope: "system",
|
|
51492
|
+
addonId: null,
|
|
51493
|
+
access: "create"
|
|
51494
|
+
},
|
|
51495
|
+
"trainingProvider.cleanupJob": {
|
|
51496
|
+
capName: "training-provider",
|
|
51497
|
+
capScope: "system",
|
|
51498
|
+
addonId: null,
|
|
51499
|
+
access: "create"
|
|
51500
|
+
},
|
|
51501
|
+
"trainingProvider.describe": {
|
|
51502
|
+
capName: "training-provider",
|
|
51503
|
+
capScope: "system",
|
|
51504
|
+
addonId: null,
|
|
51505
|
+
access: "view"
|
|
51506
|
+
},
|
|
51507
|
+
"trainingProvider.estimateJob": {
|
|
51508
|
+
capName: "training-provider",
|
|
51509
|
+
capScope: "system",
|
|
51510
|
+
addonId: null,
|
|
51511
|
+
access: "view"
|
|
51512
|
+
},
|
|
51513
|
+
"trainingProvider.getJob": {
|
|
51514
|
+
capName: "training-provider",
|
|
51515
|
+
capScope: "system",
|
|
51516
|
+
addonId: null,
|
|
51517
|
+
access: "view"
|
|
51518
|
+
},
|
|
51519
|
+
"trainingProvider.listJobEvents": {
|
|
51520
|
+
capName: "training-provider",
|
|
51521
|
+
capScope: "system",
|
|
51522
|
+
addonId: null,
|
|
51523
|
+
access: "view"
|
|
51524
|
+
},
|
|
51525
|
+
"trainingProvider.listJobs": {
|
|
51526
|
+
capName: "training-provider",
|
|
51527
|
+
capScope: "system",
|
|
51528
|
+
addonId: null,
|
|
51529
|
+
access: "view"
|
|
51530
|
+
},
|
|
51531
|
+
"trainingProvider.offerArtifact": {
|
|
51532
|
+
capName: "training-provider",
|
|
51533
|
+
capScope: "system",
|
|
51534
|
+
addonId: null,
|
|
51535
|
+
access: "create"
|
|
51536
|
+
},
|
|
51537
|
+
"trainingProvider.readResult": {
|
|
51538
|
+
capName: "training-provider",
|
|
51539
|
+
capScope: "system",
|
|
51540
|
+
addonId: null,
|
|
51541
|
+
access: "create"
|
|
51542
|
+
},
|
|
51543
|
+
"trainingProvider.submitJob": {
|
|
51544
|
+
capName: "training-provider",
|
|
51545
|
+
capScope: "system",
|
|
51546
|
+
addonId: null,
|
|
51547
|
+
access: "create"
|
|
51548
|
+
},
|
|
51549
|
+
"trainingProvider.uploadDataset": {
|
|
51550
|
+
capName: "training-provider",
|
|
51551
|
+
capScope: "system",
|
|
51552
|
+
addonId: null,
|
|
51553
|
+
access: "create"
|
|
51554
|
+
},
|
|
51555
|
+
"trainingProvider.validateCredentials": {
|
|
51556
|
+
capName: "training-provider",
|
|
51557
|
+
capScope: "system",
|
|
51558
|
+
addonId: null,
|
|
51559
|
+
access: "create"
|
|
51560
|
+
},
|
|
49908
51561
|
"turnProvider.getTurnServers": {
|
|
49909
51562
|
capName: "turn-provider",
|
|
49910
51563
|
capScope: "system",
|
|
@@ -49929,12 +51582,6 @@ Object.freeze({
|
|
|
49929
51582
|
addonId: null,
|
|
49930
51583
|
access: "create"
|
|
49931
51584
|
},
|
|
49932
|
-
"userManagement.createApiKey": {
|
|
49933
|
-
capName: "user-management",
|
|
49934
|
-
capScope: "system",
|
|
49935
|
-
addonId: null,
|
|
49936
|
-
access: "create"
|
|
49937
|
-
},
|
|
49938
51585
|
"userManagement.createScopedToken": {
|
|
49939
51586
|
capName: "user-management",
|
|
49940
51587
|
capScope: "system",
|
|
@@ -49971,12 +51618,6 @@ Object.freeze({
|
|
|
49971
51618
|
addonId: null,
|
|
49972
51619
|
access: "view"
|
|
49973
51620
|
},
|
|
49974
|
-
"userManagement.linkExternalIdentity": {
|
|
49975
|
-
capName: "user-management",
|
|
49976
|
-
capScope: "system",
|
|
49977
|
-
addonId: null,
|
|
49978
|
-
access: "create"
|
|
49979
|
-
},
|
|
49980
51621
|
"userManagement.listApiKeys": {
|
|
49981
51622
|
capName: "user-management",
|
|
49982
51623
|
capScope: "system",
|
|
@@ -50079,12 +51720,6 @@ Object.freeze({
|
|
|
50079
51720
|
addonId: null,
|
|
50080
51721
|
access: "create"
|
|
50081
51722
|
},
|
|
50082
|
-
"userManagement.validateApiKey": {
|
|
50083
|
-
capName: "user-management",
|
|
50084
|
-
capScope: "system",
|
|
50085
|
-
addonId: null,
|
|
50086
|
-
access: "view"
|
|
50087
|
-
},
|
|
50088
51723
|
"userManagement.validateCredentials": {
|
|
50089
51724
|
capName: "user-management",
|
|
50090
51725
|
capScope: "system",
|
|
@@ -54198,6 +55833,11 @@ Object.freeze({
|
|
|
54198
55833
|
form: "single",
|
|
54199
55834
|
optional: false
|
|
54200
55835
|
}],
|
|
55836
|
+
"training.canaryResult": [{
|
|
55837
|
+
name: "deviceIds",
|
|
55838
|
+
form: "array",
|
|
55839
|
+
optional: false
|
|
55840
|
+
}],
|
|
54201
55841
|
"update.getStatus": [{
|
|
54202
55842
|
name: "deviceId",
|
|
54203
55843
|
form: "single",
|