@camstack/addon-export-google 0.1.89 → 0.1.90
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/export-google.addon.js +1771 -131
- package/dist/export-google.addon.mjs +1771 -131
- package/package.json +1 -1
|
@@ -5455,7 +5455,7 @@ var ZodIssueCode = {
|
|
|
5455
5455
|
var ZodFirstPartyTypeKind;
|
|
5456
5456
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5457
5457
|
//#endregion
|
|
5458
|
-
//#region ../types/dist/sleep-
|
|
5458
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5459
5459
|
/**
|
|
5460
5460
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5461
5461
|
* window to float samples (D455).
|
|
@@ -5572,7 +5572,7 @@ function isKeychainStoredField(field) {
|
|
|
5572
5572
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5573
5573
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5574
5574
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5575
|
-
function isRecord$
|
|
5575
|
+
function isRecord$2(value) {
|
|
5576
5576
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5577
5577
|
}
|
|
5578
5578
|
function makeSecretMarker(ref) {
|
|
@@ -5583,12 +5583,12 @@ function makeSecretMarker(ref) {
|
|
|
5583
5583
|
}
|
|
5584
5584
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5585
5585
|
function isSecretMarker(value) {
|
|
5586
|
-
if (!isRecord$
|
|
5586
|
+
if (!isRecord$2(value)) return false;
|
|
5587
5587
|
const ref = value["$secret"];
|
|
5588
5588
|
return typeof ref === "string" && ref.length > 0;
|
|
5589
5589
|
}
|
|
5590
5590
|
function isSecretClear(value) {
|
|
5591
|
-
return isRecord$
|
|
5591
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5592
5592
|
}
|
|
5593
5593
|
/**
|
|
5594
5594
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6104,6 +6104,13 @@ function globalSecretScope() {
|
|
|
6104
6104
|
function encodeSegment(value) {
|
|
6105
6105
|
return encodeURIComponent(value);
|
|
6106
6106
|
}
|
|
6107
|
+
function decodeSegment(value) {
|
|
6108
|
+
try {
|
|
6109
|
+
return decodeURIComponent(value);
|
|
6110
|
+
} catch {
|
|
6111
|
+
return null;
|
|
6112
|
+
}
|
|
6113
|
+
}
|
|
6107
6114
|
/**
|
|
6108
6115
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6109
6116
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6112,6 +6119,75 @@ function encodeSegment(value) {
|
|
|
6112
6119
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6113
6120
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6114
6121
|
}
|
|
6122
|
+
function parseScope(segments) {
|
|
6123
|
+
switch (segments[0]) {
|
|
6124
|
+
case "global": return {
|
|
6125
|
+
scope: GLOBAL_SCOPE,
|
|
6126
|
+
used: 1
|
|
6127
|
+
};
|
|
6128
|
+
case "node": {
|
|
6129
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6130
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6131
|
+
scope: {
|
|
6132
|
+
kind: "node",
|
|
6133
|
+
nodeId
|
|
6134
|
+
},
|
|
6135
|
+
used: 2
|
|
6136
|
+
};
|
|
6137
|
+
}
|
|
6138
|
+
case "device": {
|
|
6139
|
+
const raw = segments[1];
|
|
6140
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6141
|
+
return {
|
|
6142
|
+
scope: {
|
|
6143
|
+
kind: "device",
|
|
6144
|
+
deviceId: Number(raw)
|
|
6145
|
+
},
|
|
6146
|
+
used: 2
|
|
6147
|
+
};
|
|
6148
|
+
}
|
|
6149
|
+
case "integration": {
|
|
6150
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6151
|
+
return id === null || id.length === 0 ? null : {
|
|
6152
|
+
scope: {
|
|
6153
|
+
kind: "integration",
|
|
6154
|
+
integrationId: id
|
|
6155
|
+
},
|
|
6156
|
+
used: 2
|
|
6157
|
+
};
|
|
6158
|
+
}
|
|
6159
|
+
case "row": {
|
|
6160
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6161
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6162
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6163
|
+
return {
|
|
6164
|
+
scope: {
|
|
6165
|
+
kind: "row",
|
|
6166
|
+
collection,
|
|
6167
|
+
rowId
|
|
6168
|
+
},
|
|
6169
|
+
used: 3
|
|
6170
|
+
};
|
|
6171
|
+
}
|
|
6172
|
+
default: return null;
|
|
6173
|
+
}
|
|
6174
|
+
}
|
|
6175
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6176
|
+
function parseSecretRef(ref) {
|
|
6177
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6178
|
+
const segments = ref.slice(9).split("/");
|
|
6179
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6180
|
+
if (owner === null || owner.length === 0) return null;
|
|
6181
|
+
const parsed = parseScope(segments.slice(1));
|
|
6182
|
+
if (parsed === null) return null;
|
|
6183
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6184
|
+
if (fieldPath.length === 0) return null;
|
|
6185
|
+
return {
|
|
6186
|
+
owner,
|
|
6187
|
+
scope: parsed.scope,
|
|
6188
|
+
fieldPath
|
|
6189
|
+
};
|
|
6190
|
+
}
|
|
6115
6191
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6116
6192
|
var KeychainWriteRefusedError = class extends Error {
|
|
6117
6193
|
fieldPath;
|
|
@@ -6122,7 +6198,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6122
6198
|
}
|
|
6123
6199
|
};
|
|
6124
6200
|
var KEEP = { kind: "keep" };
|
|
6125
|
-
function isRecord(value) {
|
|
6201
|
+
function isRecord$1(value) {
|
|
6126
6202
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6127
6203
|
}
|
|
6128
6204
|
function defaultMintId() {
|
|
@@ -6135,7 +6211,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6135
6211
|
return out;
|
|
6136
6212
|
}
|
|
6137
6213
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6138
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6214
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6139
6215
|
return out;
|
|
6140
6216
|
}
|
|
6141
6217
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6190,7 +6266,7 @@ function rowId(row, idKey) {
|
|
|
6190
6266
|
return null;
|
|
6191
6267
|
}
|
|
6192
6268
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6193
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6269
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6194
6270
|
if (!Array.isArray(incoming)) {
|
|
6195
6271
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6196
6272
|
return {
|
|
@@ -6206,7 +6282,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6206
6282
|
const kept = /* @__PURE__ */ new Set();
|
|
6207
6283
|
const rows = [];
|
|
6208
6284
|
for (const row of incoming) {
|
|
6209
|
-
if (!isRecord(row)) {
|
|
6285
|
+
if (!isRecord$1(row)) {
|
|
6210
6286
|
rows.push(row);
|
|
6211
6287
|
continue;
|
|
6212
6288
|
}
|
|
@@ -6231,7 +6307,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6231
6307
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6232
6308
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6233
6309
|
case "object": {
|
|
6234
|
-
if (!isRecord(incoming)) {
|
|
6310
|
+
if (!isRecord$1(incoming)) {
|
|
6235
6311
|
if (incoming === void 0) return KEEP;
|
|
6236
6312
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6237
6313
|
return {
|
|
@@ -6239,7 +6315,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6239
6315
|
value: incoming
|
|
6240
6316
|
};
|
|
6241
6317
|
}
|
|
6242
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6318
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6243
6319
|
return {
|
|
6244
6320
|
kind: "value",
|
|
6245
6321
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6298,12 +6374,19 @@ async function transformSecretWrite(input) {
|
|
|
6298
6374
|
}
|
|
6299
6375
|
};
|
|
6300
6376
|
}
|
|
6377
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6378
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6379
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6380
|
+
}
|
|
6301
6381
|
/**
|
|
6302
6382
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6303
6383
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6304
6384
|
*/
|
|
6305
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6306
|
-
const
|
|
6385
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6386
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6387
|
+
const owner = options.ownedBy;
|
|
6388
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6389
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6307
6390
|
if (refs.length === 0) return {
|
|
6308
6391
|
value,
|
|
6309
6392
|
unresolved: []
|
|
@@ -6327,10 +6410,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6327
6410
|
}
|
|
6328
6411
|
const substitute = (v) => {
|
|
6329
6412
|
if (isSecretMarker(v)) {
|
|
6413
|
+
if (!inScope(v.$secret)) return {
|
|
6414
|
+
keep: true,
|
|
6415
|
+
value: v
|
|
6416
|
+
};
|
|
6330
6417
|
const answer = answers[v.$secret];
|
|
6331
|
-
|
|
6418
|
+
if (answer?.kind === "value") return {
|
|
6332
6419
|
keep: true,
|
|
6333
6420
|
value: answer.value
|
|
6421
|
+
};
|
|
6422
|
+
return keepMarker ? {
|
|
6423
|
+
keep: true,
|
|
6424
|
+
value: v
|
|
6334
6425
|
} : {
|
|
6335
6426
|
keep: false,
|
|
6336
6427
|
value: void 0
|
|
@@ -6347,7 +6438,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6347
6438
|
value: items
|
|
6348
6439
|
};
|
|
6349
6440
|
}
|
|
6350
|
-
if (isRecord(v)) {
|
|
6441
|
+
if (isRecord$1(v)) {
|
|
6351
6442
|
const out = {};
|
|
6352
6443
|
for (const [k, child] of Object.entries(v)) {
|
|
6353
6444
|
const s = substitute(child);
|
|
@@ -6368,14 +6459,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6368
6459
|
unresolved
|
|
6369
6460
|
};
|
|
6370
6461
|
}
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6462
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6463
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6464
|
+
ref;
|
|
6465
|
+
reason;
|
|
6466
|
+
constructor(ref, reason) {
|
|
6467
|
+
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.`);
|
|
6468
|
+
this.ref = ref;
|
|
6469
|
+
this.reason = reason;
|
|
6470
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6471
|
+
}
|
|
6472
|
+
};
|
|
6473
|
+
function isRecord(value) {
|
|
6474
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6475
|
+
}
|
|
6476
|
+
function resolvedValue(pass, marker) {
|
|
6477
|
+
const answer = pass.answers[marker.$secret];
|
|
6478
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6479
|
+
}
|
|
6480
|
+
async function atMarker(pass, incoming, stored) {
|
|
6481
|
+
if (incoming === null) return stored;
|
|
6482
|
+
if (typeof incoming !== "string") return incoming;
|
|
6483
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6484
|
+
const intent = classifySecretWrite(incoming);
|
|
6485
|
+
if (intent.kind !== "set") return stored;
|
|
6486
|
+
const ref = stored.$secret;
|
|
6487
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6488
|
+
const answer = pass.answers[ref];
|
|
6489
|
+
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);
|
|
6490
|
+
try {
|
|
6491
|
+
await pass.secrets.put(ref, intent.value);
|
|
6492
|
+
} catch (err) {
|
|
6493
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6494
|
+
}
|
|
6495
|
+
pass.changedRefs.push(ref);
|
|
6496
|
+
return stored;
|
|
6497
|
+
}
|
|
6498
|
+
function inArray(pass, incoming, stored) {
|
|
6499
|
+
return incoming.map((item, index) => {
|
|
6500
|
+
const twin = stored[index];
|
|
6501
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6502
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6503
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6504
|
+
return item;
|
|
6505
|
+
});
|
|
6506
|
+
}
|
|
6507
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6508
|
+
const out = { ...incoming };
|
|
6509
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6510
|
+
const twin = stored[key];
|
|
6511
|
+
if (isSecretMarker(twin)) {
|
|
6512
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6513
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6514
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6515
|
+
}
|
|
6516
|
+
return out;
|
|
6517
|
+
}
|
|
6518
|
+
async function walk(pass, incoming, stored) {
|
|
6519
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6520
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6521
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6522
|
+
const out = { ...incoming };
|
|
6523
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6524
|
+
return out;
|
|
6525
|
+
}
|
|
6526
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6527
|
+
async function restoreUnchangedSecrets(input) {
|
|
6528
|
+
const refs = [];
|
|
6529
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6530
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6531
|
+
if (owned.length === 0) return {
|
|
6532
|
+
patch: input.patch,
|
|
6533
|
+
changedRefs: []
|
|
6534
|
+
};
|
|
6535
|
+
const pass = {
|
|
6536
|
+
secrets: input.secrets,
|
|
6537
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6538
|
+
operatorWrite: input.operatorWrite,
|
|
6539
|
+
changedRefs: []
|
|
6540
|
+
};
|
|
6541
|
+
const out = {};
|
|
6542
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6543
|
+
return {
|
|
6544
|
+
patch: out,
|
|
6545
|
+
changedRefs: pass.changedRefs
|
|
6546
|
+
};
|
|
6547
|
+
}
|
|
6548
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6549
|
+
function isJsonEqual(a, b) {
|
|
6550
|
+
if (Object.is(a, b)) return true;
|
|
6551
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6552
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6553
|
+
const keys = Object.keys(a);
|
|
6554
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6555
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6376
6556
|
}
|
|
6377
6557
|
return false;
|
|
6378
6558
|
}
|
|
6559
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6560
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6561
|
+
const out = {};
|
|
6562
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6563
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6564
|
+
out[key] = value;
|
|
6565
|
+
}
|
|
6566
|
+
return out;
|
|
6567
|
+
}
|
|
6568
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6569
|
+
function markerKeysOf(blob, owner) {
|
|
6570
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6571
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6572
|
+
return keys;
|
|
6573
|
+
}
|
|
6574
|
+
function nodeFromStored(value, owner) {
|
|
6575
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6576
|
+
if (!isRecord(value)) return null;
|
|
6577
|
+
const children = /* @__PURE__ */ new Map();
|
|
6578
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6579
|
+
const node = nodeFromStored(child, owner);
|
|
6580
|
+
if (node !== null) children.set(key, node);
|
|
6581
|
+
}
|
|
6582
|
+
return children.size > 0 ? {
|
|
6583
|
+
kind: "object",
|
|
6584
|
+
children
|
|
6585
|
+
} : null;
|
|
6586
|
+
}
|
|
6587
|
+
/**
|
|
6588
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6589
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6590
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6591
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6592
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6593
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6594
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6595
|
+
* over.
|
|
6596
|
+
*/
|
|
6597
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6598
|
+
const added = /* @__PURE__ */ new Map();
|
|
6599
|
+
for (const key of keys) {
|
|
6600
|
+
const at = key.indexOf("@");
|
|
6601
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6602
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6603
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6604
|
+
if (node !== null) added.set(base, node);
|
|
6605
|
+
}
|
|
6606
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6607
|
+
}
|
|
6379
6608
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6380
6609
|
async function readStoredAddonBlob(raw) {
|
|
6381
6610
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6384,7 +6613,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6384
6613
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6385
6614
|
return result.kind === "missing" ? {} : result.value;
|
|
6386
6615
|
}
|
|
6387
|
-
function
|
|
6616
|
+
function touchesTree(tree, patch) {
|
|
6617
|
+
if (tree.size === 0) return false;
|
|
6618
|
+
for (const key of Object.keys(patch)) {
|
|
6619
|
+
const at = key.indexOf("@");
|
|
6620
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6621
|
+
}
|
|
6622
|
+
return false;
|
|
6623
|
+
}
|
|
6624
|
+
/**
|
|
6625
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6626
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6627
|
+
*/
|
|
6628
|
+
var MarkerKeyIndex = class {
|
|
6629
|
+
owner;
|
|
6630
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6631
|
+
constructor(owner) {
|
|
6632
|
+
this.owner = owner;
|
|
6633
|
+
}
|
|
6634
|
+
seen(store, blob) {
|
|
6635
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6636
|
+
}
|
|
6637
|
+
wrote(store, patch) {
|
|
6638
|
+
const keys = this.byStore.get(store);
|
|
6639
|
+
if (keys === void 0) return;
|
|
6640
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6641
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6642
|
+
else keys.delete(key);
|
|
6643
|
+
}
|
|
6644
|
+
mayHoldMarkers(store, patch) {
|
|
6645
|
+
const keys = this.byStore.get(store);
|
|
6646
|
+
if (keys === void 0) return true;
|
|
6647
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6648
|
+
}
|
|
6649
|
+
};
|
|
6650
|
+
function createHandle(raw, opts) {
|
|
6388
6651
|
const chains = /* @__PURE__ */ new Map();
|
|
6389
6652
|
const serialize = (key, fn) => {
|
|
6390
6653
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6395,46 +6658,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6395
6658
|
});
|
|
6396
6659
|
return next;
|
|
6397
6660
|
};
|
|
6398
|
-
const
|
|
6399
|
-
|
|
6400
|
-
|
|
6661
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6662
|
+
const resolveRead = async (store, blob) => {
|
|
6663
|
+
index.seen(store, blob);
|
|
6664
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6665
|
+
unresolved: "keep-marker",
|
|
6666
|
+
ownedBy: opts.secrets.owner
|
|
6667
|
+
});
|
|
6668
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6669
|
+
return value;
|
|
6670
|
+
};
|
|
6671
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6672
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6673
|
+
await rawWrite(patch);
|
|
6674
|
+
index.wrote(store, patch);
|
|
6675
|
+
return { changed: true };
|
|
6676
|
+
}
|
|
6677
|
+
return serialize(store, async () => {
|
|
6401
6678
|
const stored = await readStored();
|
|
6679
|
+
index.seen(store, stored);
|
|
6680
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6681
|
+
const restored = await restoreUnchangedSecrets({
|
|
6682
|
+
patch,
|
|
6683
|
+
stored,
|
|
6684
|
+
secrets: opts.secrets,
|
|
6685
|
+
operatorWrite
|
|
6686
|
+
});
|
|
6402
6687
|
const result = await transformSecretWrite({
|
|
6403
|
-
tree,
|
|
6688
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6404
6689
|
secrets: opts.secrets,
|
|
6405
|
-
patch,
|
|
6690
|
+
patch: restored.patch,
|
|
6406
6691
|
stored,
|
|
6407
6692
|
...scope !== void 0 ? { scope } : {},
|
|
6408
|
-
operatorWrite
|
|
6693
|
+
operatorWrite
|
|
6409
6694
|
});
|
|
6410
|
-
|
|
6695
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6696
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6697
|
+
if (wroteBlob) {
|
|
6698
|
+
await rawWrite(effective);
|
|
6699
|
+
index.wrote(store, effective);
|
|
6700
|
+
}
|
|
6411
6701
|
const { orphaned } = await result.afterWrite();
|
|
6412
6702
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6703
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6413
6704
|
});
|
|
6414
6705
|
};
|
|
6415
|
-
const
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6706
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6707
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6708
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6709
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6710
|
+
const overrides = {
|
|
6711
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6712
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6713
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6714
|
+
return result.kind === "value" ? {
|
|
6715
|
+
kind: "value",
|
|
6716
|
+
value: await resolveRead("addon", result.value)
|
|
6717
|
+
} : result;
|
|
6718
|
+
} } : {},
|
|
6719
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6720
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6721
|
+
if (result.kind !== "present") return result;
|
|
6722
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6723
|
+
unresolved: "keep-marker",
|
|
6724
|
+
ownedBy: opts.secrets.owner
|
|
6725
|
+
});
|
|
6726
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6727
|
+
return {
|
|
6728
|
+
kind: "present",
|
|
6729
|
+
value: value[key]
|
|
6730
|
+
};
|
|
6731
|
+
} } : {},
|
|
6732
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6733
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6734
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6735
|
+
const out = /* @__PURE__ */ new Map();
|
|
6736
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6737
|
+
return out;
|
|
6738
|
+
} } : {},
|
|
6739
|
+
writeAddonStore: async (patch) => {
|
|
6740
|
+
await writeAddon(patch);
|
|
6741
|
+
},
|
|
6742
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6743
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6744
|
+
kind: "device",
|
|
6745
|
+
deviceId
|
|
6746
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6747
|
+
}
|
|
6748
|
+
};
|
|
6749
|
+
return {
|
|
6750
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6751
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6752
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6753
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6754
|
+
} }),
|
|
6755
|
+
raw: {
|
|
6756
|
+
readAddonStore: async () => {
|
|
6757
|
+
const blob = await raw.readAddonStore();
|
|
6758
|
+
index.seen("addon", blob);
|
|
6759
|
+
return blob;
|
|
6760
|
+
},
|
|
6761
|
+
readDeviceStore: async (deviceId) => {
|
|
6762
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6763
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6764
|
+
return blob;
|
|
6765
|
+
}
|
|
6766
|
+
},
|
|
6767
|
+
writeAddonStore: writeAddon
|
|
6421
6768
|
};
|
|
6422
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6423
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6424
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6425
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6426
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6427
|
-
} });
|
|
6428
6769
|
}
|
|
6429
|
-
/** The context the addon sees
|
|
6430
|
-
function
|
|
6770
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6771
|
+
function createSecretAwareContext(context, opts) {
|
|
6431
6772
|
const raw = context.settings;
|
|
6432
|
-
if (raw === void 0) return
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6773
|
+
if (raw === void 0) return {
|
|
6774
|
+
context,
|
|
6775
|
+
handle: null
|
|
6776
|
+
};
|
|
6777
|
+
const handle = createHandle(raw, opts);
|
|
6778
|
+
return {
|
|
6779
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6780
|
+
if (prop === "settings") return handle.settings;
|
|
6781
|
+
return Reflect.get(target, prop, receiver);
|
|
6782
|
+
} }),
|
|
6783
|
+
handle
|
|
6784
|
+
};
|
|
6438
6785
|
}
|
|
6439
6786
|
var LEAF = { kind: "leaf" };
|
|
6440
6787
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6609,6 +6956,14 @@ var BaseAddon = class {
|
|
|
6609
6956
|
_secretChangeUnsub = null;
|
|
6610
6957
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6611
6958
|
_operatorWriteDepth = 0;
|
|
6959
|
+
/**
|
|
6960
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6961
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6962
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6963
|
+
*/
|
|
6964
|
+
_secretSettings = null;
|
|
6965
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6966
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6612
6967
|
constructor(defaults) {
|
|
6613
6968
|
this.defaults = defaults;
|
|
6614
6969
|
this._config = { ...defaults };
|
|
@@ -6645,13 +7000,21 @@ var BaseAddon = class {
|
|
|
6645
7000
|
}
|
|
6646
7001
|
async initialize(context) {
|
|
6647
7002
|
const secrets = context.secrets;
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
7003
|
+
if (secrets !== void 0) {
|
|
7004
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7005
|
+
secrets,
|
|
7006
|
+
addonTree: () => this.addonSecretTree(),
|
|
7007
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7008
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7009
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7010
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7011
|
+
});
|
|
7012
|
+
this._ctx = wrapped;
|
|
7013
|
+
this._secretSettings = handle;
|
|
7014
|
+
} else {
|
|
7015
|
+
this._ctx = context;
|
|
7016
|
+
this._secretSettings = null;
|
|
7017
|
+
}
|
|
6655
7018
|
await this.resolveConfig();
|
|
6656
7019
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6657
7020
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6768,11 +7131,8 @@ var BaseAddon = class {
|
|
|
6768
7131
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6769
7132
|
const schema = this.globalSettingsSchema(cap);
|
|
6770
7133
|
if (!schema) return { sections: [] };
|
|
6771
|
-
const projected = await this.
|
|
6772
|
-
return hydrateSchema(schema, overlay ? {
|
|
6773
|
-
...projected,
|
|
6774
|
-
...overlay
|
|
6775
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7134
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7135
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6776
7136
|
}
|
|
6777
7137
|
/**
|
|
6778
7138
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6817,7 +7177,7 @@ var BaseAddon = class {
|
|
|
6817
7177
|
});
|
|
6818
7178
|
}
|
|
6819
7179
|
if (sections.length === 0) return null;
|
|
6820
|
-
const projected = await this.
|
|
7180
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6821
7181
|
return hydrateSchema({
|
|
6822
7182
|
...schema,
|
|
6823
7183
|
sections
|
|
@@ -6834,12 +7194,50 @@ var BaseAddon = class {
|
|
|
6834
7194
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6835
7195
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6836
7196
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7197
|
+
*
|
|
7198
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7199
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7200
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7201
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7202
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7203
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6837
7204
|
*/
|
|
6838
7205
|
async resolveGlobalStore(nodeId, cap) {
|
|
6839
7206
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7207
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7208
|
+
}
|
|
7209
|
+
projectForNode(store, nodeId, cap) {
|
|
6840
7210
|
const keys = this.perNodeKeys(cap);
|
|
6841
7211
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6842
|
-
return keys.size > 0 ? projectStore(
|
|
7212
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7213
|
+
}
|
|
7214
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7215
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7216
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7217
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7218
|
+
}
|
|
7219
|
+
/**
|
|
7220
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7221
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7222
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7223
|
+
* its value.
|
|
7224
|
+
*/
|
|
7225
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7226
|
+
const secrets = this._ctx?.secrets;
|
|
7227
|
+
const merged = {
|
|
7228
|
+
...stored,
|
|
7229
|
+
...overlay
|
|
7230
|
+
};
|
|
7231
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7232
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7233
|
+
unresolved: "keep-marker",
|
|
7234
|
+
ownedBy: secrets.owner
|
|
7235
|
+
});
|
|
7236
|
+
for (const key of Object.keys(overlay)) {
|
|
7237
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7238
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7239
|
+
}
|
|
7240
|
+
return merged;
|
|
6843
7241
|
}
|
|
6844
7242
|
/**
|
|
6845
7243
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6904,8 +7302,12 @@ var BaseAddon = class {
|
|
|
6904
7302
|
async clearSecrets(keys, nodeId) {
|
|
6905
7303
|
const tree = this.addonSecretTree();
|
|
6906
7304
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7305
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6907
7306
|
const patch = {};
|
|
6908
|
-
for (const key of keys)
|
|
7307
|
+
for (const key of keys) {
|
|
7308
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7309
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7310
|
+
}
|
|
6909
7311
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6910
7312
|
}
|
|
6911
7313
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6913,7 +7315,11 @@ var BaseAddon = class {
|
|
|
6913
7315
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6914
7316
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6915
7317
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6916
|
-
|
|
7318
|
+
const handle = this._secretSettings;
|
|
7319
|
+
if (handle !== null) {
|
|
7320
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7321
|
+
if (!changed) return;
|
|
7322
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6917
7323
|
if (target !== localNode) return;
|
|
6918
7324
|
await this.resolveConfig();
|
|
6919
7325
|
await this.onConfigChanged();
|
|
@@ -6966,7 +7372,7 @@ var BaseAddon = class {
|
|
|
6966
7372
|
async getDeviceSettings(deviceId) {
|
|
6967
7373
|
const schema = this.deviceSettingsSchema();
|
|
6968
7374
|
if (!schema) return { sections: [] };
|
|
6969
|
-
return hydrateSchema(schema, await this.
|
|
7375
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6970
7376
|
}
|
|
6971
7377
|
async updateDeviceSettings(deviceId, patch) {
|
|
6972
7378
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7138,7 +7544,7 @@ var BaseAddon = class {
|
|
|
7138
7544
|
key,
|
|
7139
7545
|
schema,
|
|
7140
7546
|
fallback,
|
|
7141
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7547
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7142
7548
|
write: async (patch) => {
|
|
7143
7549
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7144
7550
|
},
|
|
@@ -7200,6 +7606,23 @@ var BaseAddon = class {
|
|
|
7200
7606
|
}
|
|
7201
7607
|
return value;
|
|
7202
7608
|
}
|
|
7609
|
+
/**
|
|
7610
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7611
|
+
* keychain the context's own view is already raw.
|
|
7612
|
+
*/
|
|
7613
|
+
rawSettings() {
|
|
7614
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7615
|
+
}
|
|
7616
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7617
|
+
logUnresolvedRead(unresolved) {
|
|
7618
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7619
|
+
if (fresh.length === 0) return;
|
|
7620
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7621
|
+
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) => ({
|
|
7622
|
+
ref: u.ref,
|
|
7623
|
+
reason: u.reason
|
|
7624
|
+
})) } });
|
|
7625
|
+
}
|
|
7203
7626
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7204
7627
|
scheduleSecretReresolve(delayMs) {
|
|
7205
7628
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7226,7 +7649,7 @@ var BaseAddon = class {
|
|
|
7226
7649
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7227
7650
|
*/
|
|
7228
7651
|
async readAddonStoreWithRetry() {
|
|
7229
|
-
const settings = this.
|
|
7652
|
+
const settings = this.rawSettings();
|
|
7230
7653
|
if (!settings) return {};
|
|
7231
7654
|
const delaysMs = [
|
|
7232
7655
|
150,
|
|
@@ -9601,6 +10024,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9601
10024
|
fetchedAt: number()
|
|
9602
10025
|
});
|
|
9603
10026
|
/**
|
|
10027
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10028
|
+
* gets back (cloud training, D805+).
|
|
10029
|
+
*
|
|
10030
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10031
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10032
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10033
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10034
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10035
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10036
|
+
* change there, in the same piece of work.
|
|
10037
|
+
*
|
|
10038
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10039
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10040
|
+
*/
|
|
10041
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10042
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10043
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10044
|
+
var TrainingExportSchema = _enum([
|
|
10045
|
+
"onnx",
|
|
10046
|
+
"openvino-fp16",
|
|
10047
|
+
"openvino-int8",
|
|
10048
|
+
"coreml-fp16"
|
|
10049
|
+
]);
|
|
10050
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10051
|
+
object({
|
|
10052
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10053
|
+
jobKey: string().uuid(),
|
|
10054
|
+
target: object({
|
|
10055
|
+
kind: literal("detector"),
|
|
10056
|
+
step: literal("object-detection")
|
|
10057
|
+
}),
|
|
10058
|
+
base: object({
|
|
10059
|
+
modelId: string().min(1),
|
|
10060
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10061
|
+
weights: string().min(1),
|
|
10062
|
+
imgsz: number().int().positive()
|
|
10063
|
+
}),
|
|
10064
|
+
baseline: object({
|
|
10065
|
+
modelId: string().min(1),
|
|
10066
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10067
|
+
onnxUrl: string().url(),
|
|
10068
|
+
imgsz: number().int().positive(),
|
|
10069
|
+
floors: FloorsSchema
|
|
10070
|
+
}),
|
|
10071
|
+
dataset: object({
|
|
10072
|
+
versionId: string().min(1),
|
|
10073
|
+
annotationHash: string(),
|
|
10074
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10075
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10076
|
+
}),
|
|
10077
|
+
split: object({
|
|
10078
|
+
holdoutCameras: array(number().int()),
|
|
10079
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10080
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10081
|
+
valFraction: number().min(0).max(.5),
|
|
10082
|
+
seed: number().int()
|
|
10083
|
+
}),
|
|
10084
|
+
hyper: object({
|
|
10085
|
+
epochs: number().int().positive(),
|
|
10086
|
+
batch: number().int().positive(),
|
|
10087
|
+
lr0: number().positive(),
|
|
10088
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10089
|
+
freeze: number().int().nonnegative(),
|
|
10090
|
+
patience: number().int().nonnegative(),
|
|
10091
|
+
seed: number().int()
|
|
10092
|
+
}),
|
|
10093
|
+
replay: object({
|
|
10094
|
+
source: literal("coco2017"),
|
|
10095
|
+
count: number().int().nonnegative()
|
|
10096
|
+
}),
|
|
10097
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10098
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10099
|
+
floors: object({
|
|
10100
|
+
minSupport: number().int().positive(),
|
|
10101
|
+
clamp: number().min(0).max(1)
|
|
10102
|
+
}),
|
|
10103
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10104
|
+
catalog: object({
|
|
10105
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10106
|
+
name: string().min(1).max(160)
|
|
10107
|
+
})
|
|
10108
|
+
});
|
|
10109
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10110
|
+
var TrainingResultFileSchema = object({
|
|
10111
|
+
path: string().min(1),
|
|
10112
|
+
bytes: number().int().nonnegative(),
|
|
10113
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10114
|
+
format: _enum([
|
|
10115
|
+
"onnx",
|
|
10116
|
+
"openvino",
|
|
10117
|
+
"coreml",
|
|
10118
|
+
"pt"
|
|
10119
|
+
]),
|
|
10120
|
+
variant: _enum(["base", "int8"])
|
|
10121
|
+
});
|
|
10122
|
+
var DraftFormatSchema = object({
|
|
10123
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10124
|
+
url: string().min(1),
|
|
10125
|
+
sizeMB: number().nonnegative(),
|
|
10126
|
+
isDirectory: boolean().optional(),
|
|
10127
|
+
files: array(string()).optional(),
|
|
10128
|
+
runtimes: array(literal("python")).optional(),
|
|
10129
|
+
revision: string().min(1)
|
|
10130
|
+
});
|
|
10131
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10132
|
+
var TrainingCatalogDraftSchema = object({
|
|
10133
|
+
id: string().min(1),
|
|
10134
|
+
name: string().min(1),
|
|
10135
|
+
description: string(),
|
|
10136
|
+
labels: array(unknown()),
|
|
10137
|
+
inputSize: object({
|
|
10138
|
+
width: number().int().positive(),
|
|
10139
|
+
height: number().int().positive()
|
|
10140
|
+
}),
|
|
10141
|
+
preprocessMode: literal("letterbox"),
|
|
10142
|
+
defaultClassFloors: FloorsSchema,
|
|
10143
|
+
formats: object({
|
|
10144
|
+
onnx: DraftFormatSchema.optional(),
|
|
10145
|
+
openvino: DraftFormatSchema.optional(),
|
|
10146
|
+
coreml: DraftFormatSchema.optional()
|
|
10147
|
+
})
|
|
10148
|
+
});
|
|
10149
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10150
|
+
var TrainingEvalClassSchema = object({
|
|
10151
|
+
positives: number().int(),
|
|
10152
|
+
floor: number().nullable(),
|
|
10153
|
+
tp: number().int(),
|
|
10154
|
+
fp: number().int(),
|
|
10155
|
+
fn: number().int(),
|
|
10156
|
+
precision: number().nullable(),
|
|
10157
|
+
recall: number().nullable(),
|
|
10158
|
+
ap50: number().nullable(),
|
|
10159
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10160
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10161
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10162
|
+
smallFound: number().int().optional(),
|
|
10163
|
+
smallTotal: number().int().optional()
|
|
10164
|
+
}).passthrough();
|
|
10165
|
+
var TrainingEvalReportSchema = object({
|
|
10166
|
+
frames: number().int(),
|
|
10167
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10168
|
+
}).passthrough();
|
|
10169
|
+
/**
|
|
10170
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10171
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10172
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10173
|
+
*/
|
|
10174
|
+
var TrainingResultSchema = object({
|
|
10175
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10176
|
+
jobKey: string(),
|
|
10177
|
+
status: _enum(["succeeded", "failed"]),
|
|
10178
|
+
error: object({
|
|
10179
|
+
stage: string(),
|
|
10180
|
+
code: string(),
|
|
10181
|
+
message: string()
|
|
10182
|
+
}).nullable(),
|
|
10183
|
+
trainer: object({
|
|
10184
|
+
version: string(),
|
|
10185
|
+
revision: string()
|
|
10186
|
+
}),
|
|
10187
|
+
toolchain: record(string(), string().nullable()),
|
|
10188
|
+
dataset: object({
|
|
10189
|
+
versionId: string(),
|
|
10190
|
+
annotationHash: string(),
|
|
10191
|
+
sha256: string(),
|
|
10192
|
+
frames: object({
|
|
10193
|
+
train: number().int(),
|
|
10194
|
+
val: number().int(),
|
|
10195
|
+
holdout: number().int()
|
|
10196
|
+
}),
|
|
10197
|
+
holdoutCameras: array(number().int()),
|
|
10198
|
+
replayImages: number().int()
|
|
10199
|
+
}).optional(),
|
|
10200
|
+
training: object({
|
|
10201
|
+
epochsRun: number().int(),
|
|
10202
|
+
bestEpoch: number().int(),
|
|
10203
|
+
bestMap50: number(),
|
|
10204
|
+
bestMap50_95: number(),
|
|
10205
|
+
seconds: number()
|
|
10206
|
+
}).optional(),
|
|
10207
|
+
evaluation: object({
|
|
10208
|
+
holdoutFrames: number().int(),
|
|
10209
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10210
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10211
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10212
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10213
|
+
map50: record(string(), number().nullable())
|
|
10214
|
+
}).optional(),
|
|
10215
|
+
floors: object({
|
|
10216
|
+
baseline: FloorsSchema,
|
|
10217
|
+
candidate: FloorsSchema,
|
|
10218
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10219
|
+
notes: array(string())
|
|
10220
|
+
}).optional(),
|
|
10221
|
+
int8: object({
|
|
10222
|
+
kept: boolean(),
|
|
10223
|
+
map50Fp16: number().nullable(),
|
|
10224
|
+
map50Int8: number().nullable(),
|
|
10225
|
+
reason: string().nullable()
|
|
10226
|
+
}).optional(),
|
|
10227
|
+
exportsDropped: array(object({
|
|
10228
|
+
export: string(),
|
|
10229
|
+
reason: string()
|
|
10230
|
+
})).optional(),
|
|
10231
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10232
|
+
bundle: object({
|
|
10233
|
+
path: literal("bundle.tar"),
|
|
10234
|
+
bytes: number().int().nonnegative(),
|
|
10235
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10236
|
+
}).nullable().optional(),
|
|
10237
|
+
catalogDraft: object({
|
|
10238
|
+
base: TrainingCatalogDraftSchema,
|
|
10239
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10240
|
+
}).nullable().optional(),
|
|
10241
|
+
licence: string()
|
|
10242
|
+
});
|
|
10243
|
+
var TrainingStageSchema = _enum([
|
|
10244
|
+
"prepare",
|
|
10245
|
+
"replay",
|
|
10246
|
+
"train",
|
|
10247
|
+
"eval",
|
|
10248
|
+
"export",
|
|
10249
|
+
"package"
|
|
10250
|
+
]);
|
|
10251
|
+
var EventBase = {
|
|
10252
|
+
v: literal(1),
|
|
10253
|
+
ts: number()
|
|
10254
|
+
};
|
|
10255
|
+
discriminatedUnion("type", [
|
|
10256
|
+
object({
|
|
10257
|
+
...EventBase,
|
|
10258
|
+
type: literal("stage"),
|
|
10259
|
+
stage: TrainingStageSchema
|
|
10260
|
+
}),
|
|
10261
|
+
object({
|
|
10262
|
+
...EventBase,
|
|
10263
|
+
type: literal("epoch"),
|
|
10264
|
+
epoch: number().int(),
|
|
10265
|
+
epochs: number().int(),
|
|
10266
|
+
boxLoss: number().nullable().optional(),
|
|
10267
|
+
map50: number().nullable().optional(),
|
|
10268
|
+
map50_95: number().nullable().optional(),
|
|
10269
|
+
etaSec: number().nullable().optional()
|
|
10270
|
+
}),
|
|
10271
|
+
object({
|
|
10272
|
+
...EventBase,
|
|
10273
|
+
type: literal("metric"),
|
|
10274
|
+
name: string(),
|
|
10275
|
+
value: number()
|
|
10276
|
+
}),
|
|
10277
|
+
object({
|
|
10278
|
+
...EventBase,
|
|
10279
|
+
type: literal("artifact"),
|
|
10280
|
+
path: string(),
|
|
10281
|
+
bytes: number(),
|
|
10282
|
+
sha256: string()
|
|
10283
|
+
}),
|
|
10284
|
+
object({
|
|
10285
|
+
...EventBase,
|
|
10286
|
+
type: literal("done"),
|
|
10287
|
+
status: _enum(["succeeded", "failed"]),
|
|
10288
|
+
resultSha256: string().nullable().optional()
|
|
10289
|
+
}),
|
|
10290
|
+
object({
|
|
10291
|
+
...EventBase,
|
|
10292
|
+
type: literal("error"),
|
|
10293
|
+
stage: string(),
|
|
10294
|
+
code: string(),
|
|
10295
|
+
message: string()
|
|
10296
|
+
})
|
|
10297
|
+
]);
|
|
10298
|
+
/**
|
|
9604
10299
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9605
10300
|
*
|
|
9606
10301
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11935,7 +12630,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11935
12630
|
"authenticated",
|
|
11936
12631
|
"admin"
|
|
11937
12632
|
]).optional(),
|
|
11938
|
-
description: string().optional()
|
|
12633
|
+
description: string().optional(),
|
|
12634
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12635
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11939
12636
|
});
|
|
11940
12637
|
/**
|
|
11941
12638
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12659,6 +13356,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12659
13356
|
lastError: string().optional()
|
|
12660
13357
|
});
|
|
12661
13358
|
/**
|
|
13359
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13360
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13361
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13362
|
+
* with it off — which restores without a key.
|
|
13363
|
+
*/
|
|
13364
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13365
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13366
|
+
scheme: string(),
|
|
13367
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13368
|
+
keyId: string()
|
|
13369
|
+
});
|
|
13370
|
+
/**
|
|
13371
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13372
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13373
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13374
|
+
*/
|
|
13375
|
+
var BackupEncryptionStatusSchema = object({
|
|
13376
|
+
enabled: boolean(),
|
|
13377
|
+
active: object({
|
|
13378
|
+
keyId: string(),
|
|
13379
|
+
publicKey: string(),
|
|
13380
|
+
createdAt: number()
|
|
13381
|
+
}).nullable(),
|
|
13382
|
+
/** Every key ever set up, newest first. */
|
|
13383
|
+
keys: array(object({
|
|
13384
|
+
keyId: string(),
|
|
13385
|
+
createdAt: number(),
|
|
13386
|
+
retiredAt: number().nullable()
|
|
13387
|
+
})).readonly()
|
|
13388
|
+
});
|
|
13389
|
+
/**
|
|
12662
13390
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12663
13391
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12664
13392
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12670,7 +13398,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12670
13398
|
sizeBytes: number(),
|
|
12671
13399
|
label: string().optional(),
|
|
12672
13400
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12673
|
-
locations: array(string()).readonly()
|
|
13401
|
+
locations: array(string()).readonly(),
|
|
13402
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13403
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12674
13404
|
});
|
|
12675
13405
|
var BackupEntrySchema = object({
|
|
12676
13406
|
id: string(),
|
|
@@ -12679,7 +13409,8 @@ var BackupEntrySchema = object({
|
|
|
12679
13409
|
label: string().optional(),
|
|
12680
13410
|
createdAt: number(),
|
|
12681
13411
|
sizeBytes: number(),
|
|
12682
|
-
locations: array(string()).optional()
|
|
13412
|
+
locations: array(string()).optional(),
|
|
13413
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12683
13414
|
});
|
|
12684
13415
|
var ArchiveEntrySchema = object({
|
|
12685
13416
|
path: string(),
|
|
@@ -12868,10 +13599,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12868
13599
|
* this list and skips entries whose path doesn't start with
|
|
12869
13600
|
* any of them.
|
|
12870
13601
|
*/
|
|
12871
|
-
locations: array(string()).optional()
|
|
13602
|
+
locations: array(string()).optional(),
|
|
13603
|
+
/**
|
|
13604
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13605
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13606
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13607
|
+
* is refused before the archive is downloaded.
|
|
13608
|
+
*/
|
|
13609
|
+
backupSecretKey: string().optional()
|
|
12872
13610
|
}), _void(), {
|
|
12873
13611
|
kind: "mutation",
|
|
12874
13612
|
auth: "admin"
|
|
13613
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13614
|
+
keyId: string(),
|
|
13615
|
+
secretKey: string(),
|
|
13616
|
+
publicKey: string(),
|
|
13617
|
+
createdAt: number(),
|
|
13618
|
+
replacedKeyId: string().nullable()
|
|
13619
|
+
}), {
|
|
13620
|
+
kind: "mutation",
|
|
13621
|
+
auth: "admin"
|
|
13622
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13623
|
+
kind: "mutation",
|
|
13624
|
+
auth: "admin"
|
|
13625
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13626
|
+
valid: boolean(),
|
|
13627
|
+
keyId: string().nullable(),
|
|
13628
|
+
/** The hub knows this key (active or retired). */
|
|
13629
|
+
known: boolean(),
|
|
13630
|
+
/** It is the key new archives are encrypted to. */
|
|
13631
|
+
active: boolean(),
|
|
13632
|
+
error: string().optional()
|
|
13633
|
+
}), {
|
|
13634
|
+
kind: "mutation",
|
|
13635
|
+
auth: "admin"
|
|
12875
13636
|
}), method(object({
|
|
12876
13637
|
destinationId: string(),
|
|
12877
13638
|
backupId: string()
|
|
@@ -14495,7 +15256,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14495
15256
|
stepId: string(),
|
|
14496
15257
|
entry: ModelCatalogEntrySchema
|
|
14497
15258
|
});
|
|
14498
|
-
|
|
15259
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15260
|
+
var ModelBundleFileSchema = object({
|
|
15261
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15262
|
+
path: string().min(1),
|
|
15263
|
+
bytes: number().int().nonnegative(),
|
|
15264
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15265
|
+
});
|
|
15266
|
+
var ImportModelBundleInputSchema = object({
|
|
15267
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15268
|
+
addonId: string(),
|
|
15269
|
+
stepId: string().min(1),
|
|
15270
|
+
/**
|
|
15271
|
+
* The catalog rows to register, complete, every format URL already
|
|
15272
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15273
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15274
|
+
*/
|
|
15275
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15276
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15277
|
+
bundle: object({
|
|
15278
|
+
ticket: PeerBytesTicketSchema,
|
|
15279
|
+
bytes: number().int().positive(),
|
|
15280
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15281
|
+
}),
|
|
15282
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15283
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15284
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15285
|
+
distribute: boolean()
|
|
15286
|
+
});
|
|
15287
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15288
|
+
kind: literal("imported"),
|
|
15289
|
+
modelIds: array(string()).readonly(),
|
|
15290
|
+
distributed: array(object({
|
|
15291
|
+
modelId: string(),
|
|
15292
|
+
nodeId: string(),
|
|
15293
|
+
format: _enum(MODEL_FORMATS),
|
|
15294
|
+
ok: boolean(),
|
|
15295
|
+
error: string().optional()
|
|
15296
|
+
})).readonly()
|
|
15297
|
+
}), object({
|
|
15298
|
+
kind: literal("refused"),
|
|
15299
|
+
reason: _enum([
|
|
15300
|
+
"transfer-failed",
|
|
15301
|
+
"checksum-mismatch",
|
|
15302
|
+
"bundle-mismatch",
|
|
15303
|
+
"invalid-entry",
|
|
15304
|
+
"id-taken"
|
|
15305
|
+
]),
|
|
15306
|
+
detail: string()
|
|
15307
|
+
})]);
|
|
15308
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15309
|
+
kind: "mutation",
|
|
15310
|
+
auth: "admin",
|
|
15311
|
+
timeoutMs: 30 * 6e4
|
|
15312
|
+
});
|
|
14499
15313
|
/**
|
|
14500
15314
|
* Query filter for settings-store collections.
|
|
14501
15315
|
*/
|
|
@@ -14974,6 +15788,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14974
15788
|
*/
|
|
14975
15789
|
sharesBackupWithDatabase: boolean()
|
|
14976
15790
|
});
|
|
15791
|
+
/**
|
|
15792
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15793
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15794
|
+
*/
|
|
15795
|
+
var KeychainResetRecordSchema = object({
|
|
15796
|
+
id: string(),
|
|
15797
|
+
at: number(),
|
|
15798
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15799
|
+
actor: string(),
|
|
15800
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15801
|
+
lockedReason: string().nullable(),
|
|
15802
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15803
|
+
archived: number().int(),
|
|
15804
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15805
|
+
archivedCollection: string().nullable(),
|
|
15806
|
+
/**
|
|
15807
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15808
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15809
|
+
*/
|
|
15810
|
+
archivedKeysCollection: string().nullable(),
|
|
15811
|
+
/**
|
|
15812
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15813
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15814
|
+
* agent forever (D797).
|
|
15815
|
+
*/
|
|
15816
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15817
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15818
|
+
acknowledgedAt: number().nullable()
|
|
15819
|
+
});
|
|
14977
15820
|
var KeychainStatusSchema = object({
|
|
14978
15821
|
keychain: KeychainStateSchema,
|
|
14979
15822
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14991,7 +15834,9 @@ var KeychainStatusSchema = object({
|
|
|
14991
15834
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14992
15835
|
retiredWraps: number().int(),
|
|
14993
15836
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14994
|
-
secretCount: number().int()
|
|
15837
|
+
secretCount: number().int(),
|
|
15838
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15839
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14995
15840
|
});
|
|
14996
15841
|
/**
|
|
14997
15842
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15013,17 +15858,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15013
15858
|
"download-recovery-key",
|
|
15014
15859
|
"delete-orphans",
|
|
15015
15860
|
"reset",
|
|
15861
|
+
"acknowledge-reset",
|
|
15016
15862
|
"initialize"
|
|
15017
15863
|
]);
|
|
15018
15864
|
var KeychainAuditEntrySchema = object({
|
|
15019
15865
|
id: string(),
|
|
15020
15866
|
at: number(),
|
|
15021
15867
|
action: KeychainAuditActionSchema,
|
|
15022
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15868
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15023
15869
|
actor: string(),
|
|
15024
15870
|
ref: string().nullable(),
|
|
15025
15871
|
detail: string().nullable()
|
|
15026
15872
|
});
|
|
15873
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15874
|
+
/**
|
|
15875
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15876
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15877
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15878
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15879
|
+
*/
|
|
15880
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15027
15881
|
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({
|
|
15028
15882
|
value: string(),
|
|
15029
15883
|
version: number().int()
|
|
@@ -15031,6 +15885,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15031
15885
|
kind: "mutation",
|
|
15032
15886
|
auth: "admin",
|
|
15033
15887
|
caller: "required"
|
|
15888
|
+
}), method(object({
|
|
15889
|
+
name: SystemHeldSecretNameSchema,
|
|
15890
|
+
value: string().min(16)
|
|
15891
|
+
}), object({
|
|
15892
|
+
ref: string(),
|
|
15893
|
+
version: number().int()
|
|
15894
|
+
}), {
|
|
15895
|
+
kind: "mutation",
|
|
15896
|
+
auth: "admin",
|
|
15897
|
+
caller: "required"
|
|
15034
15898
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15035
15899
|
deleted: array(string()).readonly(),
|
|
15036
15900
|
kept: array(object({
|
|
@@ -15060,13 +15924,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15060
15924
|
kind: "mutation",
|
|
15061
15925
|
auth: "admin",
|
|
15062
15926
|
caller: "required"
|
|
15063
|
-
}), method(object({ confirm: literal(
|
|
15927
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15064
15928
|
archivedCollection: string().nullable(),
|
|
15065
15929
|
archived: number().int()
|
|
15066
15930
|
}), {
|
|
15067
15931
|
kind: "mutation",
|
|
15068
15932
|
auth: "admin",
|
|
15069
15933
|
caller: "required"
|
|
15934
|
+
}), method(object({}), object({
|
|
15935
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15936
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15937
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15938
|
+
kind: "mutation",
|
|
15939
|
+
auth: "admin",
|
|
15940
|
+
caller: "required"
|
|
15070
15941
|
});
|
|
15071
15942
|
method(_void(), object({
|
|
15072
15943
|
id: string(),
|
|
@@ -17737,7 +18608,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17737
18608
|
* `login-method` — collection cap through which auth addons contribute
|
|
17738
18609
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17739
18610
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17740
|
-
* every auth addon (OIDC,
|
|
18611
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17741
18612
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17742
18613
|
* procedure aggregates them for the unauthenticated login page.
|
|
17743
18614
|
*
|
|
@@ -17745,8 +18616,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17745
18616
|
*
|
|
17746
18617
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17747
18618
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17748
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17749
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18619
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17750
18620
|
* login page needs NO change.
|
|
17751
18621
|
*
|
|
17752
18622
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17765,8 +18635,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17765
18635
|
* decision.
|
|
17766
18636
|
*
|
|
17767
18637
|
* Every contribution carries a `stage`:
|
|
17768
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17769
|
-
*
|
|
18638
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18639
|
+
* buttons; a usernameless passkey).
|
|
17770
18640
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17771
18641
|
* returned `factors` (passkey-as-2FA today).
|
|
17772
18642
|
*
|
|
@@ -17793,7 +18663,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17793
18663
|
* The provider names an external identity a signed-in user can link to
|
|
17794
18664
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17795
18665
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17796
|
-
* whatever their id. Absent / false — a login button only
|
|
18666
|
+
* whatever their id. Absent / false — a login button only.
|
|
17797
18667
|
*/
|
|
17798
18668
|
linkable: boolean().optional()
|
|
17799
18669
|
}),
|
|
@@ -21610,8 +22480,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21610
22480
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21611
22481
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21612
22482
|
* distinction was only ever used to route role-specific procedures
|
|
21613
|
-
* which we no longer have.
|
|
21614
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22483
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21615
22484
|
* with `isAdmin: false` + an explicit scope list.
|
|
21616
22485
|
*/
|
|
21617
22486
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23302,6 +24171,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23302
24171
|
frameIds: array(string()).max(2e4).optional(),
|
|
23303
24172
|
/** Only frames in at least one of these named collections. */
|
|
23304
24173
|
collectionIds: array(string()).max(200).optional(),
|
|
24174
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24175
|
+
* unknown id selects nothing. */
|
|
24176
|
+
datasetVersionId: string().optional(),
|
|
23305
24177
|
batchId: string().optional(),
|
|
23306
24178
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23307
24179
|
completeOnly: boolean().optional()
|
|
@@ -23469,6 +24341,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23469
24341
|
]),
|
|
23470
24342
|
detail: string().optional()
|
|
23471
24343
|
})]);
|
|
24344
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24345
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24346
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24347
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24348
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24349
|
+
});
|
|
24350
|
+
/** The counts a dataset is judged by. */
|
|
24351
|
+
var RetrainDatasetStatsSchema = object({
|
|
24352
|
+
frames: number().int(),
|
|
24353
|
+
completeFrames: number().int(),
|
|
24354
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24355
|
+
completeness: number(),
|
|
24356
|
+
/** Boxes to learn (model errors excluded). */
|
|
24357
|
+
subjects: number().int(),
|
|
24358
|
+
modelErrors: number().int(),
|
|
24359
|
+
/** Complete frames with no subject. */
|
|
24360
|
+
hardNegatives: number().int(),
|
|
24361
|
+
/** Subjects per class × camera × day/night. */
|
|
24362
|
+
cells: array(object({
|
|
24363
|
+
macroClass: string(),
|
|
24364
|
+
deviceId: number(),
|
|
24365
|
+
lighting: _enum([
|
|
24366
|
+
"day",
|
|
24367
|
+
"night",
|
|
24368
|
+
"unknown"
|
|
24369
|
+
]),
|
|
24370
|
+
subjects: number().int(),
|
|
24371
|
+
frames: number().int()
|
|
24372
|
+
})).readonly(),
|
|
24373
|
+
cameras: array(object({
|
|
24374
|
+
deviceId: number(),
|
|
24375
|
+
frames: number().int(),
|
|
24376
|
+
completeFrames: number().int()
|
|
24377
|
+
})).readonly()
|
|
24378
|
+
});
|
|
24379
|
+
/** An immutable dataset version, without its frame list. */
|
|
24380
|
+
var RetrainDatasetVersionSchema = object({
|
|
24381
|
+
id: string(),
|
|
24382
|
+
name: string(),
|
|
24383
|
+
createdAt: number(),
|
|
24384
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24385
|
+
layout: RetrainExportLayoutSchema,
|
|
24386
|
+
completeOnly: boolean(),
|
|
24387
|
+
frameCount: number().int(),
|
|
24388
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24389
|
+
annotationHash: string(),
|
|
24390
|
+
/** The export manifest schema the version was cut under. */
|
|
24391
|
+
manifestSchema: string(),
|
|
24392
|
+
stats: RetrainDatasetStatsSchema
|
|
24393
|
+
});
|
|
24394
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24395
|
+
kind: literal("created"),
|
|
24396
|
+
version: RetrainDatasetVersionSchema
|
|
24397
|
+
}), object({
|
|
24398
|
+
kind: literal("refused"),
|
|
24399
|
+
reason: _enum([
|
|
24400
|
+
"empty-name",
|
|
24401
|
+
"duplicate-name",
|
|
24402
|
+
"no-frames"
|
|
24403
|
+
])
|
|
24404
|
+
})]);
|
|
23472
24405
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23473
24406
|
var RetrainTransitionResultSchema = object({
|
|
23474
24407
|
trackId: string(),
|
|
@@ -24258,6 +25191,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24258
25191
|
kind: "mutation",
|
|
24259
25192
|
auth: "admin",
|
|
24260
25193
|
timeoutMs: 60 * 6e4
|
|
25194
|
+
}), method(object({
|
|
25195
|
+
filter: RetrainExportFilterSchema,
|
|
25196
|
+
layout: RetrainExportLayoutSchema
|
|
25197
|
+
}), object({
|
|
25198
|
+
ticket: PeerBytesTicketSchema,
|
|
25199
|
+
frames: number().int(),
|
|
25200
|
+
annotations: number().int()
|
|
25201
|
+
}), {
|
|
25202
|
+
kind: "mutation",
|
|
25203
|
+
auth: "admin",
|
|
25204
|
+
timeoutMs: 12e4
|
|
25205
|
+
}), method(object({
|
|
25206
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25207
|
+
completeOnly: boolean().optional()
|
|
25208
|
+
}), RetrainDatasetStatsSchema, {
|
|
25209
|
+
kind: "query",
|
|
25210
|
+
auth: "admin"
|
|
25211
|
+
}), method(object({
|
|
25212
|
+
name: string().max(120),
|
|
25213
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25214
|
+
layout: RetrainExportLayoutSchema,
|
|
25215
|
+
completeOnly: boolean()
|
|
25216
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25217
|
+
kind: "mutation",
|
|
25218
|
+
auth: "admin",
|
|
25219
|
+
timeoutMs: 12e4
|
|
25220
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25221
|
+
kind: "query",
|
|
25222
|
+
auth: "admin"
|
|
25223
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25224
|
+
kind: "mutation",
|
|
25225
|
+
auth: "admin"
|
|
25226
|
+
}), method(object({ id: string() }), object({
|
|
25227
|
+
found: boolean(),
|
|
25228
|
+
annotationHash: string(),
|
|
25229
|
+
matches: boolean(),
|
|
25230
|
+
missingFrames: number().int()
|
|
25231
|
+
}), {
|
|
25232
|
+
kind: "query",
|
|
25233
|
+
auth: "admin",
|
|
25234
|
+
timeoutMs: 12e4
|
|
24261
25235
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24262
25236
|
kind: "query",
|
|
24263
25237
|
auth: "admin"
|
|
@@ -27796,8 +28770,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
27796
28770
|
* `smtp-provider` — pluggable email delivery surface.
|
|
27797
28771
|
*
|
|
27798
28772
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
27799
|
-
* one for transactional / one for notifications). Consumers (
|
|
27800
|
-
*
|
|
28773
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28774
|
+
* addons, …) walk the collection and pick the first
|
|
27801
28775
|
* ready provider OR target a specific addonId.
|
|
27802
28776
|
*
|
|
27803
28777
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -27976,7 +28950,7 @@ targets: array(object({
|
|
|
27976
28950
|
})));
|
|
27977
28951
|
/**
|
|
27978
28952
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
27979
|
-
* providers (OIDC, SAML,
|
|
28953
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
27980
28954
|
* carrying the post-callback claims before redirecting back to
|
|
27981
28955
|
* `/api/auth/sso/finish`.
|
|
27982
28956
|
*
|
|
@@ -28039,7 +29013,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28039
29013
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28040
29014
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28041
29015
|
*/
|
|
28042
|
-
issuer: string().optional()
|
|
29016
|
+
issuer: string().optional(),
|
|
29017
|
+
/**
|
|
29018
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29019
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29020
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29021
|
+
* any other browser.
|
|
29022
|
+
*/
|
|
29023
|
+
browserBinding: string().optional()
|
|
28043
29024
|
});
|
|
28044
29025
|
method(object({
|
|
28045
29026
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -37978,16 +38959,6 @@ var ApiKeySummarySchema = object({
|
|
|
37978
38959
|
createdAt: number(),
|
|
37979
38960
|
lastUsedAt: number().optional()
|
|
37980
38961
|
});
|
|
37981
|
-
var CreateApiKeyInputSchema = object({
|
|
37982
|
-
label: string(),
|
|
37983
|
-
isAdmin: boolean().default(false),
|
|
37984
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
37985
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
37986
|
-
});
|
|
37987
|
-
var CreateApiKeyResultSchema = object({
|
|
37988
|
-
token: string(),
|
|
37989
|
-
record: ApiKeySummarySchema
|
|
37990
|
-
});
|
|
37991
38962
|
var ScopedTokenSummarySchema = object({
|
|
37992
38963
|
id: string(),
|
|
37993
38964
|
userId: string(),
|
|
@@ -38086,17 +39057,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
38086
39057
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
38087
39058
|
kind: "mutation",
|
|
38088
39059
|
access: "view"
|
|
38089
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
38090
|
-
kind: "mutation",
|
|
38091
|
-
auth: "admin",
|
|
38092
|
-
access: "create"
|
|
38093
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39060
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
38094
39061
|
kind: "mutation",
|
|
38095
39062
|
auth: "admin",
|
|
38096
39063
|
access: "delete"
|
|
38097
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
38098
|
-
kind: "mutation",
|
|
38099
|
-
access: "view"
|
|
38100
39064
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
38101
39065
|
kind: "mutation",
|
|
38102
39066
|
auth: "admin",
|
|
@@ -38170,15 +39134,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
38170
39134
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
38171
39135
|
userId: string(),
|
|
38172
39136
|
issuer: string()
|
|
38173
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
38174
|
-
userId: string(),
|
|
38175
|
-
issuer: string().min(1),
|
|
38176
|
-
label: string().optional()
|
|
38177
|
-
}), object({ success: literal(true) }), {
|
|
38178
|
-
kind: "mutation",
|
|
38179
|
-
auth: "admin",
|
|
38180
|
-
access: "create"
|
|
38181
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39137
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38182
39138
|
kind: "mutation",
|
|
38183
39139
|
auth: "admin",
|
|
38184
39140
|
access: "delete"
|
|
@@ -38573,6 +39529,451 @@ DeviceType.Camera, method(object({
|
|
|
38573
39529
|
detection: array(ZoneRuleSchema).readonly(),
|
|
38574
39530
|
package: array(ZoneRuleSchema).readonly()
|
|
38575
39531
|
});
|
|
39532
|
+
/**
|
|
39533
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
39534
|
+
*
|
|
39535
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
39536
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
39537
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
39538
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
39539
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
39540
|
+
* manifest entry and nothing else.
|
|
39541
|
+
*
|
|
39542
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
39543
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
39544
|
+
* Every method is `admin`: these spend money.
|
|
39545
|
+
*
|
|
39546
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
39547
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
39548
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
39549
|
+
*
|
|
39550
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
39551
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
39552
|
+
* ticket the provider mints (D613).
|
|
39553
|
+
*/
|
|
39554
|
+
var TrainingGpuOptionSchema = object({
|
|
39555
|
+
id: string(),
|
|
39556
|
+
label: string(),
|
|
39557
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
39558
|
+
usdPerHour: number().nonnegative(),
|
|
39559
|
+
vramGb: number().nonnegative()
|
|
39560
|
+
});
|
|
39561
|
+
var TrainingRegionOptionSchema = object({
|
|
39562
|
+
/** `''` = any region (the provider's choice). */
|
|
39563
|
+
id: string(),
|
|
39564
|
+
label: string(),
|
|
39565
|
+
priceMultiplier: number().positive()
|
|
39566
|
+
});
|
|
39567
|
+
/**
|
|
39568
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
39569
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
39570
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
39571
|
+
*/
|
|
39572
|
+
var TrainingProviderDefaultsSchema = object({
|
|
39573
|
+
gpuType: string(),
|
|
39574
|
+
region: string(),
|
|
39575
|
+
costCapUsd: number().nonnegative(),
|
|
39576
|
+
maxRuntimeSec: number().int().positive(),
|
|
39577
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
39578
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
39579
|
+
});
|
|
39580
|
+
var TrainingProviderDescriptorSchema = object({
|
|
39581
|
+
addonId: string(),
|
|
39582
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
39583
|
+
kind: string(),
|
|
39584
|
+
label: string(),
|
|
39585
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
39586
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
39587
|
+
maxDatasetBytes: number().int().positive(),
|
|
39588
|
+
maxRuntimeSec: number().int().positive(),
|
|
39589
|
+
freeTierNote: string().optional(),
|
|
39590
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
39591
|
+
dataResidencyNote: string(),
|
|
39592
|
+
/** Credentials are present — never the values. */
|
|
39593
|
+
configured: boolean(),
|
|
39594
|
+
defaults: TrainingProviderDefaultsSchema
|
|
39595
|
+
});
|
|
39596
|
+
var TrainingCredentialCheckSchema = object({
|
|
39597
|
+
ok: boolean(),
|
|
39598
|
+
/** Workspace / account name, when the provider says. */
|
|
39599
|
+
account: string().optional(),
|
|
39600
|
+
reason: _enum([
|
|
39601
|
+
"missing",
|
|
39602
|
+
"invalid",
|
|
39603
|
+
"forbidden",
|
|
39604
|
+
"network",
|
|
39605
|
+
"quota"
|
|
39606
|
+
]).optional(),
|
|
39607
|
+
detail: string().optional()
|
|
39608
|
+
});
|
|
39609
|
+
var ProviderJobStateSchema = _enum([
|
|
39610
|
+
"pending",
|
|
39611
|
+
"starting",
|
|
39612
|
+
"running",
|
|
39613
|
+
"succeeded",
|
|
39614
|
+
"failed",
|
|
39615
|
+
"cancelled",
|
|
39616
|
+
"lost"
|
|
39617
|
+
]);
|
|
39618
|
+
var ProviderJobStatusSchema = object({
|
|
39619
|
+
jobKey: string(),
|
|
39620
|
+
providerJobId: string().optional(),
|
|
39621
|
+
state: ProviderJobStateSchema,
|
|
39622
|
+
startedAt: number().optional(),
|
|
39623
|
+
endedAt: number().optional(),
|
|
39624
|
+
exitCode: number().int().optional(),
|
|
39625
|
+
failureReason: string().optional(),
|
|
39626
|
+
gpuType: string(),
|
|
39627
|
+
region: string().optional(),
|
|
39628
|
+
billedSeconds: number().nonnegative(),
|
|
39629
|
+
costUsd: number().nonnegative(),
|
|
39630
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
39631
|
+
costIsEstimate: boolean(),
|
|
39632
|
+
lastFetchedAt: number()
|
|
39633
|
+
});
|
|
39634
|
+
/**
|
|
39635
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
39636
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
39637
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
39638
|
+
* in `result.json`.
|
|
39639
|
+
*/
|
|
39640
|
+
var TrainerSourceRefSchema = object({
|
|
39641
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
39642
|
+
repo: string().min(1),
|
|
39643
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
39644
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
39645
|
+
});
|
|
39646
|
+
var JobRef = {
|
|
39647
|
+
addonId: string(),
|
|
39648
|
+
jobKey: string().uuid()
|
|
39649
|
+
};
|
|
39650
|
+
var TrainingLogLineSchema = object({
|
|
39651
|
+
ts: number(),
|
|
39652
|
+
text: string()
|
|
39653
|
+
});
|
|
39654
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
39655
|
+
kind: "mutation",
|
|
39656
|
+
auth: "admin",
|
|
39657
|
+
timeoutMs: 3e4
|
|
39658
|
+
}), method(object({
|
|
39659
|
+
addonId: string(),
|
|
39660
|
+
gpuType: string(),
|
|
39661
|
+
region: string(),
|
|
39662
|
+
datasetBytes: number().int().nonnegative(),
|
|
39663
|
+
gpuSecondsLow: number().nonnegative(),
|
|
39664
|
+
gpuSecondsHigh: number().nonnegative()
|
|
39665
|
+
}), object({
|
|
39666
|
+
usdLow: number().nonnegative(),
|
|
39667
|
+
usdHigh: number().nonnegative(),
|
|
39668
|
+
notes: array(string()).readonly()
|
|
39669
|
+
}), { auth: "admin" }), method(object({
|
|
39670
|
+
...JobRef,
|
|
39671
|
+
ticket: PeerBytesTicketSchema
|
|
39672
|
+
}), object({
|
|
39673
|
+
bytes: number().int().nonnegative(),
|
|
39674
|
+
sha256: string()
|
|
39675
|
+
}), {
|
|
39676
|
+
kind: "mutation",
|
|
39677
|
+
auth: "admin",
|
|
39678
|
+
timeoutMs: 120 * 6e4
|
|
39679
|
+
}), method(object({
|
|
39680
|
+
...JobRef,
|
|
39681
|
+
trainer: TrainerSourceRefSchema,
|
|
39682
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
39683
|
+
gpuType: string(),
|
|
39684
|
+
region: string(),
|
|
39685
|
+
maxRuntimeSec: number().int().positive()
|
|
39686
|
+
}), ProviderJobStatusSchema, {
|
|
39687
|
+
kind: "mutation",
|
|
39688
|
+
auth: "admin",
|
|
39689
|
+
timeoutMs: 30 * 6e4
|
|
39690
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
39691
|
+
auth: "admin",
|
|
39692
|
+
timeoutMs: 6e4
|
|
39693
|
+
}), method(object({
|
|
39694
|
+
...JobRef,
|
|
39695
|
+
cursor: string().optional(),
|
|
39696
|
+
max: number().int().min(1).max(500)
|
|
39697
|
+
}), object({
|
|
39698
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
39699
|
+
cursor: string()
|
|
39700
|
+
}), {
|
|
39701
|
+
auth: "admin",
|
|
39702
|
+
timeoutMs: 6e4
|
|
39703
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
39704
|
+
kind: "mutation",
|
|
39705
|
+
auth: "admin",
|
|
39706
|
+
timeoutMs: 6e4
|
|
39707
|
+
}), method(object(JobRef), object({
|
|
39708
|
+
found: boolean(),
|
|
39709
|
+
text: string().optional()
|
|
39710
|
+
}), {
|
|
39711
|
+
kind: "mutation",
|
|
39712
|
+
auth: "admin",
|
|
39713
|
+
timeoutMs: 5 * 6e4
|
|
39714
|
+
}), method(object({
|
|
39715
|
+
...JobRef,
|
|
39716
|
+
path: _enum(["bundle.tar"])
|
|
39717
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
39718
|
+
kind: "mutation",
|
|
39719
|
+
auth: "admin",
|
|
39720
|
+
timeoutMs: 5 * 6e4
|
|
39721
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
39722
|
+
kind: "mutation",
|
|
39723
|
+
auth: "admin",
|
|
39724
|
+
timeoutMs: 5 * 6e4
|
|
39725
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
39726
|
+
auth: "admin",
|
|
39727
|
+
timeoutMs: 2 * 6e4
|
|
39728
|
+
});
|
|
39729
|
+
/**
|
|
39730
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
39731
|
+
* provided by `addon-training`.
|
|
39732
|
+
*
|
|
39733
|
+
* It owns what every provider must agree on, written once:
|
|
39734
|
+
*
|
|
39735
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
39736
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
39737
|
+
* the export plan) and reaches this store through the five row methods
|
|
39738
|
+
* below, so the Retrain page and the export did not change.
|
|
39739
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
39740
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
39741
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
39742
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
39743
|
+
* rollback. Nothing is ever registered automatically.
|
|
39744
|
+
*
|
|
39745
|
+
* Every method is `admin`.
|
|
39746
|
+
*/
|
|
39747
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
39748
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
39749
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
39750
|
+
var TrainingBaseModelSchema = object({
|
|
39751
|
+
modelId: string(),
|
|
39752
|
+
label: string(),
|
|
39753
|
+
weights: string(),
|
|
39754
|
+
imgsz: number().int(),
|
|
39755
|
+
baselineOnnxUrl: string(),
|
|
39756
|
+
baselineFloors: record(string(), number()),
|
|
39757
|
+
/** The base the fleet runs most — the UI's default. */
|
|
39758
|
+
recommended: boolean()
|
|
39759
|
+
});
|
|
39760
|
+
var TrainingPresetSchema = _enum([
|
|
39761
|
+
"quick",
|
|
39762
|
+
"standard",
|
|
39763
|
+
"thorough"
|
|
39764
|
+
]);
|
|
39765
|
+
var TrainingJobRequestSchema = object({
|
|
39766
|
+
datasetVersionId: string().min(1),
|
|
39767
|
+
/** The `training-provider` addon that runs it. */
|
|
39768
|
+
addonId: string().min(1),
|
|
39769
|
+
gpuType: string().min(1),
|
|
39770
|
+
region: string(),
|
|
39771
|
+
baseModelId: string().min(1),
|
|
39772
|
+
preset: TrainingPresetSchema,
|
|
39773
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
39774
|
+
freeze: number().int().nonnegative().nullable(),
|
|
39775
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
39776
|
+
holdoutCameras: array(number().int()).nullable()
|
|
39777
|
+
});
|
|
39778
|
+
var TrainingSplitPlanSchema = object({
|
|
39779
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
39780
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
39781
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
39782
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
39783
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
39784
|
+
trainSubjects: number().int()
|
|
39785
|
+
});
|
|
39786
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
39787
|
+
"unknown-dataset",
|
|
39788
|
+
"unknown-provider",
|
|
39789
|
+
"provider-not-configured",
|
|
39790
|
+
"unknown-base-model",
|
|
39791
|
+
"unknown-gpu",
|
|
39792
|
+
"dataset-too-large",
|
|
39793
|
+
"no-training-subjects",
|
|
39794
|
+
"job-already-running"
|
|
39795
|
+
]);
|
|
39796
|
+
var TrainingJobPlanSchema = object({
|
|
39797
|
+
refusal: object({
|
|
39798
|
+
reason: TrainingRefusalReasonSchema,
|
|
39799
|
+
detail: string()
|
|
39800
|
+
}).nullable(),
|
|
39801
|
+
warnings: array(string()).readonly(),
|
|
39802
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
39803
|
+
estimate: object({
|
|
39804
|
+
datasetBytes: number().int(),
|
|
39805
|
+
uploadMinutesAt20Mbps: number(),
|
|
39806
|
+
gpuSecondsLow: number(),
|
|
39807
|
+
gpuSecondsHigh: number(),
|
|
39808
|
+
usdLow: number(),
|
|
39809
|
+
usdHigh: number(),
|
|
39810
|
+
notes: array(string()).readonly()
|
|
39811
|
+
}).nullable(),
|
|
39812
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
39813
|
+
defaults: object({
|
|
39814
|
+
maxCostUsd: number(),
|
|
39815
|
+
maxRuntimeSec: number().int()
|
|
39816
|
+
}).nullable(),
|
|
39817
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
39818
|
+
dataNotice: string()
|
|
39819
|
+
});
|
|
39820
|
+
/**
|
|
39821
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
39822
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
39823
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
39824
|
+
* result lives after the operator acted on it.
|
|
39825
|
+
*/
|
|
39826
|
+
var TrainingJobStateSchema = _enum([
|
|
39827
|
+
"uploading",
|
|
39828
|
+
"submitted",
|
|
39829
|
+
"starting",
|
|
39830
|
+
"running",
|
|
39831
|
+
"collecting",
|
|
39832
|
+
"ready",
|
|
39833
|
+
"registered",
|
|
39834
|
+
"canary",
|
|
39835
|
+
"failed",
|
|
39836
|
+
"cancelling",
|
|
39837
|
+
"cancelled",
|
|
39838
|
+
"lost",
|
|
39839
|
+
"expired",
|
|
39840
|
+
"discarded"
|
|
39841
|
+
]);
|
|
39842
|
+
var TrainingFailureReasonSchema = _enum([
|
|
39843
|
+
"cost-cap",
|
|
39844
|
+
"runtime-cap",
|
|
39845
|
+
"upload-failed",
|
|
39846
|
+
"submit-failed",
|
|
39847
|
+
"trainer-failed",
|
|
39848
|
+
"result-invalid",
|
|
39849
|
+
"checksum-mismatch",
|
|
39850
|
+
"fetch-failed",
|
|
39851
|
+
"provider-error",
|
|
39852
|
+
"hub-restart-during-upload"
|
|
39853
|
+
]);
|
|
39854
|
+
var TrainingProgressPointSchema = object({
|
|
39855
|
+
epoch: number().int(),
|
|
39856
|
+
map50: number().nullable(),
|
|
39857
|
+
map50_95: number().nullable()
|
|
39858
|
+
});
|
|
39859
|
+
var TrainingCanarySchema = object({
|
|
39860
|
+
deviceIds: array(number().int()).readonly(),
|
|
39861
|
+
since: number(),
|
|
39862
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
39863
|
+
previous: array(object({
|
|
39864
|
+
deviceId: number().int(),
|
|
39865
|
+
nodeId: string(),
|
|
39866
|
+
deviceKey: string(),
|
|
39867
|
+
patch: object({
|
|
39868
|
+
modelId: string().optional(),
|
|
39869
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
39870
|
+
}).nullable()
|
|
39871
|
+
})).readonly()
|
|
39872
|
+
});
|
|
39873
|
+
var TrainingJobSchema = object({
|
|
39874
|
+
id: string(),
|
|
39875
|
+
idempotencyKey: string(),
|
|
39876
|
+
name: string(),
|
|
39877
|
+
createdAt: number(),
|
|
39878
|
+
updatedAt: number(),
|
|
39879
|
+
state: TrainingJobStateSchema,
|
|
39880
|
+
stage: TrainingStageSchema.nullable(),
|
|
39881
|
+
failure: object({
|
|
39882
|
+
reason: TrainingFailureReasonSchema,
|
|
39883
|
+
stage: string().nullable(),
|
|
39884
|
+
detail: string()
|
|
39885
|
+
}).nullable(),
|
|
39886
|
+
request: TrainingJobRequestSchema,
|
|
39887
|
+
maxCostUsd: number().nonnegative(),
|
|
39888
|
+
maxRuntimeSec: number().int().positive(),
|
|
39889
|
+
trainer: TrainerSourceRefSchema,
|
|
39890
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
39891
|
+
dataset: object({
|
|
39892
|
+
bytes: number().int(),
|
|
39893
|
+
sha256: string(),
|
|
39894
|
+
uploadedAt: number()
|
|
39895
|
+
}).nullable(),
|
|
39896
|
+
split: TrainingSplitPlanSchema,
|
|
39897
|
+
provider: object({
|
|
39898
|
+
state: ProviderJobStateSchema.nullable(),
|
|
39899
|
+
providerJobId: string().nullable(),
|
|
39900
|
+
startedAt: number().nullable(),
|
|
39901
|
+
endedAt: number().nullable(),
|
|
39902
|
+
billedSeconds: number(),
|
|
39903
|
+
costUsd: number(),
|
|
39904
|
+
costIsEstimate: boolean(),
|
|
39905
|
+
lastPolledAt: number().nullable()
|
|
39906
|
+
}),
|
|
39907
|
+
progress: object({
|
|
39908
|
+
epoch: number().int().nullable(),
|
|
39909
|
+
epochs: number().int().nullable(),
|
|
39910
|
+
etaSec: number().nullable(),
|
|
39911
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
39912
|
+
}),
|
|
39913
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
39914
|
+
logTail: array(string()).readonly(),
|
|
39915
|
+
logCursor: string().nullable(),
|
|
39916
|
+
artifacts: object({
|
|
39917
|
+
bundleBytes: number().int(),
|
|
39918
|
+
bundleSha256: string(),
|
|
39919
|
+
fetchedAt: number(),
|
|
39920
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
39921
|
+
expiresAt: number()
|
|
39922
|
+
}).nullable(),
|
|
39923
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
39924
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
39925
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
39926
|
+
cloudCleanupDueAt: number().nullable(),
|
|
39927
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
39928
|
+
registeredModelIds: array(string()).readonly(),
|
|
39929
|
+
canary: TrainingCanarySchema.nullable()
|
|
39930
|
+
});
|
|
39931
|
+
var IdInput = object({ id: string().min(1) });
|
|
39932
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
39933
|
+
kind: "mutation",
|
|
39934
|
+
auth: "admin"
|
|
39935
|
+
}), 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() }), {
|
|
39936
|
+
kind: "mutation",
|
|
39937
|
+
auth: "admin"
|
|
39938
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
39939
|
+
auth: "admin",
|
|
39940
|
+
timeoutMs: 6e4
|
|
39941
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
39942
|
+
name: string().min(1).max(120),
|
|
39943
|
+
maxCostUsd: number().positive(),
|
|
39944
|
+
maxRuntimeSec: number().int().positive(),
|
|
39945
|
+
idempotencyKey: string().min(8).max(80)
|
|
39946
|
+
}), discriminatedUnion("kind", [object({
|
|
39947
|
+
kind: literal("started"),
|
|
39948
|
+
job: TrainingJobSchema
|
|
39949
|
+
}), object({
|
|
39950
|
+
kind: literal("refused"),
|
|
39951
|
+
reason: TrainingRefusalReasonSchema,
|
|
39952
|
+
detail: string()
|
|
39953
|
+
})]), {
|
|
39954
|
+
kind: "mutation",
|
|
39955
|
+
auth: "admin",
|
|
39956
|
+
timeoutMs: 12e4
|
|
39957
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
39958
|
+
kind: "mutation",
|
|
39959
|
+
auth: "admin",
|
|
39960
|
+
timeoutMs: 12e4
|
|
39961
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
39962
|
+
kind: "mutation",
|
|
39963
|
+
auth: "admin",
|
|
39964
|
+
timeoutMs: 30 * 6e4
|
|
39965
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
39966
|
+
kind: "mutation",
|
|
39967
|
+
auth: "admin",
|
|
39968
|
+
timeoutMs: 12e4
|
|
39969
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39970
|
+
kind: "mutation",
|
|
39971
|
+
auth: "admin",
|
|
39972
|
+
timeoutMs: 12e4
|
|
39973
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39974
|
+
kind: "mutation",
|
|
39975
|
+
auth: "admin"
|
|
39976
|
+
});
|
|
38576
39977
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
38577
39978
|
Object.freeze({
|
|
38578
39979
|
person: .5,
|
|
@@ -39196,6 +40597,12 @@ Object.freeze({
|
|
|
39196
40597
|
addonId: null,
|
|
39197
40598
|
access: "create"
|
|
39198
40599
|
},
|
|
40600
|
+
"backup.checkBackupKey": {
|
|
40601
|
+
capName: "backup",
|
|
40602
|
+
capScope: "system",
|
|
40603
|
+
addonId: null,
|
|
40604
|
+
access: "create"
|
|
40605
|
+
},
|
|
39199
40606
|
"backup.delete": {
|
|
39200
40607
|
capName: "backup",
|
|
39201
40608
|
capScope: "system",
|
|
@@ -39208,6 +40615,18 @@ Object.freeze({
|
|
|
39208
40615
|
addonId: null,
|
|
39209
40616
|
access: "delete"
|
|
39210
40617
|
},
|
|
40618
|
+
"backup.disableEncryption": {
|
|
40619
|
+
capName: "backup",
|
|
40620
|
+
capScope: "system",
|
|
40621
|
+
addonId: null,
|
|
40622
|
+
access: "create"
|
|
40623
|
+
},
|
|
40624
|
+
"backup.getEncryption": {
|
|
40625
|
+
capName: "backup",
|
|
40626
|
+
capScope: "system",
|
|
40627
|
+
addonId: null,
|
|
40628
|
+
access: "view"
|
|
40629
|
+
},
|
|
39211
40630
|
"backup.getEntries": {
|
|
39212
40631
|
capName: "backup",
|
|
39213
40632
|
capScope: "system",
|
|
@@ -39262,6 +40681,12 @@ Object.freeze({
|
|
|
39262
40681
|
addonId: null,
|
|
39263
40682
|
access: "create"
|
|
39264
40683
|
},
|
|
40684
|
+
"backup.setupEncryption": {
|
|
40685
|
+
capName: "backup",
|
|
40686
|
+
capScope: "system",
|
|
40687
|
+
addonId: null,
|
|
40688
|
+
access: "create"
|
|
40689
|
+
},
|
|
39265
40690
|
"backup.trigger": {
|
|
39266
40691
|
capName: "backup",
|
|
39267
40692
|
capScope: "system",
|
|
@@ -39814,6 +41239,12 @@ Object.freeze({
|
|
|
39814
41239
|
addonId: null,
|
|
39815
41240
|
access: "create"
|
|
39816
41241
|
},
|
|
41242
|
+
"customModelRegistry.importModelBundle": {
|
|
41243
|
+
capName: "custom-model-registry",
|
|
41244
|
+
capScope: "system",
|
|
41245
|
+
addonId: null,
|
|
41246
|
+
access: "create"
|
|
41247
|
+
},
|
|
39817
41248
|
"customModelRegistry.listModels": {
|
|
39818
41249
|
capName: "custom-model-registry",
|
|
39819
41250
|
capScope: "system",
|
|
@@ -41254,6 +42685,12 @@ Object.freeze({
|
|
|
41254
42685
|
addonId: null,
|
|
41255
42686
|
access: "view"
|
|
41256
42687
|
},
|
|
42688
|
+
"keychainAdmin.acknowledgeReset": {
|
|
42689
|
+
capName: "keychain-admin",
|
|
42690
|
+
capScope: "system",
|
|
42691
|
+
addonId: null,
|
|
42692
|
+
access: "create"
|
|
42693
|
+
},
|
|
41257
42694
|
"keychainAdmin.deleteOrphans": {
|
|
41258
42695
|
capName: "keychain-admin",
|
|
41259
42696
|
capScope: "system",
|
|
@@ -41290,6 +42727,12 @@ Object.freeze({
|
|
|
41290
42727
|
addonId: null,
|
|
41291
42728
|
access: "delete"
|
|
41292
42729
|
},
|
|
42730
|
+
"keychainAdmin.resetReport": {
|
|
42731
|
+
capName: "keychain-admin",
|
|
42732
|
+
capScope: "system",
|
|
42733
|
+
addonId: null,
|
|
42734
|
+
access: "delete"
|
|
42735
|
+
},
|
|
41293
42736
|
"keychainAdmin.reveal": {
|
|
41294
42737
|
capName: "keychain-admin",
|
|
41295
42738
|
capScope: "system",
|
|
@@ -41302,6 +42745,12 @@ Object.freeze({
|
|
|
41302
42745
|
addonId: null,
|
|
41303
42746
|
access: "create"
|
|
41304
42747
|
},
|
|
42748
|
+
"keychainAdmin.setSystemSecret": {
|
|
42749
|
+
capName: "keychain-admin",
|
|
42750
|
+
capScope: "system",
|
|
42751
|
+
addonId: null,
|
|
42752
|
+
access: "create"
|
|
42753
|
+
},
|
|
41305
42754
|
"keychainAdmin.status": {
|
|
41306
42755
|
capName: "keychain-admin",
|
|
41307
42756
|
capScope: "system",
|
|
@@ -42748,6 +44197,12 @@ Object.freeze({
|
|
|
42748
44197
|
addonId: null,
|
|
42749
44198
|
access: "create"
|
|
42750
44199
|
},
|
|
44200
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
44201
|
+
capName: "pipeline-analytics",
|
|
44202
|
+
capScope: "device",
|
|
44203
|
+
addonId: null,
|
|
44204
|
+
access: "create"
|
|
44205
|
+
},
|
|
42751
44206
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
42752
44207
|
capName: "pipeline-analytics",
|
|
42753
44208
|
capScope: "device",
|
|
@@ -42760,6 +44215,12 @@ Object.freeze({
|
|
|
42760
44215
|
addonId: null,
|
|
42761
44216
|
access: "delete"
|
|
42762
44217
|
},
|
|
44218
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
44219
|
+
capName: "pipeline-analytics",
|
|
44220
|
+
capScope: "device",
|
|
44221
|
+
addonId: null,
|
|
44222
|
+
access: "delete"
|
|
44223
|
+
},
|
|
42763
44224
|
"pipelineAnalytics.deleteTracks": {
|
|
42764
44225
|
capName: "pipeline-analytics",
|
|
42765
44226
|
capScope: "device",
|
|
@@ -42982,6 +44443,12 @@ Object.freeze({
|
|
|
42982
44443
|
addonId: null,
|
|
42983
44444
|
access: "view"
|
|
42984
44445
|
},
|
|
44446
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
44447
|
+
capName: "pipeline-analytics",
|
|
44448
|
+
capScope: "device",
|
|
44449
|
+
addonId: null,
|
|
44450
|
+
access: "view"
|
|
44451
|
+
},
|
|
42985
44452
|
"pipelineAnalytics.listRetrainFrames": {
|
|
42986
44453
|
capName: "pipeline-analytics",
|
|
42987
44454
|
capScope: "device",
|
|
@@ -43012,6 +44479,12 @@ Object.freeze({
|
|
|
43012
44479
|
addonId: null,
|
|
43013
44480
|
access: "view"
|
|
43014
44481
|
},
|
|
44482
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
44483
|
+
capName: "pipeline-analytics",
|
|
44484
|
+
capScope: "device",
|
|
44485
|
+
addonId: null,
|
|
44486
|
+
access: "create"
|
|
44487
|
+
},
|
|
43015
44488
|
"pipelineAnalytics.ownersWithMedia": {
|
|
43016
44489
|
capName: "pipeline-analytics",
|
|
43017
44490
|
capScope: "device",
|
|
@@ -43024,6 +44497,12 @@ Object.freeze({
|
|
|
43024
44497
|
addonId: null,
|
|
43025
44498
|
access: "create"
|
|
43026
44499
|
},
|
|
44500
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
44501
|
+
capName: "pipeline-analytics",
|
|
44502
|
+
capScope: "device",
|
|
44503
|
+
addonId: null,
|
|
44504
|
+
access: "view"
|
|
44505
|
+
},
|
|
43027
44506
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
43028
44507
|
capName: "pipeline-analytics",
|
|
43029
44508
|
capScope: "device",
|
|
@@ -43162,6 +44641,12 @@ Object.freeze({
|
|
|
43162
44641
|
addonId: null,
|
|
43163
44642
|
access: "create"
|
|
43164
44643
|
},
|
|
44644
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
44645
|
+
capName: "pipeline-analytics",
|
|
44646
|
+
capScope: "device",
|
|
44647
|
+
addonId: null,
|
|
44648
|
+
access: "view"
|
|
44649
|
+
},
|
|
43165
44650
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
43166
44651
|
capName: "pipeline-analytics",
|
|
43167
44652
|
capScope: "device",
|
|
@@ -45538,6 +47023,174 @@ Object.freeze({
|
|
|
45538
47023
|
addonId: null,
|
|
45539
47024
|
access: "view"
|
|
45540
47025
|
},
|
|
47026
|
+
"training.canaryResult": {
|
|
47027
|
+
capName: "training",
|
|
47028
|
+
capScope: "system",
|
|
47029
|
+
addonId: null,
|
|
47030
|
+
access: "create"
|
|
47031
|
+
},
|
|
47032
|
+
"training.cancelJob": {
|
|
47033
|
+
capName: "training",
|
|
47034
|
+
capScope: "system",
|
|
47035
|
+
addonId: null,
|
|
47036
|
+
access: "create"
|
|
47037
|
+
},
|
|
47038
|
+
"training.discardResult": {
|
|
47039
|
+
capName: "training",
|
|
47040
|
+
capScope: "system",
|
|
47041
|
+
addonId: null,
|
|
47042
|
+
access: "create"
|
|
47043
|
+
},
|
|
47044
|
+
"training.findDatasetVersionIdByName": {
|
|
47045
|
+
capName: "training",
|
|
47046
|
+
capScope: "system",
|
|
47047
|
+
addonId: null,
|
|
47048
|
+
access: "view"
|
|
47049
|
+
},
|
|
47050
|
+
"training.getDatasetVersion": {
|
|
47051
|
+
capName: "training",
|
|
47052
|
+
capScope: "system",
|
|
47053
|
+
addonId: null,
|
|
47054
|
+
access: "view"
|
|
47055
|
+
},
|
|
47056
|
+
"training.getJob": {
|
|
47057
|
+
capName: "training",
|
|
47058
|
+
capScope: "system",
|
|
47059
|
+
addonId: null,
|
|
47060
|
+
access: "view"
|
|
47061
|
+
},
|
|
47062
|
+
"training.getJobResult": {
|
|
47063
|
+
capName: "training",
|
|
47064
|
+
capScope: "system",
|
|
47065
|
+
addonId: null,
|
|
47066
|
+
access: "view"
|
|
47067
|
+
},
|
|
47068
|
+
"training.listBaseModels": {
|
|
47069
|
+
capName: "training",
|
|
47070
|
+
capScope: "system",
|
|
47071
|
+
addonId: null,
|
|
47072
|
+
access: "view"
|
|
47073
|
+
},
|
|
47074
|
+
"training.listDatasetVersions": {
|
|
47075
|
+
capName: "training",
|
|
47076
|
+
capScope: "system",
|
|
47077
|
+
addonId: null,
|
|
47078
|
+
access: "view"
|
|
47079
|
+
},
|
|
47080
|
+
"training.listJobs": {
|
|
47081
|
+
capName: "training",
|
|
47082
|
+
capScope: "system",
|
|
47083
|
+
addonId: null,
|
|
47084
|
+
access: "view"
|
|
47085
|
+
},
|
|
47086
|
+
"training.planJob": {
|
|
47087
|
+
capName: "training",
|
|
47088
|
+
capScope: "system",
|
|
47089
|
+
addonId: null,
|
|
47090
|
+
access: "view"
|
|
47091
|
+
},
|
|
47092
|
+
"training.putDatasetVersion": {
|
|
47093
|
+
capName: "training",
|
|
47094
|
+
capScope: "system",
|
|
47095
|
+
addonId: null,
|
|
47096
|
+
access: "create"
|
|
47097
|
+
},
|
|
47098
|
+
"training.registerResult": {
|
|
47099
|
+
capName: "training",
|
|
47100
|
+
capScope: "system",
|
|
47101
|
+
addonId: null,
|
|
47102
|
+
access: "create"
|
|
47103
|
+
},
|
|
47104
|
+
"training.removeDatasetVersion": {
|
|
47105
|
+
capName: "training",
|
|
47106
|
+
capScope: "system",
|
|
47107
|
+
addonId: null,
|
|
47108
|
+
access: "delete"
|
|
47109
|
+
},
|
|
47110
|
+
"training.rollbackCanary": {
|
|
47111
|
+
capName: "training",
|
|
47112
|
+
capScope: "system",
|
|
47113
|
+
addonId: null,
|
|
47114
|
+
access: "create"
|
|
47115
|
+
},
|
|
47116
|
+
"training.startJob": {
|
|
47117
|
+
capName: "training",
|
|
47118
|
+
capScope: "system",
|
|
47119
|
+
addonId: null,
|
|
47120
|
+
access: "create"
|
|
47121
|
+
},
|
|
47122
|
+
"trainingProvider.cancelJob": {
|
|
47123
|
+
capName: "training-provider",
|
|
47124
|
+
capScope: "system",
|
|
47125
|
+
addonId: null,
|
|
47126
|
+
access: "create"
|
|
47127
|
+
},
|
|
47128
|
+
"trainingProvider.cleanupJob": {
|
|
47129
|
+
capName: "training-provider",
|
|
47130
|
+
capScope: "system",
|
|
47131
|
+
addonId: null,
|
|
47132
|
+
access: "create"
|
|
47133
|
+
},
|
|
47134
|
+
"trainingProvider.describe": {
|
|
47135
|
+
capName: "training-provider",
|
|
47136
|
+
capScope: "system",
|
|
47137
|
+
addonId: null,
|
|
47138
|
+
access: "view"
|
|
47139
|
+
},
|
|
47140
|
+
"trainingProvider.estimateJob": {
|
|
47141
|
+
capName: "training-provider",
|
|
47142
|
+
capScope: "system",
|
|
47143
|
+
addonId: null,
|
|
47144
|
+
access: "view"
|
|
47145
|
+
},
|
|
47146
|
+
"trainingProvider.getJob": {
|
|
47147
|
+
capName: "training-provider",
|
|
47148
|
+
capScope: "system",
|
|
47149
|
+
addonId: null,
|
|
47150
|
+
access: "view"
|
|
47151
|
+
},
|
|
47152
|
+
"trainingProvider.listJobEvents": {
|
|
47153
|
+
capName: "training-provider",
|
|
47154
|
+
capScope: "system",
|
|
47155
|
+
addonId: null,
|
|
47156
|
+
access: "view"
|
|
47157
|
+
},
|
|
47158
|
+
"trainingProvider.listJobs": {
|
|
47159
|
+
capName: "training-provider",
|
|
47160
|
+
capScope: "system",
|
|
47161
|
+
addonId: null,
|
|
47162
|
+
access: "view"
|
|
47163
|
+
},
|
|
47164
|
+
"trainingProvider.offerArtifact": {
|
|
47165
|
+
capName: "training-provider",
|
|
47166
|
+
capScope: "system",
|
|
47167
|
+
addonId: null,
|
|
47168
|
+
access: "create"
|
|
47169
|
+
},
|
|
47170
|
+
"trainingProvider.readResult": {
|
|
47171
|
+
capName: "training-provider",
|
|
47172
|
+
capScope: "system",
|
|
47173
|
+
addonId: null,
|
|
47174
|
+
access: "create"
|
|
47175
|
+
},
|
|
47176
|
+
"trainingProvider.submitJob": {
|
|
47177
|
+
capName: "training-provider",
|
|
47178
|
+
capScope: "system",
|
|
47179
|
+
addonId: null,
|
|
47180
|
+
access: "create"
|
|
47181
|
+
},
|
|
47182
|
+
"trainingProvider.uploadDataset": {
|
|
47183
|
+
capName: "training-provider",
|
|
47184
|
+
capScope: "system",
|
|
47185
|
+
addonId: null,
|
|
47186
|
+
access: "create"
|
|
47187
|
+
},
|
|
47188
|
+
"trainingProvider.validateCredentials": {
|
|
47189
|
+
capName: "training-provider",
|
|
47190
|
+
capScope: "system",
|
|
47191
|
+
addonId: null,
|
|
47192
|
+
access: "create"
|
|
47193
|
+
},
|
|
45541
47194
|
"turnProvider.getTurnServers": {
|
|
45542
47195
|
capName: "turn-provider",
|
|
45543
47196
|
capScope: "system",
|
|
@@ -45562,12 +47215,6 @@ Object.freeze({
|
|
|
45562
47215
|
addonId: null,
|
|
45563
47216
|
access: "create"
|
|
45564
47217
|
},
|
|
45565
|
-
"userManagement.createApiKey": {
|
|
45566
|
-
capName: "user-management",
|
|
45567
|
-
capScope: "system",
|
|
45568
|
-
addonId: null,
|
|
45569
|
-
access: "create"
|
|
45570
|
-
},
|
|
45571
47218
|
"userManagement.createScopedToken": {
|
|
45572
47219
|
capName: "user-management",
|
|
45573
47220
|
capScope: "system",
|
|
@@ -45604,12 +47251,6 @@ Object.freeze({
|
|
|
45604
47251
|
addonId: null,
|
|
45605
47252
|
access: "view"
|
|
45606
47253
|
},
|
|
45607
|
-
"userManagement.linkExternalIdentity": {
|
|
45608
|
-
capName: "user-management",
|
|
45609
|
-
capScope: "system",
|
|
45610
|
-
addonId: null,
|
|
45611
|
-
access: "create"
|
|
45612
|
-
},
|
|
45613
47254
|
"userManagement.listApiKeys": {
|
|
45614
47255
|
capName: "user-management",
|
|
45615
47256
|
capScope: "system",
|
|
@@ -45712,12 +47353,6 @@ Object.freeze({
|
|
|
45712
47353
|
addonId: null,
|
|
45713
47354
|
access: "create"
|
|
45714
47355
|
},
|
|
45715
|
-
"userManagement.validateApiKey": {
|
|
45716
|
-
capName: "user-management",
|
|
45717
|
-
capScope: "system",
|
|
45718
|
-
addonId: null,
|
|
45719
|
-
access: "view"
|
|
45720
|
-
},
|
|
45721
47356
|
"userManagement.validateCredentials": {
|
|
45722
47357
|
capName: "user-management",
|
|
45723
47358
|
capScope: "system",
|
|
@@ -49831,6 +51466,11 @@ Object.freeze({
|
|
|
49831
51466
|
form: "single",
|
|
49832
51467
|
optional: false
|
|
49833
51468
|
}],
|
|
51469
|
+
"training.canaryResult": [{
|
|
51470
|
+
name: "deviceIds",
|
|
51471
|
+
form: "array",
|
|
51472
|
+
optional: false
|
|
51473
|
+
}],
|
|
49834
51474
|
"update.getStatus": [{
|
|
49835
51475
|
name: "deviceId",
|
|
49836
51476
|
form: "single",
|