@camstack/addon-provider-reolink 1.2.180 → 1.2.182
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 +1679 -136
- package/dist/addon.mjs +1679 -136
- 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. */
|
|
@@ -25214,6 +26087,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
25214
26087
|
kind: "mutation",
|
|
25215
26088
|
auth: "admin",
|
|
25216
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
|
|
25217
26101
|
}), method(object({
|
|
25218
26102
|
selection: RetrainDatasetSelectionSchema,
|
|
25219
26103
|
completeOnly: boolean().optional()
|
|
@@ -28822,8 +29706,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28822
29706
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28823
29707
|
*
|
|
28824
29708
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28825
|
-
* one for transactional / one for notifications). Consumers (
|
|
28826
|
-
*
|
|
29709
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29710
|
+
* addons, …) walk the collection and pick the first
|
|
28827
29711
|
* ready provider OR target a specific addonId.
|
|
28828
29712
|
*
|
|
28829
29713
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -29106,7 +29990,7 @@ targets: array(object({
|
|
|
29106
29990
|
};
|
|
29107
29991
|
/**
|
|
29108
29992
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
29109
|
-
* providers (OIDC, SAML,
|
|
29993
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
29110
29994
|
* carrying the post-callback claims before redirecting back to
|
|
29111
29995
|
* `/api/auth/sso/finish`.
|
|
29112
29996
|
*
|
|
@@ -29169,7 +30053,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
29169
30053
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29170
30054
|
* subject is unique only per issuer, so a link is bound to it.
|
|
29171
30055
|
*/
|
|
29172
|
-
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()
|
|
29173
30064
|
});
|
|
29174
30065
|
method(object({
|
|
29175
30066
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -37043,7 +37934,13 @@ var TopologyNodeSchema = object({
|
|
|
37043
37934
|
})).readonly(),
|
|
37044
37935
|
processes: array(TopologyProcessSchema).readonly(),
|
|
37045
37936
|
categories: array(TopologyCategorySchema).readonly(),
|
|
37046
|
-
rootPackage: TopologyRootPackageSchema.nullable()
|
|
37937
|
+
rootPackage: TopologyRootPackageSchema.nullable(),
|
|
37938
|
+
/**
|
|
37939
|
+
* How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
|
|
37940
|
+
* completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
|
|
37941
|
+
* for offline rows and when the hub cannot tell.
|
|
37942
|
+
*/
|
|
37943
|
+
meshTransport: _enum(["tls", "clear"]).optional()
|
|
37047
37944
|
});
|
|
37048
37945
|
var CapUsageEdgeSchema = object({
|
|
37049
37946
|
callerAddonId: string(),
|
|
@@ -42416,16 +43313,6 @@ var ApiKeySummarySchema = object({
|
|
|
42416
43313
|
createdAt: number(),
|
|
42417
43314
|
lastUsedAt: number().optional()
|
|
42418
43315
|
});
|
|
42419
|
-
var CreateApiKeyInputSchema = object({
|
|
42420
|
-
label: string(),
|
|
42421
|
-
isAdmin: boolean().default(false),
|
|
42422
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
42423
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
42424
|
-
});
|
|
42425
|
-
var CreateApiKeyResultSchema = object({
|
|
42426
|
-
token: string(),
|
|
42427
|
-
record: ApiKeySummarySchema
|
|
42428
|
-
});
|
|
42429
43316
|
var ScopedTokenSummarySchema = object({
|
|
42430
43317
|
id: string(),
|
|
42431
43318
|
userId: string(),
|
|
@@ -42524,17 +43411,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42524
43411
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
42525
43412
|
kind: "mutation",
|
|
42526
43413
|
access: "view"
|
|
42527
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
42528
|
-
kind: "mutation",
|
|
42529
|
-
auth: "admin",
|
|
42530
|
-
access: "create"
|
|
42531
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
43414
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42532
43415
|
kind: "mutation",
|
|
42533
43416
|
auth: "admin",
|
|
42534
43417
|
access: "delete"
|
|
42535
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
42536
|
-
kind: "mutation",
|
|
42537
|
-
access: "view"
|
|
42538
43418
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
42539
43419
|
kind: "mutation",
|
|
42540
43420
|
auth: "admin",
|
|
@@ -42608,15 +43488,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
42608
43488
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
42609
43489
|
userId: string(),
|
|
42610
43490
|
issuer: string()
|
|
42611
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
42612
|
-
userId: string(),
|
|
42613
|
-
issuer: string().min(1),
|
|
42614
|
-
label: string().optional()
|
|
42615
|
-
}), object({ success: literal(true) }), {
|
|
42616
|
-
kind: "mutation",
|
|
42617
|
-
auth: "admin",
|
|
42618
|
-
access: "create"
|
|
42619
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
43491
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42620
43492
|
kind: "mutation",
|
|
42621
43493
|
auth: "admin",
|
|
42622
43494
|
access: "delete"
|
|
@@ -43321,6 +44193,451 @@ var zoneRulesCapability = {
|
|
|
43321
44193
|
*/
|
|
43322
44194
|
durability: "restored"
|
|
43323
44195
|
};
|
|
44196
|
+
/**
|
|
44197
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
44198
|
+
*
|
|
44199
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
44200
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
44201
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
44202
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
44203
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
44204
|
+
* manifest entry and nothing else.
|
|
44205
|
+
*
|
|
44206
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
44207
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
44208
|
+
* Every method is `admin`: these spend money.
|
|
44209
|
+
*
|
|
44210
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
44211
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
44212
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
44213
|
+
*
|
|
44214
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
44215
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
44216
|
+
* ticket the provider mints (D613).
|
|
44217
|
+
*/
|
|
44218
|
+
var TrainingGpuOptionSchema = object({
|
|
44219
|
+
id: string(),
|
|
44220
|
+
label: string(),
|
|
44221
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
44222
|
+
usdPerHour: number().nonnegative(),
|
|
44223
|
+
vramGb: number().nonnegative()
|
|
44224
|
+
});
|
|
44225
|
+
var TrainingRegionOptionSchema = object({
|
|
44226
|
+
/** `''` = any region (the provider's choice). */
|
|
44227
|
+
id: string(),
|
|
44228
|
+
label: string(),
|
|
44229
|
+
priceMultiplier: number().positive()
|
|
44230
|
+
});
|
|
44231
|
+
/**
|
|
44232
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
44233
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
44234
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
44235
|
+
*/
|
|
44236
|
+
var TrainingProviderDefaultsSchema = object({
|
|
44237
|
+
gpuType: string(),
|
|
44238
|
+
region: string(),
|
|
44239
|
+
costCapUsd: number().nonnegative(),
|
|
44240
|
+
maxRuntimeSec: number().int().positive(),
|
|
44241
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
44242
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
44243
|
+
});
|
|
44244
|
+
var TrainingProviderDescriptorSchema = object({
|
|
44245
|
+
addonId: string(),
|
|
44246
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
44247
|
+
kind: string(),
|
|
44248
|
+
label: string(),
|
|
44249
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
44250
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
44251
|
+
maxDatasetBytes: number().int().positive(),
|
|
44252
|
+
maxRuntimeSec: number().int().positive(),
|
|
44253
|
+
freeTierNote: string().optional(),
|
|
44254
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
44255
|
+
dataResidencyNote: string(),
|
|
44256
|
+
/** Credentials are present — never the values. */
|
|
44257
|
+
configured: boolean(),
|
|
44258
|
+
defaults: TrainingProviderDefaultsSchema
|
|
44259
|
+
});
|
|
44260
|
+
var TrainingCredentialCheckSchema = object({
|
|
44261
|
+
ok: boolean(),
|
|
44262
|
+
/** Workspace / account name, when the provider says. */
|
|
44263
|
+
account: string().optional(),
|
|
44264
|
+
reason: _enum([
|
|
44265
|
+
"missing",
|
|
44266
|
+
"invalid",
|
|
44267
|
+
"forbidden",
|
|
44268
|
+
"network",
|
|
44269
|
+
"quota"
|
|
44270
|
+
]).optional(),
|
|
44271
|
+
detail: string().optional()
|
|
44272
|
+
});
|
|
44273
|
+
var ProviderJobStateSchema = _enum([
|
|
44274
|
+
"pending",
|
|
44275
|
+
"starting",
|
|
44276
|
+
"running",
|
|
44277
|
+
"succeeded",
|
|
44278
|
+
"failed",
|
|
44279
|
+
"cancelled",
|
|
44280
|
+
"lost"
|
|
44281
|
+
]);
|
|
44282
|
+
var ProviderJobStatusSchema = object({
|
|
44283
|
+
jobKey: string(),
|
|
44284
|
+
providerJobId: string().optional(),
|
|
44285
|
+
state: ProviderJobStateSchema,
|
|
44286
|
+
startedAt: number().optional(),
|
|
44287
|
+
endedAt: number().optional(),
|
|
44288
|
+
exitCode: number().int().optional(),
|
|
44289
|
+
failureReason: string().optional(),
|
|
44290
|
+
gpuType: string(),
|
|
44291
|
+
region: string().optional(),
|
|
44292
|
+
billedSeconds: number().nonnegative(),
|
|
44293
|
+
costUsd: number().nonnegative(),
|
|
44294
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
44295
|
+
costIsEstimate: boolean(),
|
|
44296
|
+
lastFetchedAt: number()
|
|
44297
|
+
});
|
|
44298
|
+
/**
|
|
44299
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
44300
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
44301
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
44302
|
+
* in `result.json`.
|
|
44303
|
+
*/
|
|
44304
|
+
var TrainerSourceRefSchema = object({
|
|
44305
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
44306
|
+
repo: string().min(1),
|
|
44307
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
44308
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
44309
|
+
});
|
|
44310
|
+
var JobRef = {
|
|
44311
|
+
addonId: string(),
|
|
44312
|
+
jobKey: string().uuid()
|
|
44313
|
+
};
|
|
44314
|
+
var TrainingLogLineSchema = object({
|
|
44315
|
+
ts: number(),
|
|
44316
|
+
text: string()
|
|
44317
|
+
});
|
|
44318
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
44319
|
+
kind: "mutation",
|
|
44320
|
+
auth: "admin",
|
|
44321
|
+
timeoutMs: 3e4
|
|
44322
|
+
}), method(object({
|
|
44323
|
+
addonId: string(),
|
|
44324
|
+
gpuType: string(),
|
|
44325
|
+
region: string(),
|
|
44326
|
+
datasetBytes: number().int().nonnegative(),
|
|
44327
|
+
gpuSecondsLow: number().nonnegative(),
|
|
44328
|
+
gpuSecondsHigh: number().nonnegative()
|
|
44329
|
+
}), object({
|
|
44330
|
+
usdLow: number().nonnegative(),
|
|
44331
|
+
usdHigh: number().nonnegative(),
|
|
44332
|
+
notes: array(string()).readonly()
|
|
44333
|
+
}), { auth: "admin" }), method(object({
|
|
44334
|
+
...JobRef,
|
|
44335
|
+
ticket: PeerBytesTicketSchema
|
|
44336
|
+
}), object({
|
|
44337
|
+
bytes: number().int().nonnegative(),
|
|
44338
|
+
sha256: string()
|
|
44339
|
+
}), {
|
|
44340
|
+
kind: "mutation",
|
|
44341
|
+
auth: "admin",
|
|
44342
|
+
timeoutMs: 120 * 6e4
|
|
44343
|
+
}), method(object({
|
|
44344
|
+
...JobRef,
|
|
44345
|
+
trainer: TrainerSourceRefSchema,
|
|
44346
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
44347
|
+
gpuType: string(),
|
|
44348
|
+
region: string(),
|
|
44349
|
+
maxRuntimeSec: number().int().positive()
|
|
44350
|
+
}), ProviderJobStatusSchema, {
|
|
44351
|
+
kind: "mutation",
|
|
44352
|
+
auth: "admin",
|
|
44353
|
+
timeoutMs: 30 * 6e4
|
|
44354
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
44355
|
+
auth: "admin",
|
|
44356
|
+
timeoutMs: 6e4
|
|
44357
|
+
}), method(object({
|
|
44358
|
+
...JobRef,
|
|
44359
|
+
cursor: string().optional(),
|
|
44360
|
+
max: number().int().min(1).max(500)
|
|
44361
|
+
}), object({
|
|
44362
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
44363
|
+
cursor: string()
|
|
44364
|
+
}), {
|
|
44365
|
+
auth: "admin",
|
|
44366
|
+
timeoutMs: 6e4
|
|
44367
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
44368
|
+
kind: "mutation",
|
|
44369
|
+
auth: "admin",
|
|
44370
|
+
timeoutMs: 6e4
|
|
44371
|
+
}), method(object(JobRef), object({
|
|
44372
|
+
found: boolean(),
|
|
44373
|
+
text: string().optional()
|
|
44374
|
+
}), {
|
|
44375
|
+
kind: "mutation",
|
|
44376
|
+
auth: "admin",
|
|
44377
|
+
timeoutMs: 5 * 6e4
|
|
44378
|
+
}), method(object({
|
|
44379
|
+
...JobRef,
|
|
44380
|
+
path: _enum(["bundle.tar"])
|
|
44381
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
44382
|
+
kind: "mutation",
|
|
44383
|
+
auth: "admin",
|
|
44384
|
+
timeoutMs: 5 * 6e4
|
|
44385
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
44386
|
+
kind: "mutation",
|
|
44387
|
+
auth: "admin",
|
|
44388
|
+
timeoutMs: 5 * 6e4
|
|
44389
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
44390
|
+
auth: "admin",
|
|
44391
|
+
timeoutMs: 2 * 6e4
|
|
44392
|
+
});
|
|
44393
|
+
/**
|
|
44394
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
44395
|
+
* provided by `addon-training`.
|
|
44396
|
+
*
|
|
44397
|
+
* It owns what every provider must agree on, written once:
|
|
44398
|
+
*
|
|
44399
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
44400
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
44401
|
+
* the export plan) and reaches this store through the five row methods
|
|
44402
|
+
* below, so the Retrain page and the export did not change.
|
|
44403
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
44404
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
44405
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
44406
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
44407
|
+
* rollback. Nothing is ever registered automatically.
|
|
44408
|
+
*
|
|
44409
|
+
* Every method is `admin`.
|
|
44410
|
+
*/
|
|
44411
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
44412
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
44413
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
44414
|
+
var TrainingBaseModelSchema = object({
|
|
44415
|
+
modelId: string(),
|
|
44416
|
+
label: string(),
|
|
44417
|
+
weights: string(),
|
|
44418
|
+
imgsz: number().int(),
|
|
44419
|
+
baselineOnnxUrl: string(),
|
|
44420
|
+
baselineFloors: record(string(), number()),
|
|
44421
|
+
/** The base the fleet runs most — the UI's default. */
|
|
44422
|
+
recommended: boolean()
|
|
44423
|
+
});
|
|
44424
|
+
var TrainingPresetSchema = _enum([
|
|
44425
|
+
"quick",
|
|
44426
|
+
"standard",
|
|
44427
|
+
"thorough"
|
|
44428
|
+
]);
|
|
44429
|
+
var TrainingJobRequestSchema = object({
|
|
44430
|
+
datasetVersionId: string().min(1),
|
|
44431
|
+
/** The `training-provider` addon that runs it. */
|
|
44432
|
+
addonId: string().min(1),
|
|
44433
|
+
gpuType: string().min(1),
|
|
44434
|
+
region: string(),
|
|
44435
|
+
baseModelId: string().min(1),
|
|
44436
|
+
preset: TrainingPresetSchema,
|
|
44437
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
44438
|
+
freeze: number().int().nonnegative().nullable(),
|
|
44439
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
44440
|
+
holdoutCameras: array(number().int()).nullable()
|
|
44441
|
+
});
|
|
44442
|
+
var TrainingSplitPlanSchema = object({
|
|
44443
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
44444
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
44445
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
44446
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
44447
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
44448
|
+
trainSubjects: number().int()
|
|
44449
|
+
});
|
|
44450
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
44451
|
+
"unknown-dataset",
|
|
44452
|
+
"unknown-provider",
|
|
44453
|
+
"provider-not-configured",
|
|
44454
|
+
"unknown-base-model",
|
|
44455
|
+
"unknown-gpu",
|
|
44456
|
+
"dataset-too-large",
|
|
44457
|
+
"no-training-subjects",
|
|
44458
|
+
"job-already-running"
|
|
44459
|
+
]);
|
|
44460
|
+
var TrainingJobPlanSchema = object({
|
|
44461
|
+
refusal: object({
|
|
44462
|
+
reason: TrainingRefusalReasonSchema,
|
|
44463
|
+
detail: string()
|
|
44464
|
+
}).nullable(),
|
|
44465
|
+
warnings: array(string()).readonly(),
|
|
44466
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
44467
|
+
estimate: object({
|
|
44468
|
+
datasetBytes: number().int(),
|
|
44469
|
+
uploadMinutesAt20Mbps: number(),
|
|
44470
|
+
gpuSecondsLow: number(),
|
|
44471
|
+
gpuSecondsHigh: number(),
|
|
44472
|
+
usdLow: number(),
|
|
44473
|
+
usdHigh: number(),
|
|
44474
|
+
notes: array(string()).readonly()
|
|
44475
|
+
}).nullable(),
|
|
44476
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
44477
|
+
defaults: object({
|
|
44478
|
+
maxCostUsd: number(),
|
|
44479
|
+
maxRuntimeSec: number().int()
|
|
44480
|
+
}).nullable(),
|
|
44481
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
44482
|
+
dataNotice: string()
|
|
44483
|
+
});
|
|
44484
|
+
/**
|
|
44485
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
44486
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
44487
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
44488
|
+
* result lives after the operator acted on it.
|
|
44489
|
+
*/
|
|
44490
|
+
var TrainingJobStateSchema = _enum([
|
|
44491
|
+
"uploading",
|
|
44492
|
+
"submitted",
|
|
44493
|
+
"starting",
|
|
44494
|
+
"running",
|
|
44495
|
+
"collecting",
|
|
44496
|
+
"ready",
|
|
44497
|
+
"registered",
|
|
44498
|
+
"canary",
|
|
44499
|
+
"failed",
|
|
44500
|
+
"cancelling",
|
|
44501
|
+
"cancelled",
|
|
44502
|
+
"lost",
|
|
44503
|
+
"expired",
|
|
44504
|
+
"discarded"
|
|
44505
|
+
]);
|
|
44506
|
+
var TrainingFailureReasonSchema = _enum([
|
|
44507
|
+
"cost-cap",
|
|
44508
|
+
"runtime-cap",
|
|
44509
|
+
"upload-failed",
|
|
44510
|
+
"submit-failed",
|
|
44511
|
+
"trainer-failed",
|
|
44512
|
+
"result-invalid",
|
|
44513
|
+
"checksum-mismatch",
|
|
44514
|
+
"fetch-failed",
|
|
44515
|
+
"provider-error",
|
|
44516
|
+
"hub-restart-during-upload"
|
|
44517
|
+
]);
|
|
44518
|
+
var TrainingProgressPointSchema = object({
|
|
44519
|
+
epoch: number().int(),
|
|
44520
|
+
map50: number().nullable(),
|
|
44521
|
+
map50_95: number().nullable()
|
|
44522
|
+
});
|
|
44523
|
+
var TrainingCanarySchema = object({
|
|
44524
|
+
deviceIds: array(number().int()).readonly(),
|
|
44525
|
+
since: number(),
|
|
44526
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
44527
|
+
previous: array(object({
|
|
44528
|
+
deviceId: number().int(),
|
|
44529
|
+
nodeId: string(),
|
|
44530
|
+
deviceKey: string(),
|
|
44531
|
+
patch: object({
|
|
44532
|
+
modelId: string().optional(),
|
|
44533
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
44534
|
+
}).nullable()
|
|
44535
|
+
})).readonly()
|
|
44536
|
+
});
|
|
44537
|
+
var TrainingJobSchema = object({
|
|
44538
|
+
id: string(),
|
|
44539
|
+
idempotencyKey: string(),
|
|
44540
|
+
name: string(),
|
|
44541
|
+
createdAt: number(),
|
|
44542
|
+
updatedAt: number(),
|
|
44543
|
+
state: TrainingJobStateSchema,
|
|
44544
|
+
stage: TrainingStageSchema.nullable(),
|
|
44545
|
+
failure: object({
|
|
44546
|
+
reason: TrainingFailureReasonSchema,
|
|
44547
|
+
stage: string().nullable(),
|
|
44548
|
+
detail: string()
|
|
44549
|
+
}).nullable(),
|
|
44550
|
+
request: TrainingJobRequestSchema,
|
|
44551
|
+
maxCostUsd: number().nonnegative(),
|
|
44552
|
+
maxRuntimeSec: number().int().positive(),
|
|
44553
|
+
trainer: TrainerSourceRefSchema,
|
|
44554
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
44555
|
+
dataset: object({
|
|
44556
|
+
bytes: number().int(),
|
|
44557
|
+
sha256: string(),
|
|
44558
|
+
uploadedAt: number()
|
|
44559
|
+
}).nullable(),
|
|
44560
|
+
split: TrainingSplitPlanSchema,
|
|
44561
|
+
provider: object({
|
|
44562
|
+
state: ProviderJobStateSchema.nullable(),
|
|
44563
|
+
providerJobId: string().nullable(),
|
|
44564
|
+
startedAt: number().nullable(),
|
|
44565
|
+
endedAt: number().nullable(),
|
|
44566
|
+
billedSeconds: number(),
|
|
44567
|
+
costUsd: number(),
|
|
44568
|
+
costIsEstimate: boolean(),
|
|
44569
|
+
lastPolledAt: number().nullable()
|
|
44570
|
+
}),
|
|
44571
|
+
progress: object({
|
|
44572
|
+
epoch: number().int().nullable(),
|
|
44573
|
+
epochs: number().int().nullable(),
|
|
44574
|
+
etaSec: number().nullable(),
|
|
44575
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
44576
|
+
}),
|
|
44577
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
44578
|
+
logTail: array(string()).readonly(),
|
|
44579
|
+
logCursor: string().nullable(),
|
|
44580
|
+
artifacts: object({
|
|
44581
|
+
bundleBytes: number().int(),
|
|
44582
|
+
bundleSha256: string(),
|
|
44583
|
+
fetchedAt: number(),
|
|
44584
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
44585
|
+
expiresAt: number()
|
|
44586
|
+
}).nullable(),
|
|
44587
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
44588
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
44589
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
44590
|
+
cloudCleanupDueAt: number().nullable(),
|
|
44591
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
44592
|
+
registeredModelIds: array(string()).readonly(),
|
|
44593
|
+
canary: TrainingCanarySchema.nullable()
|
|
44594
|
+
});
|
|
44595
|
+
var IdInput = object({ id: string().min(1) });
|
|
44596
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
44597
|
+
kind: "mutation",
|
|
44598
|
+
auth: "admin"
|
|
44599
|
+
}), 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() }), {
|
|
44600
|
+
kind: "mutation",
|
|
44601
|
+
auth: "admin"
|
|
44602
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
44603
|
+
auth: "admin",
|
|
44604
|
+
timeoutMs: 6e4
|
|
44605
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
44606
|
+
name: string().min(1).max(120),
|
|
44607
|
+
maxCostUsd: number().positive(),
|
|
44608
|
+
maxRuntimeSec: number().int().positive(),
|
|
44609
|
+
idempotencyKey: string().min(8).max(80)
|
|
44610
|
+
}), discriminatedUnion("kind", [object({
|
|
44611
|
+
kind: literal("started"),
|
|
44612
|
+
job: TrainingJobSchema
|
|
44613
|
+
}), object({
|
|
44614
|
+
kind: literal("refused"),
|
|
44615
|
+
reason: TrainingRefusalReasonSchema,
|
|
44616
|
+
detail: string()
|
|
44617
|
+
})]), {
|
|
44618
|
+
kind: "mutation",
|
|
44619
|
+
auth: "admin",
|
|
44620
|
+
timeoutMs: 12e4
|
|
44621
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
44622
|
+
kind: "mutation",
|
|
44623
|
+
auth: "admin",
|
|
44624
|
+
timeoutMs: 12e4
|
|
44625
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
44626
|
+
kind: "mutation",
|
|
44627
|
+
auth: "admin",
|
|
44628
|
+
timeoutMs: 30 * 6e4
|
|
44629
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
44630
|
+
kind: "mutation",
|
|
44631
|
+
auth: "admin",
|
|
44632
|
+
timeoutMs: 12e4
|
|
44633
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44634
|
+
kind: "mutation",
|
|
44635
|
+
auth: "admin",
|
|
44636
|
+
timeoutMs: 12e4
|
|
44637
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
44638
|
+
kind: "mutation",
|
|
44639
|
+
auth: "admin"
|
|
44640
|
+
});
|
|
43324
44641
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
43325
44642
|
Object.freeze({
|
|
43326
44643
|
person: .5,
|
|
@@ -45495,6 +46812,12 @@ Object.freeze({
|
|
|
45495
46812
|
addonId: null,
|
|
45496
46813
|
access: "create"
|
|
45497
46814
|
},
|
|
46815
|
+
"backup.checkBackupKey": {
|
|
46816
|
+
capName: "backup",
|
|
46817
|
+
capScope: "system",
|
|
46818
|
+
addonId: null,
|
|
46819
|
+
access: "create"
|
|
46820
|
+
},
|
|
45498
46821
|
"backup.delete": {
|
|
45499
46822
|
capName: "backup",
|
|
45500
46823
|
capScope: "system",
|
|
@@ -45507,6 +46830,18 @@ Object.freeze({
|
|
|
45507
46830
|
addonId: null,
|
|
45508
46831
|
access: "delete"
|
|
45509
46832
|
},
|
|
46833
|
+
"backup.disableEncryption": {
|
|
46834
|
+
capName: "backup",
|
|
46835
|
+
capScope: "system",
|
|
46836
|
+
addonId: null,
|
|
46837
|
+
access: "create"
|
|
46838
|
+
},
|
|
46839
|
+
"backup.getEncryption": {
|
|
46840
|
+
capName: "backup",
|
|
46841
|
+
capScope: "system",
|
|
46842
|
+
addonId: null,
|
|
46843
|
+
access: "view"
|
|
46844
|
+
},
|
|
45510
46845
|
"backup.getEntries": {
|
|
45511
46846
|
capName: "backup",
|
|
45512
46847
|
capScope: "system",
|
|
@@ -45561,6 +46896,12 @@ Object.freeze({
|
|
|
45561
46896
|
addonId: null,
|
|
45562
46897
|
access: "create"
|
|
45563
46898
|
},
|
|
46899
|
+
"backup.setupEncryption": {
|
|
46900
|
+
capName: "backup",
|
|
46901
|
+
capScope: "system",
|
|
46902
|
+
addonId: null,
|
|
46903
|
+
access: "create"
|
|
46904
|
+
},
|
|
45564
46905
|
"backup.trigger": {
|
|
45565
46906
|
capName: "backup",
|
|
45566
46907
|
capScope: "system",
|
|
@@ -46113,6 +47454,12 @@ Object.freeze({
|
|
|
46113
47454
|
addonId: null,
|
|
46114
47455
|
access: "create"
|
|
46115
47456
|
},
|
|
47457
|
+
"customModelRegistry.importModelBundle": {
|
|
47458
|
+
capName: "custom-model-registry",
|
|
47459
|
+
capScope: "system",
|
|
47460
|
+
addonId: null,
|
|
47461
|
+
access: "create"
|
|
47462
|
+
},
|
|
46116
47463
|
"customModelRegistry.listModels": {
|
|
46117
47464
|
capName: "custom-model-registry",
|
|
46118
47465
|
capScope: "system",
|
|
@@ -47553,6 +48900,12 @@ Object.freeze({
|
|
|
47553
48900
|
addonId: null,
|
|
47554
48901
|
access: "view"
|
|
47555
48902
|
},
|
|
48903
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48904
|
+
capName: "keychain-admin",
|
|
48905
|
+
capScope: "system",
|
|
48906
|
+
addonId: null,
|
|
48907
|
+
access: "create"
|
|
48908
|
+
},
|
|
47556
48909
|
"keychainAdmin.deleteOrphans": {
|
|
47557
48910
|
capName: "keychain-admin",
|
|
47558
48911
|
capScope: "system",
|
|
@@ -47589,6 +48942,12 @@ Object.freeze({
|
|
|
47589
48942
|
addonId: null,
|
|
47590
48943
|
access: "delete"
|
|
47591
48944
|
},
|
|
48945
|
+
"keychainAdmin.resetReport": {
|
|
48946
|
+
capName: "keychain-admin",
|
|
48947
|
+
capScope: "system",
|
|
48948
|
+
addonId: null,
|
|
48949
|
+
access: "delete"
|
|
48950
|
+
},
|
|
47592
48951
|
"keychainAdmin.reveal": {
|
|
47593
48952
|
capName: "keychain-admin",
|
|
47594
48953
|
capScope: "system",
|
|
@@ -47601,6 +48960,12 @@ Object.freeze({
|
|
|
47601
48960
|
addonId: null,
|
|
47602
48961
|
access: "create"
|
|
47603
48962
|
},
|
|
48963
|
+
"keychainAdmin.setSystemSecret": {
|
|
48964
|
+
capName: "keychain-admin",
|
|
48965
|
+
capScope: "system",
|
|
48966
|
+
addonId: null,
|
|
48967
|
+
access: "create"
|
|
48968
|
+
},
|
|
47604
48969
|
"keychainAdmin.status": {
|
|
47605
48970
|
capName: "keychain-admin",
|
|
47606
48971
|
capScope: "system",
|
|
@@ -49329,6 +50694,12 @@ Object.freeze({
|
|
|
49329
50694
|
addonId: null,
|
|
49330
50695
|
access: "view"
|
|
49331
50696
|
},
|
|
50697
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
50698
|
+
capName: "pipeline-analytics",
|
|
50699
|
+
capScope: "device",
|
|
50700
|
+
addonId: null,
|
|
50701
|
+
access: "create"
|
|
50702
|
+
},
|
|
49332
50703
|
"pipelineAnalytics.ownersWithMedia": {
|
|
49333
50704
|
capName: "pipeline-analytics",
|
|
49334
50705
|
capScope: "device",
|
|
@@ -51867,6 +53238,174 @@ Object.freeze({
|
|
|
51867
53238
|
addonId: null,
|
|
51868
53239
|
access: "view"
|
|
51869
53240
|
},
|
|
53241
|
+
"training.canaryResult": {
|
|
53242
|
+
capName: "training",
|
|
53243
|
+
capScope: "system",
|
|
53244
|
+
addonId: null,
|
|
53245
|
+
access: "create"
|
|
53246
|
+
},
|
|
53247
|
+
"training.cancelJob": {
|
|
53248
|
+
capName: "training",
|
|
53249
|
+
capScope: "system",
|
|
53250
|
+
addonId: null,
|
|
53251
|
+
access: "create"
|
|
53252
|
+
},
|
|
53253
|
+
"training.discardResult": {
|
|
53254
|
+
capName: "training",
|
|
53255
|
+
capScope: "system",
|
|
53256
|
+
addonId: null,
|
|
53257
|
+
access: "create"
|
|
53258
|
+
},
|
|
53259
|
+
"training.findDatasetVersionIdByName": {
|
|
53260
|
+
capName: "training",
|
|
53261
|
+
capScope: "system",
|
|
53262
|
+
addonId: null,
|
|
53263
|
+
access: "view"
|
|
53264
|
+
},
|
|
53265
|
+
"training.getDatasetVersion": {
|
|
53266
|
+
capName: "training",
|
|
53267
|
+
capScope: "system",
|
|
53268
|
+
addonId: null,
|
|
53269
|
+
access: "view"
|
|
53270
|
+
},
|
|
53271
|
+
"training.getJob": {
|
|
53272
|
+
capName: "training",
|
|
53273
|
+
capScope: "system",
|
|
53274
|
+
addonId: null,
|
|
53275
|
+
access: "view"
|
|
53276
|
+
},
|
|
53277
|
+
"training.getJobResult": {
|
|
53278
|
+
capName: "training",
|
|
53279
|
+
capScope: "system",
|
|
53280
|
+
addonId: null,
|
|
53281
|
+
access: "view"
|
|
53282
|
+
},
|
|
53283
|
+
"training.listBaseModels": {
|
|
53284
|
+
capName: "training",
|
|
53285
|
+
capScope: "system",
|
|
53286
|
+
addonId: null,
|
|
53287
|
+
access: "view"
|
|
53288
|
+
},
|
|
53289
|
+
"training.listDatasetVersions": {
|
|
53290
|
+
capName: "training",
|
|
53291
|
+
capScope: "system",
|
|
53292
|
+
addonId: null,
|
|
53293
|
+
access: "view"
|
|
53294
|
+
},
|
|
53295
|
+
"training.listJobs": {
|
|
53296
|
+
capName: "training",
|
|
53297
|
+
capScope: "system",
|
|
53298
|
+
addonId: null,
|
|
53299
|
+
access: "view"
|
|
53300
|
+
},
|
|
53301
|
+
"training.planJob": {
|
|
53302
|
+
capName: "training",
|
|
53303
|
+
capScope: "system",
|
|
53304
|
+
addonId: null,
|
|
53305
|
+
access: "view"
|
|
53306
|
+
},
|
|
53307
|
+
"training.putDatasetVersion": {
|
|
53308
|
+
capName: "training",
|
|
53309
|
+
capScope: "system",
|
|
53310
|
+
addonId: null,
|
|
53311
|
+
access: "create"
|
|
53312
|
+
},
|
|
53313
|
+
"training.registerResult": {
|
|
53314
|
+
capName: "training",
|
|
53315
|
+
capScope: "system",
|
|
53316
|
+
addonId: null,
|
|
53317
|
+
access: "create"
|
|
53318
|
+
},
|
|
53319
|
+
"training.removeDatasetVersion": {
|
|
53320
|
+
capName: "training",
|
|
53321
|
+
capScope: "system",
|
|
53322
|
+
addonId: null,
|
|
53323
|
+
access: "delete"
|
|
53324
|
+
},
|
|
53325
|
+
"training.rollbackCanary": {
|
|
53326
|
+
capName: "training",
|
|
53327
|
+
capScope: "system",
|
|
53328
|
+
addonId: null,
|
|
53329
|
+
access: "create"
|
|
53330
|
+
},
|
|
53331
|
+
"training.startJob": {
|
|
53332
|
+
capName: "training",
|
|
53333
|
+
capScope: "system",
|
|
53334
|
+
addonId: null,
|
|
53335
|
+
access: "create"
|
|
53336
|
+
},
|
|
53337
|
+
"trainingProvider.cancelJob": {
|
|
53338
|
+
capName: "training-provider",
|
|
53339
|
+
capScope: "system",
|
|
53340
|
+
addonId: null,
|
|
53341
|
+
access: "create"
|
|
53342
|
+
},
|
|
53343
|
+
"trainingProvider.cleanupJob": {
|
|
53344
|
+
capName: "training-provider",
|
|
53345
|
+
capScope: "system",
|
|
53346
|
+
addonId: null,
|
|
53347
|
+
access: "create"
|
|
53348
|
+
},
|
|
53349
|
+
"trainingProvider.describe": {
|
|
53350
|
+
capName: "training-provider",
|
|
53351
|
+
capScope: "system",
|
|
53352
|
+
addonId: null,
|
|
53353
|
+
access: "view"
|
|
53354
|
+
},
|
|
53355
|
+
"trainingProvider.estimateJob": {
|
|
53356
|
+
capName: "training-provider",
|
|
53357
|
+
capScope: "system",
|
|
53358
|
+
addonId: null,
|
|
53359
|
+
access: "view"
|
|
53360
|
+
},
|
|
53361
|
+
"trainingProvider.getJob": {
|
|
53362
|
+
capName: "training-provider",
|
|
53363
|
+
capScope: "system",
|
|
53364
|
+
addonId: null,
|
|
53365
|
+
access: "view"
|
|
53366
|
+
},
|
|
53367
|
+
"trainingProvider.listJobEvents": {
|
|
53368
|
+
capName: "training-provider",
|
|
53369
|
+
capScope: "system",
|
|
53370
|
+
addonId: null,
|
|
53371
|
+
access: "view"
|
|
53372
|
+
},
|
|
53373
|
+
"trainingProvider.listJobs": {
|
|
53374
|
+
capName: "training-provider",
|
|
53375
|
+
capScope: "system",
|
|
53376
|
+
addonId: null,
|
|
53377
|
+
access: "view"
|
|
53378
|
+
},
|
|
53379
|
+
"trainingProvider.offerArtifact": {
|
|
53380
|
+
capName: "training-provider",
|
|
53381
|
+
capScope: "system",
|
|
53382
|
+
addonId: null,
|
|
53383
|
+
access: "create"
|
|
53384
|
+
},
|
|
53385
|
+
"trainingProvider.readResult": {
|
|
53386
|
+
capName: "training-provider",
|
|
53387
|
+
capScope: "system",
|
|
53388
|
+
addonId: null,
|
|
53389
|
+
access: "create"
|
|
53390
|
+
},
|
|
53391
|
+
"trainingProvider.submitJob": {
|
|
53392
|
+
capName: "training-provider",
|
|
53393
|
+
capScope: "system",
|
|
53394
|
+
addonId: null,
|
|
53395
|
+
access: "create"
|
|
53396
|
+
},
|
|
53397
|
+
"trainingProvider.uploadDataset": {
|
|
53398
|
+
capName: "training-provider",
|
|
53399
|
+
capScope: "system",
|
|
53400
|
+
addonId: null,
|
|
53401
|
+
access: "create"
|
|
53402
|
+
},
|
|
53403
|
+
"trainingProvider.validateCredentials": {
|
|
53404
|
+
capName: "training-provider",
|
|
53405
|
+
capScope: "system",
|
|
53406
|
+
addonId: null,
|
|
53407
|
+
access: "create"
|
|
53408
|
+
},
|
|
51870
53409
|
"turnProvider.getTurnServers": {
|
|
51871
53410
|
capName: "turn-provider",
|
|
51872
53411
|
capScope: "system",
|
|
@@ -51891,12 +53430,6 @@ Object.freeze({
|
|
|
51891
53430
|
addonId: null,
|
|
51892
53431
|
access: "create"
|
|
51893
53432
|
},
|
|
51894
|
-
"userManagement.createApiKey": {
|
|
51895
|
-
capName: "user-management",
|
|
51896
|
-
capScope: "system",
|
|
51897
|
-
addonId: null,
|
|
51898
|
-
access: "create"
|
|
51899
|
-
},
|
|
51900
53433
|
"userManagement.createScopedToken": {
|
|
51901
53434
|
capName: "user-management",
|
|
51902
53435
|
capScope: "system",
|
|
@@ -51933,12 +53466,6 @@ Object.freeze({
|
|
|
51933
53466
|
addonId: null,
|
|
51934
53467
|
access: "view"
|
|
51935
53468
|
},
|
|
51936
|
-
"userManagement.linkExternalIdentity": {
|
|
51937
|
-
capName: "user-management",
|
|
51938
|
-
capScope: "system",
|
|
51939
|
-
addonId: null,
|
|
51940
|
-
access: "create"
|
|
51941
|
-
},
|
|
51942
53469
|
"userManagement.listApiKeys": {
|
|
51943
53470
|
capName: "user-management",
|
|
51944
53471
|
capScope: "system",
|
|
@@ -52041,12 +53568,6 @@ Object.freeze({
|
|
|
52041
53568
|
addonId: null,
|
|
52042
53569
|
access: "create"
|
|
52043
53570
|
},
|
|
52044
|
-
"userManagement.validateApiKey": {
|
|
52045
|
-
capName: "user-management",
|
|
52046
|
-
capScope: "system",
|
|
52047
|
-
addonId: null,
|
|
52048
|
-
access: "view"
|
|
52049
|
-
},
|
|
52050
53571
|
"userManagement.validateCredentials": {
|
|
52051
53572
|
capName: "user-management",
|
|
52052
53573
|
capScope: "system",
|
|
@@ -56312,6 +57833,11 @@ Object.freeze({
|
|
|
56312
57833
|
form: "single",
|
|
56313
57834
|
optional: false
|
|
56314
57835
|
}],
|
|
57836
|
+
"training.canaryResult": [{
|
|
57837
|
+
name: "deviceIds",
|
|
57838
|
+
form: "array",
|
|
57839
|
+
optional: false
|
|
57840
|
+
}],
|
|
56315
57841
|
"update.getStatus": [{
|
|
56316
57842
|
name: "deviceId",
|
|
56317
57843
|
form: "single",
|
|
@@ -57040,6 +58566,8 @@ var STATE_SUMMARY_VARS = [
|
|
|
57040
58566
|
[...RULE_TEXT],
|
|
57041
58567
|
[...RULE_TEXT],
|
|
57042
58568
|
[...RULE_TEXT],
|
|
58569
|
+
[...RULE_TEXT],
|
|
58570
|
+
[...RULE_TEXT],
|
|
57043
58571
|
([...RULE_TEXT], [...UPDATES]),
|
|
57044
58572
|
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
57045
58573
|
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
@@ -178597,6 +180125,7 @@ var ReolinkEmailPushServer = class {
|
|
|
178597
180125
|
const raw = await this.deps.readStore();
|
|
178598
180126
|
let authUsername = readString$1(raw, "emailPushAuthUsername", "");
|
|
178599
180127
|
let authPassword = readString$1(raw, "emailPushAuthPassword", "");
|
|
180128
|
+
const passwordUnresolved = isSecretMarkerLike(raw["emailPushAuthPassword"]);
|
|
178600
180129
|
const bootstrapped = {};
|
|
178601
180130
|
if (!authUsername) {
|
|
178602
180131
|
authUsername = `camstack-${randomBytes(4).toString("hex")}`;
|
|
@@ -178604,7 +180133,8 @@ var ReolinkEmailPushServer = class {
|
|
|
178604
180133
|
}
|
|
178605
180134
|
if (!authPassword) {
|
|
178606
180135
|
authPassword = randomBytes(18).toString("base64url");
|
|
178607
|
-
|
|
180136
|
+
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");
|
|
180137
|
+
else bootstrapped.emailPushAuthPassword = authPassword;
|
|
178608
180138
|
}
|
|
178609
180139
|
if (Object.keys(bootstrapped).length > 0) try {
|
|
178610
180140
|
await this.deps.writeStore(bootstrapped);
|
|
@@ -178764,6 +180294,16 @@ var ReolinkEmailPushServer = class {
|
|
|
178764
180294
|
}
|
|
178765
180295
|
};
|
|
178766
180296
|
//#endregion
|
|
180297
|
+
//#region src/email-push-store.ts
|
|
180298
|
+
async function readEmailPushStore(deps) {
|
|
180299
|
+
const raw = await deps.readRaw();
|
|
180300
|
+
const password = await deps.readPassword();
|
|
180301
|
+
return password.length > 0 ? {
|
|
180302
|
+
...raw,
|
|
180303
|
+
emailPushAuthPassword: password
|
|
180304
|
+
} : raw;
|
|
180305
|
+
}
|
|
180306
|
+
//#endregion
|
|
178767
180307
|
//#region src/email-push-schema.ts
|
|
178768
180308
|
/**
|
|
178769
180309
|
* The ids of the sections above, in render order — the value the addon hands
|
|
@@ -179363,7 +180903,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
179363
180903
|
if (!this.emailPushServer) this.emailPushServer = new ReolinkEmailPushServer({
|
|
179364
180904
|
logger: this.ctx.logger.child("email-push"),
|
|
179365
180905
|
listCameras: () => this.listReolinkCameras(),
|
|
179366
|
-
readStore:
|
|
180906
|
+
readStore: () => readEmailPushStore({
|
|
180907
|
+
readRaw: () => this.resolveGlobalStore(),
|
|
180908
|
+
readPassword: () => this.emailPushAuthPasswordState.get()
|
|
180909
|
+
}),
|
|
179367
180910
|
writeStore: async (patch) => {
|
|
179368
180911
|
const username = patch["emailPushAuthUsername"];
|
|
179369
180912
|
if (typeof username === "string") await this.emailPushAuthUsernameState.set(username);
|