@camstack/addon-provider-reolink 1.2.179 → 1.2.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1823 -135
- package/dist/addon.mjs +1823 -135
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -5405,7 +5405,7 @@ var ZodIssueCode = {
|
|
|
5405
5405
|
var ZodFirstPartyTypeKind;
|
|
5406
5406
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5407
5407
|
//#endregion
|
|
5408
|
-
//#region ../types/dist/sleep-
|
|
5408
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5409
5409
|
/**
|
|
5410
5410
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5411
5411
|
* window to float samples (D455).
|
|
@@ -5522,7 +5522,7 @@ function isKeychainStoredField(field) {
|
|
|
5522
5522
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5523
5523
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5524
5524
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5525
|
-
function isRecord$
|
|
5525
|
+
function isRecord$2(value) {
|
|
5526
5526
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5527
5527
|
}
|
|
5528
5528
|
function makeSecretMarker(ref) {
|
|
@@ -5533,12 +5533,16 @@ function makeSecretMarker(ref) {
|
|
|
5533
5533
|
}
|
|
5534
5534
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5535
5535
|
function isSecretMarker(value) {
|
|
5536
|
-
if (!isRecord$
|
|
5536
|
+
if (!isRecord$2(value)) return false;
|
|
5537
5537
|
const ref = value["$secret"];
|
|
5538
5538
|
return typeof ref === "string" && ref.length > 0;
|
|
5539
5539
|
}
|
|
5540
|
+
/** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
|
|
5541
|
+
function isSecretMarkerLike(value) {
|
|
5542
|
+
return isRecord$2(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
|
|
5543
|
+
}
|
|
5540
5544
|
function isSecretClear(value) {
|
|
5541
|
-
return isRecord$
|
|
5545
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5542
5546
|
}
|
|
5543
5547
|
/**
|
|
5544
5548
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6054,6 +6058,13 @@ function globalSecretScope() {
|
|
|
6054
6058
|
function encodeSegment(value) {
|
|
6055
6059
|
return encodeURIComponent(value);
|
|
6056
6060
|
}
|
|
6061
|
+
function decodeSegment(value) {
|
|
6062
|
+
try {
|
|
6063
|
+
return decodeURIComponent(value);
|
|
6064
|
+
} catch {
|
|
6065
|
+
return null;
|
|
6066
|
+
}
|
|
6067
|
+
}
|
|
6057
6068
|
/**
|
|
6058
6069
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6059
6070
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6062,6 +6073,75 @@ function encodeSegment(value) {
|
|
|
6062
6073
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6063
6074
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6064
6075
|
}
|
|
6076
|
+
function parseScope(segments) {
|
|
6077
|
+
switch (segments[0]) {
|
|
6078
|
+
case "global": return {
|
|
6079
|
+
scope: GLOBAL_SCOPE,
|
|
6080
|
+
used: 1
|
|
6081
|
+
};
|
|
6082
|
+
case "node": {
|
|
6083
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6084
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6085
|
+
scope: {
|
|
6086
|
+
kind: "node",
|
|
6087
|
+
nodeId
|
|
6088
|
+
},
|
|
6089
|
+
used: 2
|
|
6090
|
+
};
|
|
6091
|
+
}
|
|
6092
|
+
case "device": {
|
|
6093
|
+
const raw = segments[1];
|
|
6094
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6095
|
+
return {
|
|
6096
|
+
scope: {
|
|
6097
|
+
kind: "device",
|
|
6098
|
+
deviceId: Number(raw)
|
|
6099
|
+
},
|
|
6100
|
+
used: 2
|
|
6101
|
+
};
|
|
6102
|
+
}
|
|
6103
|
+
case "integration": {
|
|
6104
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6105
|
+
return id === null || id.length === 0 ? null : {
|
|
6106
|
+
scope: {
|
|
6107
|
+
kind: "integration",
|
|
6108
|
+
integrationId: id
|
|
6109
|
+
},
|
|
6110
|
+
used: 2
|
|
6111
|
+
};
|
|
6112
|
+
}
|
|
6113
|
+
case "row": {
|
|
6114
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6115
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6116
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6117
|
+
return {
|
|
6118
|
+
scope: {
|
|
6119
|
+
kind: "row",
|
|
6120
|
+
collection,
|
|
6121
|
+
rowId
|
|
6122
|
+
},
|
|
6123
|
+
used: 3
|
|
6124
|
+
};
|
|
6125
|
+
}
|
|
6126
|
+
default: return null;
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6129
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6130
|
+
function parseSecretRef(ref) {
|
|
6131
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6132
|
+
const segments = ref.slice(9).split("/");
|
|
6133
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6134
|
+
if (owner === null || owner.length === 0) return null;
|
|
6135
|
+
const parsed = parseScope(segments.slice(1));
|
|
6136
|
+
if (parsed === null) return null;
|
|
6137
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6138
|
+
if (fieldPath.length === 0) return null;
|
|
6139
|
+
return {
|
|
6140
|
+
owner,
|
|
6141
|
+
scope: parsed.scope,
|
|
6142
|
+
fieldPath
|
|
6143
|
+
};
|
|
6144
|
+
}
|
|
6065
6145
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6066
6146
|
var KeychainWriteRefusedError = class extends Error {
|
|
6067
6147
|
fieldPath;
|
|
@@ -6072,7 +6152,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6072
6152
|
}
|
|
6073
6153
|
};
|
|
6074
6154
|
var KEEP = { kind: "keep" };
|
|
6075
|
-
function isRecord$
|
|
6155
|
+
function isRecord$1(value) {
|
|
6076
6156
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6077
6157
|
}
|
|
6078
6158
|
function defaultMintId() {
|
|
@@ -6085,7 +6165,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6085
6165
|
return out;
|
|
6086
6166
|
}
|
|
6087
6167
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6088
|
-
else if (isRecord$
|
|
6168
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6089
6169
|
return out;
|
|
6090
6170
|
}
|
|
6091
6171
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6140,7 +6220,7 @@ function rowId(row, idKey) {
|
|
|
6140
6220
|
return null;
|
|
6141
6221
|
}
|
|
6142
6222
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6143
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6223
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6144
6224
|
if (!Array.isArray(incoming)) {
|
|
6145
6225
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6146
6226
|
return {
|
|
@@ -6156,7 +6236,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6156
6236
|
const kept = /* @__PURE__ */ new Set();
|
|
6157
6237
|
const rows = [];
|
|
6158
6238
|
for (const row of incoming) {
|
|
6159
|
-
if (!isRecord$
|
|
6239
|
+
if (!isRecord$1(row)) {
|
|
6160
6240
|
rows.push(row);
|
|
6161
6241
|
continue;
|
|
6162
6242
|
}
|
|
@@ -6181,7 +6261,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6181
6261
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6182
6262
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6183
6263
|
case "object": {
|
|
6184
|
-
if (!isRecord$
|
|
6264
|
+
if (!isRecord$1(incoming)) {
|
|
6185
6265
|
if (incoming === void 0) return KEEP;
|
|
6186
6266
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6187
6267
|
return {
|
|
@@ -6189,7 +6269,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6189
6269
|
value: incoming
|
|
6190
6270
|
};
|
|
6191
6271
|
}
|
|
6192
|
-
const storedObj = isRecord$
|
|
6272
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6193
6273
|
return {
|
|
6194
6274
|
kind: "value",
|
|
6195
6275
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6248,12 +6328,19 @@ async function transformSecretWrite(input) {
|
|
|
6248
6328
|
}
|
|
6249
6329
|
};
|
|
6250
6330
|
}
|
|
6331
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6332
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6333
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6334
|
+
}
|
|
6251
6335
|
/**
|
|
6252
6336
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6253
6337
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6254
6338
|
*/
|
|
6255
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6256
|
-
const
|
|
6339
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6340
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6341
|
+
const owner = options.ownedBy;
|
|
6342
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6343
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6257
6344
|
if (refs.length === 0) return {
|
|
6258
6345
|
value,
|
|
6259
6346
|
unresolved: []
|
|
@@ -6277,10 +6364,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6277
6364
|
}
|
|
6278
6365
|
const substitute = (v) => {
|
|
6279
6366
|
if (isSecretMarker(v)) {
|
|
6367
|
+
if (!inScope(v.$secret)) return {
|
|
6368
|
+
keep: true,
|
|
6369
|
+
value: v
|
|
6370
|
+
};
|
|
6280
6371
|
const answer = answers[v.$secret];
|
|
6281
|
-
|
|
6372
|
+
if (answer?.kind === "value") return {
|
|
6282
6373
|
keep: true,
|
|
6283
6374
|
value: answer.value
|
|
6375
|
+
};
|
|
6376
|
+
return keepMarker ? {
|
|
6377
|
+
keep: true,
|
|
6378
|
+
value: v
|
|
6284
6379
|
} : {
|
|
6285
6380
|
keep: false,
|
|
6286
6381
|
value: void 0
|
|
@@ -6297,7 +6392,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6297
6392
|
value: items
|
|
6298
6393
|
};
|
|
6299
6394
|
}
|
|
6300
|
-
if (isRecord$
|
|
6395
|
+
if (isRecord$1(v)) {
|
|
6301
6396
|
const out = {};
|
|
6302
6397
|
for (const [k, child] of Object.entries(v)) {
|
|
6303
6398
|
const s = substitute(child);
|
|
@@ -6318,14 +6413,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6318
6413
|
unresolved
|
|
6319
6414
|
};
|
|
6320
6415
|
}
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6416
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6417
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6418
|
+
ref;
|
|
6419
|
+
reason;
|
|
6420
|
+
constructor(ref, reason) {
|
|
6421
|
+
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.`);
|
|
6422
|
+
this.ref = ref;
|
|
6423
|
+
this.reason = reason;
|
|
6424
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6425
|
+
}
|
|
6426
|
+
};
|
|
6427
|
+
function isRecord$3(value) {
|
|
6428
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6429
|
+
}
|
|
6430
|
+
function resolvedValue(pass, marker) {
|
|
6431
|
+
const answer = pass.answers[marker.$secret];
|
|
6432
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6433
|
+
}
|
|
6434
|
+
async function atMarker(pass, incoming, stored) {
|
|
6435
|
+
if (incoming === null) return stored;
|
|
6436
|
+
if (typeof incoming !== "string") return incoming;
|
|
6437
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6438
|
+
const intent = classifySecretWrite(incoming);
|
|
6439
|
+
if (intent.kind !== "set") return stored;
|
|
6440
|
+
const ref = stored.$secret;
|
|
6441
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6442
|
+
const answer = pass.answers[ref];
|
|
6443
|
+
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);
|
|
6444
|
+
try {
|
|
6445
|
+
await pass.secrets.put(ref, intent.value);
|
|
6446
|
+
} catch (err) {
|
|
6447
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6448
|
+
}
|
|
6449
|
+
pass.changedRefs.push(ref);
|
|
6450
|
+
return stored;
|
|
6451
|
+
}
|
|
6452
|
+
function inArray(pass, incoming, stored) {
|
|
6453
|
+
return incoming.map((item, index) => {
|
|
6454
|
+
const twin = stored[index];
|
|
6455
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6456
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6457
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6458
|
+
return item;
|
|
6459
|
+
});
|
|
6460
|
+
}
|
|
6461
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6462
|
+
const out = { ...incoming };
|
|
6463
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6464
|
+
const twin = stored[key];
|
|
6465
|
+
if (isSecretMarker(twin)) {
|
|
6466
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6467
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6468
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6469
|
+
}
|
|
6470
|
+
return out;
|
|
6471
|
+
}
|
|
6472
|
+
async function walk(pass, incoming, stored) {
|
|
6473
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6474
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6475
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6476
|
+
const out = { ...incoming };
|
|
6477
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6478
|
+
return out;
|
|
6479
|
+
}
|
|
6480
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6481
|
+
async function restoreUnchangedSecrets(input) {
|
|
6482
|
+
const refs = [];
|
|
6483
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6484
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6485
|
+
if (owned.length === 0) return {
|
|
6486
|
+
patch: input.patch,
|
|
6487
|
+
changedRefs: []
|
|
6488
|
+
};
|
|
6489
|
+
const pass = {
|
|
6490
|
+
secrets: input.secrets,
|
|
6491
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6492
|
+
operatorWrite: input.operatorWrite,
|
|
6493
|
+
changedRefs: []
|
|
6494
|
+
};
|
|
6495
|
+
const out = {};
|
|
6496
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6497
|
+
return {
|
|
6498
|
+
patch: out,
|
|
6499
|
+
changedRefs: pass.changedRefs
|
|
6500
|
+
};
|
|
6501
|
+
}
|
|
6502
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6503
|
+
function isJsonEqual(a, b) {
|
|
6504
|
+
if (Object.is(a, b)) return true;
|
|
6505
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6506
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6507
|
+
const keys = Object.keys(a);
|
|
6508
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6509
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6326
6510
|
}
|
|
6327
6511
|
return false;
|
|
6328
6512
|
}
|
|
6513
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6514
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6515
|
+
const out = {};
|
|
6516
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6517
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6518
|
+
out[key] = value;
|
|
6519
|
+
}
|
|
6520
|
+
return out;
|
|
6521
|
+
}
|
|
6522
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6523
|
+
function markerKeysOf(blob, owner) {
|
|
6524
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6525
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6526
|
+
return keys;
|
|
6527
|
+
}
|
|
6528
|
+
function nodeFromStored(value, owner) {
|
|
6529
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6530
|
+
if (!isRecord$3(value)) return null;
|
|
6531
|
+
const children = /* @__PURE__ */ new Map();
|
|
6532
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6533
|
+
const node = nodeFromStored(child, owner);
|
|
6534
|
+
if (node !== null) children.set(key, node);
|
|
6535
|
+
}
|
|
6536
|
+
return children.size > 0 ? {
|
|
6537
|
+
kind: "object",
|
|
6538
|
+
children
|
|
6539
|
+
} : null;
|
|
6540
|
+
}
|
|
6541
|
+
/**
|
|
6542
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6543
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6544
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6545
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6546
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6547
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6548
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6549
|
+
* over.
|
|
6550
|
+
*/
|
|
6551
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6552
|
+
const added = /* @__PURE__ */ new Map();
|
|
6553
|
+
for (const key of keys) {
|
|
6554
|
+
const at = key.indexOf("@");
|
|
6555
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6556
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6557
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6558
|
+
if (node !== null) added.set(base, node);
|
|
6559
|
+
}
|
|
6560
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6561
|
+
}
|
|
6329
6562
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6330
6563
|
async function readStoredAddonBlob(raw) {
|
|
6331
6564
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6334,7 +6567,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6334
6567
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6335
6568
|
return result.kind === "missing" ? {} : result.value;
|
|
6336
6569
|
}
|
|
6337
|
-
function
|
|
6570
|
+
function touchesTree(tree, patch) {
|
|
6571
|
+
if (tree.size === 0) return false;
|
|
6572
|
+
for (const key of Object.keys(patch)) {
|
|
6573
|
+
const at = key.indexOf("@");
|
|
6574
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6575
|
+
}
|
|
6576
|
+
return false;
|
|
6577
|
+
}
|
|
6578
|
+
/**
|
|
6579
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6580
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6581
|
+
*/
|
|
6582
|
+
var MarkerKeyIndex = class {
|
|
6583
|
+
owner;
|
|
6584
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6585
|
+
constructor(owner) {
|
|
6586
|
+
this.owner = owner;
|
|
6587
|
+
}
|
|
6588
|
+
seen(store, blob) {
|
|
6589
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6590
|
+
}
|
|
6591
|
+
wrote(store, patch) {
|
|
6592
|
+
const keys = this.byStore.get(store);
|
|
6593
|
+
if (keys === void 0) return;
|
|
6594
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6595
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6596
|
+
else keys.delete(key);
|
|
6597
|
+
}
|
|
6598
|
+
mayHoldMarkers(store, patch) {
|
|
6599
|
+
const keys = this.byStore.get(store);
|
|
6600
|
+
if (keys === void 0) return true;
|
|
6601
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6602
|
+
}
|
|
6603
|
+
};
|
|
6604
|
+
function createHandle(raw, opts) {
|
|
6338
6605
|
const chains = /* @__PURE__ */ new Map();
|
|
6339
6606
|
const serialize = (key, fn) => {
|
|
6340
6607
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6345,46 +6612,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6345
6612
|
});
|
|
6346
6613
|
return next;
|
|
6347
6614
|
};
|
|
6348
|
-
const
|
|
6349
|
-
|
|
6350
|
-
|
|
6615
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6616
|
+
const resolveRead = async (store, blob) => {
|
|
6617
|
+
index.seen(store, blob);
|
|
6618
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6619
|
+
unresolved: "keep-marker",
|
|
6620
|
+
ownedBy: opts.secrets.owner
|
|
6621
|
+
});
|
|
6622
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6623
|
+
return value;
|
|
6624
|
+
};
|
|
6625
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6626
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6627
|
+
await rawWrite(patch);
|
|
6628
|
+
index.wrote(store, patch);
|
|
6629
|
+
return { changed: true };
|
|
6630
|
+
}
|
|
6631
|
+
return serialize(store, async () => {
|
|
6351
6632
|
const stored = await readStored();
|
|
6633
|
+
index.seen(store, stored);
|
|
6634
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6635
|
+
const restored = await restoreUnchangedSecrets({
|
|
6636
|
+
patch,
|
|
6637
|
+
stored,
|
|
6638
|
+
secrets: opts.secrets,
|
|
6639
|
+
operatorWrite
|
|
6640
|
+
});
|
|
6352
6641
|
const result = await transformSecretWrite({
|
|
6353
|
-
tree,
|
|
6642
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6354
6643
|
secrets: opts.secrets,
|
|
6355
|
-
patch,
|
|
6644
|
+
patch: restored.patch,
|
|
6356
6645
|
stored,
|
|
6357
6646
|
...scope !== void 0 ? { scope } : {},
|
|
6358
|
-
operatorWrite
|
|
6647
|
+
operatorWrite
|
|
6359
6648
|
});
|
|
6360
|
-
|
|
6649
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6650
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6651
|
+
if (wroteBlob) {
|
|
6652
|
+
await rawWrite(effective);
|
|
6653
|
+
index.wrote(store, effective);
|
|
6654
|
+
}
|
|
6361
6655
|
const { orphaned } = await result.afterWrite();
|
|
6362
6656
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6363
|
-
|
|
6657
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6658
|
+
});
|
|
6659
|
+
};
|
|
6660
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6661
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6662
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6663
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6664
|
+
const overrides = {
|
|
6665
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6666
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6667
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6668
|
+
return result.kind === "value" ? {
|
|
6669
|
+
kind: "value",
|
|
6670
|
+
value: await resolveRead("addon", result.value)
|
|
6671
|
+
} : result;
|
|
6672
|
+
} } : {},
|
|
6673
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6674
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6675
|
+
if (result.kind !== "present") return result;
|
|
6676
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6677
|
+
unresolved: "keep-marker",
|
|
6678
|
+
ownedBy: opts.secrets.owner
|
|
6679
|
+
});
|
|
6680
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6681
|
+
return {
|
|
6682
|
+
kind: "present",
|
|
6683
|
+
value: value[key]
|
|
6684
|
+
};
|
|
6685
|
+
} } : {},
|
|
6686
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6687
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6688
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6689
|
+
const out = /* @__PURE__ */ new Map();
|
|
6690
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6691
|
+
return out;
|
|
6692
|
+
} } : {},
|
|
6693
|
+
writeAddonStore: async (patch) => {
|
|
6694
|
+
await writeAddon(patch);
|
|
6695
|
+
},
|
|
6696
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6697
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6698
|
+
kind: "device",
|
|
6699
|
+
deviceId
|
|
6700
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6701
|
+
}
|
|
6702
|
+
};
|
|
6703
|
+
return {
|
|
6704
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6705
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6706
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6707
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6708
|
+
} }),
|
|
6709
|
+
raw: {
|
|
6710
|
+
readAddonStore: async () => {
|
|
6711
|
+
const blob = await raw.readAddonStore();
|
|
6712
|
+
index.seen("addon", blob);
|
|
6713
|
+
return blob;
|
|
6714
|
+
},
|
|
6715
|
+
readDeviceStore: async (deviceId) => {
|
|
6716
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6717
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6718
|
+
return blob;
|
|
6719
|
+
}
|
|
6720
|
+
},
|
|
6721
|
+
writeAddonStore: writeAddon
|
|
6364
6722
|
};
|
|
6365
|
-
const wrapped = {
|
|
6366
|
-
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6367
|
-
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6368
|
-
kind: "device",
|
|
6369
|
-
deviceId
|
|
6370
|
-
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6371
|
-
};
|
|
6372
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6373
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6374
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6375
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6376
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6377
|
-
} });
|
|
6378
6723
|
}
|
|
6379
|
-
/** The context the addon sees
|
|
6380
|
-
function
|
|
6724
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6725
|
+
function createSecretAwareContext(context, opts) {
|
|
6381
6726
|
const raw = context.settings;
|
|
6382
|
-
if (raw === void 0) return
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6727
|
+
if (raw === void 0) return {
|
|
6728
|
+
context,
|
|
6729
|
+
handle: null
|
|
6730
|
+
};
|
|
6731
|
+
const handle = createHandle(raw, opts);
|
|
6732
|
+
return {
|
|
6733
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6734
|
+
if (prop === "settings") return handle.settings;
|
|
6735
|
+
return Reflect.get(target, prop, receiver);
|
|
6736
|
+
} }),
|
|
6737
|
+
handle
|
|
6738
|
+
};
|
|
6388
6739
|
}
|
|
6389
6740
|
var LEAF = { kind: "leaf" };
|
|
6390
6741
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6559,6 +6910,14 @@ var BaseAddon = class {
|
|
|
6559
6910
|
_secretChangeUnsub = null;
|
|
6560
6911
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6561
6912
|
_operatorWriteDepth = 0;
|
|
6913
|
+
/**
|
|
6914
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6915
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6916
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6917
|
+
*/
|
|
6918
|
+
_secretSettings = null;
|
|
6919
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6920
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6562
6921
|
constructor(defaults) {
|
|
6563
6922
|
this.defaults = defaults;
|
|
6564
6923
|
this._config = { ...defaults };
|
|
@@ -6595,13 +6954,21 @@ var BaseAddon = class {
|
|
|
6595
6954
|
}
|
|
6596
6955
|
async initialize(context) {
|
|
6597
6956
|
const secrets = context.secrets;
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6957
|
+
if (secrets !== void 0) {
|
|
6958
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6959
|
+
secrets,
|
|
6960
|
+
addonTree: () => this.addonSecretTree(),
|
|
6961
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6962
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6963
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6964
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6965
|
+
});
|
|
6966
|
+
this._ctx = wrapped;
|
|
6967
|
+
this._secretSettings = handle;
|
|
6968
|
+
} else {
|
|
6969
|
+
this._ctx = context;
|
|
6970
|
+
this._secretSettings = null;
|
|
6971
|
+
}
|
|
6605
6972
|
await this.resolveConfig();
|
|
6606
6973
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6607
6974
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6718,11 +7085,8 @@ var BaseAddon = class {
|
|
|
6718
7085
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6719
7086
|
const schema = this.globalSettingsSchema(cap);
|
|
6720
7087
|
if (!schema) return { sections: [] };
|
|
6721
|
-
const projected = await this.
|
|
6722
|
-
return hydrateSchema(schema, overlay ? {
|
|
6723
|
-
...projected,
|
|
6724
|
-
...overlay
|
|
6725
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7088
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7089
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6726
7090
|
}
|
|
6727
7091
|
/**
|
|
6728
7092
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6767,7 +7131,7 @@ var BaseAddon = class {
|
|
|
6767
7131
|
});
|
|
6768
7132
|
}
|
|
6769
7133
|
if (sections.length === 0) return null;
|
|
6770
|
-
const projected = await this.
|
|
7134
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6771
7135
|
return hydrateSchema({
|
|
6772
7136
|
...schema,
|
|
6773
7137
|
sections
|
|
@@ -6784,12 +7148,50 @@ var BaseAddon = class {
|
|
|
6784
7148
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6785
7149
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6786
7150
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7151
|
+
*
|
|
7152
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7153
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7154
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7155
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7156
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7157
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6787
7158
|
*/
|
|
6788
7159
|
async resolveGlobalStore(nodeId, cap) {
|
|
6789
7160
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7161
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7162
|
+
}
|
|
7163
|
+
projectForNode(store, nodeId, cap) {
|
|
6790
7164
|
const keys = this.perNodeKeys(cap);
|
|
6791
7165
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6792
|
-
return keys.size > 0 ? projectStore(
|
|
7166
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7167
|
+
}
|
|
7168
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7169
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7170
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7171
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7172
|
+
}
|
|
7173
|
+
/**
|
|
7174
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7175
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7176
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7177
|
+
* its value.
|
|
7178
|
+
*/
|
|
7179
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7180
|
+
const secrets = this._ctx?.secrets;
|
|
7181
|
+
const merged = {
|
|
7182
|
+
...stored,
|
|
7183
|
+
...overlay
|
|
7184
|
+
};
|
|
7185
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7186
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7187
|
+
unresolved: "keep-marker",
|
|
7188
|
+
ownedBy: secrets.owner
|
|
7189
|
+
});
|
|
7190
|
+
for (const key of Object.keys(overlay)) {
|
|
7191
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7192
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7193
|
+
}
|
|
7194
|
+
return merged;
|
|
6793
7195
|
}
|
|
6794
7196
|
/**
|
|
6795
7197
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6854,8 +7256,12 @@ var BaseAddon = class {
|
|
|
6854
7256
|
async clearSecrets(keys, nodeId) {
|
|
6855
7257
|
const tree = this.addonSecretTree();
|
|
6856
7258
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7259
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6857
7260
|
const patch = {};
|
|
6858
|
-
for (const key of keys)
|
|
7261
|
+
for (const key of keys) {
|
|
7262
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7263
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7264
|
+
}
|
|
6859
7265
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6860
7266
|
}
|
|
6861
7267
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6863,7 +7269,11 @@ var BaseAddon = class {
|
|
|
6863
7269
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6864
7270
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6865
7271
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6866
|
-
|
|
7272
|
+
const handle = this._secretSettings;
|
|
7273
|
+
if (handle !== null) {
|
|
7274
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7275
|
+
if (!changed) return;
|
|
7276
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6867
7277
|
if (target !== localNode) return;
|
|
6868
7278
|
await this.resolveConfig();
|
|
6869
7279
|
await this.onConfigChanged();
|
|
@@ -6916,7 +7326,7 @@ var BaseAddon = class {
|
|
|
6916
7326
|
async getDeviceSettings(deviceId) {
|
|
6917
7327
|
const schema = this.deviceSettingsSchema();
|
|
6918
7328
|
if (!schema) return { sections: [] };
|
|
6919
|
-
return hydrateSchema(schema, await this.
|
|
7329
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6920
7330
|
}
|
|
6921
7331
|
async updateDeviceSettings(deviceId, patch) {
|
|
6922
7332
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7088,7 +7498,7 @@ var BaseAddon = class {
|
|
|
7088
7498
|
key,
|
|
7089
7499
|
schema,
|
|
7090
7500
|
fallback,
|
|
7091
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7501
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7092
7502
|
write: async (patch) => {
|
|
7093
7503
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7094
7504
|
},
|
|
@@ -7150,6 +7560,23 @@ var BaseAddon = class {
|
|
|
7150
7560
|
}
|
|
7151
7561
|
return value;
|
|
7152
7562
|
}
|
|
7563
|
+
/**
|
|
7564
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7565
|
+
* keychain the context's own view is already raw.
|
|
7566
|
+
*/
|
|
7567
|
+
rawSettings() {
|
|
7568
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7569
|
+
}
|
|
7570
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7571
|
+
logUnresolvedRead(unresolved) {
|
|
7572
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7573
|
+
if (fresh.length === 0) return;
|
|
7574
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7575
|
+
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) => ({
|
|
7576
|
+
ref: u.ref,
|
|
7577
|
+
reason: u.reason
|
|
7578
|
+
})) } });
|
|
7579
|
+
}
|
|
7153
7580
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7154
7581
|
scheduleSecretReresolve(delayMs) {
|
|
7155
7582
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7176,7 +7603,7 @@ var BaseAddon = class {
|
|
|
7176
7603
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7177
7604
|
*/
|
|
7178
7605
|
async readAddonStoreWithRetry() {
|
|
7179
|
-
const settings = this.
|
|
7606
|
+
const settings = this.rawSettings();
|
|
7180
7607
|
if (!settings) return {};
|
|
7181
7608
|
const delaysMs = [
|
|
7182
7609
|
150,
|
|
@@ -9547,6 +9974,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9547
9974
|
fetchedAt: number()
|
|
9548
9975
|
});
|
|
9549
9976
|
/**
|
|
9977
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9978
|
+
* gets back (cloud training, D805+).
|
|
9979
|
+
*
|
|
9980
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9981
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9982
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9983
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9984
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9985
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9986
|
+
* change there, in the same piece of work.
|
|
9987
|
+
*
|
|
9988
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9989
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9990
|
+
*/
|
|
9991
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9992
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9993
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9994
|
+
var TrainingExportSchema = _enum([
|
|
9995
|
+
"onnx",
|
|
9996
|
+
"openvino-fp16",
|
|
9997
|
+
"openvino-int8",
|
|
9998
|
+
"coreml-fp16"
|
|
9999
|
+
]);
|
|
10000
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10001
|
+
object({
|
|
10002
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10003
|
+
jobKey: string().uuid(),
|
|
10004
|
+
target: object({
|
|
10005
|
+
kind: literal("detector"),
|
|
10006
|
+
step: literal("object-detection")
|
|
10007
|
+
}),
|
|
10008
|
+
base: object({
|
|
10009
|
+
modelId: string().min(1),
|
|
10010
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10011
|
+
weights: string().min(1),
|
|
10012
|
+
imgsz: number().int().positive()
|
|
10013
|
+
}),
|
|
10014
|
+
baseline: object({
|
|
10015
|
+
modelId: string().min(1),
|
|
10016
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10017
|
+
onnxUrl: string().url(),
|
|
10018
|
+
imgsz: number().int().positive(),
|
|
10019
|
+
floors: FloorsSchema
|
|
10020
|
+
}),
|
|
10021
|
+
dataset: object({
|
|
10022
|
+
versionId: string().min(1),
|
|
10023
|
+
annotationHash: string(),
|
|
10024
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10025
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10026
|
+
}),
|
|
10027
|
+
split: object({
|
|
10028
|
+
holdoutCameras: array(number().int()),
|
|
10029
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10030
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10031
|
+
valFraction: number().min(0).max(.5),
|
|
10032
|
+
seed: number().int()
|
|
10033
|
+
}),
|
|
10034
|
+
hyper: object({
|
|
10035
|
+
epochs: number().int().positive(),
|
|
10036
|
+
batch: number().int().positive(),
|
|
10037
|
+
lr0: number().positive(),
|
|
10038
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10039
|
+
freeze: number().int().nonnegative(),
|
|
10040
|
+
patience: number().int().nonnegative(),
|
|
10041
|
+
seed: number().int()
|
|
10042
|
+
}),
|
|
10043
|
+
replay: object({
|
|
10044
|
+
source: literal("coco2017"),
|
|
10045
|
+
count: number().int().nonnegative()
|
|
10046
|
+
}),
|
|
10047
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10048
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10049
|
+
floors: object({
|
|
10050
|
+
minSupport: number().int().positive(),
|
|
10051
|
+
clamp: number().min(0).max(1)
|
|
10052
|
+
}),
|
|
10053
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10054
|
+
catalog: object({
|
|
10055
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10056
|
+
name: string().min(1).max(160)
|
|
10057
|
+
})
|
|
10058
|
+
});
|
|
10059
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10060
|
+
var TrainingResultFileSchema = object({
|
|
10061
|
+
path: string().min(1),
|
|
10062
|
+
bytes: number().int().nonnegative(),
|
|
10063
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10064
|
+
format: _enum([
|
|
10065
|
+
"onnx",
|
|
10066
|
+
"openvino",
|
|
10067
|
+
"coreml",
|
|
10068
|
+
"pt"
|
|
10069
|
+
]),
|
|
10070
|
+
variant: _enum(["base", "int8"])
|
|
10071
|
+
});
|
|
10072
|
+
var DraftFormatSchema = object({
|
|
10073
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10074
|
+
url: string().min(1),
|
|
10075
|
+
sizeMB: number().nonnegative(),
|
|
10076
|
+
isDirectory: boolean().optional(),
|
|
10077
|
+
files: array(string()).optional(),
|
|
10078
|
+
runtimes: array(literal("python")).optional(),
|
|
10079
|
+
revision: string().min(1)
|
|
10080
|
+
});
|
|
10081
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10082
|
+
var TrainingCatalogDraftSchema = object({
|
|
10083
|
+
id: string().min(1),
|
|
10084
|
+
name: string().min(1),
|
|
10085
|
+
description: string(),
|
|
10086
|
+
labels: array(unknown()),
|
|
10087
|
+
inputSize: object({
|
|
10088
|
+
width: number().int().positive(),
|
|
10089
|
+
height: number().int().positive()
|
|
10090
|
+
}),
|
|
10091
|
+
preprocessMode: literal("letterbox"),
|
|
10092
|
+
defaultClassFloors: FloorsSchema,
|
|
10093
|
+
formats: object({
|
|
10094
|
+
onnx: DraftFormatSchema.optional(),
|
|
10095
|
+
openvino: DraftFormatSchema.optional(),
|
|
10096
|
+
coreml: DraftFormatSchema.optional()
|
|
10097
|
+
})
|
|
10098
|
+
});
|
|
10099
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10100
|
+
var TrainingEvalClassSchema = object({
|
|
10101
|
+
positives: number().int(),
|
|
10102
|
+
floor: number().nullable(),
|
|
10103
|
+
tp: number().int(),
|
|
10104
|
+
fp: number().int(),
|
|
10105
|
+
fn: number().int(),
|
|
10106
|
+
precision: number().nullable(),
|
|
10107
|
+
recall: number().nullable(),
|
|
10108
|
+
ap50: number().nullable(),
|
|
10109
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10110
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10111
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10112
|
+
smallFound: number().int().optional(),
|
|
10113
|
+
smallTotal: number().int().optional()
|
|
10114
|
+
}).passthrough();
|
|
10115
|
+
var TrainingEvalReportSchema = object({
|
|
10116
|
+
frames: number().int(),
|
|
10117
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10118
|
+
}).passthrough();
|
|
10119
|
+
/**
|
|
10120
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10121
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10122
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10123
|
+
*/
|
|
10124
|
+
var TrainingResultSchema = object({
|
|
10125
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10126
|
+
jobKey: string(),
|
|
10127
|
+
status: _enum(["succeeded", "failed"]),
|
|
10128
|
+
error: object({
|
|
10129
|
+
stage: string(),
|
|
10130
|
+
code: string(),
|
|
10131
|
+
message: string()
|
|
10132
|
+
}).nullable(),
|
|
10133
|
+
trainer: object({
|
|
10134
|
+
version: string(),
|
|
10135
|
+
revision: string()
|
|
10136
|
+
}),
|
|
10137
|
+
toolchain: record(string(), string().nullable()),
|
|
10138
|
+
dataset: object({
|
|
10139
|
+
versionId: string(),
|
|
10140
|
+
annotationHash: string(),
|
|
10141
|
+
sha256: string(),
|
|
10142
|
+
frames: object({
|
|
10143
|
+
train: number().int(),
|
|
10144
|
+
val: number().int(),
|
|
10145
|
+
holdout: number().int()
|
|
10146
|
+
}),
|
|
10147
|
+
holdoutCameras: array(number().int()),
|
|
10148
|
+
replayImages: number().int()
|
|
10149
|
+
}).optional(),
|
|
10150
|
+
training: object({
|
|
10151
|
+
epochsRun: number().int(),
|
|
10152
|
+
bestEpoch: number().int(),
|
|
10153
|
+
bestMap50: number(),
|
|
10154
|
+
bestMap50_95: number(),
|
|
10155
|
+
seconds: number()
|
|
10156
|
+
}).optional(),
|
|
10157
|
+
evaluation: object({
|
|
10158
|
+
holdoutFrames: number().int(),
|
|
10159
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10160
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10161
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10162
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10163
|
+
map50: record(string(), number().nullable())
|
|
10164
|
+
}).optional(),
|
|
10165
|
+
floors: object({
|
|
10166
|
+
baseline: FloorsSchema,
|
|
10167
|
+
candidate: FloorsSchema,
|
|
10168
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10169
|
+
notes: array(string())
|
|
10170
|
+
}).optional(),
|
|
10171
|
+
int8: object({
|
|
10172
|
+
kept: boolean(),
|
|
10173
|
+
map50Fp16: number().nullable(),
|
|
10174
|
+
map50Int8: number().nullable(),
|
|
10175
|
+
reason: string().nullable()
|
|
10176
|
+
}).optional(),
|
|
10177
|
+
exportsDropped: array(object({
|
|
10178
|
+
export: string(),
|
|
10179
|
+
reason: string()
|
|
10180
|
+
})).optional(),
|
|
10181
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10182
|
+
bundle: object({
|
|
10183
|
+
path: literal("bundle.tar"),
|
|
10184
|
+
bytes: number().int().nonnegative(),
|
|
10185
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10186
|
+
}).nullable().optional(),
|
|
10187
|
+
catalogDraft: object({
|
|
10188
|
+
base: TrainingCatalogDraftSchema,
|
|
10189
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10190
|
+
}).nullable().optional(),
|
|
10191
|
+
licence: string()
|
|
10192
|
+
});
|
|
10193
|
+
var TrainingStageSchema = _enum([
|
|
10194
|
+
"prepare",
|
|
10195
|
+
"replay",
|
|
10196
|
+
"train",
|
|
10197
|
+
"eval",
|
|
10198
|
+
"export",
|
|
10199
|
+
"package"
|
|
10200
|
+
]);
|
|
10201
|
+
var EventBase = {
|
|
10202
|
+
v: literal(1),
|
|
10203
|
+
ts: number()
|
|
10204
|
+
};
|
|
10205
|
+
discriminatedUnion("type", [
|
|
10206
|
+
object({
|
|
10207
|
+
...EventBase,
|
|
10208
|
+
type: literal("stage"),
|
|
10209
|
+
stage: TrainingStageSchema
|
|
10210
|
+
}),
|
|
10211
|
+
object({
|
|
10212
|
+
...EventBase,
|
|
10213
|
+
type: literal("epoch"),
|
|
10214
|
+
epoch: number().int(),
|
|
10215
|
+
epochs: number().int(),
|
|
10216
|
+
boxLoss: number().nullable().optional(),
|
|
10217
|
+
map50: number().nullable().optional(),
|
|
10218
|
+
map50_95: number().nullable().optional(),
|
|
10219
|
+
etaSec: number().nullable().optional()
|
|
10220
|
+
}),
|
|
10221
|
+
object({
|
|
10222
|
+
...EventBase,
|
|
10223
|
+
type: literal("metric"),
|
|
10224
|
+
name: string(),
|
|
10225
|
+
value: number()
|
|
10226
|
+
}),
|
|
10227
|
+
object({
|
|
10228
|
+
...EventBase,
|
|
10229
|
+
type: literal("artifact"),
|
|
10230
|
+
path: string(),
|
|
10231
|
+
bytes: number(),
|
|
10232
|
+
sha256: string()
|
|
10233
|
+
}),
|
|
10234
|
+
object({
|
|
10235
|
+
...EventBase,
|
|
10236
|
+
type: literal("done"),
|
|
10237
|
+
status: _enum(["succeeded", "failed"]),
|
|
10238
|
+
resultSha256: string().nullable().optional()
|
|
10239
|
+
}),
|
|
10240
|
+
object({
|
|
10241
|
+
...EventBase,
|
|
10242
|
+
type: literal("error"),
|
|
10243
|
+
stage: string(),
|
|
10244
|
+
code: string(),
|
|
10245
|
+
message: string()
|
|
10246
|
+
})
|
|
10247
|
+
]);
|
|
10248
|
+
/**
|
|
9550
10249
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9551
10250
|
*
|
|
9552
10251
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12406,7 +13105,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12406
13105
|
"authenticated",
|
|
12407
13106
|
"admin"
|
|
12408
13107
|
]).optional(),
|
|
12409
|
-
description: string().optional()
|
|
13108
|
+
description: string().optional(),
|
|
13109
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13110
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12410
13111
|
});
|
|
12411
13112
|
/**
|
|
12412
13113
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13111,6 +13812,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13111
13812
|
lastError: string().optional()
|
|
13112
13813
|
});
|
|
13113
13814
|
/**
|
|
13815
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13816
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13817
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13818
|
+
* with it off — which restores without a key.
|
|
13819
|
+
*/
|
|
13820
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13821
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13822
|
+
scheme: string(),
|
|
13823
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13824
|
+
keyId: string()
|
|
13825
|
+
});
|
|
13826
|
+
/**
|
|
13827
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13828
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13829
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13830
|
+
*/
|
|
13831
|
+
var BackupEncryptionStatusSchema = object({
|
|
13832
|
+
enabled: boolean(),
|
|
13833
|
+
active: object({
|
|
13834
|
+
keyId: string(),
|
|
13835
|
+
publicKey: string(),
|
|
13836
|
+
createdAt: number()
|
|
13837
|
+
}).nullable(),
|
|
13838
|
+
/** Every key ever set up, newest first. */
|
|
13839
|
+
keys: array(object({
|
|
13840
|
+
keyId: string(),
|
|
13841
|
+
createdAt: number(),
|
|
13842
|
+
retiredAt: number().nullable()
|
|
13843
|
+
})).readonly()
|
|
13844
|
+
});
|
|
13845
|
+
/**
|
|
13114
13846
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13115
13847
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13116
13848
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13122,7 +13854,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13122
13854
|
sizeBytes: number(),
|
|
13123
13855
|
label: string().optional(),
|
|
13124
13856
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13125
|
-
locations: array(string()).readonly()
|
|
13857
|
+
locations: array(string()).readonly(),
|
|
13858
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13859
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13126
13860
|
});
|
|
13127
13861
|
var BackupEntrySchema = object({
|
|
13128
13862
|
id: string(),
|
|
@@ -13131,7 +13865,8 @@ var BackupEntrySchema = object({
|
|
|
13131
13865
|
label: string().optional(),
|
|
13132
13866
|
createdAt: number(),
|
|
13133
13867
|
sizeBytes: number(),
|
|
13134
|
-
locations: array(string()).optional()
|
|
13868
|
+
locations: array(string()).optional(),
|
|
13869
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13135
13870
|
});
|
|
13136
13871
|
var ArchiveEntrySchema = object({
|
|
13137
13872
|
path: string(),
|
|
@@ -13320,10 +14055,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13320
14055
|
* this list and skips entries whose path doesn't start with
|
|
13321
14056
|
* any of them.
|
|
13322
14057
|
*/
|
|
13323
|
-
locations: array(string()).optional()
|
|
14058
|
+
locations: array(string()).optional(),
|
|
14059
|
+
/**
|
|
14060
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14061
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14062
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14063
|
+
* is refused before the archive is downloaded.
|
|
14064
|
+
*/
|
|
14065
|
+
backupSecretKey: string().optional()
|
|
13324
14066
|
}), _void(), {
|
|
13325
14067
|
kind: "mutation",
|
|
13326
14068
|
auth: "admin"
|
|
14069
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14070
|
+
keyId: string(),
|
|
14071
|
+
secretKey: string(),
|
|
14072
|
+
publicKey: string(),
|
|
14073
|
+
createdAt: number(),
|
|
14074
|
+
replacedKeyId: string().nullable()
|
|
14075
|
+
}), {
|
|
14076
|
+
kind: "mutation",
|
|
14077
|
+
auth: "admin"
|
|
14078
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14079
|
+
kind: "mutation",
|
|
14080
|
+
auth: "admin"
|
|
14081
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14082
|
+
valid: boolean(),
|
|
14083
|
+
keyId: string().nullable(),
|
|
14084
|
+
/** The hub knows this key (active or retired). */
|
|
14085
|
+
known: boolean(),
|
|
14086
|
+
/** It is the key new archives are encrypted to. */
|
|
14087
|
+
active: boolean(),
|
|
14088
|
+
error: string().optional()
|
|
14089
|
+
}), {
|
|
14090
|
+
kind: "mutation",
|
|
14091
|
+
auth: "admin"
|
|
13327
14092
|
}), method(object({
|
|
13328
14093
|
destinationId: string(),
|
|
13329
14094
|
backupId: string()
|
|
@@ -15049,7 +15814,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
15049
15814
|
stepId: string(),
|
|
15050
15815
|
entry: ModelCatalogEntrySchema
|
|
15051
15816
|
});
|
|
15052
|
-
|
|
15817
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15818
|
+
var ModelBundleFileSchema = object({
|
|
15819
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15820
|
+
path: string().min(1),
|
|
15821
|
+
bytes: number().int().nonnegative(),
|
|
15822
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15823
|
+
});
|
|
15824
|
+
var ImportModelBundleInputSchema = object({
|
|
15825
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15826
|
+
addonId: string(),
|
|
15827
|
+
stepId: string().min(1),
|
|
15828
|
+
/**
|
|
15829
|
+
* The catalog rows to register, complete, every format URL already
|
|
15830
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15831
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15832
|
+
*/
|
|
15833
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15834
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15835
|
+
bundle: object({
|
|
15836
|
+
ticket: PeerBytesTicketSchema,
|
|
15837
|
+
bytes: number().int().positive(),
|
|
15838
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15839
|
+
}),
|
|
15840
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15841
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15842
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15843
|
+
distribute: boolean()
|
|
15844
|
+
});
|
|
15845
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15846
|
+
kind: literal("imported"),
|
|
15847
|
+
modelIds: array(string()).readonly(),
|
|
15848
|
+
distributed: array(object({
|
|
15849
|
+
modelId: string(),
|
|
15850
|
+
nodeId: string(),
|
|
15851
|
+
format: _enum(MODEL_FORMATS),
|
|
15852
|
+
ok: boolean(),
|
|
15853
|
+
error: string().optional()
|
|
15854
|
+
})).readonly()
|
|
15855
|
+
}), object({
|
|
15856
|
+
kind: literal("refused"),
|
|
15857
|
+
reason: _enum([
|
|
15858
|
+
"transfer-failed",
|
|
15859
|
+
"checksum-mismatch",
|
|
15860
|
+
"bundle-mismatch",
|
|
15861
|
+
"invalid-entry",
|
|
15862
|
+
"id-taken"
|
|
15863
|
+
]),
|
|
15864
|
+
detail: string()
|
|
15865
|
+
})]);
|
|
15866
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15867
|
+
kind: "mutation",
|
|
15868
|
+
auth: "admin",
|
|
15869
|
+
timeoutMs: 30 * 6e4
|
|
15870
|
+
});
|
|
15053
15871
|
/**
|
|
15054
15872
|
* Query filter for settings-store collections.
|
|
15055
15873
|
*/
|
|
@@ -15528,6 +16346,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15528
16346
|
*/
|
|
15529
16347
|
sharesBackupWithDatabase: boolean()
|
|
15530
16348
|
});
|
|
16349
|
+
/**
|
|
16350
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16351
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16352
|
+
*/
|
|
16353
|
+
var KeychainResetRecordSchema = object({
|
|
16354
|
+
id: string(),
|
|
16355
|
+
at: number(),
|
|
16356
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16357
|
+
actor: string(),
|
|
16358
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16359
|
+
lockedReason: string().nullable(),
|
|
16360
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16361
|
+
archived: number().int(),
|
|
16362
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16363
|
+
archivedCollection: string().nullable(),
|
|
16364
|
+
/**
|
|
16365
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16366
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16367
|
+
*/
|
|
16368
|
+
archivedKeysCollection: string().nullable(),
|
|
16369
|
+
/**
|
|
16370
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16371
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16372
|
+
* agent forever (D797).
|
|
16373
|
+
*/
|
|
16374
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16375
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16376
|
+
acknowledgedAt: number().nullable()
|
|
16377
|
+
});
|
|
15531
16378
|
var KeychainStatusSchema = object({
|
|
15532
16379
|
keychain: KeychainStateSchema,
|
|
15533
16380
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15545,7 +16392,9 @@ var KeychainStatusSchema = object({
|
|
|
15545
16392
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15546
16393
|
retiredWraps: number().int(),
|
|
15547
16394
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15548
|
-
secretCount: number().int()
|
|
16395
|
+
secretCount: number().int(),
|
|
16396
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16397
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15549
16398
|
});
|
|
15550
16399
|
/**
|
|
15551
16400
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15567,17 +16416,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15567
16416
|
"download-recovery-key",
|
|
15568
16417
|
"delete-orphans",
|
|
15569
16418
|
"reset",
|
|
16419
|
+
"acknowledge-reset",
|
|
15570
16420
|
"initialize"
|
|
15571
16421
|
]);
|
|
15572
16422
|
var KeychainAuditEntrySchema = object({
|
|
15573
16423
|
id: string(),
|
|
15574
16424
|
at: number(),
|
|
15575
16425
|
action: KeychainAuditActionSchema,
|
|
15576
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16426
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15577
16427
|
actor: string(),
|
|
15578
16428
|
ref: string().nullable(),
|
|
15579
16429
|
detail: string().nullable()
|
|
15580
16430
|
});
|
|
16431
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16432
|
+
/**
|
|
16433
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16434
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16435
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16436
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16437
|
+
*/
|
|
16438
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15581
16439
|
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({
|
|
15582
16440
|
value: string(),
|
|
15583
16441
|
version: number().int()
|
|
@@ -15585,6 +16443,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15585
16443
|
kind: "mutation",
|
|
15586
16444
|
auth: "admin",
|
|
15587
16445
|
caller: "required"
|
|
16446
|
+
}), method(object({
|
|
16447
|
+
name: SystemHeldSecretNameSchema,
|
|
16448
|
+
value: string().min(16)
|
|
16449
|
+
}), object({
|
|
16450
|
+
ref: string(),
|
|
16451
|
+
version: number().int()
|
|
16452
|
+
}), {
|
|
16453
|
+
kind: "mutation",
|
|
16454
|
+
auth: "admin",
|
|
16455
|
+
caller: "required"
|
|
15588
16456
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15589
16457
|
deleted: array(string()).readonly(),
|
|
15590
16458
|
kept: array(object({
|
|
@@ -15614,13 +16482,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15614
16482
|
kind: "mutation",
|
|
15615
16483
|
auth: "admin",
|
|
15616
16484
|
caller: "required"
|
|
15617
|
-
}), method(object({ confirm: literal(
|
|
16485
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15618
16486
|
archivedCollection: string().nullable(),
|
|
15619
16487
|
archived: number().int()
|
|
15620
16488
|
}), {
|
|
15621
16489
|
kind: "mutation",
|
|
15622
16490
|
auth: "admin",
|
|
15623
16491
|
caller: "required"
|
|
16492
|
+
}), method(object({}), object({
|
|
16493
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16494
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16495
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16496
|
+
kind: "mutation",
|
|
16497
|
+
auth: "admin",
|
|
16498
|
+
caller: "required"
|
|
15624
16499
|
});
|
|
15625
16500
|
method(_void(), object({
|
|
15626
16501
|
id: string(),
|
|
@@ -18607,7 +19482,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18607
19482
|
* `login-method` — collection cap through which auth addons contribute
|
|
18608
19483
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18609
19484
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18610
|
-
* every auth addon (OIDC,
|
|
19485
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18611
19486
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18612
19487
|
* procedure aggregates them for the unauthenticated login page.
|
|
18613
19488
|
*
|
|
@@ -18615,8 +19490,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18615
19490
|
*
|
|
18616
19491
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18617
19492
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18618
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18619
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19493
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18620
19494
|
* login page needs NO change.
|
|
18621
19495
|
*
|
|
18622
19496
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18635,8 +19509,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18635
19509
|
* decision.
|
|
18636
19510
|
*
|
|
18637
19511
|
* Every contribution carries a `stage`:
|
|
18638
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18639
|
-
*
|
|
19512
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19513
|
+
* buttons; a usernameless passkey).
|
|
18640
19514
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18641
19515
|
* returned `factors` (passkey-as-2FA today).
|
|
18642
19516
|
*
|
|
@@ -18663,7 +19537,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18663
19537
|
* The provider names an external identity a signed-in user can link to
|
|
18664
19538
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18665
19539
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18666
|
-
* whatever their id. Absent / false — a login button only
|
|
19540
|
+
* whatever their id. Absent / false — a login button only.
|
|
18667
19541
|
*/
|
|
18668
19542
|
linkable: boolean().optional()
|
|
18669
19543
|
}),
|
|
@@ -22518,8 +23392,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22518
23392
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22519
23393
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22520
23394
|
* distinction was only ever used to route role-specific procedures
|
|
22521
|
-
* which we no longer have.
|
|
22522
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23395
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22523
23396
|
* with `isAdmin: false` + an explicit scope list.
|
|
22524
23397
|
*/
|
|
22525
23398
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24194,6 +25067,9 @@ var RetrainExportFilterSchema = object({
|
|
|
24194
25067
|
frameIds: array(string()).max(2e4).optional(),
|
|
24195
25068
|
/** Only frames in at least one of these named collections. */
|
|
24196
25069
|
collectionIds: array(string()).max(200).optional(),
|
|
25070
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25071
|
+
* unknown id selects nothing. */
|
|
25072
|
+
datasetVersionId: string().optional(),
|
|
24197
25073
|
batchId: string().optional(),
|
|
24198
25074
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24199
25075
|
completeOnly: boolean().optional()
|
|
@@ -24361,6 +25237,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24361
25237
|
]),
|
|
24362
25238
|
detail: string().optional()
|
|
24363
25239
|
})]);
|
|
25240
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25241
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25242
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25243
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25244
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25245
|
+
});
|
|
25246
|
+
/** The counts a dataset is judged by. */
|
|
25247
|
+
var RetrainDatasetStatsSchema = object({
|
|
25248
|
+
frames: number().int(),
|
|
25249
|
+
completeFrames: number().int(),
|
|
25250
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25251
|
+
completeness: number(),
|
|
25252
|
+
/** Boxes to learn (model errors excluded). */
|
|
25253
|
+
subjects: number().int(),
|
|
25254
|
+
modelErrors: number().int(),
|
|
25255
|
+
/** Complete frames with no subject. */
|
|
25256
|
+
hardNegatives: number().int(),
|
|
25257
|
+
/** Subjects per class × camera × day/night. */
|
|
25258
|
+
cells: array(object({
|
|
25259
|
+
macroClass: string(),
|
|
25260
|
+
deviceId: number(),
|
|
25261
|
+
lighting: _enum([
|
|
25262
|
+
"day",
|
|
25263
|
+
"night",
|
|
25264
|
+
"unknown"
|
|
25265
|
+
]),
|
|
25266
|
+
subjects: number().int(),
|
|
25267
|
+
frames: number().int()
|
|
25268
|
+
})).readonly(),
|
|
25269
|
+
cameras: array(object({
|
|
25270
|
+
deviceId: number(),
|
|
25271
|
+
frames: number().int(),
|
|
25272
|
+
completeFrames: number().int()
|
|
25273
|
+
})).readonly()
|
|
25274
|
+
});
|
|
25275
|
+
/** An immutable dataset version, without its frame list. */
|
|
25276
|
+
var RetrainDatasetVersionSchema = object({
|
|
25277
|
+
id: string(),
|
|
25278
|
+
name: string(),
|
|
25279
|
+
createdAt: number(),
|
|
25280
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25281
|
+
layout: RetrainExportLayoutSchema,
|
|
25282
|
+
completeOnly: boolean(),
|
|
25283
|
+
frameCount: number().int(),
|
|
25284
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25285
|
+
annotationHash: string(),
|
|
25286
|
+
/** The export manifest schema the version was cut under. */
|
|
25287
|
+
manifestSchema: string(),
|
|
25288
|
+
stats: RetrainDatasetStatsSchema
|
|
25289
|
+
});
|
|
25290
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25291
|
+
kind: literal("created"),
|
|
25292
|
+
version: RetrainDatasetVersionSchema
|
|
25293
|
+
}), object({
|
|
25294
|
+
kind: literal("refused"),
|
|
25295
|
+
reason: _enum([
|
|
25296
|
+
"empty-name",
|
|
25297
|
+
"duplicate-name",
|
|
25298
|
+
"no-frames"
|
|
25299
|
+
])
|
|
25300
|
+
})]);
|
|
24364
25301
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24365
25302
|
var RetrainTransitionResultSchema = object({
|
|
24366
25303
|
trackId: string(),
|
|
@@ -25150,6 +26087,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
25150
26087
|
kind: "mutation",
|
|
25151
26088
|
auth: "admin",
|
|
25152
26089
|
timeoutMs: 60 * 6e4
|
|
26090
|
+
}), method(object({
|
|
26091
|
+
filter: RetrainExportFilterSchema,
|
|
26092
|
+
layout: RetrainExportLayoutSchema
|
|
26093
|
+
}), object({
|
|
26094
|
+
ticket: PeerBytesTicketSchema,
|
|
26095
|
+
frames: number().int(),
|
|
26096
|
+
annotations: number().int()
|
|
26097
|
+
}), {
|
|
26098
|
+
kind: "mutation",
|
|
26099
|
+
auth: "admin",
|
|
26100
|
+
timeoutMs: 12e4
|
|
26101
|
+
}), method(object({
|
|
26102
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26103
|
+
completeOnly: boolean().optional()
|
|
26104
|
+
}), RetrainDatasetStatsSchema, {
|
|
26105
|
+
kind: "query",
|
|
26106
|
+
auth: "admin"
|
|
26107
|
+
}), method(object({
|
|
26108
|
+
name: string().max(120),
|
|
26109
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26110
|
+
layout: RetrainExportLayoutSchema,
|
|
26111
|
+
completeOnly: boolean()
|
|
26112
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26113
|
+
kind: "mutation",
|
|
26114
|
+
auth: "admin",
|
|
26115
|
+
timeoutMs: 12e4
|
|
26116
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26117
|
+
kind: "query",
|
|
26118
|
+
auth: "admin"
|
|
26119
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26120
|
+
kind: "mutation",
|
|
26121
|
+
auth: "admin"
|
|
26122
|
+
}), method(object({ id: string() }), object({
|
|
26123
|
+
found: boolean(),
|
|
26124
|
+
annotationHash: string(),
|
|
26125
|
+
matches: boolean(),
|
|
26126
|
+
missingFrames: number().int()
|
|
26127
|
+
}), {
|
|
26128
|
+
kind: "query",
|
|
26129
|
+
auth: "admin",
|
|
26130
|
+
timeoutMs: 12e4
|
|
25153
26131
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25154
26132
|
kind: "query",
|
|
25155
26133
|
auth: "admin"
|
|
@@ -28728,8 +29706,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28728
29706
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28729
29707
|
*
|
|
28730
29708
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28731
|
-
* one for transactional / one for notifications). Consumers (
|
|
28732
|
-
*
|
|
29709
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29710
|
+
* addons, …) walk the collection and pick the first
|
|
28733
29711
|
* ready provider OR target a specific addonId.
|
|
28734
29712
|
*
|
|
28735
29713
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -29012,7 +29990,7 @@ targets: array(object({
|
|
|
29012
29990
|
};
|
|
29013
29991
|
/**
|
|
29014
29992
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
29015
|
-
* providers (OIDC, SAML,
|
|
29993
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
29016
29994
|
* carrying the post-callback claims before redirecting back to
|
|
29017
29995
|
* `/api/auth/sso/finish`.
|
|
29018
29996
|
*
|
|
@@ -29075,7 +30053,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
29075
30053
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29076
30054
|
* subject is unique only per issuer, so a link is bound to it.
|
|
29077
30055
|
*/
|
|
29078
|
-
issuer: string().optional()
|
|
30056
|
+
issuer: string().optional(),
|
|
30057
|
+
/**
|
|
30058
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30059
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30060
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30061
|
+
* any other browser.
|
|
30062
|
+
*/
|
|
30063
|
+
browserBinding: string().optional()
|
|
29079
30064
|
});
|
|
29080
30065
|
method(object({
|
|
29081
30066
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -42322,16 +43307,6 @@ var ApiKeySummarySchema = object({
|
|
|
42322
43307
|
createdAt: number(),
|
|
42323
43308
|
lastUsedAt: number().optional()
|
|
42324
43309
|
});
|
|
42325
|
-
var CreateApiKeyInputSchema = object({
|
|
42326
|
-
label: string(),
|
|
42327
|
-
isAdmin: boolean().default(false),
|
|
42328
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
42329
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
42330
|
-
});
|
|
42331
|
-
var CreateApiKeyResultSchema = object({
|
|
42332
|
-
token: string(),
|
|
42333
|
-
record: ApiKeySummarySchema
|
|
42334
|
-
});
|
|
42335
43310
|
var ScopedTokenSummarySchema = object({
|
|
42336
43311
|
id: string(),
|
|
42337
43312
|
userId: string(),
|
|
@@ -42430,17 +43405,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42430
43405
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
42431
43406
|
kind: "mutation",
|
|
42432
43407
|
access: "view"
|
|
42433
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
42434
|
-
kind: "mutation",
|
|
42435
|
-
auth: "admin",
|
|
42436
|
-
access: "create"
|
|
42437
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
43408
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42438
43409
|
kind: "mutation",
|
|
42439
43410
|
auth: "admin",
|
|
42440
43411
|
access: "delete"
|
|
42441
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
42442
|
-
kind: "mutation",
|
|
42443
|
-
access: "view"
|
|
42444
43412
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
42445
43413
|
kind: "mutation",
|
|
42446
43414
|
auth: "admin",
|
|
@@ -42514,15 +43482,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42514
43482
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
42515
43483
|
userId: string(),
|
|
42516
43484
|
issuer: string()
|
|
42517
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
42518
|
-
userId: string(),
|
|
42519
|
-
issuer: string().min(1),
|
|
42520
|
-
label: string().optional()
|
|
42521
|
-
}), object({ success: literal(true) }), {
|
|
42522
|
-
kind: "mutation",
|
|
42523
|
-
auth: "admin",
|
|
42524
|
-
access: "create"
|
|
42525
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
43485
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42526
43486
|
kind: "mutation",
|
|
42527
43487
|
auth: "admin",
|
|
42528
43488
|
access: "delete"
|
|
@@ -43227,6 +44187,451 @@ var zoneRulesCapability = {
|
|
|
43227
44187
|
*/
|
|
43228
44188
|
durability: "restored"
|
|
43229
44189
|
};
|
|
44190
|
+
/**
|
|
44191
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
44192
|
+
*
|
|
44193
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
44194
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
44195
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
44196
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
44197
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
44198
|
+
* manifest entry and nothing else.
|
|
44199
|
+
*
|
|
44200
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
44201
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
44202
|
+
* Every method is `admin`: these spend money.
|
|
44203
|
+
*
|
|
44204
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
44205
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
44206
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
44207
|
+
*
|
|
44208
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
44209
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
44210
|
+
* ticket the provider mints (D613).
|
|
44211
|
+
*/
|
|
44212
|
+
var TrainingGpuOptionSchema = object({
|
|
44213
|
+
id: string(),
|
|
44214
|
+
label: string(),
|
|
44215
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
44216
|
+
usdPerHour: number().nonnegative(),
|
|
44217
|
+
vramGb: number().nonnegative()
|
|
44218
|
+
});
|
|
44219
|
+
var TrainingRegionOptionSchema = object({
|
|
44220
|
+
/** `''` = any region (the provider's choice). */
|
|
44221
|
+
id: string(),
|
|
44222
|
+
label: string(),
|
|
44223
|
+
priceMultiplier: number().positive()
|
|
44224
|
+
});
|
|
44225
|
+
/**
|
|
44226
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
44227
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
44228
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
44229
|
+
*/
|
|
44230
|
+
var TrainingProviderDefaultsSchema = object({
|
|
44231
|
+
gpuType: string(),
|
|
44232
|
+
region: string(),
|
|
44233
|
+
costCapUsd: number().nonnegative(),
|
|
44234
|
+
maxRuntimeSec: number().int().positive(),
|
|
44235
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
44236
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
44237
|
+
});
|
|
44238
|
+
var TrainingProviderDescriptorSchema = object({
|
|
44239
|
+
addonId: string(),
|
|
44240
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
44241
|
+
kind: string(),
|
|
44242
|
+
label: string(),
|
|
44243
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
44244
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
44245
|
+
maxDatasetBytes: number().int().positive(),
|
|
44246
|
+
maxRuntimeSec: number().int().positive(),
|
|
44247
|
+
freeTierNote: string().optional(),
|
|
44248
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
44249
|
+
dataResidencyNote: string(),
|
|
44250
|
+
/** Credentials are present — never the values. */
|
|
44251
|
+
configured: boolean(),
|
|
44252
|
+
defaults: TrainingProviderDefaultsSchema
|
|
44253
|
+
});
|
|
44254
|
+
var TrainingCredentialCheckSchema = object({
|
|
44255
|
+
ok: boolean(),
|
|
44256
|
+
/** Workspace / account name, when the provider says. */
|
|
44257
|
+
account: string().optional(),
|
|
44258
|
+
reason: _enum([
|
|
44259
|
+
"missing",
|
|
44260
|
+
"invalid",
|
|
44261
|
+
"forbidden",
|
|
44262
|
+
"network",
|
|
44263
|
+
"quota"
|
|
44264
|
+
]).optional(),
|
|
44265
|
+
detail: string().optional()
|
|
44266
|
+
});
|
|
44267
|
+
var ProviderJobStateSchema = _enum([
|
|
44268
|
+
"pending",
|
|
44269
|
+
"starting",
|
|
44270
|
+
"running",
|
|
44271
|
+
"succeeded",
|
|
44272
|
+
"failed",
|
|
44273
|
+
"cancelled",
|
|
44274
|
+
"lost"
|
|
44275
|
+
]);
|
|
44276
|
+
var ProviderJobStatusSchema = object({
|
|
44277
|
+
jobKey: string(),
|
|
44278
|
+
providerJobId: string().optional(),
|
|
44279
|
+
state: ProviderJobStateSchema,
|
|
44280
|
+
startedAt: number().optional(),
|
|
44281
|
+
endedAt: number().optional(),
|
|
44282
|
+
exitCode: number().int().optional(),
|
|
44283
|
+
failureReason: string().optional(),
|
|
44284
|
+
gpuType: string(),
|
|
44285
|
+
region: string().optional(),
|
|
44286
|
+
billedSeconds: number().nonnegative(),
|
|
44287
|
+
costUsd: number().nonnegative(),
|
|
44288
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
44289
|
+
costIsEstimate: boolean(),
|
|
44290
|
+
lastFetchedAt: number()
|
|
44291
|
+
});
|
|
44292
|
+
/**
|
|
44293
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
44294
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
44295
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
44296
|
+
* in `result.json`.
|
|
44297
|
+
*/
|
|
44298
|
+
var TrainerSourceRefSchema = object({
|
|
44299
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
44300
|
+
repo: string().min(1),
|
|
44301
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
44302
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
44303
|
+
});
|
|
44304
|
+
var JobRef = {
|
|
44305
|
+
addonId: string(),
|
|
44306
|
+
jobKey: string().uuid()
|
|
44307
|
+
};
|
|
44308
|
+
var TrainingLogLineSchema = object({
|
|
44309
|
+
ts: number(),
|
|
44310
|
+
text: string()
|
|
44311
|
+
});
|
|
44312
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
44313
|
+
kind: "mutation",
|
|
44314
|
+
auth: "admin",
|
|
44315
|
+
timeoutMs: 3e4
|
|
44316
|
+
}), method(object({
|
|
44317
|
+
addonId: string(),
|
|
44318
|
+
gpuType: string(),
|
|
44319
|
+
region: string(),
|
|
44320
|
+
datasetBytes: number().int().nonnegative(),
|
|
44321
|
+
gpuSecondsLow: number().nonnegative(),
|
|
44322
|
+
gpuSecondsHigh: number().nonnegative()
|
|
44323
|
+
}), object({
|
|
44324
|
+
usdLow: number().nonnegative(),
|
|
44325
|
+
usdHigh: number().nonnegative(),
|
|
44326
|
+
notes: array(string()).readonly()
|
|
44327
|
+
}), { auth: "admin" }), method(object({
|
|
44328
|
+
...JobRef,
|
|
44329
|
+
ticket: PeerBytesTicketSchema
|
|
44330
|
+
}), object({
|
|
44331
|
+
bytes: number().int().nonnegative(),
|
|
44332
|
+
sha256: string()
|
|
44333
|
+
}), {
|
|
44334
|
+
kind: "mutation",
|
|
44335
|
+
auth: "admin",
|
|
44336
|
+
timeoutMs: 120 * 6e4
|
|
44337
|
+
}), method(object({
|
|
44338
|
+
...JobRef,
|
|
44339
|
+
trainer: TrainerSourceRefSchema,
|
|
44340
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
44341
|
+
gpuType: string(),
|
|
44342
|
+
region: string(),
|
|
44343
|
+
maxRuntimeSec: number().int().positive()
|
|
44344
|
+
}), ProviderJobStatusSchema, {
|
|
44345
|
+
kind: "mutation",
|
|
44346
|
+
auth: "admin",
|
|
44347
|
+
timeoutMs: 30 * 6e4
|
|
44348
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
44349
|
+
auth: "admin",
|
|
44350
|
+
timeoutMs: 6e4
|
|
44351
|
+
}), method(object({
|
|
44352
|
+
...JobRef,
|
|
44353
|
+
cursor: string().optional(),
|
|
44354
|
+
max: number().int().min(1).max(500)
|
|
44355
|
+
}), object({
|
|
44356
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
44357
|
+
cursor: string()
|
|
44358
|
+
}), {
|
|
44359
|
+
auth: "admin",
|
|
44360
|
+
timeoutMs: 6e4
|
|
44361
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
44362
|
+
kind: "mutation",
|
|
44363
|
+
auth: "admin",
|
|
44364
|
+
timeoutMs: 6e4
|
|
44365
|
+
}), method(object(JobRef), object({
|
|
44366
|
+
found: boolean(),
|
|
44367
|
+
text: string().optional()
|
|
44368
|
+
}), {
|
|
44369
|
+
kind: "mutation",
|
|
44370
|
+
auth: "admin",
|
|
44371
|
+
timeoutMs: 5 * 6e4
|
|
44372
|
+
}), method(object({
|
|
44373
|
+
...JobRef,
|
|
44374
|
+
path: _enum(["bundle.tar"])
|
|
44375
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
44376
|
+
kind: "mutation",
|
|
44377
|
+
auth: "admin",
|
|
44378
|
+
timeoutMs: 5 * 6e4
|
|
44379
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
44380
|
+
kind: "mutation",
|
|
44381
|
+
auth: "admin",
|
|
44382
|
+
timeoutMs: 5 * 6e4
|
|
44383
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
44384
|
+
auth: "admin",
|
|
44385
|
+
timeoutMs: 2 * 6e4
|
|
44386
|
+
});
|
|
44387
|
+
/**
|
|
44388
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
44389
|
+
* provided by `addon-training`.
|
|
44390
|
+
*
|
|
44391
|
+
* It owns what every provider must agree on, written once:
|
|
44392
|
+
*
|
|
44393
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
44394
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
44395
|
+
* the export plan) and reaches this store through the five row methods
|
|
44396
|
+
* below, so the Retrain page and the export did not change.
|
|
44397
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
44398
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
44399
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
44400
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
44401
|
+
* rollback. Nothing is ever registered automatically.
|
|
44402
|
+
*
|
|
44403
|
+
* Every method is `admin`.
|
|
44404
|
+
*/
|
|
44405
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
44406
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
44407
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
44408
|
+
var TrainingBaseModelSchema = object({
|
|
44409
|
+
modelId: string(),
|
|
44410
|
+
label: string(),
|
|
44411
|
+
weights: string(),
|
|
44412
|
+
imgsz: number().int(),
|
|
44413
|
+
baselineOnnxUrl: string(),
|
|
44414
|
+
baselineFloors: record(string(), number()),
|
|
44415
|
+
/** The base the fleet runs most — the UI's default. */
|
|
44416
|
+
recommended: boolean()
|
|
44417
|
+
});
|
|
44418
|
+
var TrainingPresetSchema = _enum([
|
|
44419
|
+
"quick",
|
|
44420
|
+
"standard",
|
|
44421
|
+
"thorough"
|
|
44422
|
+
]);
|
|
44423
|
+
var TrainingJobRequestSchema = object({
|
|
44424
|
+
datasetVersionId: string().min(1),
|
|
44425
|
+
/** The `training-provider` addon that runs it. */
|
|
44426
|
+
addonId: string().min(1),
|
|
44427
|
+
gpuType: string().min(1),
|
|
44428
|
+
region: string(),
|
|
44429
|
+
baseModelId: string().min(1),
|
|
44430
|
+
preset: TrainingPresetSchema,
|
|
44431
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
44432
|
+
freeze: number().int().nonnegative().nullable(),
|
|
44433
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
44434
|
+
holdoutCameras: array(number().int()).nullable()
|
|
44435
|
+
});
|
|
44436
|
+
var TrainingSplitPlanSchema = object({
|
|
44437
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
44438
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
44439
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
44440
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
44441
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
44442
|
+
trainSubjects: number().int()
|
|
44443
|
+
});
|
|
44444
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
44445
|
+
"unknown-dataset",
|
|
44446
|
+
"unknown-provider",
|
|
44447
|
+
"provider-not-configured",
|
|
44448
|
+
"unknown-base-model",
|
|
44449
|
+
"unknown-gpu",
|
|
44450
|
+
"dataset-too-large",
|
|
44451
|
+
"no-training-subjects",
|
|
44452
|
+
"job-already-running"
|
|
44453
|
+
]);
|
|
44454
|
+
var TrainingJobPlanSchema = object({
|
|
44455
|
+
refusal: object({
|
|
44456
|
+
reason: TrainingRefusalReasonSchema,
|
|
44457
|
+
detail: string()
|
|
44458
|
+
}).nullable(),
|
|
44459
|
+
warnings: array(string()).readonly(),
|
|
44460
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
44461
|
+
estimate: object({
|
|
44462
|
+
datasetBytes: number().int(),
|
|
44463
|
+
uploadMinutesAt20Mbps: number(),
|
|
44464
|
+
gpuSecondsLow: number(),
|
|
44465
|
+
gpuSecondsHigh: number(),
|
|
44466
|
+
usdLow: number(),
|
|
44467
|
+
usdHigh: number(),
|
|
44468
|
+
notes: array(string()).readonly()
|
|
44469
|
+
}).nullable(),
|
|
44470
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
44471
|
+
defaults: object({
|
|
44472
|
+
maxCostUsd: number(),
|
|
44473
|
+
maxRuntimeSec: number().int()
|
|
44474
|
+
}).nullable(),
|
|
44475
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
44476
|
+
dataNotice: string()
|
|
44477
|
+
});
|
|
44478
|
+
/**
|
|
44479
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
44480
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
44481
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
44482
|
+
* result lives after the operator acted on it.
|
|
44483
|
+
*/
|
|
44484
|
+
var TrainingJobStateSchema = _enum([
|
|
44485
|
+
"uploading",
|
|
44486
|
+
"submitted",
|
|
44487
|
+
"starting",
|
|
44488
|
+
"running",
|
|
44489
|
+
"collecting",
|
|
44490
|
+
"ready",
|
|
44491
|
+
"registered",
|
|
44492
|
+
"canary",
|
|
44493
|
+
"failed",
|
|
44494
|
+
"cancelling",
|
|
44495
|
+
"cancelled",
|
|
44496
|
+
"lost",
|
|
44497
|
+
"expired",
|
|
44498
|
+
"discarded"
|
|
44499
|
+
]);
|
|
44500
|
+
var TrainingFailureReasonSchema = _enum([
|
|
44501
|
+
"cost-cap",
|
|
44502
|
+
"runtime-cap",
|
|
44503
|
+
"upload-failed",
|
|
44504
|
+
"submit-failed",
|
|
44505
|
+
"trainer-failed",
|
|
44506
|
+
"result-invalid",
|
|
44507
|
+
"checksum-mismatch",
|
|
44508
|
+
"fetch-failed",
|
|
44509
|
+
"provider-error",
|
|
44510
|
+
"hub-restart-during-upload"
|
|
44511
|
+
]);
|
|
44512
|
+
var TrainingProgressPointSchema = object({
|
|
44513
|
+
epoch: number().int(),
|
|
44514
|
+
map50: number().nullable(),
|
|
44515
|
+
map50_95: number().nullable()
|
|
44516
|
+
});
|
|
44517
|
+
var TrainingCanarySchema = object({
|
|
44518
|
+
deviceIds: array(number().int()).readonly(),
|
|
44519
|
+
since: number(),
|
|
44520
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
44521
|
+
previous: array(object({
|
|
44522
|
+
deviceId: number().int(),
|
|
44523
|
+
nodeId: string(),
|
|
44524
|
+
deviceKey: string(),
|
|
44525
|
+
patch: object({
|
|
44526
|
+
modelId: string().optional(),
|
|
44527
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
44528
|
+
}).nullable()
|
|
44529
|
+
})).readonly()
|
|
44530
|
+
});
|
|
44531
|
+
var TrainingJobSchema = object({
|
|
44532
|
+
id: string(),
|
|
44533
|
+
idempotencyKey: string(),
|
|
44534
|
+
name: string(),
|
|
44535
|
+
createdAt: number(),
|
|
44536
|
+
updatedAt: number(),
|
|
44537
|
+
state: TrainingJobStateSchema,
|
|
44538
|
+
stage: TrainingStageSchema.nullable(),
|
|
44539
|
+
failure: object({
|
|
44540
|
+
reason: TrainingFailureReasonSchema,
|
|
44541
|
+
stage: string().nullable(),
|
|
44542
|
+
detail: string()
|
|
44543
|
+
}).nullable(),
|
|
44544
|
+
request: TrainingJobRequestSchema,
|
|
44545
|
+
maxCostUsd: number().nonnegative(),
|
|
44546
|
+
maxRuntimeSec: number().int().positive(),
|
|
44547
|
+
trainer: TrainerSourceRefSchema,
|
|
44548
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
44549
|
+
dataset: object({
|
|
44550
|
+
bytes: number().int(),
|
|
44551
|
+
sha256: string(),
|
|
44552
|
+
uploadedAt: number()
|
|
44553
|
+
}).nullable(),
|
|
44554
|
+
split: TrainingSplitPlanSchema,
|
|
44555
|
+
provider: object({
|
|
44556
|
+
state: ProviderJobStateSchema.nullable(),
|
|
44557
|
+
providerJobId: string().nullable(),
|
|
44558
|
+
startedAt: number().nullable(),
|
|
44559
|
+
endedAt: number().nullable(),
|
|
44560
|
+
billedSeconds: number(),
|
|
44561
|
+
costUsd: number(),
|
|
44562
|
+
costIsEstimate: boolean(),
|
|
44563
|
+
lastPolledAt: number().nullable()
|
|
44564
|
+
}),
|
|
44565
|
+
progress: object({
|
|
44566
|
+
epoch: number().int().nullable(),
|
|
44567
|
+
epochs: number().int().nullable(),
|
|
44568
|
+
etaSec: number().nullable(),
|
|
44569
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
44570
|
+
}),
|
|
44571
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
44572
|
+
logTail: array(string()).readonly(),
|
|
44573
|
+
logCursor: string().nullable(),
|
|
44574
|
+
artifacts: object({
|
|
44575
|
+
bundleBytes: number().int(),
|
|
44576
|
+
bundleSha256: string(),
|
|
44577
|
+
fetchedAt: number(),
|
|
44578
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
44579
|
+
expiresAt: number()
|
|
44580
|
+
}).nullable(),
|
|
44581
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
44582
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
44583
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
44584
|
+
cloudCleanupDueAt: number().nullable(),
|
|
44585
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
44586
|
+
registeredModelIds: array(string()).readonly(),
|
|
44587
|
+
canary: TrainingCanarySchema.nullable()
|
|
44588
|
+
});
|
|
44589
|
+
var IdInput = object({ id: string().min(1) });
|
|
44590
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
44591
|
+
kind: "mutation",
|
|
44592
|
+
auth: "admin"
|
|
44593
|
+
}), 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() }), {
|
|
44594
|
+
kind: "mutation",
|
|
44595
|
+
auth: "admin"
|
|
44596
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
44597
|
+
auth: "admin",
|
|
44598
|
+
timeoutMs: 6e4
|
|
44599
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
44600
|
+
name: string().min(1).max(120),
|
|
44601
|
+
maxCostUsd: number().positive(),
|
|
44602
|
+
maxRuntimeSec: number().int().positive(),
|
|
44603
|
+
idempotencyKey: string().min(8).max(80)
|
|
44604
|
+
}), discriminatedUnion("kind", [object({
|
|
44605
|
+
kind: literal("started"),
|
|
44606
|
+
job: TrainingJobSchema
|
|
44607
|
+
}), object({
|
|
44608
|
+
kind: literal("refused"),
|
|
44609
|
+
reason: TrainingRefusalReasonSchema,
|
|
44610
|
+
detail: string()
|
|
44611
|
+
})]), {
|
|
44612
|
+
kind: "mutation",
|
|
44613
|
+
auth: "admin",
|
|
44614
|
+
timeoutMs: 12e4
|
|
44615
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
44616
|
+
kind: "mutation",
|
|
44617
|
+
auth: "admin",
|
|
44618
|
+
timeoutMs: 12e4
|
|
44619
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
44620
|
+
kind: "mutation",
|
|
44621
|
+
auth: "admin",
|
|
44622
|
+
timeoutMs: 30 * 6e4
|
|
44623
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
44624
|
+
kind: "mutation",
|
|
44625
|
+
auth: "admin",
|
|
44626
|
+
timeoutMs: 12e4
|
|
44627
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44628
|
+
kind: "mutation",
|
|
44629
|
+
auth: "admin",
|
|
44630
|
+
timeoutMs: 12e4
|
|
44631
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44632
|
+
kind: "mutation",
|
|
44633
|
+
auth: "admin"
|
|
44634
|
+
});
|
|
43230
44635
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
43231
44636
|
Object.freeze({
|
|
43232
44637
|
person: .5,
|
|
@@ -45401,6 +46806,12 @@ Object.freeze({
|
|
|
45401
46806
|
addonId: null,
|
|
45402
46807
|
access: "create"
|
|
45403
46808
|
},
|
|
46809
|
+
"backup.checkBackupKey": {
|
|
46810
|
+
capName: "backup",
|
|
46811
|
+
capScope: "system",
|
|
46812
|
+
addonId: null,
|
|
46813
|
+
access: "create"
|
|
46814
|
+
},
|
|
45404
46815
|
"backup.delete": {
|
|
45405
46816
|
capName: "backup",
|
|
45406
46817
|
capScope: "system",
|
|
@@ -45413,6 +46824,18 @@ Object.freeze({
|
|
|
45413
46824
|
addonId: null,
|
|
45414
46825
|
access: "delete"
|
|
45415
46826
|
},
|
|
46827
|
+
"backup.disableEncryption": {
|
|
46828
|
+
capName: "backup",
|
|
46829
|
+
capScope: "system",
|
|
46830
|
+
addonId: null,
|
|
46831
|
+
access: "create"
|
|
46832
|
+
},
|
|
46833
|
+
"backup.getEncryption": {
|
|
46834
|
+
capName: "backup",
|
|
46835
|
+
capScope: "system",
|
|
46836
|
+
addonId: null,
|
|
46837
|
+
access: "view"
|
|
46838
|
+
},
|
|
45416
46839
|
"backup.getEntries": {
|
|
45417
46840
|
capName: "backup",
|
|
45418
46841
|
capScope: "system",
|
|
@@ -45467,6 +46890,12 @@ Object.freeze({
|
|
|
45467
46890
|
addonId: null,
|
|
45468
46891
|
access: "create"
|
|
45469
46892
|
},
|
|
46893
|
+
"backup.setupEncryption": {
|
|
46894
|
+
capName: "backup",
|
|
46895
|
+
capScope: "system",
|
|
46896
|
+
addonId: null,
|
|
46897
|
+
access: "create"
|
|
46898
|
+
},
|
|
45470
46899
|
"backup.trigger": {
|
|
45471
46900
|
capName: "backup",
|
|
45472
46901
|
capScope: "system",
|
|
@@ -46019,6 +47448,12 @@ Object.freeze({
|
|
|
46019
47448
|
addonId: null,
|
|
46020
47449
|
access: "create"
|
|
46021
47450
|
},
|
|
47451
|
+
"customModelRegistry.importModelBundle": {
|
|
47452
|
+
capName: "custom-model-registry",
|
|
47453
|
+
capScope: "system",
|
|
47454
|
+
addonId: null,
|
|
47455
|
+
access: "create"
|
|
47456
|
+
},
|
|
46022
47457
|
"customModelRegistry.listModels": {
|
|
46023
47458
|
capName: "custom-model-registry",
|
|
46024
47459
|
capScope: "system",
|
|
@@ -47459,6 +48894,12 @@ Object.freeze({
|
|
|
47459
48894
|
addonId: null,
|
|
47460
48895
|
access: "view"
|
|
47461
48896
|
},
|
|
48897
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48898
|
+
capName: "keychain-admin",
|
|
48899
|
+
capScope: "system",
|
|
48900
|
+
addonId: null,
|
|
48901
|
+
access: "create"
|
|
48902
|
+
},
|
|
47462
48903
|
"keychainAdmin.deleteOrphans": {
|
|
47463
48904
|
capName: "keychain-admin",
|
|
47464
48905
|
capScope: "system",
|
|
@@ -47495,6 +48936,12 @@ Object.freeze({
|
|
|
47495
48936
|
addonId: null,
|
|
47496
48937
|
access: "delete"
|
|
47497
48938
|
},
|
|
48939
|
+
"keychainAdmin.resetReport": {
|
|
48940
|
+
capName: "keychain-admin",
|
|
48941
|
+
capScope: "system",
|
|
48942
|
+
addonId: null,
|
|
48943
|
+
access: "delete"
|
|
48944
|
+
},
|
|
47498
48945
|
"keychainAdmin.reveal": {
|
|
47499
48946
|
capName: "keychain-admin",
|
|
47500
48947
|
capScope: "system",
|
|
@@ -47507,6 +48954,12 @@ Object.freeze({
|
|
|
47507
48954
|
addonId: null,
|
|
47508
48955
|
access: "create"
|
|
47509
48956
|
},
|
|
48957
|
+
"keychainAdmin.setSystemSecret": {
|
|
48958
|
+
capName: "keychain-admin",
|
|
48959
|
+
capScope: "system",
|
|
48960
|
+
addonId: null,
|
|
48961
|
+
access: "create"
|
|
48962
|
+
},
|
|
47510
48963
|
"keychainAdmin.status": {
|
|
47511
48964
|
capName: "keychain-admin",
|
|
47512
48965
|
capScope: "system",
|
|
@@ -48953,6 +50406,12 @@ Object.freeze({
|
|
|
48953
50406
|
addonId: null,
|
|
48954
50407
|
access: "create"
|
|
48955
50408
|
},
|
|
50409
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
50410
|
+
capName: "pipeline-analytics",
|
|
50411
|
+
capScope: "device",
|
|
50412
|
+
addonId: null,
|
|
50413
|
+
access: "create"
|
|
50414
|
+
},
|
|
48956
50415
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
48957
50416
|
capName: "pipeline-analytics",
|
|
48958
50417
|
capScope: "device",
|
|
@@ -48965,6 +50424,12 @@ Object.freeze({
|
|
|
48965
50424
|
addonId: null,
|
|
48966
50425
|
access: "delete"
|
|
48967
50426
|
},
|
|
50427
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
50428
|
+
capName: "pipeline-analytics",
|
|
50429
|
+
capScope: "device",
|
|
50430
|
+
addonId: null,
|
|
50431
|
+
access: "delete"
|
|
50432
|
+
},
|
|
48968
50433
|
"pipelineAnalytics.deleteTracks": {
|
|
48969
50434
|
capName: "pipeline-analytics",
|
|
48970
50435
|
capScope: "device",
|
|
@@ -49187,6 +50652,12 @@ Object.freeze({
|
|
|
49187
50652
|
addonId: null,
|
|
49188
50653
|
access: "view"
|
|
49189
50654
|
},
|
|
50655
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
50656
|
+
capName: "pipeline-analytics",
|
|
50657
|
+
capScope: "device",
|
|
50658
|
+
addonId: null,
|
|
50659
|
+
access: "view"
|
|
50660
|
+
},
|
|
49190
50661
|
"pipelineAnalytics.listRetrainFrames": {
|
|
49191
50662
|
capName: "pipeline-analytics",
|
|
49192
50663
|
capScope: "device",
|
|
@@ -49217,6 +50688,12 @@ Object.freeze({
|
|
|
49217
50688
|
addonId: null,
|
|
49218
50689
|
access: "view"
|
|
49219
50690
|
},
|
|
50691
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
50692
|
+
capName: "pipeline-analytics",
|
|
50693
|
+
capScope: "device",
|
|
50694
|
+
addonId: null,
|
|
50695
|
+
access: "create"
|
|
50696
|
+
},
|
|
49220
50697
|
"pipelineAnalytics.ownersWithMedia": {
|
|
49221
50698
|
capName: "pipeline-analytics",
|
|
49222
50699
|
capScope: "device",
|
|
@@ -49229,6 +50706,12 @@ Object.freeze({
|
|
|
49229
50706
|
addonId: null,
|
|
49230
50707
|
access: "create"
|
|
49231
50708
|
},
|
|
50709
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
50710
|
+
capName: "pipeline-analytics",
|
|
50711
|
+
capScope: "device",
|
|
50712
|
+
addonId: null,
|
|
50713
|
+
access: "view"
|
|
50714
|
+
},
|
|
49232
50715
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
49233
50716
|
capName: "pipeline-analytics",
|
|
49234
50717
|
capScope: "device",
|
|
@@ -49367,6 +50850,12 @@ Object.freeze({
|
|
|
49367
50850
|
addonId: null,
|
|
49368
50851
|
access: "create"
|
|
49369
50852
|
},
|
|
50853
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50854
|
+
capName: "pipeline-analytics",
|
|
50855
|
+
capScope: "device",
|
|
50856
|
+
addonId: null,
|
|
50857
|
+
access: "view"
|
|
50858
|
+
},
|
|
49370
50859
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
49371
50860
|
capName: "pipeline-analytics",
|
|
49372
50861
|
capScope: "device",
|
|
@@ -51743,6 +53232,174 @@ Object.freeze({
|
|
|
51743
53232
|
addonId: null,
|
|
51744
53233
|
access: "view"
|
|
51745
53234
|
},
|
|
53235
|
+
"training.canaryResult": {
|
|
53236
|
+
capName: "training",
|
|
53237
|
+
capScope: "system",
|
|
53238
|
+
addonId: null,
|
|
53239
|
+
access: "create"
|
|
53240
|
+
},
|
|
53241
|
+
"training.cancelJob": {
|
|
53242
|
+
capName: "training",
|
|
53243
|
+
capScope: "system",
|
|
53244
|
+
addonId: null,
|
|
53245
|
+
access: "create"
|
|
53246
|
+
},
|
|
53247
|
+
"training.discardResult": {
|
|
53248
|
+
capName: "training",
|
|
53249
|
+
capScope: "system",
|
|
53250
|
+
addonId: null,
|
|
53251
|
+
access: "create"
|
|
53252
|
+
},
|
|
53253
|
+
"training.findDatasetVersionIdByName": {
|
|
53254
|
+
capName: "training",
|
|
53255
|
+
capScope: "system",
|
|
53256
|
+
addonId: null,
|
|
53257
|
+
access: "view"
|
|
53258
|
+
},
|
|
53259
|
+
"training.getDatasetVersion": {
|
|
53260
|
+
capName: "training",
|
|
53261
|
+
capScope: "system",
|
|
53262
|
+
addonId: null,
|
|
53263
|
+
access: "view"
|
|
53264
|
+
},
|
|
53265
|
+
"training.getJob": {
|
|
53266
|
+
capName: "training",
|
|
53267
|
+
capScope: "system",
|
|
53268
|
+
addonId: null,
|
|
53269
|
+
access: "view"
|
|
53270
|
+
},
|
|
53271
|
+
"training.getJobResult": {
|
|
53272
|
+
capName: "training",
|
|
53273
|
+
capScope: "system",
|
|
53274
|
+
addonId: null,
|
|
53275
|
+
access: "view"
|
|
53276
|
+
},
|
|
53277
|
+
"training.listBaseModels": {
|
|
53278
|
+
capName: "training",
|
|
53279
|
+
capScope: "system",
|
|
53280
|
+
addonId: null,
|
|
53281
|
+
access: "view"
|
|
53282
|
+
},
|
|
53283
|
+
"training.listDatasetVersions": {
|
|
53284
|
+
capName: "training",
|
|
53285
|
+
capScope: "system",
|
|
53286
|
+
addonId: null,
|
|
53287
|
+
access: "view"
|
|
53288
|
+
},
|
|
53289
|
+
"training.listJobs": {
|
|
53290
|
+
capName: "training",
|
|
53291
|
+
capScope: "system",
|
|
53292
|
+
addonId: null,
|
|
53293
|
+
access: "view"
|
|
53294
|
+
},
|
|
53295
|
+
"training.planJob": {
|
|
53296
|
+
capName: "training",
|
|
53297
|
+
capScope: "system",
|
|
53298
|
+
addonId: null,
|
|
53299
|
+
access: "view"
|
|
53300
|
+
},
|
|
53301
|
+
"training.putDatasetVersion": {
|
|
53302
|
+
capName: "training",
|
|
53303
|
+
capScope: "system",
|
|
53304
|
+
addonId: null,
|
|
53305
|
+
access: "create"
|
|
53306
|
+
},
|
|
53307
|
+
"training.registerResult": {
|
|
53308
|
+
capName: "training",
|
|
53309
|
+
capScope: "system",
|
|
53310
|
+
addonId: null,
|
|
53311
|
+
access: "create"
|
|
53312
|
+
},
|
|
53313
|
+
"training.removeDatasetVersion": {
|
|
53314
|
+
capName: "training",
|
|
53315
|
+
capScope: "system",
|
|
53316
|
+
addonId: null,
|
|
53317
|
+
access: "delete"
|
|
53318
|
+
},
|
|
53319
|
+
"training.rollbackCanary": {
|
|
53320
|
+
capName: "training",
|
|
53321
|
+
capScope: "system",
|
|
53322
|
+
addonId: null,
|
|
53323
|
+
access: "create"
|
|
53324
|
+
},
|
|
53325
|
+
"training.startJob": {
|
|
53326
|
+
capName: "training",
|
|
53327
|
+
capScope: "system",
|
|
53328
|
+
addonId: null,
|
|
53329
|
+
access: "create"
|
|
53330
|
+
},
|
|
53331
|
+
"trainingProvider.cancelJob": {
|
|
53332
|
+
capName: "training-provider",
|
|
53333
|
+
capScope: "system",
|
|
53334
|
+
addonId: null,
|
|
53335
|
+
access: "create"
|
|
53336
|
+
},
|
|
53337
|
+
"trainingProvider.cleanupJob": {
|
|
53338
|
+
capName: "training-provider",
|
|
53339
|
+
capScope: "system",
|
|
53340
|
+
addonId: null,
|
|
53341
|
+
access: "create"
|
|
53342
|
+
},
|
|
53343
|
+
"trainingProvider.describe": {
|
|
53344
|
+
capName: "training-provider",
|
|
53345
|
+
capScope: "system",
|
|
53346
|
+
addonId: null,
|
|
53347
|
+
access: "view"
|
|
53348
|
+
},
|
|
53349
|
+
"trainingProvider.estimateJob": {
|
|
53350
|
+
capName: "training-provider",
|
|
53351
|
+
capScope: "system",
|
|
53352
|
+
addonId: null,
|
|
53353
|
+
access: "view"
|
|
53354
|
+
},
|
|
53355
|
+
"trainingProvider.getJob": {
|
|
53356
|
+
capName: "training-provider",
|
|
53357
|
+
capScope: "system",
|
|
53358
|
+
addonId: null,
|
|
53359
|
+
access: "view"
|
|
53360
|
+
},
|
|
53361
|
+
"trainingProvider.listJobEvents": {
|
|
53362
|
+
capName: "training-provider",
|
|
53363
|
+
capScope: "system",
|
|
53364
|
+
addonId: null,
|
|
53365
|
+
access: "view"
|
|
53366
|
+
},
|
|
53367
|
+
"trainingProvider.listJobs": {
|
|
53368
|
+
capName: "training-provider",
|
|
53369
|
+
capScope: "system",
|
|
53370
|
+
addonId: null,
|
|
53371
|
+
access: "view"
|
|
53372
|
+
},
|
|
53373
|
+
"trainingProvider.offerArtifact": {
|
|
53374
|
+
capName: "training-provider",
|
|
53375
|
+
capScope: "system",
|
|
53376
|
+
addonId: null,
|
|
53377
|
+
access: "create"
|
|
53378
|
+
},
|
|
53379
|
+
"trainingProvider.readResult": {
|
|
53380
|
+
capName: "training-provider",
|
|
53381
|
+
capScope: "system",
|
|
53382
|
+
addonId: null,
|
|
53383
|
+
access: "create"
|
|
53384
|
+
},
|
|
53385
|
+
"trainingProvider.submitJob": {
|
|
53386
|
+
capName: "training-provider",
|
|
53387
|
+
capScope: "system",
|
|
53388
|
+
addonId: null,
|
|
53389
|
+
access: "create"
|
|
53390
|
+
},
|
|
53391
|
+
"trainingProvider.uploadDataset": {
|
|
53392
|
+
capName: "training-provider",
|
|
53393
|
+
capScope: "system",
|
|
53394
|
+
addonId: null,
|
|
53395
|
+
access: "create"
|
|
53396
|
+
},
|
|
53397
|
+
"trainingProvider.validateCredentials": {
|
|
53398
|
+
capName: "training-provider",
|
|
53399
|
+
capScope: "system",
|
|
53400
|
+
addonId: null,
|
|
53401
|
+
access: "create"
|
|
53402
|
+
},
|
|
51746
53403
|
"turnProvider.getTurnServers": {
|
|
51747
53404
|
capName: "turn-provider",
|
|
51748
53405
|
capScope: "system",
|
|
@@ -51767,12 +53424,6 @@ Object.freeze({
|
|
|
51767
53424
|
addonId: null,
|
|
51768
53425
|
access: "create"
|
|
51769
53426
|
},
|
|
51770
|
-
"userManagement.createApiKey": {
|
|
51771
|
-
capName: "user-management",
|
|
51772
|
-
capScope: "system",
|
|
51773
|
-
addonId: null,
|
|
51774
|
-
access: "create"
|
|
51775
|
-
},
|
|
51776
53427
|
"userManagement.createScopedToken": {
|
|
51777
53428
|
capName: "user-management",
|
|
51778
53429
|
capScope: "system",
|
|
@@ -51809,12 +53460,6 @@ Object.freeze({
|
|
|
51809
53460
|
addonId: null,
|
|
51810
53461
|
access: "view"
|
|
51811
53462
|
},
|
|
51812
|
-
"userManagement.linkExternalIdentity": {
|
|
51813
|
-
capName: "user-management",
|
|
51814
|
-
capScope: "system",
|
|
51815
|
-
addonId: null,
|
|
51816
|
-
access: "create"
|
|
51817
|
-
},
|
|
51818
53463
|
"userManagement.listApiKeys": {
|
|
51819
53464
|
capName: "user-management",
|
|
51820
53465
|
capScope: "system",
|
|
@@ -51917,12 +53562,6 @@ Object.freeze({
|
|
|
51917
53562
|
addonId: null,
|
|
51918
53563
|
access: "create"
|
|
51919
53564
|
},
|
|
51920
|
-
"userManagement.validateApiKey": {
|
|
51921
|
-
capName: "user-management",
|
|
51922
|
-
capScope: "system",
|
|
51923
|
-
addonId: null,
|
|
51924
|
-
access: "view"
|
|
51925
|
-
},
|
|
51926
53565
|
"userManagement.validateCredentials": {
|
|
51927
53566
|
capName: "user-management",
|
|
51928
53567
|
capScope: "system",
|
|
@@ -56188,6 +57827,11 @@ Object.freeze({
|
|
|
56188
57827
|
form: "single",
|
|
56189
57828
|
optional: false
|
|
56190
57829
|
}],
|
|
57830
|
+
"training.canaryResult": [{
|
|
57831
|
+
name: "deviceIds",
|
|
57832
|
+
form: "array",
|
|
57833
|
+
optional: false
|
|
57834
|
+
}],
|
|
56191
57835
|
"update.getStatus": [{
|
|
56192
57836
|
name: "deviceId",
|
|
56193
57837
|
form: "single",
|
|
@@ -167221,6 +168865,22 @@ function accessoryKindsFor(sliceProbed, sliceFlags, deviceCache) {
|
|
|
167221
168865
|
const flags = resolveAccessoryProbeFlags(sliceProbed, sliceFlags, deviceCache);
|
|
167222
168866
|
return ACCESSORY_FLAGS.filter(([flag]) => flags[flag] === true).map(([, kind]) => kind);
|
|
167223
168867
|
}
|
|
168868
|
+
/**
|
|
168869
|
+
* The probe flags every probe-gated decision should read (PTZ, intercom,
|
|
168870
|
+
* doorbell, autotrack caps, the device features, accessory children):
|
|
168871
|
+
* the live slice once this session has probed; otherwise the slice
|
|
168872
|
+
* overlaid with the flags persisted by the last successful probe. A
|
|
168873
|
+
* battery camera asleep at boot skips its probe, so without the overlay
|
|
168874
|
+
* its probe-gated caps vanish across every provider restart. With no
|
|
168875
|
+
* persisted probe stamp, the slice is returned unchanged.
|
|
168876
|
+
*/
|
|
168877
|
+
function effectiveProbeFlags(sliceProbed, sliceFlags, deviceCache) {
|
|
168878
|
+
if (sliceProbed || deviceCache?.probedAt === void 0) return sliceFlags;
|
|
168879
|
+
return {
|
|
168880
|
+
...sliceFlags,
|
|
168881
|
+
...resolveAccessoryProbeFlags(false, {}, deviceCache)
|
|
168882
|
+
};
|
|
168883
|
+
}
|
|
167224
168884
|
//#endregion
|
|
167225
168885
|
//#region src/metadata-populator.ts
|
|
167226
168886
|
var EXTENDED_INFO_TAGS = [
|
|
@@ -169172,6 +170832,19 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
169172
170832
|
* underlying state. The set is small (≤6 entries) so allocation cost
|
|
169173
170833
|
* is negligible vs the staleness of caching.
|
|
169174
170834
|
*/
|
|
170835
|
+
/**
|
|
170836
|
+
* Probe flags with the persisted fallback: until this session has probed
|
|
170837
|
+
* (a battery camera asleep at boot skips `onProbe`), the flags of the last
|
|
170838
|
+
* successful probe stored in `deviceCache` stand in for the empty
|
|
170839
|
+
* `feature-probe` slice. Every probe-gated read — PTZ / intercom /
|
|
170840
|
+
* doorbell / autotrack registration, `features`, accessory children —
|
|
170841
|
+
* goes through here, so a sleeping camera keeps those caps across a
|
|
170842
|
+
* provider restart. `config` is read defensively: the base constructor
|
|
170843
|
+
* may read flags before this class's fields exist.
|
|
170844
|
+
*/
|
|
170845
|
+
getProbeFlags() {
|
|
170846
|
+
return effectiveProbeFlags(this.hasProbed(), super.getProbeFlags(), this.config?.get("deviceCache"));
|
|
170847
|
+
}
|
|
169175
170848
|
get features() {
|
|
169176
170849
|
return deriveReolinkCameraFeatures({
|
|
169177
170850
|
probe: this.getProbeFlags(),
|
|
@@ -178444,6 +180117,7 @@ var ReolinkEmailPushServer = class {
|
|
|
178444
180117
|
const raw = await this.deps.readStore();
|
|
178445
180118
|
let authUsername = readString$1(raw, "emailPushAuthUsername", "");
|
|
178446
180119
|
let authPassword = readString$1(raw, "emailPushAuthPassword", "");
|
|
180120
|
+
const passwordUnresolved = isSecretMarkerLike(raw["emailPushAuthPassword"]);
|
|
178447
180121
|
const bootstrapped = {};
|
|
178448
180122
|
if (!authUsername) {
|
|
178449
180123
|
authUsername = `camstack-${randomBytes(4).toString("hex")}`;
|
|
@@ -178451,7 +180125,8 @@ var ReolinkEmailPushServer = class {
|
|
|
178451
180125
|
}
|
|
178452
180126
|
if (!authPassword) {
|
|
178453
180127
|
authPassword = randomBytes(18).toString("base64url");
|
|
178454
|
-
|
|
180128
|
+
if (passwordUnresolved) this.deps.logger.error("email-push: the SMTP password is in the keychain but could not be read — running on a temporary password that is NOT saved; camera mail will fail AUTH until it resolves");
|
|
180129
|
+
else bootstrapped.emailPushAuthPassword = authPassword;
|
|
178455
180130
|
}
|
|
178456
180131
|
if (Object.keys(bootstrapped).length > 0) try {
|
|
178457
180132
|
await this.deps.writeStore(bootstrapped);
|
|
@@ -178611,6 +180286,16 @@ var ReolinkEmailPushServer = class {
|
|
|
178611
180286
|
}
|
|
178612
180287
|
};
|
|
178613
180288
|
//#endregion
|
|
180289
|
+
//#region src/email-push-store.ts
|
|
180290
|
+
async function readEmailPushStore(deps) {
|
|
180291
|
+
const raw = await deps.readRaw();
|
|
180292
|
+
const password = await deps.readPassword();
|
|
180293
|
+
return password.length > 0 ? {
|
|
180294
|
+
...raw,
|
|
180295
|
+
emailPushAuthPassword: password
|
|
180296
|
+
} : raw;
|
|
180297
|
+
}
|
|
180298
|
+
//#endregion
|
|
178614
180299
|
//#region src/email-push-schema.ts
|
|
178615
180300
|
/**
|
|
178616
180301
|
* The ids of the sections above, in render order — the value the addon hands
|
|
@@ -179210,7 +180895,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
179210
180895
|
if (!this.emailPushServer) this.emailPushServer = new ReolinkEmailPushServer({
|
|
179211
180896
|
logger: this.ctx.logger.child("email-push"),
|
|
179212
180897
|
listCameras: () => this.listReolinkCameras(),
|
|
179213
|
-
readStore:
|
|
180898
|
+
readStore: () => readEmailPushStore({
|
|
180899
|
+
readRaw: () => this.resolveGlobalStore(),
|
|
180900
|
+
readPassword: () => this.emailPushAuthPasswordState.get()
|
|
180901
|
+
}),
|
|
179214
180902
|
writeStore: async (patch) => {
|
|
179215
180903
|
const username = patch["emailPushAuthUsername"];
|
|
179216
180904
|
if (typeof username === "string") await this.emailPushAuthUsernameState.set(username);
|