@camstack/addon-provider-hikvision 1.2.147 → 1.2.148
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
|
@@ -5411,7 +5411,7 @@ var ZodIssueCode = {
|
|
|
5411
5411
|
var ZodFirstPartyTypeKind;
|
|
5412
5412
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5413
5413
|
//#endregion
|
|
5414
|
-
//#region ../types/dist/sleep-
|
|
5414
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5415
5415
|
/**
|
|
5416
5416
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5417
5417
|
* window to float samples (D455).
|
|
@@ -5528,7 +5528,7 @@ function isKeychainStoredField(field) {
|
|
|
5528
5528
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5529
5529
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5530
5530
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5531
|
-
function isRecord$
|
|
5531
|
+
function isRecord$2(value) {
|
|
5532
5532
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5533
5533
|
}
|
|
5534
5534
|
function makeSecretMarker(ref) {
|
|
@@ -5539,12 +5539,12 @@ function makeSecretMarker(ref) {
|
|
|
5539
5539
|
}
|
|
5540
5540
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5541
5541
|
function isSecretMarker(value) {
|
|
5542
|
-
if (!isRecord$
|
|
5542
|
+
if (!isRecord$2(value)) return false;
|
|
5543
5543
|
const ref = value["$secret"];
|
|
5544
5544
|
return typeof ref === "string" && ref.length > 0;
|
|
5545
5545
|
}
|
|
5546
5546
|
function isSecretClear(value) {
|
|
5547
|
-
return isRecord$
|
|
5547
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5548
5548
|
}
|
|
5549
5549
|
/**
|
|
5550
5550
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6060,6 +6060,13 @@ function globalSecretScope() {
|
|
|
6060
6060
|
function encodeSegment(value) {
|
|
6061
6061
|
return encodeURIComponent(value);
|
|
6062
6062
|
}
|
|
6063
|
+
function decodeSegment(value) {
|
|
6064
|
+
try {
|
|
6065
|
+
return decodeURIComponent(value);
|
|
6066
|
+
} catch {
|
|
6067
|
+
return null;
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6063
6070
|
/**
|
|
6064
6071
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6065
6072
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6068,6 +6075,75 @@ function encodeSegment(value) {
|
|
|
6068
6075
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6069
6076
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6070
6077
|
}
|
|
6078
|
+
function parseScope(segments) {
|
|
6079
|
+
switch (segments[0]) {
|
|
6080
|
+
case "global": return {
|
|
6081
|
+
scope: GLOBAL_SCOPE,
|
|
6082
|
+
used: 1
|
|
6083
|
+
};
|
|
6084
|
+
case "node": {
|
|
6085
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6086
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6087
|
+
scope: {
|
|
6088
|
+
kind: "node",
|
|
6089
|
+
nodeId
|
|
6090
|
+
},
|
|
6091
|
+
used: 2
|
|
6092
|
+
};
|
|
6093
|
+
}
|
|
6094
|
+
case "device": {
|
|
6095
|
+
const raw = segments[1];
|
|
6096
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6097
|
+
return {
|
|
6098
|
+
scope: {
|
|
6099
|
+
kind: "device",
|
|
6100
|
+
deviceId: Number(raw)
|
|
6101
|
+
},
|
|
6102
|
+
used: 2
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
case "integration": {
|
|
6106
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6107
|
+
return id === null || id.length === 0 ? null : {
|
|
6108
|
+
scope: {
|
|
6109
|
+
kind: "integration",
|
|
6110
|
+
integrationId: id
|
|
6111
|
+
},
|
|
6112
|
+
used: 2
|
|
6113
|
+
};
|
|
6114
|
+
}
|
|
6115
|
+
case "row": {
|
|
6116
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6117
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6118
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6119
|
+
return {
|
|
6120
|
+
scope: {
|
|
6121
|
+
kind: "row",
|
|
6122
|
+
collection,
|
|
6123
|
+
rowId
|
|
6124
|
+
},
|
|
6125
|
+
used: 3
|
|
6126
|
+
};
|
|
6127
|
+
}
|
|
6128
|
+
default: return null;
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6132
|
+
function parseSecretRef(ref) {
|
|
6133
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6134
|
+
const segments = ref.slice(9).split("/");
|
|
6135
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6136
|
+
if (owner === null || owner.length === 0) return null;
|
|
6137
|
+
const parsed = parseScope(segments.slice(1));
|
|
6138
|
+
if (parsed === null) return null;
|
|
6139
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6140
|
+
if (fieldPath.length === 0) return null;
|
|
6141
|
+
return {
|
|
6142
|
+
owner,
|
|
6143
|
+
scope: parsed.scope,
|
|
6144
|
+
fieldPath
|
|
6145
|
+
};
|
|
6146
|
+
}
|
|
6071
6147
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6072
6148
|
var KeychainWriteRefusedError = class extends Error {
|
|
6073
6149
|
fieldPath;
|
|
@@ -6078,7 +6154,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6078
6154
|
}
|
|
6079
6155
|
};
|
|
6080
6156
|
var KEEP = { kind: "keep" };
|
|
6081
|
-
function isRecord(value) {
|
|
6157
|
+
function isRecord$1(value) {
|
|
6082
6158
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6083
6159
|
}
|
|
6084
6160
|
function defaultMintId() {
|
|
@@ -6091,7 +6167,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6091
6167
|
return out;
|
|
6092
6168
|
}
|
|
6093
6169
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6094
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6170
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6095
6171
|
return out;
|
|
6096
6172
|
}
|
|
6097
6173
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6146,7 +6222,7 @@ function rowId(row, idKey) {
|
|
|
6146
6222
|
return null;
|
|
6147
6223
|
}
|
|
6148
6224
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6149
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6225
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6150
6226
|
if (!Array.isArray(incoming)) {
|
|
6151
6227
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6152
6228
|
return {
|
|
@@ -6162,7 +6238,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6162
6238
|
const kept = /* @__PURE__ */ new Set();
|
|
6163
6239
|
const rows = [];
|
|
6164
6240
|
for (const row of incoming) {
|
|
6165
|
-
if (!isRecord(row)) {
|
|
6241
|
+
if (!isRecord$1(row)) {
|
|
6166
6242
|
rows.push(row);
|
|
6167
6243
|
continue;
|
|
6168
6244
|
}
|
|
@@ -6187,7 +6263,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6187
6263
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6188
6264
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6189
6265
|
case "object": {
|
|
6190
|
-
if (!isRecord(incoming)) {
|
|
6266
|
+
if (!isRecord$1(incoming)) {
|
|
6191
6267
|
if (incoming === void 0) return KEEP;
|
|
6192
6268
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6193
6269
|
return {
|
|
@@ -6195,7 +6271,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6195
6271
|
value: incoming
|
|
6196
6272
|
};
|
|
6197
6273
|
}
|
|
6198
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6274
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6199
6275
|
return {
|
|
6200
6276
|
kind: "value",
|
|
6201
6277
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6254,12 +6330,19 @@ async function transformSecretWrite(input) {
|
|
|
6254
6330
|
}
|
|
6255
6331
|
};
|
|
6256
6332
|
}
|
|
6333
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6334
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6335
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6336
|
+
}
|
|
6257
6337
|
/**
|
|
6258
6338
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6259
6339
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6260
6340
|
*/
|
|
6261
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6262
|
-
const
|
|
6341
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6342
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6343
|
+
const owner = options.ownedBy;
|
|
6344
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6345
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6263
6346
|
if (refs.length === 0) return {
|
|
6264
6347
|
value,
|
|
6265
6348
|
unresolved: []
|
|
@@ -6283,10 +6366,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6283
6366
|
}
|
|
6284
6367
|
const substitute = (v) => {
|
|
6285
6368
|
if (isSecretMarker(v)) {
|
|
6369
|
+
if (!inScope(v.$secret)) return {
|
|
6370
|
+
keep: true,
|
|
6371
|
+
value: v
|
|
6372
|
+
};
|
|
6286
6373
|
const answer = answers[v.$secret];
|
|
6287
|
-
|
|
6374
|
+
if (answer?.kind === "value") return {
|
|
6288
6375
|
keep: true,
|
|
6289
6376
|
value: answer.value
|
|
6377
|
+
};
|
|
6378
|
+
return keepMarker ? {
|
|
6379
|
+
keep: true,
|
|
6380
|
+
value: v
|
|
6290
6381
|
} : {
|
|
6291
6382
|
keep: false,
|
|
6292
6383
|
value: void 0
|
|
@@ -6303,7 +6394,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6303
6394
|
value: items
|
|
6304
6395
|
};
|
|
6305
6396
|
}
|
|
6306
|
-
if (isRecord(v)) {
|
|
6397
|
+
if (isRecord$1(v)) {
|
|
6307
6398
|
const out = {};
|
|
6308
6399
|
for (const [k, child] of Object.entries(v)) {
|
|
6309
6400
|
const s = substitute(child);
|
|
@@ -6324,14 +6415,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6324
6415
|
unresolved
|
|
6325
6416
|
};
|
|
6326
6417
|
}
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6418
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6419
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6420
|
+
ref;
|
|
6421
|
+
reason;
|
|
6422
|
+
constructor(ref, reason) {
|
|
6423
|
+
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.`);
|
|
6424
|
+
this.ref = ref;
|
|
6425
|
+
this.reason = reason;
|
|
6426
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6427
|
+
}
|
|
6428
|
+
};
|
|
6429
|
+
function isRecord(value) {
|
|
6430
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6431
|
+
}
|
|
6432
|
+
function resolvedValue(pass, marker) {
|
|
6433
|
+
const answer = pass.answers[marker.$secret];
|
|
6434
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6435
|
+
}
|
|
6436
|
+
async function atMarker(pass, incoming, stored) {
|
|
6437
|
+
if (incoming === null) return stored;
|
|
6438
|
+
if (typeof incoming !== "string") return incoming;
|
|
6439
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6440
|
+
const intent = classifySecretWrite(incoming);
|
|
6441
|
+
if (intent.kind !== "set") return stored;
|
|
6442
|
+
const ref = stored.$secret;
|
|
6443
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6444
|
+
const answer = pass.answers[ref];
|
|
6445
|
+
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);
|
|
6446
|
+
try {
|
|
6447
|
+
await pass.secrets.put(ref, intent.value);
|
|
6448
|
+
} catch (err) {
|
|
6449
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6450
|
+
}
|
|
6451
|
+
pass.changedRefs.push(ref);
|
|
6452
|
+
return stored;
|
|
6453
|
+
}
|
|
6454
|
+
function inArray(pass, incoming, stored) {
|
|
6455
|
+
return incoming.map((item, index) => {
|
|
6456
|
+
const twin = stored[index];
|
|
6457
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6458
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6459
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6460
|
+
return item;
|
|
6461
|
+
});
|
|
6462
|
+
}
|
|
6463
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6464
|
+
const out = { ...incoming };
|
|
6465
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6466
|
+
const twin = stored[key];
|
|
6467
|
+
if (isSecretMarker(twin)) {
|
|
6468
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6469
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6470
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6471
|
+
}
|
|
6472
|
+
return out;
|
|
6473
|
+
}
|
|
6474
|
+
async function walk(pass, incoming, stored) {
|
|
6475
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6476
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6477
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6478
|
+
const out = { ...incoming };
|
|
6479
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6480
|
+
return out;
|
|
6481
|
+
}
|
|
6482
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6483
|
+
async function restoreUnchangedSecrets(input) {
|
|
6484
|
+
const refs = [];
|
|
6485
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6486
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6487
|
+
if (owned.length === 0) return {
|
|
6488
|
+
patch: input.patch,
|
|
6489
|
+
changedRefs: []
|
|
6490
|
+
};
|
|
6491
|
+
const pass = {
|
|
6492
|
+
secrets: input.secrets,
|
|
6493
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6494
|
+
operatorWrite: input.operatorWrite,
|
|
6495
|
+
changedRefs: []
|
|
6496
|
+
};
|
|
6497
|
+
const out = {};
|
|
6498
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6499
|
+
return {
|
|
6500
|
+
patch: out,
|
|
6501
|
+
changedRefs: pass.changedRefs
|
|
6502
|
+
};
|
|
6503
|
+
}
|
|
6504
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6505
|
+
function isJsonEqual(a, b) {
|
|
6506
|
+
if (Object.is(a, b)) return true;
|
|
6507
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6508
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6509
|
+
const keys = Object.keys(a);
|
|
6510
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6511
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6332
6512
|
}
|
|
6333
6513
|
return false;
|
|
6334
6514
|
}
|
|
6515
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6516
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6517
|
+
const out = {};
|
|
6518
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6519
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6520
|
+
out[key] = value;
|
|
6521
|
+
}
|
|
6522
|
+
return out;
|
|
6523
|
+
}
|
|
6524
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6525
|
+
function markerKeysOf(blob, owner) {
|
|
6526
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6527
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6528
|
+
return keys;
|
|
6529
|
+
}
|
|
6530
|
+
function nodeFromStored(value, owner) {
|
|
6531
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6532
|
+
if (!isRecord(value)) return null;
|
|
6533
|
+
const children = /* @__PURE__ */ new Map();
|
|
6534
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6535
|
+
const node = nodeFromStored(child, owner);
|
|
6536
|
+
if (node !== null) children.set(key, node);
|
|
6537
|
+
}
|
|
6538
|
+
return children.size > 0 ? {
|
|
6539
|
+
kind: "object",
|
|
6540
|
+
children
|
|
6541
|
+
} : null;
|
|
6542
|
+
}
|
|
6543
|
+
/**
|
|
6544
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6545
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6546
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6547
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6548
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6549
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6550
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6551
|
+
* over.
|
|
6552
|
+
*/
|
|
6553
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6554
|
+
const added = /* @__PURE__ */ new Map();
|
|
6555
|
+
for (const key of keys) {
|
|
6556
|
+
const at = key.indexOf("@");
|
|
6557
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6558
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6559
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6560
|
+
if (node !== null) added.set(base, node);
|
|
6561
|
+
}
|
|
6562
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6563
|
+
}
|
|
6335
6564
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6336
6565
|
async function readStoredAddonBlob(raw) {
|
|
6337
6566
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6340,7 +6569,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6340
6569
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6341
6570
|
return result.kind === "missing" ? {} : result.value;
|
|
6342
6571
|
}
|
|
6343
|
-
function
|
|
6572
|
+
function touchesTree(tree, patch) {
|
|
6573
|
+
if (tree.size === 0) return false;
|
|
6574
|
+
for (const key of Object.keys(patch)) {
|
|
6575
|
+
const at = key.indexOf("@");
|
|
6576
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6577
|
+
}
|
|
6578
|
+
return false;
|
|
6579
|
+
}
|
|
6580
|
+
/**
|
|
6581
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6582
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6583
|
+
*/
|
|
6584
|
+
var MarkerKeyIndex = class {
|
|
6585
|
+
owner;
|
|
6586
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6587
|
+
constructor(owner) {
|
|
6588
|
+
this.owner = owner;
|
|
6589
|
+
}
|
|
6590
|
+
seen(store, blob) {
|
|
6591
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6592
|
+
}
|
|
6593
|
+
wrote(store, patch) {
|
|
6594
|
+
const keys = this.byStore.get(store);
|
|
6595
|
+
if (keys === void 0) return;
|
|
6596
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6597
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6598
|
+
else keys.delete(key);
|
|
6599
|
+
}
|
|
6600
|
+
mayHoldMarkers(store, patch) {
|
|
6601
|
+
const keys = this.byStore.get(store);
|
|
6602
|
+
if (keys === void 0) return true;
|
|
6603
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6604
|
+
}
|
|
6605
|
+
};
|
|
6606
|
+
function createHandle(raw, opts) {
|
|
6344
6607
|
const chains = /* @__PURE__ */ new Map();
|
|
6345
6608
|
const serialize = (key, fn) => {
|
|
6346
6609
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6351,46 +6614,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6351
6614
|
});
|
|
6352
6615
|
return next;
|
|
6353
6616
|
};
|
|
6354
|
-
const
|
|
6355
|
-
|
|
6356
|
-
|
|
6617
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6618
|
+
const resolveRead = async (store, blob) => {
|
|
6619
|
+
index.seen(store, blob);
|
|
6620
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6621
|
+
unresolved: "keep-marker",
|
|
6622
|
+
ownedBy: opts.secrets.owner
|
|
6623
|
+
});
|
|
6624
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6625
|
+
return value;
|
|
6626
|
+
};
|
|
6627
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6628
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6629
|
+
await rawWrite(patch);
|
|
6630
|
+
index.wrote(store, patch);
|
|
6631
|
+
return { changed: true };
|
|
6632
|
+
}
|
|
6633
|
+
return serialize(store, async () => {
|
|
6357
6634
|
const stored = await readStored();
|
|
6635
|
+
index.seen(store, stored);
|
|
6636
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6637
|
+
const restored = await restoreUnchangedSecrets({
|
|
6638
|
+
patch,
|
|
6639
|
+
stored,
|
|
6640
|
+
secrets: opts.secrets,
|
|
6641
|
+
operatorWrite
|
|
6642
|
+
});
|
|
6358
6643
|
const result = await transformSecretWrite({
|
|
6359
|
-
tree,
|
|
6644
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6360
6645
|
secrets: opts.secrets,
|
|
6361
|
-
patch,
|
|
6646
|
+
patch: restored.patch,
|
|
6362
6647
|
stored,
|
|
6363
6648
|
...scope !== void 0 ? { scope } : {},
|
|
6364
|
-
operatorWrite
|
|
6649
|
+
operatorWrite
|
|
6365
6650
|
});
|
|
6366
|
-
|
|
6651
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6652
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6653
|
+
if (wroteBlob) {
|
|
6654
|
+
await rawWrite(effective);
|
|
6655
|
+
index.wrote(store, effective);
|
|
6656
|
+
}
|
|
6367
6657
|
const { orphaned } = await result.afterWrite();
|
|
6368
6658
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6659
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6369
6660
|
});
|
|
6370
6661
|
};
|
|
6371
|
-
const
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6662
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6663
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6664
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6665
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6666
|
+
const overrides = {
|
|
6667
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6668
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6669
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6670
|
+
return result.kind === "value" ? {
|
|
6671
|
+
kind: "value",
|
|
6672
|
+
value: await resolveRead("addon", result.value)
|
|
6673
|
+
} : result;
|
|
6674
|
+
} } : {},
|
|
6675
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6676
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6677
|
+
if (result.kind !== "present") return result;
|
|
6678
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6679
|
+
unresolved: "keep-marker",
|
|
6680
|
+
ownedBy: opts.secrets.owner
|
|
6681
|
+
});
|
|
6682
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6683
|
+
return {
|
|
6684
|
+
kind: "present",
|
|
6685
|
+
value: value[key]
|
|
6686
|
+
};
|
|
6687
|
+
} } : {},
|
|
6688
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6689
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6690
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6691
|
+
const out = /* @__PURE__ */ new Map();
|
|
6692
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6693
|
+
return out;
|
|
6694
|
+
} } : {},
|
|
6695
|
+
writeAddonStore: async (patch) => {
|
|
6696
|
+
await writeAddon(patch);
|
|
6697
|
+
},
|
|
6698
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6699
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6700
|
+
kind: "device",
|
|
6701
|
+
deviceId
|
|
6702
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6703
|
+
}
|
|
6704
|
+
};
|
|
6705
|
+
return {
|
|
6706
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6707
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6708
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6709
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6710
|
+
} }),
|
|
6711
|
+
raw: {
|
|
6712
|
+
readAddonStore: async () => {
|
|
6713
|
+
const blob = await raw.readAddonStore();
|
|
6714
|
+
index.seen("addon", blob);
|
|
6715
|
+
return blob;
|
|
6716
|
+
},
|
|
6717
|
+
readDeviceStore: async (deviceId) => {
|
|
6718
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6719
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6720
|
+
return blob;
|
|
6721
|
+
}
|
|
6722
|
+
},
|
|
6723
|
+
writeAddonStore: writeAddon
|
|
6377
6724
|
};
|
|
6378
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6379
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6380
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6381
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6382
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6383
|
-
} });
|
|
6384
6725
|
}
|
|
6385
|
-
/** The context the addon sees
|
|
6386
|
-
function
|
|
6726
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6727
|
+
function createSecretAwareContext(context, opts) {
|
|
6387
6728
|
const raw = context.settings;
|
|
6388
|
-
if (raw === void 0) return
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6729
|
+
if (raw === void 0) return {
|
|
6730
|
+
context,
|
|
6731
|
+
handle: null
|
|
6732
|
+
};
|
|
6733
|
+
const handle = createHandle(raw, opts);
|
|
6734
|
+
return {
|
|
6735
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6736
|
+
if (prop === "settings") return handle.settings;
|
|
6737
|
+
return Reflect.get(target, prop, receiver);
|
|
6738
|
+
} }),
|
|
6739
|
+
handle
|
|
6740
|
+
};
|
|
6394
6741
|
}
|
|
6395
6742
|
var LEAF = { kind: "leaf" };
|
|
6396
6743
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6565,6 +6912,14 @@ var BaseAddon = class {
|
|
|
6565
6912
|
_secretChangeUnsub = null;
|
|
6566
6913
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6567
6914
|
_operatorWriteDepth = 0;
|
|
6915
|
+
/**
|
|
6916
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6917
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6918
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6919
|
+
*/
|
|
6920
|
+
_secretSettings = null;
|
|
6921
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6922
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6568
6923
|
constructor(defaults) {
|
|
6569
6924
|
this.defaults = defaults;
|
|
6570
6925
|
this._config = { ...defaults };
|
|
@@ -6601,13 +6956,21 @@ var BaseAddon = class {
|
|
|
6601
6956
|
}
|
|
6602
6957
|
async initialize(context) {
|
|
6603
6958
|
const secrets = context.secrets;
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6959
|
+
if (secrets !== void 0) {
|
|
6960
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6961
|
+
secrets,
|
|
6962
|
+
addonTree: () => this.addonSecretTree(),
|
|
6963
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6964
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6965
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6966
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6967
|
+
});
|
|
6968
|
+
this._ctx = wrapped;
|
|
6969
|
+
this._secretSettings = handle;
|
|
6970
|
+
} else {
|
|
6971
|
+
this._ctx = context;
|
|
6972
|
+
this._secretSettings = null;
|
|
6973
|
+
}
|
|
6611
6974
|
await this.resolveConfig();
|
|
6612
6975
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6613
6976
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6724,11 +7087,8 @@ var BaseAddon = class {
|
|
|
6724
7087
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6725
7088
|
const schema = this.globalSettingsSchema(cap);
|
|
6726
7089
|
if (!schema) return { sections: [] };
|
|
6727
|
-
const projected = await this.
|
|
6728
|
-
return hydrateSchema(schema, overlay ? {
|
|
6729
|
-
...projected,
|
|
6730
|
-
...overlay
|
|
6731
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7090
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7091
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6732
7092
|
}
|
|
6733
7093
|
/**
|
|
6734
7094
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6773,7 +7133,7 @@ var BaseAddon = class {
|
|
|
6773
7133
|
});
|
|
6774
7134
|
}
|
|
6775
7135
|
if (sections.length === 0) return null;
|
|
6776
|
-
const projected = await this.
|
|
7136
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6777
7137
|
return hydrateSchema({
|
|
6778
7138
|
...schema,
|
|
6779
7139
|
sections
|
|
@@ -6790,12 +7150,50 @@ var BaseAddon = class {
|
|
|
6790
7150
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6791
7151
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6792
7152
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7153
|
+
*
|
|
7154
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7155
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7156
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7157
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7158
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7159
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6793
7160
|
*/
|
|
6794
7161
|
async resolveGlobalStore(nodeId, cap) {
|
|
6795
7162
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7163
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7164
|
+
}
|
|
7165
|
+
projectForNode(store, nodeId, cap) {
|
|
6796
7166
|
const keys = this.perNodeKeys(cap);
|
|
6797
7167
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6798
|
-
return keys.size > 0 ? projectStore(
|
|
7168
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7169
|
+
}
|
|
7170
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7171
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7172
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7173
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7174
|
+
}
|
|
7175
|
+
/**
|
|
7176
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7177
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7178
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7179
|
+
* its value.
|
|
7180
|
+
*/
|
|
7181
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7182
|
+
const secrets = this._ctx?.secrets;
|
|
7183
|
+
const merged = {
|
|
7184
|
+
...stored,
|
|
7185
|
+
...overlay
|
|
7186
|
+
};
|
|
7187
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7188
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7189
|
+
unresolved: "keep-marker",
|
|
7190
|
+
ownedBy: secrets.owner
|
|
7191
|
+
});
|
|
7192
|
+
for (const key of Object.keys(overlay)) {
|
|
7193
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7194
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7195
|
+
}
|
|
7196
|
+
return merged;
|
|
6799
7197
|
}
|
|
6800
7198
|
/**
|
|
6801
7199
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6860,8 +7258,12 @@ var BaseAddon = class {
|
|
|
6860
7258
|
async clearSecrets(keys, nodeId) {
|
|
6861
7259
|
const tree = this.addonSecretTree();
|
|
6862
7260
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7261
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6863
7262
|
const patch = {};
|
|
6864
|
-
for (const key of keys)
|
|
7263
|
+
for (const key of keys) {
|
|
7264
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7265
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7266
|
+
}
|
|
6865
7267
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6866
7268
|
}
|
|
6867
7269
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6869,7 +7271,11 @@ var BaseAddon = class {
|
|
|
6869
7271
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6870
7272
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6871
7273
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6872
|
-
|
|
7274
|
+
const handle = this._secretSettings;
|
|
7275
|
+
if (handle !== null) {
|
|
7276
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7277
|
+
if (!changed) return;
|
|
7278
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6873
7279
|
if (target !== localNode) return;
|
|
6874
7280
|
await this.resolveConfig();
|
|
6875
7281
|
await this.onConfigChanged();
|
|
@@ -6922,7 +7328,7 @@ var BaseAddon = class {
|
|
|
6922
7328
|
async getDeviceSettings(deviceId) {
|
|
6923
7329
|
const schema = this.deviceSettingsSchema();
|
|
6924
7330
|
if (!schema) return { sections: [] };
|
|
6925
|
-
return hydrateSchema(schema, await this.
|
|
7331
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6926
7332
|
}
|
|
6927
7333
|
async updateDeviceSettings(deviceId, patch) {
|
|
6928
7334
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7094,7 +7500,7 @@ var BaseAddon = class {
|
|
|
7094
7500
|
key,
|
|
7095
7501
|
schema,
|
|
7096
7502
|
fallback,
|
|
7097
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7503
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7098
7504
|
write: async (patch) => {
|
|
7099
7505
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7100
7506
|
},
|
|
@@ -7156,6 +7562,23 @@ var BaseAddon = class {
|
|
|
7156
7562
|
}
|
|
7157
7563
|
return value;
|
|
7158
7564
|
}
|
|
7565
|
+
/**
|
|
7566
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7567
|
+
* keychain the context's own view is already raw.
|
|
7568
|
+
*/
|
|
7569
|
+
rawSettings() {
|
|
7570
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7571
|
+
}
|
|
7572
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7573
|
+
logUnresolvedRead(unresolved) {
|
|
7574
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7575
|
+
if (fresh.length === 0) return;
|
|
7576
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7577
|
+
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) => ({
|
|
7578
|
+
ref: u.ref,
|
|
7579
|
+
reason: u.reason
|
|
7580
|
+
})) } });
|
|
7581
|
+
}
|
|
7159
7582
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7160
7583
|
scheduleSecretReresolve(delayMs) {
|
|
7161
7584
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7182,7 +7605,7 @@ var BaseAddon = class {
|
|
|
7182
7605
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7183
7606
|
*/
|
|
7184
7607
|
async readAddonStoreWithRetry() {
|
|
7185
|
-
const settings = this.
|
|
7608
|
+
const settings = this.rawSettings();
|
|
7186
7609
|
if (!settings) return {};
|
|
7187
7610
|
const delaysMs = [
|
|
7188
7611
|
150,
|
|
@@ -9507,6 +9930,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9507
9930
|
fetchedAt: number()
|
|
9508
9931
|
});
|
|
9509
9932
|
/**
|
|
9933
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9934
|
+
* gets back (cloud training, D805+).
|
|
9935
|
+
*
|
|
9936
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9937
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9938
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9939
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9940
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9941
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9942
|
+
* change there, in the same piece of work.
|
|
9943
|
+
*
|
|
9944
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9945
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9946
|
+
*/
|
|
9947
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9948
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9949
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9950
|
+
var TrainingExportSchema = _enum([
|
|
9951
|
+
"onnx",
|
|
9952
|
+
"openvino-fp16",
|
|
9953
|
+
"openvino-int8",
|
|
9954
|
+
"coreml-fp16"
|
|
9955
|
+
]);
|
|
9956
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9957
|
+
object({
|
|
9958
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9959
|
+
jobKey: string().uuid(),
|
|
9960
|
+
target: object({
|
|
9961
|
+
kind: literal("detector"),
|
|
9962
|
+
step: literal("object-detection")
|
|
9963
|
+
}),
|
|
9964
|
+
base: object({
|
|
9965
|
+
modelId: string().min(1),
|
|
9966
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9967
|
+
weights: string().min(1),
|
|
9968
|
+
imgsz: number().int().positive()
|
|
9969
|
+
}),
|
|
9970
|
+
baseline: object({
|
|
9971
|
+
modelId: string().min(1),
|
|
9972
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9973
|
+
onnxUrl: string().url(),
|
|
9974
|
+
imgsz: number().int().positive(),
|
|
9975
|
+
floors: FloorsSchema
|
|
9976
|
+
}),
|
|
9977
|
+
dataset: object({
|
|
9978
|
+
versionId: string().min(1),
|
|
9979
|
+
annotationHash: string(),
|
|
9980
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9981
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9982
|
+
}),
|
|
9983
|
+
split: object({
|
|
9984
|
+
holdoutCameras: array(number().int()),
|
|
9985
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9986
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9987
|
+
valFraction: number().min(0).max(.5),
|
|
9988
|
+
seed: number().int()
|
|
9989
|
+
}),
|
|
9990
|
+
hyper: object({
|
|
9991
|
+
epochs: number().int().positive(),
|
|
9992
|
+
batch: number().int().positive(),
|
|
9993
|
+
lr0: number().positive(),
|
|
9994
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9995
|
+
freeze: number().int().nonnegative(),
|
|
9996
|
+
patience: number().int().nonnegative(),
|
|
9997
|
+
seed: number().int()
|
|
9998
|
+
}),
|
|
9999
|
+
replay: object({
|
|
10000
|
+
source: literal("coco2017"),
|
|
10001
|
+
count: number().int().nonnegative()
|
|
10002
|
+
}),
|
|
10003
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10004
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10005
|
+
floors: object({
|
|
10006
|
+
minSupport: number().int().positive(),
|
|
10007
|
+
clamp: number().min(0).max(1)
|
|
10008
|
+
}),
|
|
10009
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10010
|
+
catalog: object({
|
|
10011
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10012
|
+
name: string().min(1).max(160)
|
|
10013
|
+
})
|
|
10014
|
+
});
|
|
10015
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10016
|
+
var TrainingResultFileSchema = object({
|
|
10017
|
+
path: string().min(1),
|
|
10018
|
+
bytes: number().int().nonnegative(),
|
|
10019
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10020
|
+
format: _enum([
|
|
10021
|
+
"onnx",
|
|
10022
|
+
"openvino",
|
|
10023
|
+
"coreml",
|
|
10024
|
+
"pt"
|
|
10025
|
+
]),
|
|
10026
|
+
variant: _enum(["base", "int8"])
|
|
10027
|
+
});
|
|
10028
|
+
var DraftFormatSchema = object({
|
|
10029
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10030
|
+
url: string().min(1),
|
|
10031
|
+
sizeMB: number().nonnegative(),
|
|
10032
|
+
isDirectory: boolean().optional(),
|
|
10033
|
+
files: array(string()).optional(),
|
|
10034
|
+
runtimes: array(literal("python")).optional(),
|
|
10035
|
+
revision: string().min(1)
|
|
10036
|
+
});
|
|
10037
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10038
|
+
var TrainingCatalogDraftSchema = object({
|
|
10039
|
+
id: string().min(1),
|
|
10040
|
+
name: string().min(1),
|
|
10041
|
+
description: string(),
|
|
10042
|
+
labels: array(unknown()),
|
|
10043
|
+
inputSize: object({
|
|
10044
|
+
width: number().int().positive(),
|
|
10045
|
+
height: number().int().positive()
|
|
10046
|
+
}),
|
|
10047
|
+
preprocessMode: literal("letterbox"),
|
|
10048
|
+
defaultClassFloors: FloorsSchema,
|
|
10049
|
+
formats: object({
|
|
10050
|
+
onnx: DraftFormatSchema.optional(),
|
|
10051
|
+
openvino: DraftFormatSchema.optional(),
|
|
10052
|
+
coreml: DraftFormatSchema.optional()
|
|
10053
|
+
})
|
|
10054
|
+
});
|
|
10055
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10056
|
+
var TrainingEvalClassSchema = object({
|
|
10057
|
+
positives: number().int(),
|
|
10058
|
+
floor: number().nullable(),
|
|
10059
|
+
tp: number().int(),
|
|
10060
|
+
fp: number().int(),
|
|
10061
|
+
fn: number().int(),
|
|
10062
|
+
precision: number().nullable(),
|
|
10063
|
+
recall: number().nullable(),
|
|
10064
|
+
ap50: number().nullable(),
|
|
10065
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10066
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10067
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10068
|
+
smallFound: number().int().optional(),
|
|
10069
|
+
smallTotal: number().int().optional()
|
|
10070
|
+
}).passthrough();
|
|
10071
|
+
var TrainingEvalReportSchema = object({
|
|
10072
|
+
frames: number().int(),
|
|
10073
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10074
|
+
}).passthrough();
|
|
10075
|
+
/**
|
|
10076
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10077
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10078
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10079
|
+
*/
|
|
10080
|
+
var TrainingResultSchema = object({
|
|
10081
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10082
|
+
jobKey: string(),
|
|
10083
|
+
status: _enum(["succeeded", "failed"]),
|
|
10084
|
+
error: object({
|
|
10085
|
+
stage: string(),
|
|
10086
|
+
code: string(),
|
|
10087
|
+
message: string()
|
|
10088
|
+
}).nullable(),
|
|
10089
|
+
trainer: object({
|
|
10090
|
+
version: string(),
|
|
10091
|
+
revision: string()
|
|
10092
|
+
}),
|
|
10093
|
+
toolchain: record(string(), string().nullable()),
|
|
10094
|
+
dataset: object({
|
|
10095
|
+
versionId: string(),
|
|
10096
|
+
annotationHash: string(),
|
|
10097
|
+
sha256: string(),
|
|
10098
|
+
frames: object({
|
|
10099
|
+
train: number().int(),
|
|
10100
|
+
val: number().int(),
|
|
10101
|
+
holdout: number().int()
|
|
10102
|
+
}),
|
|
10103
|
+
holdoutCameras: array(number().int()),
|
|
10104
|
+
replayImages: number().int()
|
|
10105
|
+
}).optional(),
|
|
10106
|
+
training: object({
|
|
10107
|
+
epochsRun: number().int(),
|
|
10108
|
+
bestEpoch: number().int(),
|
|
10109
|
+
bestMap50: number(),
|
|
10110
|
+
bestMap50_95: number(),
|
|
10111
|
+
seconds: number()
|
|
10112
|
+
}).optional(),
|
|
10113
|
+
evaluation: object({
|
|
10114
|
+
holdoutFrames: number().int(),
|
|
10115
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10116
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10117
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10118
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10119
|
+
map50: record(string(), number().nullable())
|
|
10120
|
+
}).optional(),
|
|
10121
|
+
floors: object({
|
|
10122
|
+
baseline: FloorsSchema,
|
|
10123
|
+
candidate: FloorsSchema,
|
|
10124
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10125
|
+
notes: array(string())
|
|
10126
|
+
}).optional(),
|
|
10127
|
+
int8: object({
|
|
10128
|
+
kept: boolean(),
|
|
10129
|
+
map50Fp16: number().nullable(),
|
|
10130
|
+
map50Int8: number().nullable(),
|
|
10131
|
+
reason: string().nullable()
|
|
10132
|
+
}).optional(),
|
|
10133
|
+
exportsDropped: array(object({
|
|
10134
|
+
export: string(),
|
|
10135
|
+
reason: string()
|
|
10136
|
+
})).optional(),
|
|
10137
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10138
|
+
bundle: object({
|
|
10139
|
+
path: literal("bundle.tar"),
|
|
10140
|
+
bytes: number().int().nonnegative(),
|
|
10141
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10142
|
+
}).nullable().optional(),
|
|
10143
|
+
catalogDraft: object({
|
|
10144
|
+
base: TrainingCatalogDraftSchema,
|
|
10145
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10146
|
+
}).nullable().optional(),
|
|
10147
|
+
licence: string()
|
|
10148
|
+
});
|
|
10149
|
+
var TrainingStageSchema = _enum([
|
|
10150
|
+
"prepare",
|
|
10151
|
+
"replay",
|
|
10152
|
+
"train",
|
|
10153
|
+
"eval",
|
|
10154
|
+
"export",
|
|
10155
|
+
"package"
|
|
10156
|
+
]);
|
|
10157
|
+
var EventBase = {
|
|
10158
|
+
v: literal(1),
|
|
10159
|
+
ts: number()
|
|
10160
|
+
};
|
|
10161
|
+
discriminatedUnion("type", [
|
|
10162
|
+
object({
|
|
10163
|
+
...EventBase,
|
|
10164
|
+
type: literal("stage"),
|
|
10165
|
+
stage: TrainingStageSchema
|
|
10166
|
+
}),
|
|
10167
|
+
object({
|
|
10168
|
+
...EventBase,
|
|
10169
|
+
type: literal("epoch"),
|
|
10170
|
+
epoch: number().int(),
|
|
10171
|
+
epochs: number().int(),
|
|
10172
|
+
boxLoss: number().nullable().optional(),
|
|
10173
|
+
map50: number().nullable().optional(),
|
|
10174
|
+
map50_95: number().nullable().optional(),
|
|
10175
|
+
etaSec: number().nullable().optional()
|
|
10176
|
+
}),
|
|
10177
|
+
object({
|
|
10178
|
+
...EventBase,
|
|
10179
|
+
type: literal("metric"),
|
|
10180
|
+
name: string(),
|
|
10181
|
+
value: number()
|
|
10182
|
+
}),
|
|
10183
|
+
object({
|
|
10184
|
+
...EventBase,
|
|
10185
|
+
type: literal("artifact"),
|
|
10186
|
+
path: string(),
|
|
10187
|
+
bytes: number(),
|
|
10188
|
+
sha256: string()
|
|
10189
|
+
}),
|
|
10190
|
+
object({
|
|
10191
|
+
...EventBase,
|
|
10192
|
+
type: literal("done"),
|
|
10193
|
+
status: _enum(["succeeded", "failed"]),
|
|
10194
|
+
resultSha256: string().nullable().optional()
|
|
10195
|
+
}),
|
|
10196
|
+
object({
|
|
10197
|
+
...EventBase,
|
|
10198
|
+
type: literal("error"),
|
|
10199
|
+
stage: string(),
|
|
10200
|
+
code: string(),
|
|
10201
|
+
message: string()
|
|
10202
|
+
})
|
|
10203
|
+
]);
|
|
10204
|
+
/**
|
|
9510
10205
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9511
10206
|
*
|
|
9512
10207
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12115,7 +12810,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12115
12810
|
"authenticated",
|
|
12116
12811
|
"admin"
|
|
12117
12812
|
]).optional(),
|
|
12118
|
-
description: string().optional()
|
|
12813
|
+
description: string().optional(),
|
|
12814
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12815
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12119
12816
|
});
|
|
12120
12817
|
/**
|
|
12121
12818
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12820,6 +13517,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12820
13517
|
lastError: string().optional()
|
|
12821
13518
|
});
|
|
12822
13519
|
/**
|
|
13520
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13521
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13522
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13523
|
+
* with it off — which restores without a key.
|
|
13524
|
+
*/
|
|
13525
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13526
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13527
|
+
scheme: string(),
|
|
13528
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13529
|
+
keyId: string()
|
|
13530
|
+
});
|
|
13531
|
+
/**
|
|
13532
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13533
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13534
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13535
|
+
*/
|
|
13536
|
+
var BackupEncryptionStatusSchema = object({
|
|
13537
|
+
enabled: boolean(),
|
|
13538
|
+
active: object({
|
|
13539
|
+
keyId: string(),
|
|
13540
|
+
publicKey: string(),
|
|
13541
|
+
createdAt: number()
|
|
13542
|
+
}).nullable(),
|
|
13543
|
+
/** Every key ever set up, newest first. */
|
|
13544
|
+
keys: array(object({
|
|
13545
|
+
keyId: string(),
|
|
13546
|
+
createdAt: number(),
|
|
13547
|
+
retiredAt: number().nullable()
|
|
13548
|
+
})).readonly()
|
|
13549
|
+
});
|
|
13550
|
+
/**
|
|
12823
13551
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12824
13552
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12825
13553
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12831,7 +13559,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12831
13559
|
sizeBytes: number(),
|
|
12832
13560
|
label: string().optional(),
|
|
12833
13561
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12834
|
-
locations: array(string()).readonly()
|
|
13562
|
+
locations: array(string()).readonly(),
|
|
13563
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13564
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12835
13565
|
});
|
|
12836
13566
|
var BackupEntrySchema = object({
|
|
12837
13567
|
id: string(),
|
|
@@ -12840,7 +13570,8 @@ var BackupEntrySchema = object({
|
|
|
12840
13570
|
label: string().optional(),
|
|
12841
13571
|
createdAt: number(),
|
|
12842
13572
|
sizeBytes: number(),
|
|
12843
|
-
locations: array(string()).optional()
|
|
13573
|
+
locations: array(string()).optional(),
|
|
13574
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12844
13575
|
});
|
|
12845
13576
|
var ArchiveEntrySchema = object({
|
|
12846
13577
|
path: string(),
|
|
@@ -13029,10 +13760,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13029
13760
|
* this list and skips entries whose path doesn't start with
|
|
13030
13761
|
* any of them.
|
|
13031
13762
|
*/
|
|
13032
|
-
locations: array(string()).optional()
|
|
13763
|
+
locations: array(string()).optional(),
|
|
13764
|
+
/**
|
|
13765
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13766
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13767
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13768
|
+
* is refused before the archive is downloaded.
|
|
13769
|
+
*/
|
|
13770
|
+
backupSecretKey: string().optional()
|
|
13033
13771
|
}), _void(), {
|
|
13034
13772
|
kind: "mutation",
|
|
13035
13773
|
auth: "admin"
|
|
13774
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13775
|
+
keyId: string(),
|
|
13776
|
+
secretKey: string(),
|
|
13777
|
+
publicKey: string(),
|
|
13778
|
+
createdAt: number(),
|
|
13779
|
+
replacedKeyId: string().nullable()
|
|
13780
|
+
}), {
|
|
13781
|
+
kind: "mutation",
|
|
13782
|
+
auth: "admin"
|
|
13783
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13784
|
+
kind: "mutation",
|
|
13785
|
+
auth: "admin"
|
|
13786
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13787
|
+
valid: boolean(),
|
|
13788
|
+
keyId: string().nullable(),
|
|
13789
|
+
/** The hub knows this key (active or retired). */
|
|
13790
|
+
known: boolean(),
|
|
13791
|
+
/** It is the key new archives are encrypted to. */
|
|
13792
|
+
active: boolean(),
|
|
13793
|
+
error: string().optional()
|
|
13794
|
+
}), {
|
|
13795
|
+
kind: "mutation",
|
|
13796
|
+
auth: "admin"
|
|
13036
13797
|
}), method(object({
|
|
13037
13798
|
destinationId: string(),
|
|
13038
13799
|
backupId: string()
|
|
@@ -14758,7 +15519,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14758
15519
|
stepId: string(),
|
|
14759
15520
|
entry: ModelCatalogEntrySchema
|
|
14760
15521
|
});
|
|
14761
|
-
|
|
15522
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15523
|
+
var ModelBundleFileSchema = object({
|
|
15524
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15525
|
+
path: string().min(1),
|
|
15526
|
+
bytes: number().int().nonnegative(),
|
|
15527
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15528
|
+
});
|
|
15529
|
+
var ImportModelBundleInputSchema = object({
|
|
15530
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15531
|
+
addonId: string(),
|
|
15532
|
+
stepId: string().min(1),
|
|
15533
|
+
/**
|
|
15534
|
+
* The catalog rows to register, complete, every format URL already
|
|
15535
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15536
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15537
|
+
*/
|
|
15538
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15539
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15540
|
+
bundle: object({
|
|
15541
|
+
ticket: PeerBytesTicketSchema,
|
|
15542
|
+
bytes: number().int().positive(),
|
|
15543
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15544
|
+
}),
|
|
15545
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15546
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15547
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15548
|
+
distribute: boolean()
|
|
15549
|
+
});
|
|
15550
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15551
|
+
kind: literal("imported"),
|
|
15552
|
+
modelIds: array(string()).readonly(),
|
|
15553
|
+
distributed: array(object({
|
|
15554
|
+
modelId: string(),
|
|
15555
|
+
nodeId: string(),
|
|
15556
|
+
format: _enum(MODEL_FORMATS),
|
|
15557
|
+
ok: boolean(),
|
|
15558
|
+
error: string().optional()
|
|
15559
|
+
})).readonly()
|
|
15560
|
+
}), object({
|
|
15561
|
+
kind: literal("refused"),
|
|
15562
|
+
reason: _enum([
|
|
15563
|
+
"transfer-failed",
|
|
15564
|
+
"checksum-mismatch",
|
|
15565
|
+
"bundle-mismatch",
|
|
15566
|
+
"invalid-entry",
|
|
15567
|
+
"id-taken"
|
|
15568
|
+
]),
|
|
15569
|
+
detail: string()
|
|
15570
|
+
})]);
|
|
15571
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15572
|
+
kind: "mutation",
|
|
15573
|
+
auth: "admin",
|
|
15574
|
+
timeoutMs: 30 * 6e4
|
|
15575
|
+
});
|
|
14762
15576
|
/**
|
|
14763
15577
|
* Query filter for settings-store collections.
|
|
14764
15578
|
*/
|
|
@@ -15237,6 +16051,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15237
16051
|
*/
|
|
15238
16052
|
sharesBackupWithDatabase: boolean()
|
|
15239
16053
|
});
|
|
16054
|
+
/**
|
|
16055
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16056
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16057
|
+
*/
|
|
16058
|
+
var KeychainResetRecordSchema = object({
|
|
16059
|
+
id: string(),
|
|
16060
|
+
at: number(),
|
|
16061
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16062
|
+
actor: string(),
|
|
16063
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16064
|
+
lockedReason: string().nullable(),
|
|
16065
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16066
|
+
archived: number().int(),
|
|
16067
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16068
|
+
archivedCollection: string().nullable(),
|
|
16069
|
+
/**
|
|
16070
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16071
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16072
|
+
*/
|
|
16073
|
+
archivedKeysCollection: string().nullable(),
|
|
16074
|
+
/**
|
|
16075
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16076
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16077
|
+
* agent forever (D797).
|
|
16078
|
+
*/
|
|
16079
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16080
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16081
|
+
acknowledgedAt: number().nullable()
|
|
16082
|
+
});
|
|
15240
16083
|
var KeychainStatusSchema = object({
|
|
15241
16084
|
keychain: KeychainStateSchema,
|
|
15242
16085
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15254,7 +16097,9 @@ var KeychainStatusSchema = object({
|
|
|
15254
16097
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15255
16098
|
retiredWraps: number().int(),
|
|
15256
16099
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15257
|
-
secretCount: number().int()
|
|
16100
|
+
secretCount: number().int(),
|
|
16101
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16102
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15258
16103
|
});
|
|
15259
16104
|
/**
|
|
15260
16105
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15276,17 +16121,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15276
16121
|
"download-recovery-key",
|
|
15277
16122
|
"delete-orphans",
|
|
15278
16123
|
"reset",
|
|
16124
|
+
"acknowledge-reset",
|
|
15279
16125
|
"initialize"
|
|
15280
16126
|
]);
|
|
15281
16127
|
var KeychainAuditEntrySchema = object({
|
|
15282
16128
|
id: string(),
|
|
15283
16129
|
at: number(),
|
|
15284
16130
|
action: KeychainAuditActionSchema,
|
|
15285
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16131
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15286
16132
|
actor: string(),
|
|
15287
16133
|
ref: string().nullable(),
|
|
15288
16134
|
detail: string().nullable()
|
|
15289
16135
|
});
|
|
16136
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16137
|
+
/**
|
|
16138
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16139
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16140
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16141
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16142
|
+
*/
|
|
16143
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15290
16144
|
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({
|
|
15291
16145
|
value: string(),
|
|
15292
16146
|
version: number().int()
|
|
@@ -15294,6 +16148,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15294
16148
|
kind: "mutation",
|
|
15295
16149
|
auth: "admin",
|
|
15296
16150
|
caller: "required"
|
|
16151
|
+
}), method(object({
|
|
16152
|
+
name: SystemHeldSecretNameSchema,
|
|
16153
|
+
value: string().min(16)
|
|
16154
|
+
}), object({
|
|
16155
|
+
ref: string(),
|
|
16156
|
+
version: number().int()
|
|
16157
|
+
}), {
|
|
16158
|
+
kind: "mutation",
|
|
16159
|
+
auth: "admin",
|
|
16160
|
+
caller: "required"
|
|
15297
16161
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15298
16162
|
deleted: array(string()).readonly(),
|
|
15299
16163
|
kept: array(object({
|
|
@@ -15323,13 +16187,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15323
16187
|
kind: "mutation",
|
|
15324
16188
|
auth: "admin",
|
|
15325
16189
|
caller: "required"
|
|
15326
|
-
}), method(object({ confirm: literal(
|
|
16190
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15327
16191
|
archivedCollection: string().nullable(),
|
|
15328
16192
|
archived: number().int()
|
|
15329
16193
|
}), {
|
|
15330
16194
|
kind: "mutation",
|
|
15331
16195
|
auth: "admin",
|
|
15332
16196
|
caller: "required"
|
|
16197
|
+
}), method(object({}), object({
|
|
16198
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16199
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16200
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16201
|
+
kind: "mutation",
|
|
16202
|
+
auth: "admin",
|
|
16203
|
+
caller: "required"
|
|
15333
16204
|
});
|
|
15334
16205
|
method(_void(), object({
|
|
15335
16206
|
id: string(),
|
|
@@ -18295,7 +19166,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18295
19166
|
* `login-method` — collection cap through which auth addons contribute
|
|
18296
19167
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18297
19168
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18298
|
-
* every auth addon (OIDC,
|
|
19169
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18299
19170
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18300
19171
|
* procedure aggregates them for the unauthenticated login page.
|
|
18301
19172
|
*
|
|
@@ -18303,8 +19174,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18303
19174
|
*
|
|
18304
19175
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18305
19176
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18306
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18307
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19177
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18308
19178
|
* login page needs NO change.
|
|
18309
19179
|
*
|
|
18310
19180
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18323,8 +19193,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18323
19193
|
* decision.
|
|
18324
19194
|
*
|
|
18325
19195
|
* Every contribution carries a `stage`:
|
|
18326
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18327
|
-
*
|
|
19196
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19197
|
+
* buttons; a usernameless passkey).
|
|
18328
19198
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18329
19199
|
* returned `factors` (passkey-as-2FA today).
|
|
18330
19200
|
*
|
|
@@ -18351,7 +19221,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18351
19221
|
* The provider names an external identity a signed-in user can link to
|
|
18352
19222
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18353
19223
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18354
|
-
* whatever their id. Absent / false — a login button only
|
|
19224
|
+
* whatever their id. Absent / false — a login button only.
|
|
18355
19225
|
*/
|
|
18356
19226
|
linkable: boolean().optional()
|
|
18357
19227
|
}),
|
|
@@ -22206,8 +23076,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22206
23076
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22207
23077
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22208
23078
|
* distinction was only ever used to route role-specific procedures
|
|
22209
|
-
* which we no longer have.
|
|
22210
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23079
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22211
23080
|
* with `isAdmin: false` + an explicit scope list.
|
|
22212
23081
|
*/
|
|
22213
23082
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23882,6 +24751,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23882
24751
|
frameIds: array(string()).max(2e4).optional(),
|
|
23883
24752
|
/** Only frames in at least one of these named collections. */
|
|
23884
24753
|
collectionIds: array(string()).max(200).optional(),
|
|
24754
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24755
|
+
* unknown id selects nothing. */
|
|
24756
|
+
datasetVersionId: string().optional(),
|
|
23885
24757
|
batchId: string().optional(),
|
|
23886
24758
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23887
24759
|
completeOnly: boolean().optional()
|
|
@@ -24049,6 +24921,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24049
24921
|
]),
|
|
24050
24922
|
detail: string().optional()
|
|
24051
24923
|
})]);
|
|
24924
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24925
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24926
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24927
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24928
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24929
|
+
});
|
|
24930
|
+
/** The counts a dataset is judged by. */
|
|
24931
|
+
var RetrainDatasetStatsSchema = object({
|
|
24932
|
+
frames: number().int(),
|
|
24933
|
+
completeFrames: number().int(),
|
|
24934
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24935
|
+
completeness: number(),
|
|
24936
|
+
/** Boxes to learn (model errors excluded). */
|
|
24937
|
+
subjects: number().int(),
|
|
24938
|
+
modelErrors: number().int(),
|
|
24939
|
+
/** Complete frames with no subject. */
|
|
24940
|
+
hardNegatives: number().int(),
|
|
24941
|
+
/** Subjects per class × camera × day/night. */
|
|
24942
|
+
cells: array(object({
|
|
24943
|
+
macroClass: string(),
|
|
24944
|
+
deviceId: number(),
|
|
24945
|
+
lighting: _enum([
|
|
24946
|
+
"day",
|
|
24947
|
+
"night",
|
|
24948
|
+
"unknown"
|
|
24949
|
+
]),
|
|
24950
|
+
subjects: number().int(),
|
|
24951
|
+
frames: number().int()
|
|
24952
|
+
})).readonly(),
|
|
24953
|
+
cameras: array(object({
|
|
24954
|
+
deviceId: number(),
|
|
24955
|
+
frames: number().int(),
|
|
24956
|
+
completeFrames: number().int()
|
|
24957
|
+
})).readonly()
|
|
24958
|
+
});
|
|
24959
|
+
/** An immutable dataset version, without its frame list. */
|
|
24960
|
+
var RetrainDatasetVersionSchema = object({
|
|
24961
|
+
id: string(),
|
|
24962
|
+
name: string(),
|
|
24963
|
+
createdAt: number(),
|
|
24964
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24965
|
+
layout: RetrainExportLayoutSchema,
|
|
24966
|
+
completeOnly: boolean(),
|
|
24967
|
+
frameCount: number().int(),
|
|
24968
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24969
|
+
annotationHash: string(),
|
|
24970
|
+
/** The export manifest schema the version was cut under. */
|
|
24971
|
+
manifestSchema: string(),
|
|
24972
|
+
stats: RetrainDatasetStatsSchema
|
|
24973
|
+
});
|
|
24974
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24975
|
+
kind: literal("created"),
|
|
24976
|
+
version: RetrainDatasetVersionSchema
|
|
24977
|
+
}), object({
|
|
24978
|
+
kind: literal("refused"),
|
|
24979
|
+
reason: _enum([
|
|
24980
|
+
"empty-name",
|
|
24981
|
+
"duplicate-name",
|
|
24982
|
+
"no-frames"
|
|
24983
|
+
])
|
|
24984
|
+
})]);
|
|
24052
24985
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24053
24986
|
var RetrainTransitionResultSchema = object({
|
|
24054
24987
|
trackId: string(),
|
|
@@ -24838,6 +25771,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24838
25771
|
kind: "mutation",
|
|
24839
25772
|
auth: "admin",
|
|
24840
25773
|
timeoutMs: 60 * 6e4
|
|
25774
|
+
}), method(object({
|
|
25775
|
+
filter: RetrainExportFilterSchema,
|
|
25776
|
+
layout: RetrainExportLayoutSchema
|
|
25777
|
+
}), object({
|
|
25778
|
+
ticket: PeerBytesTicketSchema,
|
|
25779
|
+
frames: number().int(),
|
|
25780
|
+
annotations: number().int()
|
|
25781
|
+
}), {
|
|
25782
|
+
kind: "mutation",
|
|
25783
|
+
auth: "admin",
|
|
25784
|
+
timeoutMs: 12e4
|
|
25785
|
+
}), method(object({
|
|
25786
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25787
|
+
completeOnly: boolean().optional()
|
|
25788
|
+
}), RetrainDatasetStatsSchema, {
|
|
25789
|
+
kind: "query",
|
|
25790
|
+
auth: "admin"
|
|
25791
|
+
}), method(object({
|
|
25792
|
+
name: string().max(120),
|
|
25793
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25794
|
+
layout: RetrainExportLayoutSchema,
|
|
25795
|
+
completeOnly: boolean()
|
|
25796
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25797
|
+
kind: "mutation",
|
|
25798
|
+
auth: "admin",
|
|
25799
|
+
timeoutMs: 12e4
|
|
25800
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25801
|
+
kind: "query",
|
|
25802
|
+
auth: "admin"
|
|
25803
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25804
|
+
kind: "mutation",
|
|
25805
|
+
auth: "admin"
|
|
25806
|
+
}), method(object({ id: string() }), object({
|
|
25807
|
+
found: boolean(),
|
|
25808
|
+
annotationHash: string(),
|
|
25809
|
+
matches: boolean(),
|
|
25810
|
+
missingFrames: number().int()
|
|
25811
|
+
}), {
|
|
25812
|
+
kind: "query",
|
|
25813
|
+
auth: "admin",
|
|
25814
|
+
timeoutMs: 12e4
|
|
24841
25815
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24842
25816
|
kind: "query",
|
|
24843
25817
|
auth: "admin"
|
|
@@ -28416,8 +29390,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28416
29390
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28417
29391
|
*
|
|
28418
29392
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28419
|
-
* one for transactional / one for notifications). Consumers (
|
|
28420
|
-
*
|
|
29393
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29394
|
+
* addons, …) walk the collection and pick the first
|
|
28421
29395
|
* ready provider OR target a specific addonId.
|
|
28422
29396
|
*
|
|
28423
29397
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28700,7 +29674,7 @@ targets: array(object({
|
|
|
28700
29674
|
};
|
|
28701
29675
|
/**
|
|
28702
29676
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28703
|
-
* providers (OIDC, SAML,
|
|
29677
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28704
29678
|
* carrying the post-callback claims before redirecting back to
|
|
28705
29679
|
* `/api/auth/sso/finish`.
|
|
28706
29680
|
*
|
|
@@ -28763,7 +29737,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28763
29737
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28764
29738
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28765
29739
|
*/
|
|
28766
|
-
issuer: string().optional()
|
|
29740
|
+
issuer: string().optional(),
|
|
29741
|
+
/**
|
|
29742
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29743
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29744
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29745
|
+
* any other browser.
|
|
29746
|
+
*/
|
|
29747
|
+
browserBinding: string().optional()
|
|
28767
29748
|
});
|
|
28768
29749
|
method(object({
|
|
28769
29750
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -42001,16 +42982,6 @@ var ApiKeySummarySchema = object({
|
|
|
42001
42982
|
createdAt: number(),
|
|
42002
42983
|
lastUsedAt: number().optional()
|
|
42003
42984
|
});
|
|
42004
|
-
var CreateApiKeyInputSchema = object({
|
|
42005
|
-
label: string(),
|
|
42006
|
-
isAdmin: boolean().default(false),
|
|
42007
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
42008
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
42009
|
-
});
|
|
42010
|
-
var CreateApiKeyResultSchema = object({
|
|
42011
|
-
token: string(),
|
|
42012
|
-
record: ApiKeySummarySchema
|
|
42013
|
-
});
|
|
42014
42985
|
var ScopedTokenSummarySchema = object({
|
|
42015
42986
|
id: string(),
|
|
42016
42987
|
userId: string(),
|
|
@@ -42109,17 +43080,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42109
43080
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
42110
43081
|
kind: "mutation",
|
|
42111
43082
|
access: "view"
|
|
42112
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
42113
|
-
kind: "mutation",
|
|
42114
|
-
auth: "admin",
|
|
42115
|
-
access: "create"
|
|
42116
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
43083
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42117
43084
|
kind: "mutation",
|
|
42118
43085
|
auth: "admin",
|
|
42119
43086
|
access: "delete"
|
|
42120
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
42121
|
-
kind: "mutation",
|
|
42122
|
-
access: "view"
|
|
42123
43087
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
42124
43088
|
kind: "mutation",
|
|
42125
43089
|
auth: "admin",
|
|
@@ -42193,15 +43157,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42193
43157
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
42194
43158
|
userId: string(),
|
|
42195
43159
|
issuer: string()
|
|
42196
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
42197
|
-
userId: string(),
|
|
42198
|
-
issuer: string().min(1),
|
|
42199
|
-
label: string().optional()
|
|
42200
|
-
}), object({ success: literal(true) }), {
|
|
42201
|
-
kind: "mutation",
|
|
42202
|
-
auth: "admin",
|
|
42203
|
-
access: "create"
|
|
42204
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
43160
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42205
43161
|
kind: "mutation",
|
|
42206
43162
|
auth: "admin",
|
|
42207
43163
|
access: "delete"
|
|
@@ -42906,6 +43862,451 @@ var zoneRulesCapability = {
|
|
|
42906
43862
|
*/
|
|
42907
43863
|
durability: "restored"
|
|
42908
43864
|
};
|
|
43865
|
+
/**
|
|
43866
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43867
|
+
*
|
|
43868
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43869
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43870
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43871
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43872
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43873
|
+
* manifest entry and nothing else.
|
|
43874
|
+
*
|
|
43875
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43876
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43877
|
+
* Every method is `admin`: these spend money.
|
|
43878
|
+
*
|
|
43879
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43880
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43881
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43882
|
+
*
|
|
43883
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43884
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43885
|
+
* ticket the provider mints (D613).
|
|
43886
|
+
*/
|
|
43887
|
+
var TrainingGpuOptionSchema = object({
|
|
43888
|
+
id: string(),
|
|
43889
|
+
label: string(),
|
|
43890
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43891
|
+
usdPerHour: number().nonnegative(),
|
|
43892
|
+
vramGb: number().nonnegative()
|
|
43893
|
+
});
|
|
43894
|
+
var TrainingRegionOptionSchema = object({
|
|
43895
|
+
/** `''` = any region (the provider's choice). */
|
|
43896
|
+
id: string(),
|
|
43897
|
+
label: string(),
|
|
43898
|
+
priceMultiplier: number().positive()
|
|
43899
|
+
});
|
|
43900
|
+
/**
|
|
43901
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43902
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43903
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43904
|
+
*/
|
|
43905
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43906
|
+
gpuType: string(),
|
|
43907
|
+
region: string(),
|
|
43908
|
+
costCapUsd: number().nonnegative(),
|
|
43909
|
+
maxRuntimeSec: number().int().positive(),
|
|
43910
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43911
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43912
|
+
});
|
|
43913
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43914
|
+
addonId: string(),
|
|
43915
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43916
|
+
kind: string(),
|
|
43917
|
+
label: string(),
|
|
43918
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43919
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43920
|
+
maxDatasetBytes: number().int().positive(),
|
|
43921
|
+
maxRuntimeSec: number().int().positive(),
|
|
43922
|
+
freeTierNote: string().optional(),
|
|
43923
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43924
|
+
dataResidencyNote: string(),
|
|
43925
|
+
/** Credentials are present — never the values. */
|
|
43926
|
+
configured: boolean(),
|
|
43927
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43928
|
+
});
|
|
43929
|
+
var TrainingCredentialCheckSchema = object({
|
|
43930
|
+
ok: boolean(),
|
|
43931
|
+
/** Workspace / account name, when the provider says. */
|
|
43932
|
+
account: string().optional(),
|
|
43933
|
+
reason: _enum([
|
|
43934
|
+
"missing",
|
|
43935
|
+
"invalid",
|
|
43936
|
+
"forbidden",
|
|
43937
|
+
"network",
|
|
43938
|
+
"quota"
|
|
43939
|
+
]).optional(),
|
|
43940
|
+
detail: string().optional()
|
|
43941
|
+
});
|
|
43942
|
+
var ProviderJobStateSchema = _enum([
|
|
43943
|
+
"pending",
|
|
43944
|
+
"starting",
|
|
43945
|
+
"running",
|
|
43946
|
+
"succeeded",
|
|
43947
|
+
"failed",
|
|
43948
|
+
"cancelled",
|
|
43949
|
+
"lost"
|
|
43950
|
+
]);
|
|
43951
|
+
var ProviderJobStatusSchema = object({
|
|
43952
|
+
jobKey: string(),
|
|
43953
|
+
providerJobId: string().optional(),
|
|
43954
|
+
state: ProviderJobStateSchema,
|
|
43955
|
+
startedAt: number().optional(),
|
|
43956
|
+
endedAt: number().optional(),
|
|
43957
|
+
exitCode: number().int().optional(),
|
|
43958
|
+
failureReason: string().optional(),
|
|
43959
|
+
gpuType: string(),
|
|
43960
|
+
region: string().optional(),
|
|
43961
|
+
billedSeconds: number().nonnegative(),
|
|
43962
|
+
costUsd: number().nonnegative(),
|
|
43963
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43964
|
+
costIsEstimate: boolean(),
|
|
43965
|
+
lastFetchedAt: number()
|
|
43966
|
+
});
|
|
43967
|
+
/**
|
|
43968
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43969
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43970
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43971
|
+
* in `result.json`.
|
|
43972
|
+
*/
|
|
43973
|
+
var TrainerSourceRefSchema = object({
|
|
43974
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43975
|
+
repo: string().min(1),
|
|
43976
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43977
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43978
|
+
});
|
|
43979
|
+
var JobRef = {
|
|
43980
|
+
addonId: string(),
|
|
43981
|
+
jobKey: string().uuid()
|
|
43982
|
+
};
|
|
43983
|
+
var TrainingLogLineSchema = object({
|
|
43984
|
+
ts: number(),
|
|
43985
|
+
text: string()
|
|
43986
|
+
});
|
|
43987
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43988
|
+
kind: "mutation",
|
|
43989
|
+
auth: "admin",
|
|
43990
|
+
timeoutMs: 3e4
|
|
43991
|
+
}), method(object({
|
|
43992
|
+
addonId: string(),
|
|
43993
|
+
gpuType: string(),
|
|
43994
|
+
region: string(),
|
|
43995
|
+
datasetBytes: number().int().nonnegative(),
|
|
43996
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43997
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43998
|
+
}), object({
|
|
43999
|
+
usdLow: number().nonnegative(),
|
|
44000
|
+
usdHigh: number().nonnegative(),
|
|
44001
|
+
notes: array(string()).readonly()
|
|
44002
|
+
}), { auth: "admin" }), method(object({
|
|
44003
|
+
...JobRef,
|
|
44004
|
+
ticket: PeerBytesTicketSchema
|
|
44005
|
+
}), object({
|
|
44006
|
+
bytes: number().int().nonnegative(),
|
|
44007
|
+
sha256: string()
|
|
44008
|
+
}), {
|
|
44009
|
+
kind: "mutation",
|
|
44010
|
+
auth: "admin",
|
|
44011
|
+
timeoutMs: 120 * 6e4
|
|
44012
|
+
}), method(object({
|
|
44013
|
+
...JobRef,
|
|
44014
|
+
trainer: TrainerSourceRefSchema,
|
|
44015
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
44016
|
+
gpuType: string(),
|
|
44017
|
+
region: string(),
|
|
44018
|
+
maxRuntimeSec: number().int().positive()
|
|
44019
|
+
}), ProviderJobStatusSchema, {
|
|
44020
|
+
kind: "mutation",
|
|
44021
|
+
auth: "admin",
|
|
44022
|
+
timeoutMs: 30 * 6e4
|
|
44023
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
44024
|
+
auth: "admin",
|
|
44025
|
+
timeoutMs: 6e4
|
|
44026
|
+
}), method(object({
|
|
44027
|
+
...JobRef,
|
|
44028
|
+
cursor: string().optional(),
|
|
44029
|
+
max: number().int().min(1).max(500)
|
|
44030
|
+
}), object({
|
|
44031
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
44032
|
+
cursor: string()
|
|
44033
|
+
}), {
|
|
44034
|
+
auth: "admin",
|
|
44035
|
+
timeoutMs: 6e4
|
|
44036
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
44037
|
+
kind: "mutation",
|
|
44038
|
+
auth: "admin",
|
|
44039
|
+
timeoutMs: 6e4
|
|
44040
|
+
}), method(object(JobRef), object({
|
|
44041
|
+
found: boolean(),
|
|
44042
|
+
text: string().optional()
|
|
44043
|
+
}), {
|
|
44044
|
+
kind: "mutation",
|
|
44045
|
+
auth: "admin",
|
|
44046
|
+
timeoutMs: 5 * 6e4
|
|
44047
|
+
}), method(object({
|
|
44048
|
+
...JobRef,
|
|
44049
|
+
path: _enum(["bundle.tar"])
|
|
44050
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
44051
|
+
kind: "mutation",
|
|
44052
|
+
auth: "admin",
|
|
44053
|
+
timeoutMs: 5 * 6e4
|
|
44054
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
44055
|
+
kind: "mutation",
|
|
44056
|
+
auth: "admin",
|
|
44057
|
+
timeoutMs: 5 * 6e4
|
|
44058
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
44059
|
+
auth: "admin",
|
|
44060
|
+
timeoutMs: 2 * 6e4
|
|
44061
|
+
});
|
|
44062
|
+
/**
|
|
44063
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
44064
|
+
* provided by `addon-training`.
|
|
44065
|
+
*
|
|
44066
|
+
* It owns what every provider must agree on, written once:
|
|
44067
|
+
*
|
|
44068
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
44069
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
44070
|
+
* the export plan) and reaches this store through the five row methods
|
|
44071
|
+
* below, so the Retrain page and the export did not change.
|
|
44072
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
44073
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
44074
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
44075
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
44076
|
+
* rollback. Nothing is ever registered automatically.
|
|
44077
|
+
*
|
|
44078
|
+
* Every method is `admin`.
|
|
44079
|
+
*/
|
|
44080
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
44081
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
44082
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
44083
|
+
var TrainingBaseModelSchema = object({
|
|
44084
|
+
modelId: string(),
|
|
44085
|
+
label: string(),
|
|
44086
|
+
weights: string(),
|
|
44087
|
+
imgsz: number().int(),
|
|
44088
|
+
baselineOnnxUrl: string(),
|
|
44089
|
+
baselineFloors: record(string(), number()),
|
|
44090
|
+
/** The base the fleet runs most — the UI's default. */
|
|
44091
|
+
recommended: boolean()
|
|
44092
|
+
});
|
|
44093
|
+
var TrainingPresetSchema = _enum([
|
|
44094
|
+
"quick",
|
|
44095
|
+
"standard",
|
|
44096
|
+
"thorough"
|
|
44097
|
+
]);
|
|
44098
|
+
var TrainingJobRequestSchema = object({
|
|
44099
|
+
datasetVersionId: string().min(1),
|
|
44100
|
+
/** The `training-provider` addon that runs it. */
|
|
44101
|
+
addonId: string().min(1),
|
|
44102
|
+
gpuType: string().min(1),
|
|
44103
|
+
region: string(),
|
|
44104
|
+
baseModelId: string().min(1),
|
|
44105
|
+
preset: TrainingPresetSchema,
|
|
44106
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
44107
|
+
freeze: number().int().nonnegative().nullable(),
|
|
44108
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
44109
|
+
holdoutCameras: array(number().int()).nullable()
|
|
44110
|
+
});
|
|
44111
|
+
var TrainingSplitPlanSchema = object({
|
|
44112
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
44113
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
44114
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
44115
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
44116
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
44117
|
+
trainSubjects: number().int()
|
|
44118
|
+
});
|
|
44119
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
44120
|
+
"unknown-dataset",
|
|
44121
|
+
"unknown-provider",
|
|
44122
|
+
"provider-not-configured",
|
|
44123
|
+
"unknown-base-model",
|
|
44124
|
+
"unknown-gpu",
|
|
44125
|
+
"dataset-too-large",
|
|
44126
|
+
"no-training-subjects",
|
|
44127
|
+
"job-already-running"
|
|
44128
|
+
]);
|
|
44129
|
+
var TrainingJobPlanSchema = object({
|
|
44130
|
+
refusal: object({
|
|
44131
|
+
reason: TrainingRefusalReasonSchema,
|
|
44132
|
+
detail: string()
|
|
44133
|
+
}).nullable(),
|
|
44134
|
+
warnings: array(string()).readonly(),
|
|
44135
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
44136
|
+
estimate: object({
|
|
44137
|
+
datasetBytes: number().int(),
|
|
44138
|
+
uploadMinutesAt20Mbps: number(),
|
|
44139
|
+
gpuSecondsLow: number(),
|
|
44140
|
+
gpuSecondsHigh: number(),
|
|
44141
|
+
usdLow: number(),
|
|
44142
|
+
usdHigh: number(),
|
|
44143
|
+
notes: array(string()).readonly()
|
|
44144
|
+
}).nullable(),
|
|
44145
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
44146
|
+
defaults: object({
|
|
44147
|
+
maxCostUsd: number(),
|
|
44148
|
+
maxRuntimeSec: number().int()
|
|
44149
|
+
}).nullable(),
|
|
44150
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
44151
|
+
dataNotice: string()
|
|
44152
|
+
});
|
|
44153
|
+
/**
|
|
44154
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
44155
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
44156
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
44157
|
+
* result lives after the operator acted on it.
|
|
44158
|
+
*/
|
|
44159
|
+
var TrainingJobStateSchema = _enum([
|
|
44160
|
+
"uploading",
|
|
44161
|
+
"submitted",
|
|
44162
|
+
"starting",
|
|
44163
|
+
"running",
|
|
44164
|
+
"collecting",
|
|
44165
|
+
"ready",
|
|
44166
|
+
"registered",
|
|
44167
|
+
"canary",
|
|
44168
|
+
"failed",
|
|
44169
|
+
"cancelling",
|
|
44170
|
+
"cancelled",
|
|
44171
|
+
"lost",
|
|
44172
|
+
"expired",
|
|
44173
|
+
"discarded"
|
|
44174
|
+
]);
|
|
44175
|
+
var TrainingFailureReasonSchema = _enum([
|
|
44176
|
+
"cost-cap",
|
|
44177
|
+
"runtime-cap",
|
|
44178
|
+
"upload-failed",
|
|
44179
|
+
"submit-failed",
|
|
44180
|
+
"trainer-failed",
|
|
44181
|
+
"result-invalid",
|
|
44182
|
+
"checksum-mismatch",
|
|
44183
|
+
"fetch-failed",
|
|
44184
|
+
"provider-error",
|
|
44185
|
+
"hub-restart-during-upload"
|
|
44186
|
+
]);
|
|
44187
|
+
var TrainingProgressPointSchema = object({
|
|
44188
|
+
epoch: number().int(),
|
|
44189
|
+
map50: number().nullable(),
|
|
44190
|
+
map50_95: number().nullable()
|
|
44191
|
+
});
|
|
44192
|
+
var TrainingCanarySchema = object({
|
|
44193
|
+
deviceIds: array(number().int()).readonly(),
|
|
44194
|
+
since: number(),
|
|
44195
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
44196
|
+
previous: array(object({
|
|
44197
|
+
deviceId: number().int(),
|
|
44198
|
+
nodeId: string(),
|
|
44199
|
+
deviceKey: string(),
|
|
44200
|
+
patch: object({
|
|
44201
|
+
modelId: string().optional(),
|
|
44202
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
44203
|
+
}).nullable()
|
|
44204
|
+
})).readonly()
|
|
44205
|
+
});
|
|
44206
|
+
var TrainingJobSchema = object({
|
|
44207
|
+
id: string(),
|
|
44208
|
+
idempotencyKey: string(),
|
|
44209
|
+
name: string(),
|
|
44210
|
+
createdAt: number(),
|
|
44211
|
+
updatedAt: number(),
|
|
44212
|
+
state: TrainingJobStateSchema,
|
|
44213
|
+
stage: TrainingStageSchema.nullable(),
|
|
44214
|
+
failure: object({
|
|
44215
|
+
reason: TrainingFailureReasonSchema,
|
|
44216
|
+
stage: string().nullable(),
|
|
44217
|
+
detail: string()
|
|
44218
|
+
}).nullable(),
|
|
44219
|
+
request: TrainingJobRequestSchema,
|
|
44220
|
+
maxCostUsd: number().nonnegative(),
|
|
44221
|
+
maxRuntimeSec: number().int().positive(),
|
|
44222
|
+
trainer: TrainerSourceRefSchema,
|
|
44223
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
44224
|
+
dataset: object({
|
|
44225
|
+
bytes: number().int(),
|
|
44226
|
+
sha256: string(),
|
|
44227
|
+
uploadedAt: number()
|
|
44228
|
+
}).nullable(),
|
|
44229
|
+
split: TrainingSplitPlanSchema,
|
|
44230
|
+
provider: object({
|
|
44231
|
+
state: ProviderJobStateSchema.nullable(),
|
|
44232
|
+
providerJobId: string().nullable(),
|
|
44233
|
+
startedAt: number().nullable(),
|
|
44234
|
+
endedAt: number().nullable(),
|
|
44235
|
+
billedSeconds: number(),
|
|
44236
|
+
costUsd: number(),
|
|
44237
|
+
costIsEstimate: boolean(),
|
|
44238
|
+
lastPolledAt: number().nullable()
|
|
44239
|
+
}),
|
|
44240
|
+
progress: object({
|
|
44241
|
+
epoch: number().int().nullable(),
|
|
44242
|
+
epochs: number().int().nullable(),
|
|
44243
|
+
etaSec: number().nullable(),
|
|
44244
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
44245
|
+
}),
|
|
44246
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
44247
|
+
logTail: array(string()).readonly(),
|
|
44248
|
+
logCursor: string().nullable(),
|
|
44249
|
+
artifacts: object({
|
|
44250
|
+
bundleBytes: number().int(),
|
|
44251
|
+
bundleSha256: string(),
|
|
44252
|
+
fetchedAt: number(),
|
|
44253
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
44254
|
+
expiresAt: number()
|
|
44255
|
+
}).nullable(),
|
|
44256
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
44257
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
44258
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
44259
|
+
cloudCleanupDueAt: number().nullable(),
|
|
44260
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
44261
|
+
registeredModelIds: array(string()).readonly(),
|
|
44262
|
+
canary: TrainingCanarySchema.nullable()
|
|
44263
|
+
});
|
|
44264
|
+
var IdInput = object({ id: string().min(1) });
|
|
44265
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
44266
|
+
kind: "mutation",
|
|
44267
|
+
auth: "admin"
|
|
44268
|
+
}), 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() }), {
|
|
44269
|
+
kind: "mutation",
|
|
44270
|
+
auth: "admin"
|
|
44271
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
44272
|
+
auth: "admin",
|
|
44273
|
+
timeoutMs: 6e4
|
|
44274
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
44275
|
+
name: string().min(1).max(120),
|
|
44276
|
+
maxCostUsd: number().positive(),
|
|
44277
|
+
maxRuntimeSec: number().int().positive(),
|
|
44278
|
+
idempotencyKey: string().min(8).max(80)
|
|
44279
|
+
}), discriminatedUnion("kind", [object({
|
|
44280
|
+
kind: literal("started"),
|
|
44281
|
+
job: TrainingJobSchema
|
|
44282
|
+
}), object({
|
|
44283
|
+
kind: literal("refused"),
|
|
44284
|
+
reason: TrainingRefusalReasonSchema,
|
|
44285
|
+
detail: string()
|
|
44286
|
+
})]), {
|
|
44287
|
+
kind: "mutation",
|
|
44288
|
+
auth: "admin",
|
|
44289
|
+
timeoutMs: 12e4
|
|
44290
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
44291
|
+
kind: "mutation",
|
|
44292
|
+
auth: "admin",
|
|
44293
|
+
timeoutMs: 12e4
|
|
44294
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
44295
|
+
kind: "mutation",
|
|
44296
|
+
auth: "admin",
|
|
44297
|
+
timeoutMs: 30 * 6e4
|
|
44298
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
44299
|
+
kind: "mutation",
|
|
44300
|
+
auth: "admin",
|
|
44301
|
+
timeoutMs: 12e4
|
|
44302
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44303
|
+
kind: "mutation",
|
|
44304
|
+
auth: "admin",
|
|
44305
|
+
timeoutMs: 12e4
|
|
44306
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44307
|
+
kind: "mutation",
|
|
44308
|
+
auth: "admin"
|
|
44309
|
+
});
|
|
42909
44310
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
42910
44311
|
Object.freeze({
|
|
42911
44312
|
person: .5,
|
|
@@ -45069,6 +46470,12 @@ Object.freeze({
|
|
|
45069
46470
|
addonId: null,
|
|
45070
46471
|
access: "create"
|
|
45071
46472
|
},
|
|
46473
|
+
"backup.checkBackupKey": {
|
|
46474
|
+
capName: "backup",
|
|
46475
|
+
capScope: "system",
|
|
46476
|
+
addonId: null,
|
|
46477
|
+
access: "create"
|
|
46478
|
+
},
|
|
45072
46479
|
"backup.delete": {
|
|
45073
46480
|
capName: "backup",
|
|
45074
46481
|
capScope: "system",
|
|
@@ -45081,6 +46488,18 @@ Object.freeze({
|
|
|
45081
46488
|
addonId: null,
|
|
45082
46489
|
access: "delete"
|
|
45083
46490
|
},
|
|
46491
|
+
"backup.disableEncryption": {
|
|
46492
|
+
capName: "backup",
|
|
46493
|
+
capScope: "system",
|
|
46494
|
+
addonId: null,
|
|
46495
|
+
access: "create"
|
|
46496
|
+
},
|
|
46497
|
+
"backup.getEncryption": {
|
|
46498
|
+
capName: "backup",
|
|
46499
|
+
capScope: "system",
|
|
46500
|
+
addonId: null,
|
|
46501
|
+
access: "view"
|
|
46502
|
+
},
|
|
45084
46503
|
"backup.getEntries": {
|
|
45085
46504
|
capName: "backup",
|
|
45086
46505
|
capScope: "system",
|
|
@@ -45135,6 +46554,12 @@ Object.freeze({
|
|
|
45135
46554
|
addonId: null,
|
|
45136
46555
|
access: "create"
|
|
45137
46556
|
},
|
|
46557
|
+
"backup.setupEncryption": {
|
|
46558
|
+
capName: "backup",
|
|
46559
|
+
capScope: "system",
|
|
46560
|
+
addonId: null,
|
|
46561
|
+
access: "create"
|
|
46562
|
+
},
|
|
45138
46563
|
"backup.trigger": {
|
|
45139
46564
|
capName: "backup",
|
|
45140
46565
|
capScope: "system",
|
|
@@ -45687,6 +47112,12 @@ Object.freeze({
|
|
|
45687
47112
|
addonId: null,
|
|
45688
47113
|
access: "create"
|
|
45689
47114
|
},
|
|
47115
|
+
"customModelRegistry.importModelBundle": {
|
|
47116
|
+
capName: "custom-model-registry",
|
|
47117
|
+
capScope: "system",
|
|
47118
|
+
addonId: null,
|
|
47119
|
+
access: "create"
|
|
47120
|
+
},
|
|
45690
47121
|
"customModelRegistry.listModels": {
|
|
45691
47122
|
capName: "custom-model-registry",
|
|
45692
47123
|
capScope: "system",
|
|
@@ -47127,6 +48558,12 @@ Object.freeze({
|
|
|
47127
48558
|
addonId: null,
|
|
47128
48559
|
access: "view"
|
|
47129
48560
|
},
|
|
48561
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48562
|
+
capName: "keychain-admin",
|
|
48563
|
+
capScope: "system",
|
|
48564
|
+
addonId: null,
|
|
48565
|
+
access: "create"
|
|
48566
|
+
},
|
|
47130
48567
|
"keychainAdmin.deleteOrphans": {
|
|
47131
48568
|
capName: "keychain-admin",
|
|
47132
48569
|
capScope: "system",
|
|
@@ -47163,6 +48600,12 @@ Object.freeze({
|
|
|
47163
48600
|
addonId: null,
|
|
47164
48601
|
access: "delete"
|
|
47165
48602
|
},
|
|
48603
|
+
"keychainAdmin.resetReport": {
|
|
48604
|
+
capName: "keychain-admin",
|
|
48605
|
+
capScope: "system",
|
|
48606
|
+
addonId: null,
|
|
48607
|
+
access: "delete"
|
|
48608
|
+
},
|
|
47166
48609
|
"keychainAdmin.reveal": {
|
|
47167
48610
|
capName: "keychain-admin",
|
|
47168
48611
|
capScope: "system",
|
|
@@ -47175,6 +48618,12 @@ Object.freeze({
|
|
|
47175
48618
|
addonId: null,
|
|
47176
48619
|
access: "create"
|
|
47177
48620
|
},
|
|
48621
|
+
"keychainAdmin.setSystemSecret": {
|
|
48622
|
+
capName: "keychain-admin",
|
|
48623
|
+
capScope: "system",
|
|
48624
|
+
addonId: null,
|
|
48625
|
+
access: "create"
|
|
48626
|
+
},
|
|
47178
48627
|
"keychainAdmin.status": {
|
|
47179
48628
|
capName: "keychain-admin",
|
|
47180
48629
|
capScope: "system",
|
|
@@ -48621,6 +50070,12 @@ Object.freeze({
|
|
|
48621
50070
|
addonId: null,
|
|
48622
50071
|
access: "create"
|
|
48623
50072
|
},
|
|
50073
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
50074
|
+
capName: "pipeline-analytics",
|
|
50075
|
+
capScope: "device",
|
|
50076
|
+
addonId: null,
|
|
50077
|
+
access: "create"
|
|
50078
|
+
},
|
|
48624
50079
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
48625
50080
|
capName: "pipeline-analytics",
|
|
48626
50081
|
capScope: "device",
|
|
@@ -48633,6 +50088,12 @@ Object.freeze({
|
|
|
48633
50088
|
addonId: null,
|
|
48634
50089
|
access: "delete"
|
|
48635
50090
|
},
|
|
50091
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
50092
|
+
capName: "pipeline-analytics",
|
|
50093
|
+
capScope: "device",
|
|
50094
|
+
addonId: null,
|
|
50095
|
+
access: "delete"
|
|
50096
|
+
},
|
|
48636
50097
|
"pipelineAnalytics.deleteTracks": {
|
|
48637
50098
|
capName: "pipeline-analytics",
|
|
48638
50099
|
capScope: "device",
|
|
@@ -48855,6 +50316,12 @@ Object.freeze({
|
|
|
48855
50316
|
addonId: null,
|
|
48856
50317
|
access: "view"
|
|
48857
50318
|
},
|
|
50319
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
50320
|
+
capName: "pipeline-analytics",
|
|
50321
|
+
capScope: "device",
|
|
50322
|
+
addonId: null,
|
|
50323
|
+
access: "view"
|
|
50324
|
+
},
|
|
48858
50325
|
"pipelineAnalytics.listRetrainFrames": {
|
|
48859
50326
|
capName: "pipeline-analytics",
|
|
48860
50327
|
capScope: "device",
|
|
@@ -48885,6 +50352,12 @@ Object.freeze({
|
|
|
48885
50352
|
addonId: null,
|
|
48886
50353
|
access: "view"
|
|
48887
50354
|
},
|
|
50355
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
50356
|
+
capName: "pipeline-analytics",
|
|
50357
|
+
capScope: "device",
|
|
50358
|
+
addonId: null,
|
|
50359
|
+
access: "create"
|
|
50360
|
+
},
|
|
48888
50361
|
"pipelineAnalytics.ownersWithMedia": {
|
|
48889
50362
|
capName: "pipeline-analytics",
|
|
48890
50363
|
capScope: "device",
|
|
@@ -48897,6 +50370,12 @@ Object.freeze({
|
|
|
48897
50370
|
addonId: null,
|
|
48898
50371
|
access: "create"
|
|
48899
50372
|
},
|
|
50373
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
50374
|
+
capName: "pipeline-analytics",
|
|
50375
|
+
capScope: "device",
|
|
50376
|
+
addonId: null,
|
|
50377
|
+
access: "view"
|
|
50378
|
+
},
|
|
48900
50379
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
48901
50380
|
capName: "pipeline-analytics",
|
|
48902
50381
|
capScope: "device",
|
|
@@ -49035,6 +50514,12 @@ Object.freeze({
|
|
|
49035
50514
|
addonId: null,
|
|
49036
50515
|
access: "create"
|
|
49037
50516
|
},
|
|
50517
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50518
|
+
capName: "pipeline-analytics",
|
|
50519
|
+
capScope: "device",
|
|
50520
|
+
addonId: null,
|
|
50521
|
+
access: "view"
|
|
50522
|
+
},
|
|
49038
50523
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
49039
50524
|
capName: "pipeline-analytics",
|
|
49040
50525
|
capScope: "device",
|
|
@@ -51411,6 +52896,174 @@ Object.freeze({
|
|
|
51411
52896
|
addonId: null,
|
|
51412
52897
|
access: "view"
|
|
51413
52898
|
},
|
|
52899
|
+
"training.canaryResult": {
|
|
52900
|
+
capName: "training",
|
|
52901
|
+
capScope: "system",
|
|
52902
|
+
addonId: null,
|
|
52903
|
+
access: "create"
|
|
52904
|
+
},
|
|
52905
|
+
"training.cancelJob": {
|
|
52906
|
+
capName: "training",
|
|
52907
|
+
capScope: "system",
|
|
52908
|
+
addonId: null,
|
|
52909
|
+
access: "create"
|
|
52910
|
+
},
|
|
52911
|
+
"training.discardResult": {
|
|
52912
|
+
capName: "training",
|
|
52913
|
+
capScope: "system",
|
|
52914
|
+
addonId: null,
|
|
52915
|
+
access: "create"
|
|
52916
|
+
},
|
|
52917
|
+
"training.findDatasetVersionIdByName": {
|
|
52918
|
+
capName: "training",
|
|
52919
|
+
capScope: "system",
|
|
52920
|
+
addonId: null,
|
|
52921
|
+
access: "view"
|
|
52922
|
+
},
|
|
52923
|
+
"training.getDatasetVersion": {
|
|
52924
|
+
capName: "training",
|
|
52925
|
+
capScope: "system",
|
|
52926
|
+
addonId: null,
|
|
52927
|
+
access: "view"
|
|
52928
|
+
},
|
|
52929
|
+
"training.getJob": {
|
|
52930
|
+
capName: "training",
|
|
52931
|
+
capScope: "system",
|
|
52932
|
+
addonId: null,
|
|
52933
|
+
access: "view"
|
|
52934
|
+
},
|
|
52935
|
+
"training.getJobResult": {
|
|
52936
|
+
capName: "training",
|
|
52937
|
+
capScope: "system",
|
|
52938
|
+
addonId: null,
|
|
52939
|
+
access: "view"
|
|
52940
|
+
},
|
|
52941
|
+
"training.listBaseModels": {
|
|
52942
|
+
capName: "training",
|
|
52943
|
+
capScope: "system",
|
|
52944
|
+
addonId: null,
|
|
52945
|
+
access: "view"
|
|
52946
|
+
},
|
|
52947
|
+
"training.listDatasetVersions": {
|
|
52948
|
+
capName: "training",
|
|
52949
|
+
capScope: "system",
|
|
52950
|
+
addonId: null,
|
|
52951
|
+
access: "view"
|
|
52952
|
+
},
|
|
52953
|
+
"training.listJobs": {
|
|
52954
|
+
capName: "training",
|
|
52955
|
+
capScope: "system",
|
|
52956
|
+
addonId: null,
|
|
52957
|
+
access: "view"
|
|
52958
|
+
},
|
|
52959
|
+
"training.planJob": {
|
|
52960
|
+
capName: "training",
|
|
52961
|
+
capScope: "system",
|
|
52962
|
+
addonId: null,
|
|
52963
|
+
access: "view"
|
|
52964
|
+
},
|
|
52965
|
+
"training.putDatasetVersion": {
|
|
52966
|
+
capName: "training",
|
|
52967
|
+
capScope: "system",
|
|
52968
|
+
addonId: null,
|
|
52969
|
+
access: "create"
|
|
52970
|
+
},
|
|
52971
|
+
"training.registerResult": {
|
|
52972
|
+
capName: "training",
|
|
52973
|
+
capScope: "system",
|
|
52974
|
+
addonId: null,
|
|
52975
|
+
access: "create"
|
|
52976
|
+
},
|
|
52977
|
+
"training.removeDatasetVersion": {
|
|
52978
|
+
capName: "training",
|
|
52979
|
+
capScope: "system",
|
|
52980
|
+
addonId: null,
|
|
52981
|
+
access: "delete"
|
|
52982
|
+
},
|
|
52983
|
+
"training.rollbackCanary": {
|
|
52984
|
+
capName: "training",
|
|
52985
|
+
capScope: "system",
|
|
52986
|
+
addonId: null,
|
|
52987
|
+
access: "create"
|
|
52988
|
+
},
|
|
52989
|
+
"training.startJob": {
|
|
52990
|
+
capName: "training",
|
|
52991
|
+
capScope: "system",
|
|
52992
|
+
addonId: null,
|
|
52993
|
+
access: "create"
|
|
52994
|
+
},
|
|
52995
|
+
"trainingProvider.cancelJob": {
|
|
52996
|
+
capName: "training-provider",
|
|
52997
|
+
capScope: "system",
|
|
52998
|
+
addonId: null,
|
|
52999
|
+
access: "create"
|
|
53000
|
+
},
|
|
53001
|
+
"trainingProvider.cleanupJob": {
|
|
53002
|
+
capName: "training-provider",
|
|
53003
|
+
capScope: "system",
|
|
53004
|
+
addonId: null,
|
|
53005
|
+
access: "create"
|
|
53006
|
+
},
|
|
53007
|
+
"trainingProvider.describe": {
|
|
53008
|
+
capName: "training-provider",
|
|
53009
|
+
capScope: "system",
|
|
53010
|
+
addonId: null,
|
|
53011
|
+
access: "view"
|
|
53012
|
+
},
|
|
53013
|
+
"trainingProvider.estimateJob": {
|
|
53014
|
+
capName: "training-provider",
|
|
53015
|
+
capScope: "system",
|
|
53016
|
+
addonId: null,
|
|
53017
|
+
access: "view"
|
|
53018
|
+
},
|
|
53019
|
+
"trainingProvider.getJob": {
|
|
53020
|
+
capName: "training-provider",
|
|
53021
|
+
capScope: "system",
|
|
53022
|
+
addonId: null,
|
|
53023
|
+
access: "view"
|
|
53024
|
+
},
|
|
53025
|
+
"trainingProvider.listJobEvents": {
|
|
53026
|
+
capName: "training-provider",
|
|
53027
|
+
capScope: "system",
|
|
53028
|
+
addonId: null,
|
|
53029
|
+
access: "view"
|
|
53030
|
+
},
|
|
53031
|
+
"trainingProvider.listJobs": {
|
|
53032
|
+
capName: "training-provider",
|
|
53033
|
+
capScope: "system",
|
|
53034
|
+
addonId: null,
|
|
53035
|
+
access: "view"
|
|
53036
|
+
},
|
|
53037
|
+
"trainingProvider.offerArtifact": {
|
|
53038
|
+
capName: "training-provider",
|
|
53039
|
+
capScope: "system",
|
|
53040
|
+
addonId: null,
|
|
53041
|
+
access: "create"
|
|
53042
|
+
},
|
|
53043
|
+
"trainingProvider.readResult": {
|
|
53044
|
+
capName: "training-provider",
|
|
53045
|
+
capScope: "system",
|
|
53046
|
+
addonId: null,
|
|
53047
|
+
access: "create"
|
|
53048
|
+
},
|
|
53049
|
+
"trainingProvider.submitJob": {
|
|
53050
|
+
capName: "training-provider",
|
|
53051
|
+
capScope: "system",
|
|
53052
|
+
addonId: null,
|
|
53053
|
+
access: "create"
|
|
53054
|
+
},
|
|
53055
|
+
"trainingProvider.uploadDataset": {
|
|
53056
|
+
capName: "training-provider",
|
|
53057
|
+
capScope: "system",
|
|
53058
|
+
addonId: null,
|
|
53059
|
+
access: "create"
|
|
53060
|
+
},
|
|
53061
|
+
"trainingProvider.validateCredentials": {
|
|
53062
|
+
capName: "training-provider",
|
|
53063
|
+
capScope: "system",
|
|
53064
|
+
addonId: null,
|
|
53065
|
+
access: "create"
|
|
53066
|
+
},
|
|
51414
53067
|
"turnProvider.getTurnServers": {
|
|
51415
53068
|
capName: "turn-provider",
|
|
51416
53069
|
capScope: "system",
|
|
@@ -51435,12 +53088,6 @@ Object.freeze({
|
|
|
51435
53088
|
addonId: null,
|
|
51436
53089
|
access: "create"
|
|
51437
53090
|
},
|
|
51438
|
-
"userManagement.createApiKey": {
|
|
51439
|
-
capName: "user-management",
|
|
51440
|
-
capScope: "system",
|
|
51441
|
-
addonId: null,
|
|
51442
|
-
access: "create"
|
|
51443
|
-
},
|
|
51444
53091
|
"userManagement.createScopedToken": {
|
|
51445
53092
|
capName: "user-management",
|
|
51446
53093
|
capScope: "system",
|
|
@@ -51477,12 +53124,6 @@ Object.freeze({
|
|
|
51477
53124
|
addonId: null,
|
|
51478
53125
|
access: "view"
|
|
51479
53126
|
},
|
|
51480
|
-
"userManagement.linkExternalIdentity": {
|
|
51481
|
-
capName: "user-management",
|
|
51482
|
-
capScope: "system",
|
|
51483
|
-
addonId: null,
|
|
51484
|
-
access: "create"
|
|
51485
|
-
},
|
|
51486
53127
|
"userManagement.listApiKeys": {
|
|
51487
53128
|
capName: "user-management",
|
|
51488
53129
|
capScope: "system",
|
|
@@ -51585,12 +53226,6 @@ Object.freeze({
|
|
|
51585
53226
|
addonId: null,
|
|
51586
53227
|
access: "create"
|
|
51587
53228
|
},
|
|
51588
|
-
"userManagement.validateApiKey": {
|
|
51589
|
-
capName: "user-management",
|
|
51590
|
-
capScope: "system",
|
|
51591
|
-
addonId: null,
|
|
51592
|
-
access: "view"
|
|
51593
|
-
},
|
|
51594
53229
|
"userManagement.validateCredentials": {
|
|
51595
53230
|
capName: "user-management",
|
|
51596
53231
|
capScope: "system",
|
|
@@ -55922,6 +57557,11 @@ Object.freeze({
|
|
|
55922
57557
|
form: "single",
|
|
55923
57558
|
optional: false
|
|
55924
57559
|
}],
|
|
57560
|
+
"training.canaryResult": [{
|
|
57561
|
+
name: "deviceIds",
|
|
57562
|
+
form: "array",
|
|
57563
|
+
optional: false
|
|
57564
|
+
}],
|
|
55925
57565
|
"update.getStatus": [{
|
|
55926
57566
|
name: "deviceId",
|
|
55927
57567
|
form: "single",
|