@camstack/addon-export-hap 1.2.155 → 1.2.156
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/hap-export.addon.js +1772 -132
- package/dist/hap-export.addon.mjs +1772 -132
- package/package.json +1 -1
|
@@ -5416,7 +5416,7 @@ var ZodIssueCode = {
|
|
|
5416
5416
|
var ZodFirstPartyTypeKind;
|
|
5417
5417
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5418
5418
|
//#endregion
|
|
5419
|
-
//#region ../types/dist/sleep-
|
|
5419
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5420
5420
|
/**
|
|
5421
5421
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5422
5422
|
* window to float samples (D455).
|
|
@@ -5533,7 +5533,7 @@ function isKeychainStoredField(field) {
|
|
|
5533
5533
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5534
5534
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5535
5535
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5536
|
-
function isRecord$
|
|
5536
|
+
function isRecord$2(value) {
|
|
5537
5537
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5538
5538
|
}
|
|
5539
5539
|
function makeSecretMarker(ref) {
|
|
@@ -5544,12 +5544,12 @@ function makeSecretMarker(ref) {
|
|
|
5544
5544
|
}
|
|
5545
5545
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5546
5546
|
function isSecretMarker(value) {
|
|
5547
|
-
if (!isRecord$
|
|
5547
|
+
if (!isRecord$2(value)) return false;
|
|
5548
5548
|
const ref = value["$secret"];
|
|
5549
5549
|
return typeof ref === "string" && ref.length > 0;
|
|
5550
5550
|
}
|
|
5551
5551
|
function isSecretClear(value) {
|
|
5552
|
-
return isRecord$
|
|
5552
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5553
5553
|
}
|
|
5554
5554
|
/**
|
|
5555
5555
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6065,6 +6065,13 @@ function globalSecretScope() {
|
|
|
6065
6065
|
function encodeSegment(value) {
|
|
6066
6066
|
return encodeURIComponent(value);
|
|
6067
6067
|
}
|
|
6068
|
+
function decodeSegment(value) {
|
|
6069
|
+
try {
|
|
6070
|
+
return decodeURIComponent(value);
|
|
6071
|
+
} catch {
|
|
6072
|
+
return null;
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6068
6075
|
/**
|
|
6069
6076
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6070
6077
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6073,6 +6080,75 @@ function encodeSegment(value) {
|
|
|
6073
6080
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6074
6081
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6075
6082
|
}
|
|
6083
|
+
function parseScope(segments) {
|
|
6084
|
+
switch (segments[0]) {
|
|
6085
|
+
case "global": return {
|
|
6086
|
+
scope: GLOBAL_SCOPE,
|
|
6087
|
+
used: 1
|
|
6088
|
+
};
|
|
6089
|
+
case "node": {
|
|
6090
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6091
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6092
|
+
scope: {
|
|
6093
|
+
kind: "node",
|
|
6094
|
+
nodeId
|
|
6095
|
+
},
|
|
6096
|
+
used: 2
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
case "device": {
|
|
6100
|
+
const raw = segments[1];
|
|
6101
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6102
|
+
return {
|
|
6103
|
+
scope: {
|
|
6104
|
+
kind: "device",
|
|
6105
|
+
deviceId: Number(raw)
|
|
6106
|
+
},
|
|
6107
|
+
used: 2
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6110
|
+
case "integration": {
|
|
6111
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6112
|
+
return id === null || id.length === 0 ? null : {
|
|
6113
|
+
scope: {
|
|
6114
|
+
kind: "integration",
|
|
6115
|
+
integrationId: id
|
|
6116
|
+
},
|
|
6117
|
+
used: 2
|
|
6118
|
+
};
|
|
6119
|
+
}
|
|
6120
|
+
case "row": {
|
|
6121
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6122
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6123
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6124
|
+
return {
|
|
6125
|
+
scope: {
|
|
6126
|
+
kind: "row",
|
|
6127
|
+
collection,
|
|
6128
|
+
rowId
|
|
6129
|
+
},
|
|
6130
|
+
used: 3
|
|
6131
|
+
};
|
|
6132
|
+
}
|
|
6133
|
+
default: return null;
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
6136
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6137
|
+
function parseSecretRef(ref) {
|
|
6138
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6139
|
+
const segments = ref.slice(9).split("/");
|
|
6140
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6141
|
+
if (owner === null || owner.length === 0) return null;
|
|
6142
|
+
const parsed = parseScope(segments.slice(1));
|
|
6143
|
+
if (parsed === null) return null;
|
|
6144
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6145
|
+
if (fieldPath.length === 0) return null;
|
|
6146
|
+
return {
|
|
6147
|
+
owner,
|
|
6148
|
+
scope: parsed.scope,
|
|
6149
|
+
fieldPath
|
|
6150
|
+
};
|
|
6151
|
+
}
|
|
6076
6152
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6077
6153
|
var KeychainWriteRefusedError = class extends Error {
|
|
6078
6154
|
fieldPath;
|
|
@@ -6083,7 +6159,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6083
6159
|
}
|
|
6084
6160
|
};
|
|
6085
6161
|
var KEEP = { kind: "keep" };
|
|
6086
|
-
function isRecord$
|
|
6162
|
+
function isRecord$1$1(value) {
|
|
6087
6163
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6088
6164
|
}
|
|
6089
6165
|
function defaultMintId() {
|
|
@@ -6096,7 +6172,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6096
6172
|
return out;
|
|
6097
6173
|
}
|
|
6098
6174
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6099
|
-
else if (isRecord$
|
|
6175
|
+
else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6100
6176
|
return out;
|
|
6101
6177
|
}
|
|
6102
6178
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6151,7 +6227,7 @@ function rowId(row, idKey) {
|
|
|
6151
6227
|
return null;
|
|
6152
6228
|
}
|
|
6153
6229
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6154
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6230
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
|
|
6155
6231
|
if (!Array.isArray(incoming)) {
|
|
6156
6232
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6157
6233
|
return {
|
|
@@ -6167,7 +6243,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6167
6243
|
const kept = /* @__PURE__ */ new Set();
|
|
6168
6244
|
const rows = [];
|
|
6169
6245
|
for (const row of incoming) {
|
|
6170
|
-
if (!isRecord$
|
|
6246
|
+
if (!isRecord$1$1(row)) {
|
|
6171
6247
|
rows.push(row);
|
|
6172
6248
|
continue;
|
|
6173
6249
|
}
|
|
@@ -6192,7 +6268,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6192
6268
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6193
6269
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6194
6270
|
case "object": {
|
|
6195
|
-
if (!isRecord$
|
|
6271
|
+
if (!isRecord$1$1(incoming)) {
|
|
6196
6272
|
if (incoming === void 0) return KEEP;
|
|
6197
6273
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6198
6274
|
return {
|
|
@@ -6200,7 +6276,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6200
6276
|
value: incoming
|
|
6201
6277
|
};
|
|
6202
6278
|
}
|
|
6203
|
-
const storedObj = isRecord$
|
|
6279
|
+
const storedObj = isRecord$1$1(stored) ? stored : {};
|
|
6204
6280
|
return {
|
|
6205
6281
|
kind: "value",
|
|
6206
6282
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6259,12 +6335,19 @@ async function transformSecretWrite(input) {
|
|
|
6259
6335
|
}
|
|
6260
6336
|
};
|
|
6261
6337
|
}
|
|
6338
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6339
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6340
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6341
|
+
}
|
|
6262
6342
|
/**
|
|
6263
6343
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6264
6344
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6265
6345
|
*/
|
|
6266
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6267
|
-
const
|
|
6346
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6347
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6348
|
+
const owner = options.ownedBy;
|
|
6349
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6350
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6268
6351
|
if (refs.length === 0) return {
|
|
6269
6352
|
value,
|
|
6270
6353
|
unresolved: []
|
|
@@ -6288,10 +6371,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6288
6371
|
}
|
|
6289
6372
|
const substitute = (v) => {
|
|
6290
6373
|
if (isSecretMarker(v)) {
|
|
6374
|
+
if (!inScope(v.$secret)) return {
|
|
6375
|
+
keep: true,
|
|
6376
|
+
value: v
|
|
6377
|
+
};
|
|
6291
6378
|
const answer = answers[v.$secret];
|
|
6292
|
-
|
|
6379
|
+
if (answer?.kind === "value") return {
|
|
6293
6380
|
keep: true,
|
|
6294
6381
|
value: answer.value
|
|
6382
|
+
};
|
|
6383
|
+
return keepMarker ? {
|
|
6384
|
+
keep: true,
|
|
6385
|
+
value: v
|
|
6295
6386
|
} : {
|
|
6296
6387
|
keep: false,
|
|
6297
6388
|
value: void 0
|
|
@@ -6308,7 +6399,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6308
6399
|
value: items
|
|
6309
6400
|
};
|
|
6310
6401
|
}
|
|
6311
|
-
if (isRecord$
|
|
6402
|
+
if (isRecord$1$1(v)) {
|
|
6312
6403
|
const out = {};
|
|
6313
6404
|
for (const [k, child] of Object.entries(v)) {
|
|
6314
6405
|
const s = substitute(child);
|
|
@@ -6329,14 +6420,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6329
6420
|
unresolved
|
|
6330
6421
|
};
|
|
6331
6422
|
}
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6423
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6424
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6425
|
+
ref;
|
|
6426
|
+
reason;
|
|
6427
|
+
constructor(ref, reason) {
|
|
6428
|
+
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.`);
|
|
6429
|
+
this.ref = ref;
|
|
6430
|
+
this.reason = reason;
|
|
6431
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6432
|
+
}
|
|
6433
|
+
};
|
|
6434
|
+
function isRecord$3(value) {
|
|
6435
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6436
|
+
}
|
|
6437
|
+
function resolvedValue(pass, marker) {
|
|
6438
|
+
const answer = pass.answers[marker.$secret];
|
|
6439
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6440
|
+
}
|
|
6441
|
+
async function atMarker(pass, incoming, stored) {
|
|
6442
|
+
if (incoming === null) return stored;
|
|
6443
|
+
if (typeof incoming !== "string") return incoming;
|
|
6444
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6445
|
+
const intent = classifySecretWrite(incoming);
|
|
6446
|
+
if (intent.kind !== "set") return stored;
|
|
6447
|
+
const ref = stored.$secret;
|
|
6448
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6449
|
+
const answer = pass.answers[ref];
|
|
6450
|
+
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);
|
|
6451
|
+
try {
|
|
6452
|
+
await pass.secrets.put(ref, intent.value);
|
|
6453
|
+
} catch (err) {
|
|
6454
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6455
|
+
}
|
|
6456
|
+
pass.changedRefs.push(ref);
|
|
6457
|
+
return stored;
|
|
6458
|
+
}
|
|
6459
|
+
function inArray(pass, incoming, stored) {
|
|
6460
|
+
return incoming.map((item, index) => {
|
|
6461
|
+
const twin = stored[index];
|
|
6462
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6463
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6464
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6465
|
+
return item;
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
6468
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6469
|
+
const out = { ...incoming };
|
|
6470
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6471
|
+
const twin = stored[key];
|
|
6472
|
+
if (isSecretMarker(twin)) {
|
|
6473
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6474
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6475
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6476
|
+
}
|
|
6477
|
+
return out;
|
|
6478
|
+
}
|
|
6479
|
+
async function walk(pass, incoming, stored) {
|
|
6480
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6481
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6482
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6483
|
+
const out = { ...incoming };
|
|
6484
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6485
|
+
return out;
|
|
6486
|
+
}
|
|
6487
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6488
|
+
async function restoreUnchangedSecrets(input) {
|
|
6489
|
+
const refs = [];
|
|
6490
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6491
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6492
|
+
if (owned.length === 0) return {
|
|
6493
|
+
patch: input.patch,
|
|
6494
|
+
changedRefs: []
|
|
6495
|
+
};
|
|
6496
|
+
const pass = {
|
|
6497
|
+
secrets: input.secrets,
|
|
6498
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6499
|
+
operatorWrite: input.operatorWrite,
|
|
6500
|
+
changedRefs: []
|
|
6501
|
+
};
|
|
6502
|
+
const out = {};
|
|
6503
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6504
|
+
return {
|
|
6505
|
+
patch: out,
|
|
6506
|
+
changedRefs: pass.changedRefs
|
|
6507
|
+
};
|
|
6508
|
+
}
|
|
6509
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6510
|
+
function isJsonEqual(a, b) {
|
|
6511
|
+
if (Object.is(a, b)) return true;
|
|
6512
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6513
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6514
|
+
const keys = Object.keys(a);
|
|
6515
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6516
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6337
6517
|
}
|
|
6338
6518
|
return false;
|
|
6339
6519
|
}
|
|
6520
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6521
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6522
|
+
const out = {};
|
|
6523
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6524
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6525
|
+
out[key] = value;
|
|
6526
|
+
}
|
|
6527
|
+
return out;
|
|
6528
|
+
}
|
|
6529
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6530
|
+
function markerKeysOf(blob, owner) {
|
|
6531
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6532
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6533
|
+
return keys;
|
|
6534
|
+
}
|
|
6535
|
+
function nodeFromStored(value, owner) {
|
|
6536
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6537
|
+
if (!isRecord$3(value)) return null;
|
|
6538
|
+
const children = /* @__PURE__ */ new Map();
|
|
6539
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6540
|
+
const node = nodeFromStored(child, owner);
|
|
6541
|
+
if (node !== null) children.set(key, node);
|
|
6542
|
+
}
|
|
6543
|
+
return children.size > 0 ? {
|
|
6544
|
+
kind: "object",
|
|
6545
|
+
children
|
|
6546
|
+
} : null;
|
|
6547
|
+
}
|
|
6548
|
+
/**
|
|
6549
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6550
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6551
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6552
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6553
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6554
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6555
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6556
|
+
* over.
|
|
6557
|
+
*/
|
|
6558
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6559
|
+
const added = /* @__PURE__ */ new Map();
|
|
6560
|
+
for (const key of keys) {
|
|
6561
|
+
const at = key.indexOf("@");
|
|
6562
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6563
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6564
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6565
|
+
if (node !== null) added.set(base, node);
|
|
6566
|
+
}
|
|
6567
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6568
|
+
}
|
|
6340
6569
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6341
6570
|
async function readStoredAddonBlob(raw) {
|
|
6342
6571
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6345,7 +6574,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6345
6574
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6346
6575
|
return result.kind === "missing" ? {} : result.value;
|
|
6347
6576
|
}
|
|
6348
|
-
function
|
|
6577
|
+
function touchesTree(tree, patch) {
|
|
6578
|
+
if (tree.size === 0) return false;
|
|
6579
|
+
for (const key of Object.keys(patch)) {
|
|
6580
|
+
const at = key.indexOf("@");
|
|
6581
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6582
|
+
}
|
|
6583
|
+
return false;
|
|
6584
|
+
}
|
|
6585
|
+
/**
|
|
6586
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6587
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6588
|
+
*/
|
|
6589
|
+
var MarkerKeyIndex = class {
|
|
6590
|
+
owner;
|
|
6591
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6592
|
+
constructor(owner) {
|
|
6593
|
+
this.owner = owner;
|
|
6594
|
+
}
|
|
6595
|
+
seen(store, blob) {
|
|
6596
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6597
|
+
}
|
|
6598
|
+
wrote(store, patch) {
|
|
6599
|
+
const keys = this.byStore.get(store);
|
|
6600
|
+
if (keys === void 0) return;
|
|
6601
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6602
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6603
|
+
else keys.delete(key);
|
|
6604
|
+
}
|
|
6605
|
+
mayHoldMarkers(store, patch) {
|
|
6606
|
+
const keys = this.byStore.get(store);
|
|
6607
|
+
if (keys === void 0) return true;
|
|
6608
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6609
|
+
}
|
|
6610
|
+
};
|
|
6611
|
+
function createHandle(raw, opts) {
|
|
6349
6612
|
const chains = /* @__PURE__ */ new Map();
|
|
6350
6613
|
const serialize = (key, fn) => {
|
|
6351
6614
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6356,46 +6619,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6356
6619
|
});
|
|
6357
6620
|
return next;
|
|
6358
6621
|
};
|
|
6359
|
-
const
|
|
6360
|
-
|
|
6361
|
-
|
|
6622
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6623
|
+
const resolveRead = async (store, blob) => {
|
|
6624
|
+
index.seen(store, blob);
|
|
6625
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6626
|
+
unresolved: "keep-marker",
|
|
6627
|
+
ownedBy: opts.secrets.owner
|
|
6628
|
+
});
|
|
6629
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6630
|
+
return value;
|
|
6631
|
+
};
|
|
6632
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6633
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6634
|
+
await rawWrite(patch);
|
|
6635
|
+
index.wrote(store, patch);
|
|
6636
|
+
return { changed: true };
|
|
6637
|
+
}
|
|
6638
|
+
return serialize(store, async () => {
|
|
6362
6639
|
const stored = await readStored();
|
|
6640
|
+
index.seen(store, stored);
|
|
6641
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6642
|
+
const restored = await restoreUnchangedSecrets({
|
|
6643
|
+
patch,
|
|
6644
|
+
stored,
|
|
6645
|
+
secrets: opts.secrets,
|
|
6646
|
+
operatorWrite
|
|
6647
|
+
});
|
|
6363
6648
|
const result = await transformSecretWrite({
|
|
6364
|
-
tree,
|
|
6649
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6365
6650
|
secrets: opts.secrets,
|
|
6366
|
-
patch,
|
|
6651
|
+
patch: restored.patch,
|
|
6367
6652
|
stored,
|
|
6368
6653
|
...scope !== void 0 ? { scope } : {},
|
|
6369
|
-
operatorWrite
|
|
6654
|
+
operatorWrite
|
|
6370
6655
|
});
|
|
6371
|
-
|
|
6656
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6657
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6658
|
+
if (wroteBlob) {
|
|
6659
|
+
await rawWrite(effective);
|
|
6660
|
+
index.wrote(store, effective);
|
|
6661
|
+
}
|
|
6372
6662
|
const { orphaned } = await result.afterWrite();
|
|
6373
6663
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6664
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6374
6665
|
});
|
|
6375
6666
|
};
|
|
6376
|
-
const
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6667
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6668
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6669
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6670
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6671
|
+
const overrides = {
|
|
6672
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6673
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6674
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6675
|
+
return result.kind === "value" ? {
|
|
6676
|
+
kind: "value",
|
|
6677
|
+
value: await resolveRead("addon", result.value)
|
|
6678
|
+
} : result;
|
|
6679
|
+
} } : {},
|
|
6680
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6681
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6682
|
+
if (result.kind !== "present") return result;
|
|
6683
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6684
|
+
unresolved: "keep-marker",
|
|
6685
|
+
ownedBy: opts.secrets.owner
|
|
6686
|
+
});
|
|
6687
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6688
|
+
return {
|
|
6689
|
+
kind: "present",
|
|
6690
|
+
value: value[key]
|
|
6691
|
+
};
|
|
6692
|
+
} } : {},
|
|
6693
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6694
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6695
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6696
|
+
const out = /* @__PURE__ */ new Map();
|
|
6697
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6698
|
+
return out;
|
|
6699
|
+
} } : {},
|
|
6700
|
+
writeAddonStore: async (patch) => {
|
|
6701
|
+
await writeAddon(patch);
|
|
6702
|
+
},
|
|
6703
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6704
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6705
|
+
kind: "device",
|
|
6706
|
+
deviceId
|
|
6707
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6708
|
+
}
|
|
6709
|
+
};
|
|
6710
|
+
return {
|
|
6711
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6712
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6713
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6714
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6715
|
+
} }),
|
|
6716
|
+
raw: {
|
|
6717
|
+
readAddonStore: async () => {
|
|
6718
|
+
const blob = await raw.readAddonStore();
|
|
6719
|
+
index.seen("addon", blob);
|
|
6720
|
+
return blob;
|
|
6721
|
+
},
|
|
6722
|
+
readDeviceStore: async (deviceId) => {
|
|
6723
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6724
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6725
|
+
return blob;
|
|
6726
|
+
}
|
|
6727
|
+
},
|
|
6728
|
+
writeAddonStore: writeAddon
|
|
6729
|
+
};
|
|
6389
6730
|
}
|
|
6390
|
-
/** The context the addon sees
|
|
6391
|
-
function
|
|
6731
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6732
|
+
function createSecretAwareContext(context, opts) {
|
|
6392
6733
|
const raw = context.settings;
|
|
6393
|
-
if (raw === void 0) return
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6734
|
+
if (raw === void 0) return {
|
|
6735
|
+
context,
|
|
6736
|
+
handle: null
|
|
6737
|
+
};
|
|
6738
|
+
const handle = createHandle(raw, opts);
|
|
6739
|
+
return {
|
|
6740
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6741
|
+
if (prop === "settings") return handle.settings;
|
|
6742
|
+
return Reflect.get(target, prop, receiver);
|
|
6743
|
+
} }),
|
|
6744
|
+
handle
|
|
6745
|
+
};
|
|
6399
6746
|
}
|
|
6400
6747
|
var LEAF = { kind: "leaf" };
|
|
6401
6748
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6570,6 +6917,14 @@ var BaseAddon = class {
|
|
|
6570
6917
|
_secretChangeUnsub = null;
|
|
6571
6918
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6572
6919
|
_operatorWriteDepth = 0;
|
|
6920
|
+
/**
|
|
6921
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6922
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6923
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6924
|
+
*/
|
|
6925
|
+
_secretSettings = null;
|
|
6926
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6927
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6573
6928
|
constructor(defaults) {
|
|
6574
6929
|
this.defaults = defaults;
|
|
6575
6930
|
this._config = { ...defaults };
|
|
@@ -6606,13 +6961,21 @@ var BaseAddon = class {
|
|
|
6606
6961
|
}
|
|
6607
6962
|
async initialize(context) {
|
|
6608
6963
|
const secrets = context.secrets;
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6964
|
+
if (secrets !== void 0) {
|
|
6965
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6966
|
+
secrets,
|
|
6967
|
+
addonTree: () => this.addonSecretTree(),
|
|
6968
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6969
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6970
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6971
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6972
|
+
});
|
|
6973
|
+
this._ctx = wrapped;
|
|
6974
|
+
this._secretSettings = handle;
|
|
6975
|
+
} else {
|
|
6976
|
+
this._ctx = context;
|
|
6977
|
+
this._secretSettings = null;
|
|
6978
|
+
}
|
|
6616
6979
|
await this.resolveConfig();
|
|
6617
6980
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6618
6981
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6729,11 +7092,8 @@ var BaseAddon = class {
|
|
|
6729
7092
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6730
7093
|
const schema = this.globalSettingsSchema(cap);
|
|
6731
7094
|
if (!schema) return { sections: [] };
|
|
6732
|
-
const projected = await this.
|
|
6733
|
-
return hydrateSchema(schema, overlay ? {
|
|
6734
|
-
...projected,
|
|
6735
|
-
...overlay
|
|
6736
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7095
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7096
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6737
7097
|
}
|
|
6738
7098
|
/**
|
|
6739
7099
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6778,7 +7138,7 @@ var BaseAddon = class {
|
|
|
6778
7138
|
});
|
|
6779
7139
|
}
|
|
6780
7140
|
if (sections.length === 0) return null;
|
|
6781
|
-
const projected = await this.
|
|
7141
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6782
7142
|
return hydrateSchema({
|
|
6783
7143
|
...schema,
|
|
6784
7144
|
sections
|
|
@@ -6795,12 +7155,50 @@ var BaseAddon = class {
|
|
|
6795
7155
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6796
7156
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6797
7157
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7158
|
+
*
|
|
7159
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7160
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7161
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7162
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7163
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7164
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6798
7165
|
*/
|
|
6799
7166
|
async resolveGlobalStore(nodeId, cap) {
|
|
6800
7167
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7168
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7169
|
+
}
|
|
7170
|
+
projectForNode(store, nodeId, cap) {
|
|
6801
7171
|
const keys = this.perNodeKeys(cap);
|
|
6802
7172
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6803
|
-
return keys.size > 0 ? projectStore(
|
|
7173
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7174
|
+
}
|
|
7175
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7176
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7177
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7178
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7179
|
+
}
|
|
7180
|
+
/**
|
|
7181
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7182
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7183
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7184
|
+
* its value.
|
|
7185
|
+
*/
|
|
7186
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7187
|
+
const secrets = this._ctx?.secrets;
|
|
7188
|
+
const merged = {
|
|
7189
|
+
...stored,
|
|
7190
|
+
...overlay
|
|
7191
|
+
};
|
|
7192
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7193
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7194
|
+
unresolved: "keep-marker",
|
|
7195
|
+
ownedBy: secrets.owner
|
|
7196
|
+
});
|
|
7197
|
+
for (const key of Object.keys(overlay)) {
|
|
7198
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7199
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7200
|
+
}
|
|
7201
|
+
return merged;
|
|
6804
7202
|
}
|
|
6805
7203
|
/**
|
|
6806
7204
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6865,8 +7263,12 @@ var BaseAddon = class {
|
|
|
6865
7263
|
async clearSecrets(keys, nodeId) {
|
|
6866
7264
|
const tree = this.addonSecretTree();
|
|
6867
7265
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7266
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6868
7267
|
const patch = {};
|
|
6869
|
-
for (const key of keys)
|
|
7268
|
+
for (const key of keys) {
|
|
7269
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7270
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7271
|
+
}
|
|
6870
7272
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6871
7273
|
}
|
|
6872
7274
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6874,7 +7276,11 @@ var BaseAddon = class {
|
|
|
6874
7276
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6875
7277
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6876
7278
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6877
|
-
|
|
7279
|
+
const handle = this._secretSettings;
|
|
7280
|
+
if (handle !== null) {
|
|
7281
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7282
|
+
if (!changed) return;
|
|
7283
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6878
7284
|
if (target !== localNode) return;
|
|
6879
7285
|
await this.resolveConfig();
|
|
6880
7286
|
await this.onConfigChanged();
|
|
@@ -6927,7 +7333,7 @@ var BaseAddon = class {
|
|
|
6927
7333
|
async getDeviceSettings(deviceId) {
|
|
6928
7334
|
const schema = this.deviceSettingsSchema();
|
|
6929
7335
|
if (!schema) return { sections: [] };
|
|
6930
|
-
return hydrateSchema(schema, await this.
|
|
7336
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6931
7337
|
}
|
|
6932
7338
|
async updateDeviceSettings(deviceId, patch) {
|
|
6933
7339
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7099,7 +7505,7 @@ var BaseAddon = class {
|
|
|
7099
7505
|
key,
|
|
7100
7506
|
schema,
|
|
7101
7507
|
fallback,
|
|
7102
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7508
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7103
7509
|
write: async (patch) => {
|
|
7104
7510
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7105
7511
|
},
|
|
@@ -7161,6 +7567,23 @@ var BaseAddon = class {
|
|
|
7161
7567
|
}
|
|
7162
7568
|
return value;
|
|
7163
7569
|
}
|
|
7570
|
+
/**
|
|
7571
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7572
|
+
* keychain the context's own view is already raw.
|
|
7573
|
+
*/
|
|
7574
|
+
rawSettings() {
|
|
7575
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7576
|
+
}
|
|
7577
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7578
|
+
logUnresolvedRead(unresolved) {
|
|
7579
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7580
|
+
if (fresh.length === 0) return;
|
|
7581
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7582
|
+
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) => ({
|
|
7583
|
+
ref: u.ref,
|
|
7584
|
+
reason: u.reason
|
|
7585
|
+
})) } });
|
|
7586
|
+
}
|
|
7164
7587
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7165
7588
|
scheduleSecretReresolve(delayMs) {
|
|
7166
7589
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7187,7 +7610,7 @@ var BaseAddon = class {
|
|
|
7187
7610
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7188
7611
|
*/
|
|
7189
7612
|
async readAddonStoreWithRetry() {
|
|
7190
|
-
const settings = this.
|
|
7613
|
+
const settings = this.rawSettings();
|
|
7191
7614
|
if (!settings) return {};
|
|
7192
7615
|
const delaysMs = [
|
|
7193
7616
|
150,
|
|
@@ -10147,6 +10570,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10147
10570
|
fetchedAt: number()
|
|
10148
10571
|
});
|
|
10149
10572
|
/**
|
|
10573
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10574
|
+
* gets back (cloud training, D805+).
|
|
10575
|
+
*
|
|
10576
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10577
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10578
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10579
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10580
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10581
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10582
|
+
* change there, in the same piece of work.
|
|
10583
|
+
*
|
|
10584
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10585
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10586
|
+
*/
|
|
10587
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10588
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10589
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10590
|
+
var TrainingExportSchema = _enum([
|
|
10591
|
+
"onnx",
|
|
10592
|
+
"openvino-fp16",
|
|
10593
|
+
"openvino-int8",
|
|
10594
|
+
"coreml-fp16"
|
|
10595
|
+
]);
|
|
10596
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10597
|
+
object({
|
|
10598
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10599
|
+
jobKey: string().uuid(),
|
|
10600
|
+
target: object({
|
|
10601
|
+
kind: literal("detector"),
|
|
10602
|
+
step: literal("object-detection")
|
|
10603
|
+
}),
|
|
10604
|
+
base: object({
|
|
10605
|
+
modelId: string().min(1),
|
|
10606
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10607
|
+
weights: string().min(1),
|
|
10608
|
+
imgsz: number().int().positive()
|
|
10609
|
+
}),
|
|
10610
|
+
baseline: object({
|
|
10611
|
+
modelId: string().min(1),
|
|
10612
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10613
|
+
onnxUrl: string().url(),
|
|
10614
|
+
imgsz: number().int().positive(),
|
|
10615
|
+
floors: FloorsSchema
|
|
10616
|
+
}),
|
|
10617
|
+
dataset: object({
|
|
10618
|
+
versionId: string().min(1),
|
|
10619
|
+
annotationHash: string(),
|
|
10620
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10621
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10622
|
+
}),
|
|
10623
|
+
split: object({
|
|
10624
|
+
holdoutCameras: array(number().int()),
|
|
10625
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10626
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10627
|
+
valFraction: number().min(0).max(.5),
|
|
10628
|
+
seed: number().int()
|
|
10629
|
+
}),
|
|
10630
|
+
hyper: object({
|
|
10631
|
+
epochs: number().int().positive(),
|
|
10632
|
+
batch: number().int().positive(),
|
|
10633
|
+
lr0: number().positive(),
|
|
10634
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10635
|
+
freeze: number().int().nonnegative(),
|
|
10636
|
+
patience: number().int().nonnegative(),
|
|
10637
|
+
seed: number().int()
|
|
10638
|
+
}),
|
|
10639
|
+
replay: object({
|
|
10640
|
+
source: literal("coco2017"),
|
|
10641
|
+
count: number().int().nonnegative()
|
|
10642
|
+
}),
|
|
10643
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10644
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10645
|
+
floors: object({
|
|
10646
|
+
minSupport: number().int().positive(),
|
|
10647
|
+
clamp: number().min(0).max(1)
|
|
10648
|
+
}),
|
|
10649
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10650
|
+
catalog: object({
|
|
10651
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10652
|
+
name: string().min(1).max(160)
|
|
10653
|
+
})
|
|
10654
|
+
});
|
|
10655
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10656
|
+
var TrainingResultFileSchema = object({
|
|
10657
|
+
path: string().min(1),
|
|
10658
|
+
bytes: number().int().nonnegative(),
|
|
10659
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10660
|
+
format: _enum([
|
|
10661
|
+
"onnx",
|
|
10662
|
+
"openvino",
|
|
10663
|
+
"coreml",
|
|
10664
|
+
"pt"
|
|
10665
|
+
]),
|
|
10666
|
+
variant: _enum(["base", "int8"])
|
|
10667
|
+
});
|
|
10668
|
+
var DraftFormatSchema = object({
|
|
10669
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10670
|
+
url: string().min(1),
|
|
10671
|
+
sizeMB: number().nonnegative(),
|
|
10672
|
+
isDirectory: boolean().optional(),
|
|
10673
|
+
files: array(string()).optional(),
|
|
10674
|
+
runtimes: array(literal("python")).optional(),
|
|
10675
|
+
revision: string().min(1)
|
|
10676
|
+
});
|
|
10677
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10678
|
+
var TrainingCatalogDraftSchema = object({
|
|
10679
|
+
id: string().min(1),
|
|
10680
|
+
name: string().min(1),
|
|
10681
|
+
description: string(),
|
|
10682
|
+
labels: array(unknown()),
|
|
10683
|
+
inputSize: object({
|
|
10684
|
+
width: number().int().positive(),
|
|
10685
|
+
height: number().int().positive()
|
|
10686
|
+
}),
|
|
10687
|
+
preprocessMode: literal("letterbox"),
|
|
10688
|
+
defaultClassFloors: FloorsSchema,
|
|
10689
|
+
formats: object({
|
|
10690
|
+
onnx: DraftFormatSchema.optional(),
|
|
10691
|
+
openvino: DraftFormatSchema.optional(),
|
|
10692
|
+
coreml: DraftFormatSchema.optional()
|
|
10693
|
+
})
|
|
10694
|
+
});
|
|
10695
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10696
|
+
var TrainingEvalClassSchema = object({
|
|
10697
|
+
positives: number().int(),
|
|
10698
|
+
floor: number().nullable(),
|
|
10699
|
+
tp: number().int(),
|
|
10700
|
+
fp: number().int(),
|
|
10701
|
+
fn: number().int(),
|
|
10702
|
+
precision: number().nullable(),
|
|
10703
|
+
recall: number().nullable(),
|
|
10704
|
+
ap50: number().nullable(),
|
|
10705
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10706
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10707
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10708
|
+
smallFound: number().int().optional(),
|
|
10709
|
+
smallTotal: number().int().optional()
|
|
10710
|
+
}).passthrough();
|
|
10711
|
+
var TrainingEvalReportSchema = object({
|
|
10712
|
+
frames: number().int(),
|
|
10713
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10714
|
+
}).passthrough();
|
|
10715
|
+
/**
|
|
10716
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10717
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10718
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10719
|
+
*/
|
|
10720
|
+
var TrainingResultSchema = object({
|
|
10721
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10722
|
+
jobKey: string(),
|
|
10723
|
+
status: _enum(["succeeded", "failed"]),
|
|
10724
|
+
error: object({
|
|
10725
|
+
stage: string(),
|
|
10726
|
+
code: string(),
|
|
10727
|
+
message: string()
|
|
10728
|
+
}).nullable(),
|
|
10729
|
+
trainer: object({
|
|
10730
|
+
version: string(),
|
|
10731
|
+
revision: string()
|
|
10732
|
+
}),
|
|
10733
|
+
toolchain: record(string(), string().nullable()),
|
|
10734
|
+
dataset: object({
|
|
10735
|
+
versionId: string(),
|
|
10736
|
+
annotationHash: string(),
|
|
10737
|
+
sha256: string(),
|
|
10738
|
+
frames: object({
|
|
10739
|
+
train: number().int(),
|
|
10740
|
+
val: number().int(),
|
|
10741
|
+
holdout: number().int()
|
|
10742
|
+
}),
|
|
10743
|
+
holdoutCameras: array(number().int()),
|
|
10744
|
+
replayImages: number().int()
|
|
10745
|
+
}).optional(),
|
|
10746
|
+
training: object({
|
|
10747
|
+
epochsRun: number().int(),
|
|
10748
|
+
bestEpoch: number().int(),
|
|
10749
|
+
bestMap50: number(),
|
|
10750
|
+
bestMap50_95: number(),
|
|
10751
|
+
seconds: number()
|
|
10752
|
+
}).optional(),
|
|
10753
|
+
evaluation: object({
|
|
10754
|
+
holdoutFrames: number().int(),
|
|
10755
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10756
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10757
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10758
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10759
|
+
map50: record(string(), number().nullable())
|
|
10760
|
+
}).optional(),
|
|
10761
|
+
floors: object({
|
|
10762
|
+
baseline: FloorsSchema,
|
|
10763
|
+
candidate: FloorsSchema,
|
|
10764
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10765
|
+
notes: array(string())
|
|
10766
|
+
}).optional(),
|
|
10767
|
+
int8: object({
|
|
10768
|
+
kept: boolean(),
|
|
10769
|
+
map50Fp16: number().nullable(),
|
|
10770
|
+
map50Int8: number().nullable(),
|
|
10771
|
+
reason: string().nullable()
|
|
10772
|
+
}).optional(),
|
|
10773
|
+
exportsDropped: array(object({
|
|
10774
|
+
export: string(),
|
|
10775
|
+
reason: string()
|
|
10776
|
+
})).optional(),
|
|
10777
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10778
|
+
bundle: object({
|
|
10779
|
+
path: literal("bundle.tar"),
|
|
10780
|
+
bytes: number().int().nonnegative(),
|
|
10781
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10782
|
+
}).nullable().optional(),
|
|
10783
|
+
catalogDraft: object({
|
|
10784
|
+
base: TrainingCatalogDraftSchema,
|
|
10785
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10786
|
+
}).nullable().optional(),
|
|
10787
|
+
licence: string()
|
|
10788
|
+
});
|
|
10789
|
+
var TrainingStageSchema = _enum([
|
|
10790
|
+
"prepare",
|
|
10791
|
+
"replay",
|
|
10792
|
+
"train",
|
|
10793
|
+
"eval",
|
|
10794
|
+
"export",
|
|
10795
|
+
"package"
|
|
10796
|
+
]);
|
|
10797
|
+
var EventBase = {
|
|
10798
|
+
v: literal(1),
|
|
10799
|
+
ts: number()
|
|
10800
|
+
};
|
|
10801
|
+
discriminatedUnion("type", [
|
|
10802
|
+
object({
|
|
10803
|
+
...EventBase,
|
|
10804
|
+
type: literal("stage"),
|
|
10805
|
+
stage: TrainingStageSchema
|
|
10806
|
+
}),
|
|
10807
|
+
object({
|
|
10808
|
+
...EventBase,
|
|
10809
|
+
type: literal("epoch"),
|
|
10810
|
+
epoch: number().int(),
|
|
10811
|
+
epochs: number().int(),
|
|
10812
|
+
boxLoss: number().nullable().optional(),
|
|
10813
|
+
map50: number().nullable().optional(),
|
|
10814
|
+
map50_95: number().nullable().optional(),
|
|
10815
|
+
etaSec: number().nullable().optional()
|
|
10816
|
+
}),
|
|
10817
|
+
object({
|
|
10818
|
+
...EventBase,
|
|
10819
|
+
type: literal("metric"),
|
|
10820
|
+
name: string(),
|
|
10821
|
+
value: number()
|
|
10822
|
+
}),
|
|
10823
|
+
object({
|
|
10824
|
+
...EventBase,
|
|
10825
|
+
type: literal("artifact"),
|
|
10826
|
+
path: string(),
|
|
10827
|
+
bytes: number(),
|
|
10828
|
+
sha256: string()
|
|
10829
|
+
}),
|
|
10830
|
+
object({
|
|
10831
|
+
...EventBase,
|
|
10832
|
+
type: literal("done"),
|
|
10833
|
+
status: _enum(["succeeded", "failed"]),
|
|
10834
|
+
resultSha256: string().nullable().optional()
|
|
10835
|
+
}),
|
|
10836
|
+
object({
|
|
10837
|
+
...EventBase,
|
|
10838
|
+
type: literal("error"),
|
|
10839
|
+
stage: string(),
|
|
10840
|
+
code: string(),
|
|
10841
|
+
message: string()
|
|
10842
|
+
})
|
|
10843
|
+
]);
|
|
10844
|
+
/**
|
|
10150
10845
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
10151
10846
|
*
|
|
10152
10847
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12628,7 +13323,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12628
13323
|
"authenticated",
|
|
12629
13324
|
"admin"
|
|
12630
13325
|
]).optional(),
|
|
12631
|
-
description: string().optional()
|
|
13326
|
+
description: string().optional(),
|
|
13327
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13328
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12632
13329
|
});
|
|
12633
13330
|
/**
|
|
12634
13331
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13333,6 +14030,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13333
14030
|
lastError: string().optional()
|
|
13334
14031
|
});
|
|
13335
14032
|
/**
|
|
14033
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14034
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14035
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14036
|
+
* with it off — which restores without a key.
|
|
14037
|
+
*/
|
|
14038
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14039
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14040
|
+
scheme: string(),
|
|
14041
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14042
|
+
keyId: string()
|
|
14043
|
+
});
|
|
14044
|
+
/**
|
|
14045
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14046
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14047
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14048
|
+
*/
|
|
14049
|
+
var BackupEncryptionStatusSchema = object({
|
|
14050
|
+
enabled: boolean(),
|
|
14051
|
+
active: object({
|
|
14052
|
+
keyId: string(),
|
|
14053
|
+
publicKey: string(),
|
|
14054
|
+
createdAt: number()
|
|
14055
|
+
}).nullable(),
|
|
14056
|
+
/** Every key ever set up, newest first. */
|
|
14057
|
+
keys: array(object({
|
|
14058
|
+
keyId: string(),
|
|
14059
|
+
createdAt: number(),
|
|
14060
|
+
retiredAt: number().nullable()
|
|
14061
|
+
})).readonly()
|
|
14062
|
+
});
|
|
14063
|
+
/**
|
|
13336
14064
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13337
14065
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13338
14066
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13344,7 +14072,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13344
14072
|
sizeBytes: number(),
|
|
13345
14073
|
label: string().optional(),
|
|
13346
14074
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13347
|
-
locations: array(string()).readonly()
|
|
14075
|
+
locations: array(string()).readonly(),
|
|
14076
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14077
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13348
14078
|
});
|
|
13349
14079
|
var BackupEntrySchema = object({
|
|
13350
14080
|
id: string(),
|
|
@@ -13353,7 +14083,8 @@ var BackupEntrySchema = object({
|
|
|
13353
14083
|
label: string().optional(),
|
|
13354
14084
|
createdAt: number(),
|
|
13355
14085
|
sizeBytes: number(),
|
|
13356
|
-
locations: array(string()).optional()
|
|
14086
|
+
locations: array(string()).optional(),
|
|
14087
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13357
14088
|
});
|
|
13358
14089
|
var ArchiveEntrySchema = object({
|
|
13359
14090
|
path: string(),
|
|
@@ -13542,10 +14273,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13542
14273
|
* this list and skips entries whose path doesn't start with
|
|
13543
14274
|
* any of them.
|
|
13544
14275
|
*/
|
|
13545
|
-
locations: array(string()).optional()
|
|
14276
|
+
locations: array(string()).optional(),
|
|
14277
|
+
/**
|
|
14278
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14279
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14280
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14281
|
+
* is refused before the archive is downloaded.
|
|
14282
|
+
*/
|
|
14283
|
+
backupSecretKey: string().optional()
|
|
13546
14284
|
}), _void(), {
|
|
13547
14285
|
kind: "mutation",
|
|
13548
14286
|
auth: "admin"
|
|
14287
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14288
|
+
keyId: string(),
|
|
14289
|
+
secretKey: string(),
|
|
14290
|
+
publicKey: string(),
|
|
14291
|
+
createdAt: number(),
|
|
14292
|
+
replacedKeyId: string().nullable()
|
|
14293
|
+
}), {
|
|
14294
|
+
kind: "mutation",
|
|
14295
|
+
auth: "admin"
|
|
14296
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14297
|
+
kind: "mutation",
|
|
14298
|
+
auth: "admin"
|
|
14299
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14300
|
+
valid: boolean(),
|
|
14301
|
+
keyId: string().nullable(),
|
|
14302
|
+
/** The hub knows this key (active or retired). */
|
|
14303
|
+
known: boolean(),
|
|
14304
|
+
/** It is the key new archives are encrypted to. */
|
|
14305
|
+
active: boolean(),
|
|
14306
|
+
error: string().optional()
|
|
14307
|
+
}), {
|
|
14308
|
+
kind: "mutation",
|
|
14309
|
+
auth: "admin"
|
|
13549
14310
|
}), method(object({
|
|
13550
14311
|
destinationId: string(),
|
|
13551
14312
|
backupId: string()
|
|
@@ -15169,7 +15930,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
15169
15930
|
stepId: string(),
|
|
15170
15931
|
entry: ModelCatalogEntrySchema
|
|
15171
15932
|
});
|
|
15172
|
-
|
|
15933
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15934
|
+
var ModelBundleFileSchema = object({
|
|
15935
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15936
|
+
path: string().min(1),
|
|
15937
|
+
bytes: number().int().nonnegative(),
|
|
15938
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15939
|
+
});
|
|
15940
|
+
var ImportModelBundleInputSchema = object({
|
|
15941
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15942
|
+
addonId: string(),
|
|
15943
|
+
stepId: string().min(1),
|
|
15944
|
+
/**
|
|
15945
|
+
* The catalog rows to register, complete, every format URL already
|
|
15946
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15947
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15948
|
+
*/
|
|
15949
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15950
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15951
|
+
bundle: object({
|
|
15952
|
+
ticket: PeerBytesTicketSchema,
|
|
15953
|
+
bytes: number().int().positive(),
|
|
15954
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15955
|
+
}),
|
|
15956
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15957
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15958
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15959
|
+
distribute: boolean()
|
|
15960
|
+
});
|
|
15961
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15962
|
+
kind: literal("imported"),
|
|
15963
|
+
modelIds: array(string()).readonly(),
|
|
15964
|
+
distributed: array(object({
|
|
15965
|
+
modelId: string(),
|
|
15966
|
+
nodeId: string(),
|
|
15967
|
+
format: _enum(MODEL_FORMATS),
|
|
15968
|
+
ok: boolean(),
|
|
15969
|
+
error: string().optional()
|
|
15970
|
+
})).readonly()
|
|
15971
|
+
}), object({
|
|
15972
|
+
kind: literal("refused"),
|
|
15973
|
+
reason: _enum([
|
|
15974
|
+
"transfer-failed",
|
|
15975
|
+
"checksum-mismatch",
|
|
15976
|
+
"bundle-mismatch",
|
|
15977
|
+
"invalid-entry",
|
|
15978
|
+
"id-taken"
|
|
15979
|
+
]),
|
|
15980
|
+
detail: string()
|
|
15981
|
+
})]);
|
|
15982
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15983
|
+
kind: "mutation",
|
|
15984
|
+
auth: "admin",
|
|
15985
|
+
timeoutMs: 30 * 6e4
|
|
15986
|
+
});
|
|
15173
15987
|
/**
|
|
15174
15988
|
* Query filter for settings-store collections.
|
|
15175
15989
|
*/
|
|
@@ -15648,6 +16462,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15648
16462
|
*/
|
|
15649
16463
|
sharesBackupWithDatabase: boolean()
|
|
15650
16464
|
});
|
|
16465
|
+
/**
|
|
16466
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16467
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16468
|
+
*/
|
|
16469
|
+
var KeychainResetRecordSchema = object({
|
|
16470
|
+
id: string(),
|
|
16471
|
+
at: number(),
|
|
16472
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16473
|
+
actor: string(),
|
|
16474
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16475
|
+
lockedReason: string().nullable(),
|
|
16476
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16477
|
+
archived: number().int(),
|
|
16478
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16479
|
+
archivedCollection: string().nullable(),
|
|
16480
|
+
/**
|
|
16481
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16482
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16483
|
+
*/
|
|
16484
|
+
archivedKeysCollection: string().nullable(),
|
|
16485
|
+
/**
|
|
16486
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16487
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16488
|
+
* agent forever (D797).
|
|
16489
|
+
*/
|
|
16490
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16491
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16492
|
+
acknowledgedAt: number().nullable()
|
|
16493
|
+
});
|
|
15651
16494
|
var KeychainStatusSchema = object({
|
|
15652
16495
|
keychain: KeychainStateSchema,
|
|
15653
16496
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15665,7 +16508,9 @@ var KeychainStatusSchema = object({
|
|
|
15665
16508
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15666
16509
|
retiredWraps: number().int(),
|
|
15667
16510
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15668
|
-
secretCount: number().int()
|
|
16511
|
+
secretCount: number().int(),
|
|
16512
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16513
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15669
16514
|
});
|
|
15670
16515
|
/**
|
|
15671
16516
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15687,17 +16532,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15687
16532
|
"download-recovery-key",
|
|
15688
16533
|
"delete-orphans",
|
|
15689
16534
|
"reset",
|
|
16535
|
+
"acknowledge-reset",
|
|
15690
16536
|
"initialize"
|
|
15691
16537
|
]);
|
|
15692
16538
|
var KeychainAuditEntrySchema = object({
|
|
15693
16539
|
id: string(),
|
|
15694
16540
|
at: number(),
|
|
15695
16541
|
action: KeychainAuditActionSchema,
|
|
15696
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16542
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15697
16543
|
actor: string(),
|
|
15698
16544
|
ref: string().nullable(),
|
|
15699
16545
|
detail: string().nullable()
|
|
15700
16546
|
});
|
|
16547
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16548
|
+
/**
|
|
16549
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16550
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16551
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16552
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16553
|
+
*/
|
|
16554
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15701
16555
|
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({
|
|
15702
16556
|
value: string(),
|
|
15703
16557
|
version: number().int()
|
|
@@ -15705,6 +16559,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15705
16559
|
kind: "mutation",
|
|
15706
16560
|
auth: "admin",
|
|
15707
16561
|
caller: "required"
|
|
16562
|
+
}), method(object({
|
|
16563
|
+
name: SystemHeldSecretNameSchema,
|
|
16564
|
+
value: string().min(16)
|
|
16565
|
+
}), object({
|
|
16566
|
+
ref: string(),
|
|
16567
|
+
version: number().int()
|
|
16568
|
+
}), {
|
|
16569
|
+
kind: "mutation",
|
|
16570
|
+
auth: "admin",
|
|
16571
|
+
caller: "required"
|
|
15708
16572
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15709
16573
|
deleted: array(string()).readonly(),
|
|
15710
16574
|
kept: array(object({
|
|
@@ -15734,13 +16598,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15734
16598
|
kind: "mutation",
|
|
15735
16599
|
auth: "admin",
|
|
15736
16600
|
caller: "required"
|
|
15737
|
-
}), method(object({ confirm: literal(
|
|
16601
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15738
16602
|
archivedCollection: string().nullable(),
|
|
15739
16603
|
archived: number().int()
|
|
15740
16604
|
}), {
|
|
15741
16605
|
kind: "mutation",
|
|
15742
16606
|
auth: "admin",
|
|
15743
16607
|
caller: "required"
|
|
16608
|
+
}), method(object({}), object({
|
|
16609
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16610
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16611
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16612
|
+
kind: "mutation",
|
|
16613
|
+
auth: "admin",
|
|
16614
|
+
caller: "required"
|
|
15744
16615
|
});
|
|
15745
16616
|
/**
|
|
15746
16617
|
* Stable UI option list for the `hwaccel` setting. Decoder addons
|
|
@@ -18467,7 +19338,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18467
19338
|
* `login-method` — collection cap through which auth addons contribute
|
|
18468
19339
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18469
19340
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18470
|
-
* every auth addon (OIDC,
|
|
19341
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18471
19342
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18472
19343
|
* procedure aggregates them for the unauthenticated login page.
|
|
18473
19344
|
*
|
|
@@ -18475,8 +19346,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18475
19346
|
*
|
|
18476
19347
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18477
19348
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18478
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18479
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19349
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18480
19350
|
* login page needs NO change.
|
|
18481
19351
|
*
|
|
18482
19352
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18495,8 +19365,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18495
19365
|
* decision.
|
|
18496
19366
|
*
|
|
18497
19367
|
* Every contribution carries a `stage`:
|
|
18498
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18499
|
-
*
|
|
19368
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19369
|
+
* buttons; a usernameless passkey).
|
|
18500
19370
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18501
19371
|
* returned `factors` (passkey-as-2FA today).
|
|
18502
19372
|
*
|
|
@@ -18523,7 +19393,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18523
19393
|
* The provider names an external identity a signed-in user can link to
|
|
18524
19394
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18525
19395
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18526
|
-
* whatever their id. Absent / false — a login button only
|
|
19396
|
+
* whatever their id. Absent / false — a login button only.
|
|
18527
19397
|
*/
|
|
18528
19398
|
linkable: boolean().optional()
|
|
18529
19399
|
}),
|
|
@@ -22340,8 +23210,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22340
23210
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22341
23211
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22342
23212
|
* distinction was only ever used to route role-specific procedures
|
|
22343
|
-
* which we no longer have.
|
|
22344
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23213
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22345
23214
|
* with `isAdmin: false` + an explicit scope list.
|
|
22346
23215
|
*/
|
|
22347
23216
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24016,6 +24885,9 @@ var RetrainExportFilterSchema = object({
|
|
|
24016
24885
|
frameIds: array(string()).max(2e4).optional(),
|
|
24017
24886
|
/** Only frames in at least one of these named collections. */
|
|
24018
24887
|
collectionIds: array(string()).max(200).optional(),
|
|
24888
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24889
|
+
* unknown id selects nothing. */
|
|
24890
|
+
datasetVersionId: string().optional(),
|
|
24019
24891
|
batchId: string().optional(),
|
|
24020
24892
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24021
24893
|
completeOnly: boolean().optional()
|
|
@@ -24183,6 +25055,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24183
25055
|
]),
|
|
24184
25056
|
detail: string().optional()
|
|
24185
25057
|
})]);
|
|
25058
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25059
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25060
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25061
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25062
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25063
|
+
});
|
|
25064
|
+
/** The counts a dataset is judged by. */
|
|
25065
|
+
var RetrainDatasetStatsSchema = object({
|
|
25066
|
+
frames: number().int(),
|
|
25067
|
+
completeFrames: number().int(),
|
|
25068
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25069
|
+
completeness: number(),
|
|
25070
|
+
/** Boxes to learn (model errors excluded). */
|
|
25071
|
+
subjects: number().int(),
|
|
25072
|
+
modelErrors: number().int(),
|
|
25073
|
+
/** Complete frames with no subject. */
|
|
25074
|
+
hardNegatives: number().int(),
|
|
25075
|
+
/** Subjects per class × camera × day/night. */
|
|
25076
|
+
cells: array(object({
|
|
25077
|
+
macroClass: string(),
|
|
25078
|
+
deviceId: number(),
|
|
25079
|
+
lighting: _enum([
|
|
25080
|
+
"day",
|
|
25081
|
+
"night",
|
|
25082
|
+
"unknown"
|
|
25083
|
+
]),
|
|
25084
|
+
subjects: number().int(),
|
|
25085
|
+
frames: number().int()
|
|
25086
|
+
})).readonly(),
|
|
25087
|
+
cameras: array(object({
|
|
25088
|
+
deviceId: number(),
|
|
25089
|
+
frames: number().int(),
|
|
25090
|
+
completeFrames: number().int()
|
|
25091
|
+
})).readonly()
|
|
25092
|
+
});
|
|
25093
|
+
/** An immutable dataset version, without its frame list. */
|
|
25094
|
+
var RetrainDatasetVersionSchema = object({
|
|
25095
|
+
id: string(),
|
|
25096
|
+
name: string(),
|
|
25097
|
+
createdAt: number(),
|
|
25098
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25099
|
+
layout: RetrainExportLayoutSchema,
|
|
25100
|
+
completeOnly: boolean(),
|
|
25101
|
+
frameCount: number().int(),
|
|
25102
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25103
|
+
annotationHash: string(),
|
|
25104
|
+
/** The export manifest schema the version was cut under. */
|
|
25105
|
+
manifestSchema: string(),
|
|
25106
|
+
stats: RetrainDatasetStatsSchema
|
|
25107
|
+
});
|
|
25108
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25109
|
+
kind: literal("created"),
|
|
25110
|
+
version: RetrainDatasetVersionSchema
|
|
25111
|
+
}), object({
|
|
25112
|
+
kind: literal("refused"),
|
|
25113
|
+
reason: _enum([
|
|
25114
|
+
"empty-name",
|
|
25115
|
+
"duplicate-name",
|
|
25116
|
+
"no-frames"
|
|
25117
|
+
])
|
|
25118
|
+
})]);
|
|
24186
25119
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24187
25120
|
var RetrainTransitionResultSchema = object({
|
|
24188
25121
|
trackId: string(),
|
|
@@ -24972,6 +25905,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24972
25905
|
kind: "mutation",
|
|
24973
25906
|
auth: "admin",
|
|
24974
25907
|
timeoutMs: 60 * 6e4
|
|
25908
|
+
}), method(object({
|
|
25909
|
+
filter: RetrainExportFilterSchema,
|
|
25910
|
+
layout: RetrainExportLayoutSchema
|
|
25911
|
+
}), object({
|
|
25912
|
+
ticket: PeerBytesTicketSchema,
|
|
25913
|
+
frames: number().int(),
|
|
25914
|
+
annotations: number().int()
|
|
25915
|
+
}), {
|
|
25916
|
+
kind: "mutation",
|
|
25917
|
+
auth: "admin",
|
|
25918
|
+
timeoutMs: 12e4
|
|
25919
|
+
}), method(object({
|
|
25920
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25921
|
+
completeOnly: boolean().optional()
|
|
25922
|
+
}), RetrainDatasetStatsSchema, {
|
|
25923
|
+
kind: "query",
|
|
25924
|
+
auth: "admin"
|
|
25925
|
+
}), method(object({
|
|
25926
|
+
name: string().max(120),
|
|
25927
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25928
|
+
layout: RetrainExportLayoutSchema,
|
|
25929
|
+
completeOnly: boolean()
|
|
25930
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25931
|
+
kind: "mutation",
|
|
25932
|
+
auth: "admin",
|
|
25933
|
+
timeoutMs: 12e4
|
|
25934
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25935
|
+
kind: "query",
|
|
25936
|
+
auth: "admin"
|
|
25937
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25938
|
+
kind: "mutation",
|
|
25939
|
+
auth: "admin"
|
|
25940
|
+
}), method(object({ id: string() }), object({
|
|
25941
|
+
found: boolean(),
|
|
25942
|
+
annotationHash: string(),
|
|
25943
|
+
matches: boolean(),
|
|
25944
|
+
missingFrames: number().int()
|
|
25945
|
+
}), {
|
|
25946
|
+
kind: "query",
|
|
25947
|
+
auth: "admin",
|
|
25948
|
+
timeoutMs: 12e4
|
|
24975
25949
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24976
25950
|
kind: "query",
|
|
24977
25951
|
auth: "admin"
|
|
@@ -28510,8 +29484,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28510
29484
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28511
29485
|
*
|
|
28512
29486
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28513
|
-
* one for transactional / one for notifications). Consumers (
|
|
28514
|
-
*
|
|
29487
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29488
|
+
* addons, …) walk the collection and pick the first
|
|
28515
29489
|
* ready provider OR target a specific addonId.
|
|
28516
29490
|
*
|
|
28517
29491
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28690,7 +29664,7 @@ targets: array(object({
|
|
|
28690
29664
|
})));
|
|
28691
29665
|
/**
|
|
28692
29666
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28693
|
-
* providers (OIDC, SAML,
|
|
29667
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28694
29668
|
* carrying the post-callback claims before redirecting back to
|
|
28695
29669
|
* `/api/auth/sso/finish`.
|
|
28696
29670
|
*
|
|
@@ -28753,7 +29727,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28753
29727
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28754
29728
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28755
29729
|
*/
|
|
28756
|
-
issuer: string().optional()
|
|
29730
|
+
issuer: string().optional(),
|
|
29731
|
+
/**
|
|
29732
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29733
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29734
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29735
|
+
* any other browser.
|
|
29736
|
+
*/
|
|
29737
|
+
browserBinding: string().optional()
|
|
28757
29738
|
});
|
|
28758
29739
|
method(object({
|
|
28759
29740
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -38927,16 +39908,6 @@ var ApiKeySummarySchema = object({
|
|
|
38927
39908
|
createdAt: number(),
|
|
38928
39909
|
lastUsedAt: number().optional()
|
|
38929
39910
|
});
|
|
38930
|
-
var CreateApiKeyInputSchema = object({
|
|
38931
|
-
label: string(),
|
|
38932
|
-
isAdmin: boolean().default(false),
|
|
38933
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
38934
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
38935
|
-
});
|
|
38936
|
-
var CreateApiKeyResultSchema = object({
|
|
38937
|
-
token: string(),
|
|
38938
|
-
record: ApiKeySummarySchema
|
|
38939
|
-
});
|
|
38940
39911
|
var ScopedTokenSummarySchema = object({
|
|
38941
39912
|
id: string(),
|
|
38942
39913
|
userId: string(),
|
|
@@ -39035,17 +40006,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39035
40006
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39036
40007
|
kind: "mutation",
|
|
39037
40008
|
access: "view"
|
|
39038
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39039
|
-
kind: "mutation",
|
|
39040
|
-
auth: "admin",
|
|
39041
|
-
access: "create"
|
|
39042
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40009
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39043
40010
|
kind: "mutation",
|
|
39044
40011
|
auth: "admin",
|
|
39045
40012
|
access: "delete"
|
|
39046
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39047
|
-
kind: "mutation",
|
|
39048
|
-
access: "view"
|
|
39049
40013
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39050
40014
|
kind: "mutation",
|
|
39051
40015
|
auth: "admin",
|
|
@@ -39119,15 +40083,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39119
40083
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39120
40084
|
userId: string(),
|
|
39121
40085
|
issuer: string()
|
|
39122
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39123
|
-
userId: string(),
|
|
39124
|
-
issuer: string().min(1),
|
|
39125
|
-
label: string().optional()
|
|
39126
|
-
}), object({ success: literal(true) }), {
|
|
39127
|
-
kind: "mutation",
|
|
39128
|
-
auth: "admin",
|
|
39129
|
-
access: "create"
|
|
39130
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40086
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39131
40087
|
kind: "mutation",
|
|
39132
40088
|
auth: "admin",
|
|
39133
40089
|
access: "delete"
|
|
@@ -39522,6 +40478,451 @@ DeviceType.Camera, method(object({
|
|
|
39522
40478
|
detection: array(ZoneRuleSchema).readonly(),
|
|
39523
40479
|
package: array(ZoneRuleSchema).readonly()
|
|
39524
40480
|
});
|
|
40481
|
+
/**
|
|
40482
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
40483
|
+
*
|
|
40484
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
40485
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
40486
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
40487
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
40488
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
40489
|
+
* manifest entry and nothing else.
|
|
40490
|
+
*
|
|
40491
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
40492
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
40493
|
+
* Every method is `admin`: these spend money.
|
|
40494
|
+
*
|
|
40495
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
40496
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
40497
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
40498
|
+
*
|
|
40499
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
40500
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
40501
|
+
* ticket the provider mints (D613).
|
|
40502
|
+
*/
|
|
40503
|
+
var TrainingGpuOptionSchema = object({
|
|
40504
|
+
id: string(),
|
|
40505
|
+
label: string(),
|
|
40506
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
40507
|
+
usdPerHour: number().nonnegative(),
|
|
40508
|
+
vramGb: number().nonnegative()
|
|
40509
|
+
});
|
|
40510
|
+
var TrainingRegionOptionSchema = object({
|
|
40511
|
+
/** `''` = any region (the provider's choice). */
|
|
40512
|
+
id: string(),
|
|
40513
|
+
label: string(),
|
|
40514
|
+
priceMultiplier: number().positive()
|
|
40515
|
+
});
|
|
40516
|
+
/**
|
|
40517
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
40518
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
40519
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
40520
|
+
*/
|
|
40521
|
+
var TrainingProviderDefaultsSchema = object({
|
|
40522
|
+
gpuType: string(),
|
|
40523
|
+
region: string(),
|
|
40524
|
+
costCapUsd: number().nonnegative(),
|
|
40525
|
+
maxRuntimeSec: number().int().positive(),
|
|
40526
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
40527
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
40528
|
+
});
|
|
40529
|
+
var TrainingProviderDescriptorSchema = object({
|
|
40530
|
+
addonId: string(),
|
|
40531
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
40532
|
+
kind: string(),
|
|
40533
|
+
label: string(),
|
|
40534
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
40535
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
40536
|
+
maxDatasetBytes: number().int().positive(),
|
|
40537
|
+
maxRuntimeSec: number().int().positive(),
|
|
40538
|
+
freeTierNote: string().optional(),
|
|
40539
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
40540
|
+
dataResidencyNote: string(),
|
|
40541
|
+
/** Credentials are present — never the values. */
|
|
40542
|
+
configured: boolean(),
|
|
40543
|
+
defaults: TrainingProviderDefaultsSchema
|
|
40544
|
+
});
|
|
40545
|
+
var TrainingCredentialCheckSchema = object({
|
|
40546
|
+
ok: boolean(),
|
|
40547
|
+
/** Workspace / account name, when the provider says. */
|
|
40548
|
+
account: string().optional(),
|
|
40549
|
+
reason: _enum([
|
|
40550
|
+
"missing",
|
|
40551
|
+
"invalid",
|
|
40552
|
+
"forbidden",
|
|
40553
|
+
"network",
|
|
40554
|
+
"quota"
|
|
40555
|
+
]).optional(),
|
|
40556
|
+
detail: string().optional()
|
|
40557
|
+
});
|
|
40558
|
+
var ProviderJobStateSchema = _enum([
|
|
40559
|
+
"pending",
|
|
40560
|
+
"starting",
|
|
40561
|
+
"running",
|
|
40562
|
+
"succeeded",
|
|
40563
|
+
"failed",
|
|
40564
|
+
"cancelled",
|
|
40565
|
+
"lost"
|
|
40566
|
+
]);
|
|
40567
|
+
var ProviderJobStatusSchema = object({
|
|
40568
|
+
jobKey: string(),
|
|
40569
|
+
providerJobId: string().optional(),
|
|
40570
|
+
state: ProviderJobStateSchema,
|
|
40571
|
+
startedAt: number().optional(),
|
|
40572
|
+
endedAt: number().optional(),
|
|
40573
|
+
exitCode: number().int().optional(),
|
|
40574
|
+
failureReason: string().optional(),
|
|
40575
|
+
gpuType: string(),
|
|
40576
|
+
region: string().optional(),
|
|
40577
|
+
billedSeconds: number().nonnegative(),
|
|
40578
|
+
costUsd: number().nonnegative(),
|
|
40579
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
40580
|
+
costIsEstimate: boolean(),
|
|
40581
|
+
lastFetchedAt: number()
|
|
40582
|
+
});
|
|
40583
|
+
/**
|
|
40584
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
40585
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
40586
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
40587
|
+
* in `result.json`.
|
|
40588
|
+
*/
|
|
40589
|
+
var TrainerSourceRefSchema = object({
|
|
40590
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
40591
|
+
repo: string().min(1),
|
|
40592
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
40593
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
40594
|
+
});
|
|
40595
|
+
var JobRef = {
|
|
40596
|
+
addonId: string(),
|
|
40597
|
+
jobKey: string().uuid()
|
|
40598
|
+
};
|
|
40599
|
+
var TrainingLogLineSchema = object({
|
|
40600
|
+
ts: number(),
|
|
40601
|
+
text: string()
|
|
40602
|
+
});
|
|
40603
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
40604
|
+
kind: "mutation",
|
|
40605
|
+
auth: "admin",
|
|
40606
|
+
timeoutMs: 3e4
|
|
40607
|
+
}), method(object({
|
|
40608
|
+
addonId: string(),
|
|
40609
|
+
gpuType: string(),
|
|
40610
|
+
region: string(),
|
|
40611
|
+
datasetBytes: number().int().nonnegative(),
|
|
40612
|
+
gpuSecondsLow: number().nonnegative(),
|
|
40613
|
+
gpuSecondsHigh: number().nonnegative()
|
|
40614
|
+
}), object({
|
|
40615
|
+
usdLow: number().nonnegative(),
|
|
40616
|
+
usdHigh: number().nonnegative(),
|
|
40617
|
+
notes: array(string()).readonly()
|
|
40618
|
+
}), { auth: "admin" }), method(object({
|
|
40619
|
+
...JobRef,
|
|
40620
|
+
ticket: PeerBytesTicketSchema
|
|
40621
|
+
}), object({
|
|
40622
|
+
bytes: number().int().nonnegative(),
|
|
40623
|
+
sha256: string()
|
|
40624
|
+
}), {
|
|
40625
|
+
kind: "mutation",
|
|
40626
|
+
auth: "admin",
|
|
40627
|
+
timeoutMs: 120 * 6e4
|
|
40628
|
+
}), method(object({
|
|
40629
|
+
...JobRef,
|
|
40630
|
+
trainer: TrainerSourceRefSchema,
|
|
40631
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
40632
|
+
gpuType: string(),
|
|
40633
|
+
region: string(),
|
|
40634
|
+
maxRuntimeSec: number().int().positive()
|
|
40635
|
+
}), ProviderJobStatusSchema, {
|
|
40636
|
+
kind: "mutation",
|
|
40637
|
+
auth: "admin",
|
|
40638
|
+
timeoutMs: 30 * 6e4
|
|
40639
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
40640
|
+
auth: "admin",
|
|
40641
|
+
timeoutMs: 6e4
|
|
40642
|
+
}), method(object({
|
|
40643
|
+
...JobRef,
|
|
40644
|
+
cursor: string().optional(),
|
|
40645
|
+
max: number().int().min(1).max(500)
|
|
40646
|
+
}), object({
|
|
40647
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
40648
|
+
cursor: string()
|
|
40649
|
+
}), {
|
|
40650
|
+
auth: "admin",
|
|
40651
|
+
timeoutMs: 6e4
|
|
40652
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
40653
|
+
kind: "mutation",
|
|
40654
|
+
auth: "admin",
|
|
40655
|
+
timeoutMs: 6e4
|
|
40656
|
+
}), method(object(JobRef), object({
|
|
40657
|
+
found: boolean(),
|
|
40658
|
+
text: string().optional()
|
|
40659
|
+
}), {
|
|
40660
|
+
kind: "mutation",
|
|
40661
|
+
auth: "admin",
|
|
40662
|
+
timeoutMs: 5 * 6e4
|
|
40663
|
+
}), method(object({
|
|
40664
|
+
...JobRef,
|
|
40665
|
+
path: _enum(["bundle.tar"])
|
|
40666
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
40667
|
+
kind: "mutation",
|
|
40668
|
+
auth: "admin",
|
|
40669
|
+
timeoutMs: 5 * 6e4
|
|
40670
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
40671
|
+
kind: "mutation",
|
|
40672
|
+
auth: "admin",
|
|
40673
|
+
timeoutMs: 5 * 6e4
|
|
40674
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
40675
|
+
auth: "admin",
|
|
40676
|
+
timeoutMs: 2 * 6e4
|
|
40677
|
+
});
|
|
40678
|
+
/**
|
|
40679
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
40680
|
+
* provided by `addon-training`.
|
|
40681
|
+
*
|
|
40682
|
+
* It owns what every provider must agree on, written once:
|
|
40683
|
+
*
|
|
40684
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
40685
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
40686
|
+
* the export plan) and reaches this store through the five row methods
|
|
40687
|
+
* below, so the Retrain page and the export did not change.
|
|
40688
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
40689
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
40690
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
40691
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
40692
|
+
* rollback. Nothing is ever registered automatically.
|
|
40693
|
+
*
|
|
40694
|
+
* Every method is `admin`.
|
|
40695
|
+
*/
|
|
40696
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
40697
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
40698
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
40699
|
+
var TrainingBaseModelSchema = object({
|
|
40700
|
+
modelId: string(),
|
|
40701
|
+
label: string(),
|
|
40702
|
+
weights: string(),
|
|
40703
|
+
imgsz: number().int(),
|
|
40704
|
+
baselineOnnxUrl: string(),
|
|
40705
|
+
baselineFloors: record(string(), number()),
|
|
40706
|
+
/** The base the fleet runs most — the UI's default. */
|
|
40707
|
+
recommended: boolean()
|
|
40708
|
+
});
|
|
40709
|
+
var TrainingPresetSchema = _enum([
|
|
40710
|
+
"quick",
|
|
40711
|
+
"standard",
|
|
40712
|
+
"thorough"
|
|
40713
|
+
]);
|
|
40714
|
+
var TrainingJobRequestSchema = object({
|
|
40715
|
+
datasetVersionId: string().min(1),
|
|
40716
|
+
/** The `training-provider` addon that runs it. */
|
|
40717
|
+
addonId: string().min(1),
|
|
40718
|
+
gpuType: string().min(1),
|
|
40719
|
+
region: string(),
|
|
40720
|
+
baseModelId: string().min(1),
|
|
40721
|
+
preset: TrainingPresetSchema,
|
|
40722
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
40723
|
+
freeze: number().int().nonnegative().nullable(),
|
|
40724
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
40725
|
+
holdoutCameras: array(number().int()).nullable()
|
|
40726
|
+
});
|
|
40727
|
+
var TrainingSplitPlanSchema = object({
|
|
40728
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
40729
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
40730
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
40731
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
40732
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
40733
|
+
trainSubjects: number().int()
|
|
40734
|
+
});
|
|
40735
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
40736
|
+
"unknown-dataset",
|
|
40737
|
+
"unknown-provider",
|
|
40738
|
+
"provider-not-configured",
|
|
40739
|
+
"unknown-base-model",
|
|
40740
|
+
"unknown-gpu",
|
|
40741
|
+
"dataset-too-large",
|
|
40742
|
+
"no-training-subjects",
|
|
40743
|
+
"job-already-running"
|
|
40744
|
+
]);
|
|
40745
|
+
var TrainingJobPlanSchema = object({
|
|
40746
|
+
refusal: object({
|
|
40747
|
+
reason: TrainingRefusalReasonSchema,
|
|
40748
|
+
detail: string()
|
|
40749
|
+
}).nullable(),
|
|
40750
|
+
warnings: array(string()).readonly(),
|
|
40751
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
40752
|
+
estimate: object({
|
|
40753
|
+
datasetBytes: number().int(),
|
|
40754
|
+
uploadMinutesAt20Mbps: number(),
|
|
40755
|
+
gpuSecondsLow: number(),
|
|
40756
|
+
gpuSecondsHigh: number(),
|
|
40757
|
+
usdLow: number(),
|
|
40758
|
+
usdHigh: number(),
|
|
40759
|
+
notes: array(string()).readonly()
|
|
40760
|
+
}).nullable(),
|
|
40761
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
40762
|
+
defaults: object({
|
|
40763
|
+
maxCostUsd: number(),
|
|
40764
|
+
maxRuntimeSec: number().int()
|
|
40765
|
+
}).nullable(),
|
|
40766
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
40767
|
+
dataNotice: string()
|
|
40768
|
+
});
|
|
40769
|
+
/**
|
|
40770
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
40771
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
40772
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
40773
|
+
* result lives after the operator acted on it.
|
|
40774
|
+
*/
|
|
40775
|
+
var TrainingJobStateSchema = _enum([
|
|
40776
|
+
"uploading",
|
|
40777
|
+
"submitted",
|
|
40778
|
+
"starting",
|
|
40779
|
+
"running",
|
|
40780
|
+
"collecting",
|
|
40781
|
+
"ready",
|
|
40782
|
+
"registered",
|
|
40783
|
+
"canary",
|
|
40784
|
+
"failed",
|
|
40785
|
+
"cancelling",
|
|
40786
|
+
"cancelled",
|
|
40787
|
+
"lost",
|
|
40788
|
+
"expired",
|
|
40789
|
+
"discarded"
|
|
40790
|
+
]);
|
|
40791
|
+
var TrainingFailureReasonSchema = _enum([
|
|
40792
|
+
"cost-cap",
|
|
40793
|
+
"runtime-cap",
|
|
40794
|
+
"upload-failed",
|
|
40795
|
+
"submit-failed",
|
|
40796
|
+
"trainer-failed",
|
|
40797
|
+
"result-invalid",
|
|
40798
|
+
"checksum-mismatch",
|
|
40799
|
+
"fetch-failed",
|
|
40800
|
+
"provider-error",
|
|
40801
|
+
"hub-restart-during-upload"
|
|
40802
|
+
]);
|
|
40803
|
+
var TrainingProgressPointSchema = object({
|
|
40804
|
+
epoch: number().int(),
|
|
40805
|
+
map50: number().nullable(),
|
|
40806
|
+
map50_95: number().nullable()
|
|
40807
|
+
});
|
|
40808
|
+
var TrainingCanarySchema = object({
|
|
40809
|
+
deviceIds: array(number().int()).readonly(),
|
|
40810
|
+
since: number(),
|
|
40811
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
40812
|
+
previous: array(object({
|
|
40813
|
+
deviceId: number().int(),
|
|
40814
|
+
nodeId: string(),
|
|
40815
|
+
deviceKey: string(),
|
|
40816
|
+
patch: object({
|
|
40817
|
+
modelId: string().optional(),
|
|
40818
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
40819
|
+
}).nullable()
|
|
40820
|
+
})).readonly()
|
|
40821
|
+
});
|
|
40822
|
+
var TrainingJobSchema = object({
|
|
40823
|
+
id: string(),
|
|
40824
|
+
idempotencyKey: string(),
|
|
40825
|
+
name: string(),
|
|
40826
|
+
createdAt: number(),
|
|
40827
|
+
updatedAt: number(),
|
|
40828
|
+
state: TrainingJobStateSchema,
|
|
40829
|
+
stage: TrainingStageSchema.nullable(),
|
|
40830
|
+
failure: object({
|
|
40831
|
+
reason: TrainingFailureReasonSchema,
|
|
40832
|
+
stage: string().nullable(),
|
|
40833
|
+
detail: string()
|
|
40834
|
+
}).nullable(),
|
|
40835
|
+
request: TrainingJobRequestSchema,
|
|
40836
|
+
maxCostUsd: number().nonnegative(),
|
|
40837
|
+
maxRuntimeSec: number().int().positive(),
|
|
40838
|
+
trainer: TrainerSourceRefSchema,
|
|
40839
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
40840
|
+
dataset: object({
|
|
40841
|
+
bytes: number().int(),
|
|
40842
|
+
sha256: string(),
|
|
40843
|
+
uploadedAt: number()
|
|
40844
|
+
}).nullable(),
|
|
40845
|
+
split: TrainingSplitPlanSchema,
|
|
40846
|
+
provider: object({
|
|
40847
|
+
state: ProviderJobStateSchema.nullable(),
|
|
40848
|
+
providerJobId: string().nullable(),
|
|
40849
|
+
startedAt: number().nullable(),
|
|
40850
|
+
endedAt: number().nullable(),
|
|
40851
|
+
billedSeconds: number(),
|
|
40852
|
+
costUsd: number(),
|
|
40853
|
+
costIsEstimate: boolean(),
|
|
40854
|
+
lastPolledAt: number().nullable()
|
|
40855
|
+
}),
|
|
40856
|
+
progress: object({
|
|
40857
|
+
epoch: number().int().nullable(),
|
|
40858
|
+
epochs: number().int().nullable(),
|
|
40859
|
+
etaSec: number().nullable(),
|
|
40860
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
40861
|
+
}),
|
|
40862
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
40863
|
+
logTail: array(string()).readonly(),
|
|
40864
|
+
logCursor: string().nullable(),
|
|
40865
|
+
artifacts: object({
|
|
40866
|
+
bundleBytes: number().int(),
|
|
40867
|
+
bundleSha256: string(),
|
|
40868
|
+
fetchedAt: number(),
|
|
40869
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
40870
|
+
expiresAt: number()
|
|
40871
|
+
}).nullable(),
|
|
40872
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
40873
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
40874
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
40875
|
+
cloudCleanupDueAt: number().nullable(),
|
|
40876
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
40877
|
+
registeredModelIds: array(string()).readonly(),
|
|
40878
|
+
canary: TrainingCanarySchema.nullable()
|
|
40879
|
+
});
|
|
40880
|
+
var IdInput = object({ id: string().min(1) });
|
|
40881
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
40882
|
+
kind: "mutation",
|
|
40883
|
+
auth: "admin"
|
|
40884
|
+
}), 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() }), {
|
|
40885
|
+
kind: "mutation",
|
|
40886
|
+
auth: "admin"
|
|
40887
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
40888
|
+
auth: "admin",
|
|
40889
|
+
timeoutMs: 6e4
|
|
40890
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
40891
|
+
name: string().min(1).max(120),
|
|
40892
|
+
maxCostUsd: number().positive(),
|
|
40893
|
+
maxRuntimeSec: number().int().positive(),
|
|
40894
|
+
idempotencyKey: string().min(8).max(80)
|
|
40895
|
+
}), discriminatedUnion("kind", [object({
|
|
40896
|
+
kind: literal("started"),
|
|
40897
|
+
job: TrainingJobSchema
|
|
40898
|
+
}), object({
|
|
40899
|
+
kind: literal("refused"),
|
|
40900
|
+
reason: TrainingRefusalReasonSchema,
|
|
40901
|
+
detail: string()
|
|
40902
|
+
})]), {
|
|
40903
|
+
kind: "mutation",
|
|
40904
|
+
auth: "admin",
|
|
40905
|
+
timeoutMs: 12e4
|
|
40906
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
40907
|
+
kind: "mutation",
|
|
40908
|
+
auth: "admin",
|
|
40909
|
+
timeoutMs: 12e4
|
|
40910
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
40911
|
+
kind: "mutation",
|
|
40912
|
+
auth: "admin",
|
|
40913
|
+
timeoutMs: 30 * 6e4
|
|
40914
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
40915
|
+
kind: "mutation",
|
|
40916
|
+
auth: "admin",
|
|
40917
|
+
timeoutMs: 12e4
|
|
40918
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
40919
|
+
kind: "mutation",
|
|
40920
|
+
auth: "admin",
|
|
40921
|
+
timeoutMs: 12e4
|
|
40922
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
40923
|
+
kind: "mutation",
|
|
40924
|
+
auth: "admin"
|
|
40925
|
+
});
|
|
39525
40926
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39526
40927
|
Object.freeze({
|
|
39527
40928
|
person: .5,
|
|
@@ -40145,6 +41546,12 @@ Object.freeze({
|
|
|
40145
41546
|
addonId: null,
|
|
40146
41547
|
access: "create"
|
|
40147
41548
|
},
|
|
41549
|
+
"backup.checkBackupKey": {
|
|
41550
|
+
capName: "backup",
|
|
41551
|
+
capScope: "system",
|
|
41552
|
+
addonId: null,
|
|
41553
|
+
access: "create"
|
|
41554
|
+
},
|
|
40148
41555
|
"backup.delete": {
|
|
40149
41556
|
capName: "backup",
|
|
40150
41557
|
capScope: "system",
|
|
@@ -40157,6 +41564,18 @@ Object.freeze({
|
|
|
40157
41564
|
addonId: null,
|
|
40158
41565
|
access: "delete"
|
|
40159
41566
|
},
|
|
41567
|
+
"backup.disableEncryption": {
|
|
41568
|
+
capName: "backup",
|
|
41569
|
+
capScope: "system",
|
|
41570
|
+
addonId: null,
|
|
41571
|
+
access: "create"
|
|
41572
|
+
},
|
|
41573
|
+
"backup.getEncryption": {
|
|
41574
|
+
capName: "backup",
|
|
41575
|
+
capScope: "system",
|
|
41576
|
+
addonId: null,
|
|
41577
|
+
access: "view"
|
|
41578
|
+
},
|
|
40160
41579
|
"backup.getEntries": {
|
|
40161
41580
|
capName: "backup",
|
|
40162
41581
|
capScope: "system",
|
|
@@ -40211,6 +41630,12 @@ Object.freeze({
|
|
|
40211
41630
|
addonId: null,
|
|
40212
41631
|
access: "create"
|
|
40213
41632
|
},
|
|
41633
|
+
"backup.setupEncryption": {
|
|
41634
|
+
capName: "backup",
|
|
41635
|
+
capScope: "system",
|
|
41636
|
+
addonId: null,
|
|
41637
|
+
access: "create"
|
|
41638
|
+
},
|
|
40214
41639
|
"backup.trigger": {
|
|
40215
41640
|
capName: "backup",
|
|
40216
41641
|
capScope: "system",
|
|
@@ -40763,6 +42188,12 @@ Object.freeze({
|
|
|
40763
42188
|
addonId: null,
|
|
40764
42189
|
access: "create"
|
|
40765
42190
|
},
|
|
42191
|
+
"customModelRegistry.importModelBundle": {
|
|
42192
|
+
capName: "custom-model-registry",
|
|
42193
|
+
capScope: "system",
|
|
42194
|
+
addonId: null,
|
|
42195
|
+
access: "create"
|
|
42196
|
+
},
|
|
40766
42197
|
"customModelRegistry.listModels": {
|
|
40767
42198
|
capName: "custom-model-registry",
|
|
40768
42199
|
capScope: "system",
|
|
@@ -42203,6 +43634,12 @@ Object.freeze({
|
|
|
42203
43634
|
addonId: null,
|
|
42204
43635
|
access: "view"
|
|
42205
43636
|
},
|
|
43637
|
+
"keychainAdmin.acknowledgeReset": {
|
|
43638
|
+
capName: "keychain-admin",
|
|
43639
|
+
capScope: "system",
|
|
43640
|
+
addonId: null,
|
|
43641
|
+
access: "create"
|
|
43642
|
+
},
|
|
42206
43643
|
"keychainAdmin.deleteOrphans": {
|
|
42207
43644
|
capName: "keychain-admin",
|
|
42208
43645
|
capScope: "system",
|
|
@@ -42239,6 +43676,12 @@ Object.freeze({
|
|
|
42239
43676
|
addonId: null,
|
|
42240
43677
|
access: "delete"
|
|
42241
43678
|
},
|
|
43679
|
+
"keychainAdmin.resetReport": {
|
|
43680
|
+
capName: "keychain-admin",
|
|
43681
|
+
capScope: "system",
|
|
43682
|
+
addonId: null,
|
|
43683
|
+
access: "delete"
|
|
43684
|
+
},
|
|
42242
43685
|
"keychainAdmin.reveal": {
|
|
42243
43686
|
capName: "keychain-admin",
|
|
42244
43687
|
capScope: "system",
|
|
@@ -42251,6 +43694,12 @@ Object.freeze({
|
|
|
42251
43694
|
addonId: null,
|
|
42252
43695
|
access: "create"
|
|
42253
43696
|
},
|
|
43697
|
+
"keychainAdmin.setSystemSecret": {
|
|
43698
|
+
capName: "keychain-admin",
|
|
43699
|
+
capScope: "system",
|
|
43700
|
+
addonId: null,
|
|
43701
|
+
access: "create"
|
|
43702
|
+
},
|
|
42254
43703
|
"keychainAdmin.status": {
|
|
42255
43704
|
capName: "keychain-admin",
|
|
42256
43705
|
capScope: "system",
|
|
@@ -43697,6 +45146,12 @@ Object.freeze({
|
|
|
43697
45146
|
addonId: null,
|
|
43698
45147
|
access: "create"
|
|
43699
45148
|
},
|
|
45149
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
45150
|
+
capName: "pipeline-analytics",
|
|
45151
|
+
capScope: "device",
|
|
45152
|
+
addonId: null,
|
|
45153
|
+
access: "create"
|
|
45154
|
+
},
|
|
43700
45155
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
43701
45156
|
capName: "pipeline-analytics",
|
|
43702
45157
|
capScope: "device",
|
|
@@ -43709,6 +45164,12 @@ Object.freeze({
|
|
|
43709
45164
|
addonId: null,
|
|
43710
45165
|
access: "delete"
|
|
43711
45166
|
},
|
|
45167
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
45168
|
+
capName: "pipeline-analytics",
|
|
45169
|
+
capScope: "device",
|
|
45170
|
+
addonId: null,
|
|
45171
|
+
access: "delete"
|
|
45172
|
+
},
|
|
43712
45173
|
"pipelineAnalytics.deleteTracks": {
|
|
43713
45174
|
capName: "pipeline-analytics",
|
|
43714
45175
|
capScope: "device",
|
|
@@ -43931,6 +45392,12 @@ Object.freeze({
|
|
|
43931
45392
|
addonId: null,
|
|
43932
45393
|
access: "view"
|
|
43933
45394
|
},
|
|
45395
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
45396
|
+
capName: "pipeline-analytics",
|
|
45397
|
+
capScope: "device",
|
|
45398
|
+
addonId: null,
|
|
45399
|
+
access: "view"
|
|
45400
|
+
},
|
|
43934
45401
|
"pipelineAnalytics.listRetrainFrames": {
|
|
43935
45402
|
capName: "pipeline-analytics",
|
|
43936
45403
|
capScope: "device",
|
|
@@ -43961,6 +45428,12 @@ Object.freeze({
|
|
|
43961
45428
|
addonId: null,
|
|
43962
45429
|
access: "view"
|
|
43963
45430
|
},
|
|
45431
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
45432
|
+
capName: "pipeline-analytics",
|
|
45433
|
+
capScope: "device",
|
|
45434
|
+
addonId: null,
|
|
45435
|
+
access: "create"
|
|
45436
|
+
},
|
|
43964
45437
|
"pipelineAnalytics.ownersWithMedia": {
|
|
43965
45438
|
capName: "pipeline-analytics",
|
|
43966
45439
|
capScope: "device",
|
|
@@ -43973,6 +45446,12 @@ Object.freeze({
|
|
|
43973
45446
|
addonId: null,
|
|
43974
45447
|
access: "create"
|
|
43975
45448
|
},
|
|
45449
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
45450
|
+
capName: "pipeline-analytics",
|
|
45451
|
+
capScope: "device",
|
|
45452
|
+
addonId: null,
|
|
45453
|
+
access: "view"
|
|
45454
|
+
},
|
|
43976
45455
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
43977
45456
|
capName: "pipeline-analytics",
|
|
43978
45457
|
capScope: "device",
|
|
@@ -44111,6 +45590,12 @@ Object.freeze({
|
|
|
44111
45590
|
addonId: null,
|
|
44112
45591
|
access: "create"
|
|
44113
45592
|
},
|
|
45593
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
45594
|
+
capName: "pipeline-analytics",
|
|
45595
|
+
capScope: "device",
|
|
45596
|
+
addonId: null,
|
|
45597
|
+
access: "view"
|
|
45598
|
+
},
|
|
44114
45599
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
44115
45600
|
capName: "pipeline-analytics",
|
|
44116
45601
|
capScope: "device",
|
|
@@ -46487,6 +47972,174 @@ Object.freeze({
|
|
|
46487
47972
|
addonId: null,
|
|
46488
47973
|
access: "view"
|
|
46489
47974
|
},
|
|
47975
|
+
"training.canaryResult": {
|
|
47976
|
+
capName: "training",
|
|
47977
|
+
capScope: "system",
|
|
47978
|
+
addonId: null,
|
|
47979
|
+
access: "create"
|
|
47980
|
+
},
|
|
47981
|
+
"training.cancelJob": {
|
|
47982
|
+
capName: "training",
|
|
47983
|
+
capScope: "system",
|
|
47984
|
+
addonId: null,
|
|
47985
|
+
access: "create"
|
|
47986
|
+
},
|
|
47987
|
+
"training.discardResult": {
|
|
47988
|
+
capName: "training",
|
|
47989
|
+
capScope: "system",
|
|
47990
|
+
addonId: null,
|
|
47991
|
+
access: "create"
|
|
47992
|
+
},
|
|
47993
|
+
"training.findDatasetVersionIdByName": {
|
|
47994
|
+
capName: "training",
|
|
47995
|
+
capScope: "system",
|
|
47996
|
+
addonId: null,
|
|
47997
|
+
access: "view"
|
|
47998
|
+
},
|
|
47999
|
+
"training.getDatasetVersion": {
|
|
48000
|
+
capName: "training",
|
|
48001
|
+
capScope: "system",
|
|
48002
|
+
addonId: null,
|
|
48003
|
+
access: "view"
|
|
48004
|
+
},
|
|
48005
|
+
"training.getJob": {
|
|
48006
|
+
capName: "training",
|
|
48007
|
+
capScope: "system",
|
|
48008
|
+
addonId: null,
|
|
48009
|
+
access: "view"
|
|
48010
|
+
},
|
|
48011
|
+
"training.getJobResult": {
|
|
48012
|
+
capName: "training",
|
|
48013
|
+
capScope: "system",
|
|
48014
|
+
addonId: null,
|
|
48015
|
+
access: "view"
|
|
48016
|
+
},
|
|
48017
|
+
"training.listBaseModels": {
|
|
48018
|
+
capName: "training",
|
|
48019
|
+
capScope: "system",
|
|
48020
|
+
addonId: null,
|
|
48021
|
+
access: "view"
|
|
48022
|
+
},
|
|
48023
|
+
"training.listDatasetVersions": {
|
|
48024
|
+
capName: "training",
|
|
48025
|
+
capScope: "system",
|
|
48026
|
+
addonId: null,
|
|
48027
|
+
access: "view"
|
|
48028
|
+
},
|
|
48029
|
+
"training.listJobs": {
|
|
48030
|
+
capName: "training",
|
|
48031
|
+
capScope: "system",
|
|
48032
|
+
addonId: null,
|
|
48033
|
+
access: "view"
|
|
48034
|
+
},
|
|
48035
|
+
"training.planJob": {
|
|
48036
|
+
capName: "training",
|
|
48037
|
+
capScope: "system",
|
|
48038
|
+
addonId: null,
|
|
48039
|
+
access: "view"
|
|
48040
|
+
},
|
|
48041
|
+
"training.putDatasetVersion": {
|
|
48042
|
+
capName: "training",
|
|
48043
|
+
capScope: "system",
|
|
48044
|
+
addonId: null,
|
|
48045
|
+
access: "create"
|
|
48046
|
+
},
|
|
48047
|
+
"training.registerResult": {
|
|
48048
|
+
capName: "training",
|
|
48049
|
+
capScope: "system",
|
|
48050
|
+
addonId: null,
|
|
48051
|
+
access: "create"
|
|
48052
|
+
},
|
|
48053
|
+
"training.removeDatasetVersion": {
|
|
48054
|
+
capName: "training",
|
|
48055
|
+
capScope: "system",
|
|
48056
|
+
addonId: null,
|
|
48057
|
+
access: "delete"
|
|
48058
|
+
},
|
|
48059
|
+
"training.rollbackCanary": {
|
|
48060
|
+
capName: "training",
|
|
48061
|
+
capScope: "system",
|
|
48062
|
+
addonId: null,
|
|
48063
|
+
access: "create"
|
|
48064
|
+
},
|
|
48065
|
+
"training.startJob": {
|
|
48066
|
+
capName: "training",
|
|
48067
|
+
capScope: "system",
|
|
48068
|
+
addonId: null,
|
|
48069
|
+
access: "create"
|
|
48070
|
+
},
|
|
48071
|
+
"trainingProvider.cancelJob": {
|
|
48072
|
+
capName: "training-provider",
|
|
48073
|
+
capScope: "system",
|
|
48074
|
+
addonId: null,
|
|
48075
|
+
access: "create"
|
|
48076
|
+
},
|
|
48077
|
+
"trainingProvider.cleanupJob": {
|
|
48078
|
+
capName: "training-provider",
|
|
48079
|
+
capScope: "system",
|
|
48080
|
+
addonId: null,
|
|
48081
|
+
access: "create"
|
|
48082
|
+
},
|
|
48083
|
+
"trainingProvider.describe": {
|
|
48084
|
+
capName: "training-provider",
|
|
48085
|
+
capScope: "system",
|
|
48086
|
+
addonId: null,
|
|
48087
|
+
access: "view"
|
|
48088
|
+
},
|
|
48089
|
+
"trainingProvider.estimateJob": {
|
|
48090
|
+
capName: "training-provider",
|
|
48091
|
+
capScope: "system",
|
|
48092
|
+
addonId: null,
|
|
48093
|
+
access: "view"
|
|
48094
|
+
},
|
|
48095
|
+
"trainingProvider.getJob": {
|
|
48096
|
+
capName: "training-provider",
|
|
48097
|
+
capScope: "system",
|
|
48098
|
+
addonId: null,
|
|
48099
|
+
access: "view"
|
|
48100
|
+
},
|
|
48101
|
+
"trainingProvider.listJobEvents": {
|
|
48102
|
+
capName: "training-provider",
|
|
48103
|
+
capScope: "system",
|
|
48104
|
+
addonId: null,
|
|
48105
|
+
access: "view"
|
|
48106
|
+
},
|
|
48107
|
+
"trainingProvider.listJobs": {
|
|
48108
|
+
capName: "training-provider",
|
|
48109
|
+
capScope: "system",
|
|
48110
|
+
addonId: null,
|
|
48111
|
+
access: "view"
|
|
48112
|
+
},
|
|
48113
|
+
"trainingProvider.offerArtifact": {
|
|
48114
|
+
capName: "training-provider",
|
|
48115
|
+
capScope: "system",
|
|
48116
|
+
addonId: null,
|
|
48117
|
+
access: "create"
|
|
48118
|
+
},
|
|
48119
|
+
"trainingProvider.readResult": {
|
|
48120
|
+
capName: "training-provider",
|
|
48121
|
+
capScope: "system",
|
|
48122
|
+
addonId: null,
|
|
48123
|
+
access: "create"
|
|
48124
|
+
},
|
|
48125
|
+
"trainingProvider.submitJob": {
|
|
48126
|
+
capName: "training-provider",
|
|
48127
|
+
capScope: "system",
|
|
48128
|
+
addonId: null,
|
|
48129
|
+
access: "create"
|
|
48130
|
+
},
|
|
48131
|
+
"trainingProvider.uploadDataset": {
|
|
48132
|
+
capName: "training-provider",
|
|
48133
|
+
capScope: "system",
|
|
48134
|
+
addonId: null,
|
|
48135
|
+
access: "create"
|
|
48136
|
+
},
|
|
48137
|
+
"trainingProvider.validateCredentials": {
|
|
48138
|
+
capName: "training-provider",
|
|
48139
|
+
capScope: "system",
|
|
48140
|
+
addonId: null,
|
|
48141
|
+
access: "create"
|
|
48142
|
+
},
|
|
46490
48143
|
"turnProvider.getTurnServers": {
|
|
46491
48144
|
capName: "turn-provider",
|
|
46492
48145
|
capScope: "system",
|
|
@@ -46511,12 +48164,6 @@ Object.freeze({
|
|
|
46511
48164
|
addonId: null,
|
|
46512
48165
|
access: "create"
|
|
46513
48166
|
},
|
|
46514
|
-
"userManagement.createApiKey": {
|
|
46515
|
-
capName: "user-management",
|
|
46516
|
-
capScope: "system",
|
|
46517
|
-
addonId: null,
|
|
46518
|
-
access: "create"
|
|
46519
|
-
},
|
|
46520
48167
|
"userManagement.createScopedToken": {
|
|
46521
48168
|
capName: "user-management",
|
|
46522
48169
|
capScope: "system",
|
|
@@ -46553,12 +48200,6 @@ Object.freeze({
|
|
|
46553
48200
|
addonId: null,
|
|
46554
48201
|
access: "view"
|
|
46555
48202
|
},
|
|
46556
|
-
"userManagement.linkExternalIdentity": {
|
|
46557
|
-
capName: "user-management",
|
|
46558
|
-
capScope: "system",
|
|
46559
|
-
addonId: null,
|
|
46560
|
-
access: "create"
|
|
46561
|
-
},
|
|
46562
48203
|
"userManagement.listApiKeys": {
|
|
46563
48204
|
capName: "user-management",
|
|
46564
48205
|
capScope: "system",
|
|
@@ -46661,12 +48302,6 @@ Object.freeze({
|
|
|
46661
48302
|
addonId: null,
|
|
46662
48303
|
access: "create"
|
|
46663
48304
|
},
|
|
46664
|
-
"userManagement.validateApiKey": {
|
|
46665
|
-
capName: "user-management",
|
|
46666
|
-
capScope: "system",
|
|
46667
|
-
addonId: null,
|
|
46668
|
-
access: "view"
|
|
46669
|
-
},
|
|
46670
48305
|
"userManagement.validateCredentials": {
|
|
46671
48306
|
capName: "user-management",
|
|
46672
48307
|
capScope: "system",
|
|
@@ -50780,6 +52415,11 @@ Object.freeze({
|
|
|
50780
52415
|
form: "single",
|
|
50781
52416
|
optional: false
|
|
50782
52417
|
}],
|
|
52418
|
+
"training.canaryResult": [{
|
|
52419
|
+
name: "deviceIds",
|
|
52420
|
+
form: "array",
|
|
52421
|
+
optional: false
|
|
52422
|
+
}],
|
|
50783
52423
|
"update.getStatus": [{
|
|
50784
52424
|
name: "deviceId",
|
|
50785
52425
|
form: "single",
|