@camstack/addon-provider-homematic 1.2.130 → 1.2.132
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 +1938 -136
- package/dist/addon.mjs +1938 -136
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -5387,7 +5387,7 @@ var ZodIssueCode = {
|
|
|
5387
5387
|
var ZodFirstPartyTypeKind;
|
|
5388
5388
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5389
5389
|
//#endregion
|
|
5390
|
-
//#region ../types/dist/sleep-
|
|
5390
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5391
5391
|
/**
|
|
5392
5392
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5393
5393
|
* window to float samples (D455).
|
|
@@ -5504,7 +5504,7 @@ function isKeychainStoredField(field) {
|
|
|
5504
5504
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5505
5505
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5506
5506
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5507
|
-
function isRecord$
|
|
5507
|
+
function isRecord$2(value) {
|
|
5508
5508
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5509
5509
|
}
|
|
5510
5510
|
function makeSecretMarker(ref) {
|
|
@@ -5515,12 +5515,12 @@ function makeSecretMarker(ref) {
|
|
|
5515
5515
|
}
|
|
5516
5516
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5517
5517
|
function isSecretMarker(value) {
|
|
5518
|
-
if (!isRecord$
|
|
5518
|
+
if (!isRecord$2(value)) return false;
|
|
5519
5519
|
const ref = value["$secret"];
|
|
5520
5520
|
return typeof ref === "string" && ref.length > 0;
|
|
5521
5521
|
}
|
|
5522
5522
|
function isSecretClear(value) {
|
|
5523
|
-
return isRecord$
|
|
5523
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5524
5524
|
}
|
|
5525
5525
|
/**
|
|
5526
5526
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6036,6 +6036,13 @@ function globalSecretScope() {
|
|
|
6036
6036
|
function encodeSegment(value) {
|
|
6037
6037
|
return encodeURIComponent(value);
|
|
6038
6038
|
}
|
|
6039
|
+
function decodeSegment(value) {
|
|
6040
|
+
try {
|
|
6041
|
+
return decodeURIComponent(value);
|
|
6042
|
+
} catch {
|
|
6043
|
+
return null;
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6039
6046
|
/**
|
|
6040
6047
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6041
6048
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6044,6 +6051,75 @@ function encodeSegment(value) {
|
|
|
6044
6051
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6045
6052
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6046
6053
|
}
|
|
6054
|
+
function parseScope(segments) {
|
|
6055
|
+
switch (segments[0]) {
|
|
6056
|
+
case "global": return {
|
|
6057
|
+
scope: GLOBAL_SCOPE,
|
|
6058
|
+
used: 1
|
|
6059
|
+
};
|
|
6060
|
+
case "node": {
|
|
6061
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6062
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6063
|
+
scope: {
|
|
6064
|
+
kind: "node",
|
|
6065
|
+
nodeId
|
|
6066
|
+
},
|
|
6067
|
+
used: 2
|
|
6068
|
+
};
|
|
6069
|
+
}
|
|
6070
|
+
case "device": {
|
|
6071
|
+
const raw = segments[1];
|
|
6072
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6073
|
+
return {
|
|
6074
|
+
scope: {
|
|
6075
|
+
kind: "device",
|
|
6076
|
+
deviceId: Number(raw)
|
|
6077
|
+
},
|
|
6078
|
+
used: 2
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
case "integration": {
|
|
6082
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6083
|
+
return id === null || id.length === 0 ? null : {
|
|
6084
|
+
scope: {
|
|
6085
|
+
kind: "integration",
|
|
6086
|
+
integrationId: id
|
|
6087
|
+
},
|
|
6088
|
+
used: 2
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
case "row": {
|
|
6092
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6093
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6094
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6095
|
+
return {
|
|
6096
|
+
scope: {
|
|
6097
|
+
kind: "row",
|
|
6098
|
+
collection,
|
|
6099
|
+
rowId
|
|
6100
|
+
},
|
|
6101
|
+
used: 3
|
|
6102
|
+
};
|
|
6103
|
+
}
|
|
6104
|
+
default: return null;
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6108
|
+
function parseSecretRef(ref) {
|
|
6109
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6110
|
+
const segments = ref.slice(9).split("/");
|
|
6111
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6112
|
+
if (owner === null || owner.length === 0) return null;
|
|
6113
|
+
const parsed = parseScope(segments.slice(1));
|
|
6114
|
+
if (parsed === null) return null;
|
|
6115
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6116
|
+
if (fieldPath.length === 0) return null;
|
|
6117
|
+
return {
|
|
6118
|
+
owner,
|
|
6119
|
+
scope: parsed.scope,
|
|
6120
|
+
fieldPath
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6047
6123
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6048
6124
|
var KeychainWriteRefusedError = class extends Error {
|
|
6049
6125
|
fieldPath;
|
|
@@ -6054,7 +6130,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6054
6130
|
}
|
|
6055
6131
|
};
|
|
6056
6132
|
var KEEP = { kind: "keep" };
|
|
6057
|
-
function isRecord$
|
|
6133
|
+
function isRecord$1(value) {
|
|
6058
6134
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6059
6135
|
}
|
|
6060
6136
|
function defaultMintId() {
|
|
@@ -6067,7 +6143,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6067
6143
|
return out;
|
|
6068
6144
|
}
|
|
6069
6145
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6070
|
-
else if (isRecord$
|
|
6146
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6071
6147
|
return out;
|
|
6072
6148
|
}
|
|
6073
6149
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6122,7 +6198,7 @@ function rowId(row, idKey) {
|
|
|
6122
6198
|
return null;
|
|
6123
6199
|
}
|
|
6124
6200
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6125
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6201
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6126
6202
|
if (!Array.isArray(incoming)) {
|
|
6127
6203
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6128
6204
|
return {
|
|
@@ -6138,7 +6214,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6138
6214
|
const kept = /* @__PURE__ */ new Set();
|
|
6139
6215
|
const rows = [];
|
|
6140
6216
|
for (const row of incoming) {
|
|
6141
|
-
if (!isRecord$
|
|
6217
|
+
if (!isRecord$1(row)) {
|
|
6142
6218
|
rows.push(row);
|
|
6143
6219
|
continue;
|
|
6144
6220
|
}
|
|
@@ -6163,7 +6239,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6163
6239
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6164
6240
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6165
6241
|
case "object": {
|
|
6166
|
-
if (!isRecord$
|
|
6242
|
+
if (!isRecord$1(incoming)) {
|
|
6167
6243
|
if (incoming === void 0) return KEEP;
|
|
6168
6244
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6169
6245
|
return {
|
|
@@ -6171,7 +6247,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6171
6247
|
value: incoming
|
|
6172
6248
|
};
|
|
6173
6249
|
}
|
|
6174
|
-
const storedObj = isRecord$
|
|
6250
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6175
6251
|
return {
|
|
6176
6252
|
kind: "value",
|
|
6177
6253
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6230,12 +6306,19 @@ async function transformSecretWrite(input) {
|
|
|
6230
6306
|
}
|
|
6231
6307
|
};
|
|
6232
6308
|
}
|
|
6309
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6310
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6311
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6312
|
+
}
|
|
6233
6313
|
/**
|
|
6234
6314
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6235
6315
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6236
6316
|
*/
|
|
6237
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6238
|
-
const
|
|
6317
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6318
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6319
|
+
const owner = options.ownedBy;
|
|
6320
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6321
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6239
6322
|
if (refs.length === 0) return {
|
|
6240
6323
|
value,
|
|
6241
6324
|
unresolved: []
|
|
@@ -6259,10 +6342,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6259
6342
|
}
|
|
6260
6343
|
const substitute = (v) => {
|
|
6261
6344
|
if (isSecretMarker(v)) {
|
|
6345
|
+
if (!inScope(v.$secret)) return {
|
|
6346
|
+
keep: true,
|
|
6347
|
+
value: v
|
|
6348
|
+
};
|
|
6262
6349
|
const answer = answers[v.$secret];
|
|
6263
|
-
|
|
6350
|
+
if (answer?.kind === "value") return {
|
|
6264
6351
|
keep: true,
|
|
6265
6352
|
value: answer.value
|
|
6353
|
+
};
|
|
6354
|
+
return keepMarker ? {
|
|
6355
|
+
keep: true,
|
|
6356
|
+
value: v
|
|
6266
6357
|
} : {
|
|
6267
6358
|
keep: false,
|
|
6268
6359
|
value: void 0
|
|
@@ -6279,7 +6370,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6279
6370
|
value: items
|
|
6280
6371
|
};
|
|
6281
6372
|
}
|
|
6282
|
-
if (isRecord$
|
|
6373
|
+
if (isRecord$1(v)) {
|
|
6283
6374
|
const out = {};
|
|
6284
6375
|
for (const [k, child] of Object.entries(v)) {
|
|
6285
6376
|
const s = substitute(child);
|
|
@@ -6300,14 +6391,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6300
6391
|
unresolved
|
|
6301
6392
|
};
|
|
6302
6393
|
}
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6394
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6395
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6396
|
+
ref;
|
|
6397
|
+
reason;
|
|
6398
|
+
constructor(ref, reason) {
|
|
6399
|
+
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.`);
|
|
6400
|
+
this.ref = ref;
|
|
6401
|
+
this.reason = reason;
|
|
6402
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6403
|
+
}
|
|
6404
|
+
};
|
|
6405
|
+
function isRecord$3(value) {
|
|
6406
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6407
|
+
}
|
|
6408
|
+
function resolvedValue(pass, marker) {
|
|
6409
|
+
const answer = pass.answers[marker.$secret];
|
|
6410
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6411
|
+
}
|
|
6412
|
+
async function atMarker(pass, incoming, stored) {
|
|
6413
|
+
if (incoming === null) return stored;
|
|
6414
|
+
if (typeof incoming !== "string") return incoming;
|
|
6415
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6416
|
+
const intent = classifySecretWrite(incoming);
|
|
6417
|
+
if (intent.kind !== "set") return stored;
|
|
6418
|
+
const ref = stored.$secret;
|
|
6419
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6420
|
+
const answer = pass.answers[ref];
|
|
6421
|
+
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);
|
|
6422
|
+
try {
|
|
6423
|
+
await pass.secrets.put(ref, intent.value);
|
|
6424
|
+
} catch (err) {
|
|
6425
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6426
|
+
}
|
|
6427
|
+
pass.changedRefs.push(ref);
|
|
6428
|
+
return stored;
|
|
6429
|
+
}
|
|
6430
|
+
function inArray(pass, incoming, stored) {
|
|
6431
|
+
return incoming.map((item, index) => {
|
|
6432
|
+
const twin = stored[index];
|
|
6433
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6434
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6435
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6436
|
+
return item;
|
|
6437
|
+
});
|
|
6438
|
+
}
|
|
6439
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6440
|
+
const out = { ...incoming };
|
|
6441
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6442
|
+
const twin = stored[key];
|
|
6443
|
+
if (isSecretMarker(twin)) {
|
|
6444
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6445
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6446
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6447
|
+
}
|
|
6448
|
+
return out;
|
|
6449
|
+
}
|
|
6450
|
+
async function walk(pass, incoming, stored) {
|
|
6451
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6452
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6453
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6454
|
+
const out = { ...incoming };
|
|
6455
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6456
|
+
return out;
|
|
6457
|
+
}
|
|
6458
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6459
|
+
async function restoreUnchangedSecrets(input) {
|
|
6460
|
+
const refs = [];
|
|
6461
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6462
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6463
|
+
if (owned.length === 0) return {
|
|
6464
|
+
patch: input.patch,
|
|
6465
|
+
changedRefs: []
|
|
6466
|
+
};
|
|
6467
|
+
const pass = {
|
|
6468
|
+
secrets: input.secrets,
|
|
6469
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6470
|
+
operatorWrite: input.operatorWrite,
|
|
6471
|
+
changedRefs: []
|
|
6472
|
+
};
|
|
6473
|
+
const out = {};
|
|
6474
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6475
|
+
return {
|
|
6476
|
+
patch: out,
|
|
6477
|
+
changedRefs: pass.changedRefs
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6481
|
+
function isJsonEqual(a, b) {
|
|
6482
|
+
if (Object.is(a, b)) return true;
|
|
6483
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6484
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6485
|
+
const keys = Object.keys(a);
|
|
6486
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6487
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6308
6488
|
}
|
|
6309
6489
|
return false;
|
|
6310
6490
|
}
|
|
6491
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6492
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6493
|
+
const out = {};
|
|
6494
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6495
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6496
|
+
out[key] = value;
|
|
6497
|
+
}
|
|
6498
|
+
return out;
|
|
6499
|
+
}
|
|
6500
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6501
|
+
function markerKeysOf(blob, owner) {
|
|
6502
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6503
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6504
|
+
return keys;
|
|
6505
|
+
}
|
|
6506
|
+
function nodeFromStored(value, owner) {
|
|
6507
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6508
|
+
if (!isRecord$3(value)) return null;
|
|
6509
|
+
const children = /* @__PURE__ */ new Map();
|
|
6510
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6511
|
+
const node = nodeFromStored(child, owner);
|
|
6512
|
+
if (node !== null) children.set(key, node);
|
|
6513
|
+
}
|
|
6514
|
+
return children.size > 0 ? {
|
|
6515
|
+
kind: "object",
|
|
6516
|
+
children
|
|
6517
|
+
} : null;
|
|
6518
|
+
}
|
|
6519
|
+
/**
|
|
6520
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6521
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6522
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6523
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6524
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6525
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6526
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6527
|
+
* over.
|
|
6528
|
+
*/
|
|
6529
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6530
|
+
const added = /* @__PURE__ */ new Map();
|
|
6531
|
+
for (const key of keys) {
|
|
6532
|
+
const at = key.indexOf("@");
|
|
6533
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6534
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6535
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6536
|
+
if (node !== null) added.set(base, node);
|
|
6537
|
+
}
|
|
6538
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6539
|
+
}
|
|
6311
6540
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6312
6541
|
async function readStoredAddonBlob(raw) {
|
|
6313
6542
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6316,7 +6545,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6316
6545
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6317
6546
|
return result.kind === "missing" ? {} : result.value;
|
|
6318
6547
|
}
|
|
6319
|
-
function
|
|
6548
|
+
function touchesTree(tree, patch) {
|
|
6549
|
+
if (tree.size === 0) return false;
|
|
6550
|
+
for (const key of Object.keys(patch)) {
|
|
6551
|
+
const at = key.indexOf("@");
|
|
6552
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6553
|
+
}
|
|
6554
|
+
return false;
|
|
6555
|
+
}
|
|
6556
|
+
/**
|
|
6557
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6558
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6559
|
+
*/
|
|
6560
|
+
var MarkerKeyIndex = class {
|
|
6561
|
+
owner;
|
|
6562
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6563
|
+
constructor(owner) {
|
|
6564
|
+
this.owner = owner;
|
|
6565
|
+
}
|
|
6566
|
+
seen(store, blob) {
|
|
6567
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6568
|
+
}
|
|
6569
|
+
wrote(store, patch) {
|
|
6570
|
+
const keys = this.byStore.get(store);
|
|
6571
|
+
if (keys === void 0) return;
|
|
6572
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6573
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6574
|
+
else keys.delete(key);
|
|
6575
|
+
}
|
|
6576
|
+
mayHoldMarkers(store, patch) {
|
|
6577
|
+
const keys = this.byStore.get(store);
|
|
6578
|
+
if (keys === void 0) return true;
|
|
6579
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6580
|
+
}
|
|
6581
|
+
};
|
|
6582
|
+
function createHandle(raw, opts) {
|
|
6320
6583
|
const chains = /* @__PURE__ */ new Map();
|
|
6321
6584
|
const serialize = (key, fn) => {
|
|
6322
6585
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6327,46 +6590,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6327
6590
|
});
|
|
6328
6591
|
return next;
|
|
6329
6592
|
};
|
|
6330
|
-
const
|
|
6331
|
-
|
|
6332
|
-
|
|
6593
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6594
|
+
const resolveRead = async (store, blob) => {
|
|
6595
|
+
index.seen(store, blob);
|
|
6596
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6597
|
+
unresolved: "keep-marker",
|
|
6598
|
+
ownedBy: opts.secrets.owner
|
|
6599
|
+
});
|
|
6600
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6601
|
+
return value;
|
|
6602
|
+
};
|
|
6603
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6604
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6605
|
+
await rawWrite(patch);
|
|
6606
|
+
index.wrote(store, patch);
|
|
6607
|
+
return { changed: true };
|
|
6608
|
+
}
|
|
6609
|
+
return serialize(store, async () => {
|
|
6333
6610
|
const stored = await readStored();
|
|
6611
|
+
index.seen(store, stored);
|
|
6612
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6613
|
+
const restored = await restoreUnchangedSecrets({
|
|
6614
|
+
patch,
|
|
6615
|
+
stored,
|
|
6616
|
+
secrets: opts.secrets,
|
|
6617
|
+
operatorWrite
|
|
6618
|
+
});
|
|
6334
6619
|
const result = await transformSecretWrite({
|
|
6335
|
-
tree,
|
|
6620
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6336
6621
|
secrets: opts.secrets,
|
|
6337
|
-
patch,
|
|
6622
|
+
patch: restored.patch,
|
|
6338
6623
|
stored,
|
|
6339
6624
|
...scope !== void 0 ? { scope } : {},
|
|
6340
|
-
operatorWrite
|
|
6625
|
+
operatorWrite
|
|
6341
6626
|
});
|
|
6342
|
-
|
|
6627
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6628
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6629
|
+
if (wroteBlob) {
|
|
6630
|
+
await rawWrite(effective);
|
|
6631
|
+
index.wrote(store, effective);
|
|
6632
|
+
}
|
|
6343
6633
|
const { orphaned } = await result.afterWrite();
|
|
6344
6634
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6635
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6345
6636
|
});
|
|
6346
6637
|
};
|
|
6347
|
-
const
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6638
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6639
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6640
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6641
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6642
|
+
const overrides = {
|
|
6643
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6644
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6645
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6646
|
+
return result.kind === "value" ? {
|
|
6647
|
+
kind: "value",
|
|
6648
|
+
value: await resolveRead("addon", result.value)
|
|
6649
|
+
} : result;
|
|
6650
|
+
} } : {},
|
|
6651
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6652
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6653
|
+
if (result.kind !== "present") return result;
|
|
6654
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6655
|
+
unresolved: "keep-marker",
|
|
6656
|
+
ownedBy: opts.secrets.owner
|
|
6657
|
+
});
|
|
6658
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6659
|
+
return {
|
|
6660
|
+
kind: "present",
|
|
6661
|
+
value: value[key]
|
|
6662
|
+
};
|
|
6663
|
+
} } : {},
|
|
6664
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6665
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6666
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6667
|
+
const out = /* @__PURE__ */ new Map();
|
|
6668
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6669
|
+
return out;
|
|
6670
|
+
} } : {},
|
|
6671
|
+
writeAddonStore: async (patch) => {
|
|
6672
|
+
await writeAddon(patch);
|
|
6673
|
+
},
|
|
6674
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6675
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6676
|
+
kind: "device",
|
|
6677
|
+
deviceId
|
|
6678
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6679
|
+
}
|
|
6680
|
+
};
|
|
6681
|
+
return {
|
|
6682
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6683
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6684
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6685
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6686
|
+
} }),
|
|
6687
|
+
raw: {
|
|
6688
|
+
readAddonStore: async () => {
|
|
6689
|
+
const blob = await raw.readAddonStore();
|
|
6690
|
+
index.seen("addon", blob);
|
|
6691
|
+
return blob;
|
|
6692
|
+
},
|
|
6693
|
+
readDeviceStore: async (deviceId) => {
|
|
6694
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6695
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6696
|
+
return blob;
|
|
6697
|
+
}
|
|
6698
|
+
},
|
|
6699
|
+
writeAddonStore: writeAddon
|
|
6353
6700
|
};
|
|
6354
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6355
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6356
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6357
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6358
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6359
|
-
} });
|
|
6360
6701
|
}
|
|
6361
|
-
/** The context the addon sees
|
|
6362
|
-
function
|
|
6702
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6703
|
+
function createSecretAwareContext(context, opts) {
|
|
6363
6704
|
const raw = context.settings;
|
|
6364
|
-
if (raw === void 0) return
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6705
|
+
if (raw === void 0) return {
|
|
6706
|
+
context,
|
|
6707
|
+
handle: null
|
|
6708
|
+
};
|
|
6709
|
+
const handle = createHandle(raw, opts);
|
|
6710
|
+
return {
|
|
6711
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6712
|
+
if (prop === "settings") return handle.settings;
|
|
6713
|
+
return Reflect.get(target, prop, receiver);
|
|
6714
|
+
} }),
|
|
6715
|
+
handle
|
|
6716
|
+
};
|
|
6370
6717
|
}
|
|
6371
6718
|
var LEAF = { kind: "leaf" };
|
|
6372
6719
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6541,6 +6888,14 @@ var BaseAddon = class {
|
|
|
6541
6888
|
_secretChangeUnsub = null;
|
|
6542
6889
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6543
6890
|
_operatorWriteDepth = 0;
|
|
6891
|
+
/**
|
|
6892
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6893
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6894
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6895
|
+
*/
|
|
6896
|
+
_secretSettings = null;
|
|
6897
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6898
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6544
6899
|
constructor(defaults) {
|
|
6545
6900
|
this.defaults = defaults;
|
|
6546
6901
|
this._config = { ...defaults };
|
|
@@ -6577,13 +6932,21 @@ var BaseAddon = class {
|
|
|
6577
6932
|
}
|
|
6578
6933
|
async initialize(context) {
|
|
6579
6934
|
const secrets = context.secrets;
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6935
|
+
if (secrets !== void 0) {
|
|
6936
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6937
|
+
secrets,
|
|
6938
|
+
addonTree: () => this.addonSecretTree(),
|
|
6939
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6940
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6941
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6942
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6943
|
+
});
|
|
6944
|
+
this._ctx = wrapped;
|
|
6945
|
+
this._secretSettings = handle;
|
|
6946
|
+
} else {
|
|
6947
|
+
this._ctx = context;
|
|
6948
|
+
this._secretSettings = null;
|
|
6949
|
+
}
|
|
6587
6950
|
await this.resolveConfig();
|
|
6588
6951
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6589
6952
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6700,11 +7063,8 @@ var BaseAddon = class {
|
|
|
6700
7063
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6701
7064
|
const schema = this.globalSettingsSchema(cap);
|
|
6702
7065
|
if (!schema) return { sections: [] };
|
|
6703
|
-
const projected = await this.
|
|
6704
|
-
return hydrateSchema(schema, overlay ? {
|
|
6705
|
-
...projected,
|
|
6706
|
-
...overlay
|
|
6707
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7066
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7067
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6708
7068
|
}
|
|
6709
7069
|
/**
|
|
6710
7070
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6749,7 +7109,7 @@ var BaseAddon = class {
|
|
|
6749
7109
|
});
|
|
6750
7110
|
}
|
|
6751
7111
|
if (sections.length === 0) return null;
|
|
6752
|
-
const projected = await this.
|
|
7112
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6753
7113
|
return hydrateSchema({
|
|
6754
7114
|
...schema,
|
|
6755
7115
|
sections
|
|
@@ -6766,12 +7126,50 @@ var BaseAddon = class {
|
|
|
6766
7126
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6767
7127
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6768
7128
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7129
|
+
*
|
|
7130
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7131
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7132
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7133
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7134
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7135
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6769
7136
|
*/
|
|
6770
7137
|
async resolveGlobalStore(nodeId, cap) {
|
|
6771
7138
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7139
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7140
|
+
}
|
|
7141
|
+
projectForNode(store, nodeId, cap) {
|
|
6772
7142
|
const keys = this.perNodeKeys(cap);
|
|
6773
7143
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6774
|
-
return keys.size > 0 ? projectStore(
|
|
7144
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7145
|
+
}
|
|
7146
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7147
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7148
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7149
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7150
|
+
}
|
|
7151
|
+
/**
|
|
7152
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7153
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7154
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7155
|
+
* its value.
|
|
7156
|
+
*/
|
|
7157
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7158
|
+
const secrets = this._ctx?.secrets;
|
|
7159
|
+
const merged = {
|
|
7160
|
+
...stored,
|
|
7161
|
+
...overlay
|
|
7162
|
+
};
|
|
7163
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7164
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7165
|
+
unresolved: "keep-marker",
|
|
7166
|
+
ownedBy: secrets.owner
|
|
7167
|
+
});
|
|
7168
|
+
for (const key of Object.keys(overlay)) {
|
|
7169
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7170
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7171
|
+
}
|
|
7172
|
+
return merged;
|
|
6775
7173
|
}
|
|
6776
7174
|
/**
|
|
6777
7175
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6836,8 +7234,12 @@ var BaseAddon = class {
|
|
|
6836
7234
|
async clearSecrets(keys, nodeId) {
|
|
6837
7235
|
const tree = this.addonSecretTree();
|
|
6838
7236
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7237
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6839
7238
|
const patch = {};
|
|
6840
|
-
for (const key of keys)
|
|
7239
|
+
for (const key of keys) {
|
|
7240
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7241
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7242
|
+
}
|
|
6841
7243
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6842
7244
|
}
|
|
6843
7245
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6845,7 +7247,11 @@ var BaseAddon = class {
|
|
|
6845
7247
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6846
7248
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6847
7249
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6848
|
-
|
|
7250
|
+
const handle = this._secretSettings;
|
|
7251
|
+
if (handle !== null) {
|
|
7252
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7253
|
+
if (!changed) return;
|
|
7254
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6849
7255
|
if (target !== localNode) return;
|
|
6850
7256
|
await this.resolveConfig();
|
|
6851
7257
|
await this.onConfigChanged();
|
|
@@ -6898,7 +7304,7 @@ var BaseAddon = class {
|
|
|
6898
7304
|
async getDeviceSettings(deviceId) {
|
|
6899
7305
|
const schema = this.deviceSettingsSchema();
|
|
6900
7306
|
if (!schema) return { sections: [] };
|
|
6901
|
-
return hydrateSchema(schema, await this.
|
|
7307
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6902
7308
|
}
|
|
6903
7309
|
async updateDeviceSettings(deviceId, patch) {
|
|
6904
7310
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7070,7 +7476,7 @@ var BaseAddon = class {
|
|
|
7070
7476
|
key,
|
|
7071
7477
|
schema,
|
|
7072
7478
|
fallback,
|
|
7073
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7479
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7074
7480
|
write: async (patch) => {
|
|
7075
7481
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7076
7482
|
},
|
|
@@ -7132,6 +7538,23 @@ var BaseAddon = class {
|
|
|
7132
7538
|
}
|
|
7133
7539
|
return value;
|
|
7134
7540
|
}
|
|
7541
|
+
/**
|
|
7542
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7543
|
+
* keychain the context's own view is already raw.
|
|
7544
|
+
*/
|
|
7545
|
+
rawSettings() {
|
|
7546
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7547
|
+
}
|
|
7548
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7549
|
+
logUnresolvedRead(unresolved) {
|
|
7550
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7551
|
+
if (fresh.length === 0) return;
|
|
7552
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7553
|
+
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) => ({
|
|
7554
|
+
ref: u.ref,
|
|
7555
|
+
reason: u.reason
|
|
7556
|
+
})) } });
|
|
7557
|
+
}
|
|
7135
7558
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7136
7559
|
scheduleSecretReresolve(delayMs) {
|
|
7137
7560
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7158,7 +7581,7 @@ var BaseAddon = class {
|
|
|
7158
7581
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7159
7582
|
*/
|
|
7160
7583
|
async readAddonStoreWithRetry() {
|
|
7161
|
-
const settings = this.
|
|
7584
|
+
const settings = this.rawSettings();
|
|
7162
7585
|
if (!settings) return {};
|
|
7163
7586
|
const delaysMs = [
|
|
7164
7587
|
150,
|
|
@@ -9461,6 +9884,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9461
9884
|
fetchedAt: number()
|
|
9462
9885
|
});
|
|
9463
9886
|
/**
|
|
9887
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9888
|
+
* gets back (cloud training, D805+).
|
|
9889
|
+
*
|
|
9890
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9891
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9892
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9893
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9894
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9895
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9896
|
+
* change there, in the same piece of work.
|
|
9897
|
+
*
|
|
9898
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9899
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9900
|
+
*/
|
|
9901
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9902
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9903
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9904
|
+
var TrainingExportSchema = _enum([
|
|
9905
|
+
"onnx",
|
|
9906
|
+
"openvino-fp16",
|
|
9907
|
+
"openvino-int8",
|
|
9908
|
+
"coreml-fp16"
|
|
9909
|
+
]);
|
|
9910
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9911
|
+
object({
|
|
9912
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9913
|
+
jobKey: string().uuid(),
|
|
9914
|
+
target: object({
|
|
9915
|
+
kind: literal("detector"),
|
|
9916
|
+
step: literal("object-detection")
|
|
9917
|
+
}),
|
|
9918
|
+
base: object({
|
|
9919
|
+
modelId: string().min(1),
|
|
9920
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9921
|
+
weights: string().min(1),
|
|
9922
|
+
imgsz: number().int().positive()
|
|
9923
|
+
}),
|
|
9924
|
+
baseline: object({
|
|
9925
|
+
modelId: string().min(1),
|
|
9926
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9927
|
+
onnxUrl: string().url(),
|
|
9928
|
+
imgsz: number().int().positive(),
|
|
9929
|
+
floors: FloorsSchema
|
|
9930
|
+
}),
|
|
9931
|
+
dataset: object({
|
|
9932
|
+
versionId: string().min(1),
|
|
9933
|
+
annotationHash: string(),
|
|
9934
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9935
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9936
|
+
}),
|
|
9937
|
+
split: object({
|
|
9938
|
+
holdoutCameras: array(number().int()),
|
|
9939
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9940
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9941
|
+
valFraction: number().min(0).max(.5),
|
|
9942
|
+
seed: number().int()
|
|
9943
|
+
}),
|
|
9944
|
+
hyper: object({
|
|
9945
|
+
epochs: number().int().positive(),
|
|
9946
|
+
batch: number().int().positive(),
|
|
9947
|
+
lr0: number().positive(),
|
|
9948
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9949
|
+
freeze: number().int().nonnegative(),
|
|
9950
|
+
patience: number().int().nonnegative(),
|
|
9951
|
+
seed: number().int()
|
|
9952
|
+
}),
|
|
9953
|
+
replay: object({
|
|
9954
|
+
source: literal("coco2017"),
|
|
9955
|
+
count: number().int().nonnegative()
|
|
9956
|
+
}),
|
|
9957
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9958
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9959
|
+
floors: object({
|
|
9960
|
+
minSupport: number().int().positive(),
|
|
9961
|
+
clamp: number().min(0).max(1)
|
|
9962
|
+
}),
|
|
9963
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9964
|
+
catalog: object({
|
|
9965
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9966
|
+
name: string().min(1).max(160)
|
|
9967
|
+
})
|
|
9968
|
+
});
|
|
9969
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9970
|
+
var TrainingResultFileSchema = object({
|
|
9971
|
+
path: string().min(1),
|
|
9972
|
+
bytes: number().int().nonnegative(),
|
|
9973
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9974
|
+
format: _enum([
|
|
9975
|
+
"onnx",
|
|
9976
|
+
"openvino",
|
|
9977
|
+
"coreml",
|
|
9978
|
+
"pt"
|
|
9979
|
+
]),
|
|
9980
|
+
variant: _enum(["base", "int8"])
|
|
9981
|
+
});
|
|
9982
|
+
var DraftFormatSchema = object({
|
|
9983
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9984
|
+
url: string().min(1),
|
|
9985
|
+
sizeMB: number().nonnegative(),
|
|
9986
|
+
isDirectory: boolean().optional(),
|
|
9987
|
+
files: array(string()).optional(),
|
|
9988
|
+
runtimes: array(literal("python")).optional(),
|
|
9989
|
+
revision: string().min(1)
|
|
9990
|
+
});
|
|
9991
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9992
|
+
var TrainingCatalogDraftSchema = object({
|
|
9993
|
+
id: string().min(1),
|
|
9994
|
+
name: string().min(1),
|
|
9995
|
+
description: string(),
|
|
9996
|
+
labels: array(unknown()),
|
|
9997
|
+
inputSize: object({
|
|
9998
|
+
width: number().int().positive(),
|
|
9999
|
+
height: number().int().positive()
|
|
10000
|
+
}),
|
|
10001
|
+
preprocessMode: literal("letterbox"),
|
|
10002
|
+
defaultClassFloors: FloorsSchema,
|
|
10003
|
+
formats: object({
|
|
10004
|
+
onnx: DraftFormatSchema.optional(),
|
|
10005
|
+
openvino: DraftFormatSchema.optional(),
|
|
10006
|
+
coreml: DraftFormatSchema.optional()
|
|
10007
|
+
})
|
|
10008
|
+
});
|
|
10009
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10010
|
+
var TrainingEvalClassSchema = object({
|
|
10011
|
+
positives: number().int(),
|
|
10012
|
+
floor: number().nullable(),
|
|
10013
|
+
tp: number().int(),
|
|
10014
|
+
fp: number().int(),
|
|
10015
|
+
fn: number().int(),
|
|
10016
|
+
precision: number().nullable(),
|
|
10017
|
+
recall: number().nullable(),
|
|
10018
|
+
ap50: number().nullable(),
|
|
10019
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10020
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10021
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10022
|
+
smallFound: number().int().optional(),
|
|
10023
|
+
smallTotal: number().int().optional()
|
|
10024
|
+
}).passthrough();
|
|
10025
|
+
var TrainingEvalReportSchema = object({
|
|
10026
|
+
frames: number().int(),
|
|
10027
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10028
|
+
}).passthrough();
|
|
10029
|
+
/**
|
|
10030
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10031
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10032
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10033
|
+
*/
|
|
10034
|
+
var TrainingResultSchema = object({
|
|
10035
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10036
|
+
jobKey: string(),
|
|
10037
|
+
status: _enum(["succeeded", "failed"]),
|
|
10038
|
+
error: object({
|
|
10039
|
+
stage: string(),
|
|
10040
|
+
code: string(),
|
|
10041
|
+
message: string()
|
|
10042
|
+
}).nullable(),
|
|
10043
|
+
trainer: object({
|
|
10044
|
+
version: string(),
|
|
10045
|
+
revision: string()
|
|
10046
|
+
}),
|
|
10047
|
+
toolchain: record(string(), string().nullable()),
|
|
10048
|
+
dataset: object({
|
|
10049
|
+
versionId: string(),
|
|
10050
|
+
annotationHash: string(),
|
|
10051
|
+
sha256: string(),
|
|
10052
|
+
frames: object({
|
|
10053
|
+
train: number().int(),
|
|
10054
|
+
val: number().int(),
|
|
10055
|
+
holdout: number().int()
|
|
10056
|
+
}),
|
|
10057
|
+
holdoutCameras: array(number().int()),
|
|
10058
|
+
replayImages: number().int()
|
|
10059
|
+
}).optional(),
|
|
10060
|
+
training: object({
|
|
10061
|
+
epochsRun: number().int(),
|
|
10062
|
+
bestEpoch: number().int(),
|
|
10063
|
+
bestMap50: number(),
|
|
10064
|
+
bestMap50_95: number(),
|
|
10065
|
+
seconds: number()
|
|
10066
|
+
}).optional(),
|
|
10067
|
+
evaluation: object({
|
|
10068
|
+
holdoutFrames: number().int(),
|
|
10069
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10070
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10071
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10072
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10073
|
+
map50: record(string(), number().nullable())
|
|
10074
|
+
}).optional(),
|
|
10075
|
+
floors: object({
|
|
10076
|
+
baseline: FloorsSchema,
|
|
10077
|
+
candidate: FloorsSchema,
|
|
10078
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10079
|
+
notes: array(string())
|
|
10080
|
+
}).optional(),
|
|
10081
|
+
int8: object({
|
|
10082
|
+
kept: boolean(),
|
|
10083
|
+
map50Fp16: number().nullable(),
|
|
10084
|
+
map50Int8: number().nullable(),
|
|
10085
|
+
reason: string().nullable()
|
|
10086
|
+
}).optional(),
|
|
10087
|
+
exportsDropped: array(object({
|
|
10088
|
+
export: string(),
|
|
10089
|
+
reason: string()
|
|
10090
|
+
})).optional(),
|
|
10091
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10092
|
+
bundle: object({
|
|
10093
|
+
path: literal("bundle.tar"),
|
|
10094
|
+
bytes: number().int().nonnegative(),
|
|
10095
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10096
|
+
}).nullable().optional(),
|
|
10097
|
+
catalogDraft: object({
|
|
10098
|
+
base: TrainingCatalogDraftSchema,
|
|
10099
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10100
|
+
}).nullable().optional(),
|
|
10101
|
+
licence: string()
|
|
10102
|
+
});
|
|
10103
|
+
var TrainingStageSchema = _enum([
|
|
10104
|
+
"prepare",
|
|
10105
|
+
"replay",
|
|
10106
|
+
"train",
|
|
10107
|
+
"eval",
|
|
10108
|
+
"export",
|
|
10109
|
+
"package"
|
|
10110
|
+
]);
|
|
10111
|
+
var EventBase = {
|
|
10112
|
+
v: literal(1),
|
|
10113
|
+
ts: number()
|
|
10114
|
+
};
|
|
10115
|
+
discriminatedUnion("type", [
|
|
10116
|
+
object({
|
|
10117
|
+
...EventBase,
|
|
10118
|
+
type: literal("stage"),
|
|
10119
|
+
stage: TrainingStageSchema
|
|
10120
|
+
}),
|
|
10121
|
+
object({
|
|
10122
|
+
...EventBase,
|
|
10123
|
+
type: literal("epoch"),
|
|
10124
|
+
epoch: number().int(),
|
|
10125
|
+
epochs: number().int(),
|
|
10126
|
+
boxLoss: number().nullable().optional(),
|
|
10127
|
+
map50: number().nullable().optional(),
|
|
10128
|
+
map50_95: number().nullable().optional(),
|
|
10129
|
+
etaSec: number().nullable().optional()
|
|
10130
|
+
}),
|
|
10131
|
+
object({
|
|
10132
|
+
...EventBase,
|
|
10133
|
+
type: literal("metric"),
|
|
10134
|
+
name: string(),
|
|
10135
|
+
value: number()
|
|
10136
|
+
}),
|
|
10137
|
+
object({
|
|
10138
|
+
...EventBase,
|
|
10139
|
+
type: literal("artifact"),
|
|
10140
|
+
path: string(),
|
|
10141
|
+
bytes: number(),
|
|
10142
|
+
sha256: string()
|
|
10143
|
+
}),
|
|
10144
|
+
object({
|
|
10145
|
+
...EventBase,
|
|
10146
|
+
type: literal("done"),
|
|
10147
|
+
status: _enum(["succeeded", "failed"]),
|
|
10148
|
+
resultSha256: string().nullable().optional()
|
|
10149
|
+
}),
|
|
10150
|
+
object({
|
|
10151
|
+
...EventBase,
|
|
10152
|
+
type: literal("error"),
|
|
10153
|
+
stage: string(),
|
|
10154
|
+
code: string(),
|
|
10155
|
+
message: string()
|
|
10156
|
+
})
|
|
10157
|
+
]);
|
|
10158
|
+
/**
|
|
9464
10159
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9465
10160
|
*
|
|
9466
10161
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11788,7 +12483,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11788
12483
|
"authenticated",
|
|
11789
12484
|
"admin"
|
|
11790
12485
|
]).optional(),
|
|
11791
|
-
description: string().optional()
|
|
12486
|
+
description: string().optional(),
|
|
12487
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12488
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11792
12489
|
});
|
|
11793
12490
|
/**
|
|
11794
12491
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -12493,6 +13190,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
12493
13190
|
lastError: string().optional()
|
|
12494
13191
|
});
|
|
12495
13192
|
/**
|
|
13193
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13194
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13195
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13196
|
+
* with it off — which restores without a key.
|
|
13197
|
+
*/
|
|
13198
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13199
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13200
|
+
scheme: string(),
|
|
13201
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13202
|
+
keyId: string()
|
|
13203
|
+
});
|
|
13204
|
+
/**
|
|
13205
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13206
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13207
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13208
|
+
*/
|
|
13209
|
+
var BackupEncryptionStatusSchema = object({
|
|
13210
|
+
enabled: boolean(),
|
|
13211
|
+
active: object({
|
|
13212
|
+
keyId: string(),
|
|
13213
|
+
publicKey: string(),
|
|
13214
|
+
createdAt: number()
|
|
13215
|
+
}).nullable(),
|
|
13216
|
+
/** Every key ever set up, newest first. */
|
|
13217
|
+
keys: array(object({
|
|
13218
|
+
keyId: string(),
|
|
13219
|
+
createdAt: number(),
|
|
13220
|
+
retiredAt: number().nullable()
|
|
13221
|
+
})).readonly()
|
|
13222
|
+
});
|
|
13223
|
+
/**
|
|
12496
13224
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
12497
13225
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
12498
13226
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -12504,7 +13232,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
12504
13232
|
sizeBytes: number(),
|
|
12505
13233
|
label: string().optional(),
|
|
12506
13234
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
12507
|
-
locations: array(string()).readonly()
|
|
13235
|
+
locations: array(string()).readonly(),
|
|
13236
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13237
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12508
13238
|
});
|
|
12509
13239
|
var BackupEntrySchema = object({
|
|
12510
13240
|
id: string(),
|
|
@@ -12513,7 +13243,8 @@ var BackupEntrySchema = object({
|
|
|
12513
13243
|
label: string().optional(),
|
|
12514
13244
|
createdAt: number(),
|
|
12515
13245
|
sizeBytes: number(),
|
|
12516
|
-
locations: array(string()).optional()
|
|
13246
|
+
locations: array(string()).optional(),
|
|
13247
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
12517
13248
|
});
|
|
12518
13249
|
var ArchiveEntrySchema = object({
|
|
12519
13250
|
path: string(),
|
|
@@ -12702,10 +13433,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12702
13433
|
* this list and skips entries whose path doesn't start with
|
|
12703
13434
|
* any of them.
|
|
12704
13435
|
*/
|
|
12705
|
-
locations: array(string()).optional()
|
|
13436
|
+
locations: array(string()).optional(),
|
|
13437
|
+
/**
|
|
13438
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13439
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13440
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13441
|
+
* is refused before the archive is downloaded.
|
|
13442
|
+
*/
|
|
13443
|
+
backupSecretKey: string().optional()
|
|
12706
13444
|
}), _void(), {
|
|
12707
13445
|
kind: "mutation",
|
|
12708
13446
|
auth: "admin"
|
|
13447
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13448
|
+
keyId: string(),
|
|
13449
|
+
secretKey: string(),
|
|
13450
|
+
publicKey: string(),
|
|
13451
|
+
createdAt: number(),
|
|
13452
|
+
replacedKeyId: string().nullable()
|
|
13453
|
+
}), {
|
|
13454
|
+
kind: "mutation",
|
|
13455
|
+
auth: "admin"
|
|
13456
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13457
|
+
kind: "mutation",
|
|
13458
|
+
auth: "admin"
|
|
13459
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13460
|
+
valid: boolean(),
|
|
13461
|
+
keyId: string().nullable(),
|
|
13462
|
+
/** The hub knows this key (active or retired). */
|
|
13463
|
+
known: boolean(),
|
|
13464
|
+
/** It is the key new archives are encrypted to. */
|
|
13465
|
+
active: boolean(),
|
|
13466
|
+
error: string().optional()
|
|
13467
|
+
}), {
|
|
13468
|
+
kind: "mutation",
|
|
13469
|
+
auth: "admin"
|
|
12709
13470
|
}), method(object({
|
|
12710
13471
|
destinationId: string(),
|
|
12711
13472
|
backupId: string()
|
|
@@ -14480,7 +15241,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
14480
15241
|
stepId: string(),
|
|
14481
15242
|
entry: ModelCatalogEntrySchema
|
|
14482
15243
|
});
|
|
14483
|
-
|
|
15244
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15245
|
+
var ModelBundleFileSchema = object({
|
|
15246
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15247
|
+
path: string().min(1),
|
|
15248
|
+
bytes: number().int().nonnegative(),
|
|
15249
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15250
|
+
});
|
|
15251
|
+
var ImportModelBundleInputSchema = object({
|
|
15252
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15253
|
+
addonId: string(),
|
|
15254
|
+
stepId: string().min(1),
|
|
15255
|
+
/**
|
|
15256
|
+
* The catalog rows to register, complete, every format URL already
|
|
15257
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15258
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15259
|
+
*/
|
|
15260
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15261
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15262
|
+
bundle: object({
|
|
15263
|
+
ticket: PeerBytesTicketSchema,
|
|
15264
|
+
bytes: number().int().positive(),
|
|
15265
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15266
|
+
}),
|
|
15267
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15268
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15269
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15270
|
+
distribute: boolean()
|
|
15271
|
+
});
|
|
15272
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15273
|
+
kind: literal("imported"),
|
|
15274
|
+
modelIds: array(string()).readonly(),
|
|
15275
|
+
distributed: array(object({
|
|
15276
|
+
modelId: string(),
|
|
15277
|
+
nodeId: string(),
|
|
15278
|
+
format: _enum(MODEL_FORMATS),
|
|
15279
|
+
ok: boolean(),
|
|
15280
|
+
error: string().optional()
|
|
15281
|
+
})).readonly()
|
|
15282
|
+
}), object({
|
|
15283
|
+
kind: literal("refused"),
|
|
15284
|
+
reason: _enum([
|
|
15285
|
+
"transfer-failed",
|
|
15286
|
+
"checksum-mismatch",
|
|
15287
|
+
"bundle-mismatch",
|
|
15288
|
+
"invalid-entry",
|
|
15289
|
+
"id-taken"
|
|
15290
|
+
]),
|
|
15291
|
+
detail: string()
|
|
15292
|
+
})]);
|
|
15293
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15294
|
+
kind: "mutation",
|
|
15295
|
+
auth: "admin",
|
|
15296
|
+
timeoutMs: 30 * 6e4
|
|
15297
|
+
});
|
|
14484
15298
|
/**
|
|
14485
15299
|
* Query filter for settings-store collections.
|
|
14486
15300
|
*/
|
|
@@ -14959,6 +15773,35 @@ var KeychainKeySourceSchema = object({
|
|
|
14959
15773
|
*/
|
|
14960
15774
|
sharesBackupWithDatabase: boolean()
|
|
14961
15775
|
});
|
|
15776
|
+
/**
|
|
15777
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15778
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15779
|
+
*/
|
|
15780
|
+
var KeychainResetRecordSchema = object({
|
|
15781
|
+
id: string(),
|
|
15782
|
+
at: number(),
|
|
15783
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15784
|
+
actor: string(),
|
|
15785
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15786
|
+
lockedReason: string().nullable(),
|
|
15787
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15788
|
+
archived: number().int(),
|
|
15789
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15790
|
+
archivedCollection: string().nullable(),
|
|
15791
|
+
/**
|
|
15792
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15793
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15794
|
+
*/
|
|
15795
|
+
archivedKeysCollection: string().nullable(),
|
|
15796
|
+
/**
|
|
15797
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15798
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15799
|
+
* agent forever (D797).
|
|
15800
|
+
*/
|
|
15801
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15802
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15803
|
+
acknowledgedAt: number().nullable()
|
|
15804
|
+
});
|
|
14962
15805
|
var KeychainStatusSchema = object({
|
|
14963
15806
|
keychain: KeychainStateSchema,
|
|
14964
15807
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -14976,7 +15819,9 @@ var KeychainStatusSchema = object({
|
|
|
14976
15819
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14977
15820
|
retiredWraps: number().int(),
|
|
14978
15821
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
14979
|
-
secretCount: number().int()
|
|
15822
|
+
secretCount: number().int(),
|
|
15823
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15824
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
14980
15825
|
});
|
|
14981
15826
|
/**
|
|
14982
15827
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -14998,17 +15843,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
14998
15843
|
"download-recovery-key",
|
|
14999
15844
|
"delete-orphans",
|
|
15000
15845
|
"reset",
|
|
15846
|
+
"acknowledge-reset",
|
|
15001
15847
|
"initialize"
|
|
15002
15848
|
]);
|
|
15003
15849
|
var KeychainAuditEntrySchema = object({
|
|
15004
15850
|
id: string(),
|
|
15005
15851
|
at: number(),
|
|
15006
15852
|
action: KeychainAuditActionSchema,
|
|
15007
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15853
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15008
15854
|
actor: string(),
|
|
15009
15855
|
ref: string().nullable(),
|
|
15010
15856
|
detail: string().nullable()
|
|
15011
15857
|
});
|
|
15858
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15859
|
+
/**
|
|
15860
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15861
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15862
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15863
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15864
|
+
*/
|
|
15865
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15012
15866
|
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({
|
|
15013
15867
|
value: string(),
|
|
15014
15868
|
version: number().int()
|
|
@@ -15016,6 +15870,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15016
15870
|
kind: "mutation",
|
|
15017
15871
|
auth: "admin",
|
|
15018
15872
|
caller: "required"
|
|
15873
|
+
}), method(object({
|
|
15874
|
+
name: SystemHeldSecretNameSchema,
|
|
15875
|
+
value: string().min(16)
|
|
15876
|
+
}), object({
|
|
15877
|
+
ref: string(),
|
|
15878
|
+
version: number().int()
|
|
15879
|
+
}), {
|
|
15880
|
+
kind: "mutation",
|
|
15881
|
+
auth: "admin",
|
|
15882
|
+
caller: "required"
|
|
15019
15883
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15020
15884
|
deleted: array(string()).readonly(),
|
|
15021
15885
|
kept: array(object({
|
|
@@ -15045,13 +15909,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15045
15909
|
kind: "mutation",
|
|
15046
15910
|
auth: "admin",
|
|
15047
15911
|
caller: "required"
|
|
15048
|
-
}), method(object({ confirm: literal(
|
|
15912
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15049
15913
|
archivedCollection: string().nullable(),
|
|
15050
15914
|
archived: number().int()
|
|
15051
15915
|
}), {
|
|
15052
15916
|
kind: "mutation",
|
|
15053
15917
|
auth: "admin",
|
|
15054
15918
|
caller: "required"
|
|
15919
|
+
}), method(object({}), object({
|
|
15920
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15921
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15922
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15923
|
+
kind: "mutation",
|
|
15924
|
+
auth: "admin",
|
|
15925
|
+
caller: "required"
|
|
15055
15926
|
});
|
|
15056
15927
|
method(_void(), object({
|
|
15057
15928
|
id: string(),
|
|
@@ -18015,7 +18886,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18015
18886
|
* `login-method` — collection cap through which auth addons contribute
|
|
18016
18887
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18017
18888
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18018
|
-
* every auth addon (OIDC,
|
|
18889
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18019
18890
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18020
18891
|
* procedure aggregates them for the unauthenticated login page.
|
|
18021
18892
|
*
|
|
@@ -18023,8 +18894,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18023
18894
|
*
|
|
18024
18895
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18025
18896
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18026
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18027
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18897
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18028
18898
|
* login page needs NO change.
|
|
18029
18899
|
*
|
|
18030
18900
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18043,8 +18913,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18043
18913
|
* decision.
|
|
18044
18914
|
*
|
|
18045
18915
|
* Every contribution carries a `stage`:
|
|
18046
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18047
|
-
*
|
|
18916
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18917
|
+
* buttons; a usernameless passkey).
|
|
18048
18918
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18049
18919
|
* returned `factors` (passkey-as-2FA today).
|
|
18050
18920
|
*
|
|
@@ -18071,7 +18941,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18071
18941
|
* The provider names an external identity a signed-in user can link to
|
|
18072
18942
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18073
18943
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18074
|
-
* whatever their id. Absent / false — a login button only
|
|
18944
|
+
* whatever their id. Absent / false — a login button only.
|
|
18075
18945
|
*/
|
|
18076
18946
|
linkable: boolean().optional()
|
|
18077
18947
|
}),
|
|
@@ -21926,8 +22796,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21926
22796
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21927
22797
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21928
22798
|
* distinction was only ever used to route role-specific procedures
|
|
21929
|
-
* which we no longer have.
|
|
21930
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22799
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21931
22800
|
* with `isAdmin: false` + an explicit scope list.
|
|
21932
22801
|
*/
|
|
21933
22802
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -23602,6 +24471,9 @@ var RetrainExportFilterSchema = object({
|
|
|
23602
24471
|
frameIds: array(string()).max(2e4).optional(),
|
|
23603
24472
|
/** Only frames in at least one of these named collections. */
|
|
23604
24473
|
collectionIds: array(string()).max(200).optional(),
|
|
24474
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24475
|
+
* unknown id selects nothing. */
|
|
24476
|
+
datasetVersionId: string().optional(),
|
|
23605
24477
|
batchId: string().optional(),
|
|
23606
24478
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23607
24479
|
completeOnly: boolean().optional()
|
|
@@ -23769,6 +24641,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23769
24641
|
]),
|
|
23770
24642
|
detail: string().optional()
|
|
23771
24643
|
})]);
|
|
24644
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24645
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24646
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24647
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24648
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24649
|
+
});
|
|
24650
|
+
/** The counts a dataset is judged by. */
|
|
24651
|
+
var RetrainDatasetStatsSchema = object({
|
|
24652
|
+
frames: number().int(),
|
|
24653
|
+
completeFrames: number().int(),
|
|
24654
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24655
|
+
completeness: number(),
|
|
24656
|
+
/** Boxes to learn (model errors excluded). */
|
|
24657
|
+
subjects: number().int(),
|
|
24658
|
+
modelErrors: number().int(),
|
|
24659
|
+
/** Complete frames with no subject. */
|
|
24660
|
+
hardNegatives: number().int(),
|
|
24661
|
+
/** Subjects per class × camera × day/night. */
|
|
24662
|
+
cells: array(object({
|
|
24663
|
+
macroClass: string(),
|
|
24664
|
+
deviceId: number(),
|
|
24665
|
+
lighting: _enum([
|
|
24666
|
+
"day",
|
|
24667
|
+
"night",
|
|
24668
|
+
"unknown"
|
|
24669
|
+
]),
|
|
24670
|
+
subjects: number().int(),
|
|
24671
|
+
frames: number().int()
|
|
24672
|
+
})).readonly(),
|
|
24673
|
+
cameras: array(object({
|
|
24674
|
+
deviceId: number(),
|
|
24675
|
+
frames: number().int(),
|
|
24676
|
+
completeFrames: number().int()
|
|
24677
|
+
})).readonly()
|
|
24678
|
+
});
|
|
24679
|
+
/** An immutable dataset version, without its frame list. */
|
|
24680
|
+
var RetrainDatasetVersionSchema = object({
|
|
24681
|
+
id: string(),
|
|
24682
|
+
name: string(),
|
|
24683
|
+
createdAt: number(),
|
|
24684
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24685
|
+
layout: RetrainExportLayoutSchema,
|
|
24686
|
+
completeOnly: boolean(),
|
|
24687
|
+
frameCount: number().int(),
|
|
24688
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24689
|
+
annotationHash: string(),
|
|
24690
|
+
/** The export manifest schema the version was cut under. */
|
|
24691
|
+
manifestSchema: string(),
|
|
24692
|
+
stats: RetrainDatasetStatsSchema
|
|
24693
|
+
});
|
|
24694
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24695
|
+
kind: literal("created"),
|
|
24696
|
+
version: RetrainDatasetVersionSchema
|
|
24697
|
+
}), object({
|
|
24698
|
+
kind: literal("refused"),
|
|
24699
|
+
reason: _enum([
|
|
24700
|
+
"empty-name",
|
|
24701
|
+
"duplicate-name",
|
|
24702
|
+
"no-frames"
|
|
24703
|
+
])
|
|
24704
|
+
})]);
|
|
23772
24705
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23773
24706
|
var RetrainTransitionResultSchema = object({
|
|
23774
24707
|
trackId: string(),
|
|
@@ -24558,6 +25491,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24558
25491
|
kind: "mutation",
|
|
24559
25492
|
auth: "admin",
|
|
24560
25493
|
timeoutMs: 60 * 6e4
|
|
25494
|
+
}), method(object({
|
|
25495
|
+
filter: RetrainExportFilterSchema,
|
|
25496
|
+
layout: RetrainExportLayoutSchema
|
|
25497
|
+
}), object({
|
|
25498
|
+
ticket: PeerBytesTicketSchema,
|
|
25499
|
+
frames: number().int(),
|
|
25500
|
+
annotations: number().int()
|
|
25501
|
+
}), {
|
|
25502
|
+
kind: "mutation",
|
|
25503
|
+
auth: "admin",
|
|
25504
|
+
timeoutMs: 12e4
|
|
25505
|
+
}), method(object({
|
|
25506
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25507
|
+
completeOnly: boolean().optional()
|
|
25508
|
+
}), RetrainDatasetStatsSchema, {
|
|
25509
|
+
kind: "query",
|
|
25510
|
+
auth: "admin"
|
|
25511
|
+
}), method(object({
|
|
25512
|
+
name: string().max(120),
|
|
25513
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25514
|
+
layout: RetrainExportLayoutSchema,
|
|
25515
|
+
completeOnly: boolean()
|
|
25516
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25517
|
+
kind: "mutation",
|
|
25518
|
+
auth: "admin",
|
|
25519
|
+
timeoutMs: 12e4
|
|
25520
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25521
|
+
kind: "query",
|
|
25522
|
+
auth: "admin"
|
|
25523
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25524
|
+
kind: "mutation",
|
|
25525
|
+
auth: "admin"
|
|
25526
|
+
}), method(object({ id: string() }), object({
|
|
25527
|
+
found: boolean(),
|
|
25528
|
+
annotationHash: string(),
|
|
25529
|
+
matches: boolean(),
|
|
25530
|
+
missingFrames: number().int()
|
|
25531
|
+
}), {
|
|
25532
|
+
kind: "query",
|
|
25533
|
+
auth: "admin",
|
|
25534
|
+
timeoutMs: 12e4
|
|
24561
25535
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24562
25536
|
kind: "query",
|
|
24563
25537
|
auth: "admin"
|
|
@@ -25200,11 +26174,14 @@ var HardwareClassIdSchema = _enum([
|
|
|
25200
26174
|
"intel-n-series",
|
|
25201
26175
|
"apple-m-base",
|
|
25202
26176
|
"apple-m-pro",
|
|
26177
|
+
"amd-phoenix",
|
|
25203
26178
|
"unknown"
|
|
25204
26179
|
]);
|
|
25205
26180
|
var AcceleratorKindSchema = _enum([
|
|
25206
26181
|
"intel-npu",
|
|
25207
26182
|
"intel-igpu",
|
|
26183
|
+
"amd-igpu",
|
|
26184
|
+
"amd-npu",
|
|
25208
26185
|
"x86-cpu",
|
|
25209
26186
|
"arm-cpu",
|
|
25210
26187
|
"apple-ane",
|
|
@@ -28136,8 +29113,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28136
29113
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28137
29114
|
*
|
|
28138
29115
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28139
|
-
* one for transactional / one for notifications). Consumers (
|
|
28140
|
-
*
|
|
29116
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29117
|
+
* addons, …) walk the collection and pick the first
|
|
28141
29118
|
* ready provider OR target a specific addonId.
|
|
28142
29119
|
*
|
|
28143
29120
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28316,7 +29293,7 @@ targets: array(object({
|
|
|
28316
29293
|
})));
|
|
28317
29294
|
/**
|
|
28318
29295
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28319
|
-
* providers (OIDC, SAML,
|
|
29296
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28320
29297
|
* carrying the post-callback claims before redirecting back to
|
|
28321
29298
|
* `/api/auth/sso/finish`.
|
|
28322
29299
|
*
|
|
@@ -28379,7 +29356,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28379
29356
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28380
29357
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28381
29358
|
*/
|
|
28382
|
-
issuer: string().optional()
|
|
29359
|
+
issuer: string().optional(),
|
|
29360
|
+
/**
|
|
29361
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29362
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29363
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29364
|
+
* any other browser.
|
|
29365
|
+
*/
|
|
29366
|
+
browserBinding: string().optional()
|
|
28383
29367
|
});
|
|
28384
29368
|
method(object({
|
|
28385
29369
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -35815,7 +36799,13 @@ var TopologyNodeSchema = object({
|
|
|
35815
36799
|
})).readonly(),
|
|
35816
36800
|
processes: array(TopologyProcessSchema).readonly(),
|
|
35817
36801
|
categories: array(TopologyCategorySchema).readonly(),
|
|
35818
|
-
rootPackage: TopologyRootPackageSchema.nullable()
|
|
36802
|
+
rootPackage: TopologyRootPackageSchema.nullable(),
|
|
36803
|
+
/**
|
|
36804
|
+
* How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
|
|
36805
|
+
* completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
|
|
36806
|
+
* for offline rows and when the hub cannot tell.
|
|
36807
|
+
*/
|
|
36808
|
+
meshTransport: _enum(["tls", "clear"]).optional()
|
|
35819
36809
|
});
|
|
35820
36810
|
var CapUsageEdgeSchema = object({
|
|
35821
36811
|
callerAddonId: string(),
|
|
@@ -36785,7 +37775,15 @@ var GpuInfoSchema = object({
|
|
|
36785
37775
|
name: string(),
|
|
36786
37776
|
memoryMB: number().optional()
|
|
36787
37777
|
});
|
|
36788
|
-
var NpuInfoSchema = object({
|
|
37778
|
+
var NpuInfoSchema = object({
|
|
37779
|
+
type: _enum([
|
|
37780
|
+
"apple-ane",
|
|
37781
|
+
"intel-npu",
|
|
37782
|
+
"amd-xdna"
|
|
37783
|
+
]),
|
|
37784
|
+
name: string().optional(),
|
|
37785
|
+
generation: _enum(["xdna1", "xdna2"]).optional()
|
|
37786
|
+
});
|
|
36789
37787
|
var CoralInfoSchema = object({
|
|
36790
37788
|
type: literal("coral-edgetpu"),
|
|
36791
37789
|
bus: string().optional()
|
|
@@ -40638,16 +41636,6 @@ var ApiKeySummarySchema = object({
|
|
|
40638
41636
|
createdAt: number(),
|
|
40639
41637
|
lastUsedAt: number().optional()
|
|
40640
41638
|
});
|
|
40641
|
-
var CreateApiKeyInputSchema = object({
|
|
40642
|
-
label: string(),
|
|
40643
|
-
isAdmin: boolean().default(false),
|
|
40644
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
40645
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
40646
|
-
});
|
|
40647
|
-
var CreateApiKeyResultSchema = object({
|
|
40648
|
-
token: string(),
|
|
40649
|
-
record: ApiKeySummarySchema
|
|
40650
|
-
});
|
|
40651
41639
|
var ScopedTokenSummarySchema = object({
|
|
40652
41640
|
id: string(),
|
|
40653
41641
|
userId: string(),
|
|
@@ -40746,17 +41734,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40746
41734
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40747
41735
|
kind: "mutation",
|
|
40748
41736
|
access: "view"
|
|
40749
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40750
|
-
kind: "mutation",
|
|
40751
|
-
auth: "admin",
|
|
40752
|
-
access: "create"
|
|
40753
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41737
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40754
41738
|
kind: "mutation",
|
|
40755
41739
|
auth: "admin",
|
|
40756
41740
|
access: "delete"
|
|
40757
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40758
|
-
kind: "mutation",
|
|
40759
|
-
access: "view"
|
|
40760
41741
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40761
41742
|
kind: "mutation",
|
|
40762
41743
|
auth: "admin",
|
|
@@ -40830,15 +41811,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40830
41811
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40831
41812
|
userId: string(),
|
|
40832
41813
|
issuer: string()
|
|
40833
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40834
|
-
userId: string(),
|
|
40835
|
-
issuer: string().min(1),
|
|
40836
|
-
label: string().optional()
|
|
40837
|
-
}), object({ success: literal(true) }), {
|
|
40838
|
-
kind: "mutation",
|
|
40839
|
-
auth: "admin",
|
|
40840
|
-
access: "create"
|
|
40841
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41814
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40842
41815
|
kind: "mutation",
|
|
40843
41816
|
auth: "admin",
|
|
40844
41817
|
access: "delete"
|
|
@@ -41543,6 +42516,451 @@ var zoneRulesCapability = {
|
|
|
41543
42516
|
*/
|
|
41544
42517
|
durability: "restored"
|
|
41545
42518
|
};
|
|
42519
|
+
/**
|
|
42520
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42521
|
+
*
|
|
42522
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42523
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42524
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42525
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42526
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42527
|
+
* manifest entry and nothing else.
|
|
42528
|
+
*
|
|
42529
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42530
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42531
|
+
* Every method is `admin`: these spend money.
|
|
42532
|
+
*
|
|
42533
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42534
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42535
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42536
|
+
*
|
|
42537
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42538
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42539
|
+
* ticket the provider mints (D613).
|
|
42540
|
+
*/
|
|
42541
|
+
var TrainingGpuOptionSchema = object({
|
|
42542
|
+
id: string(),
|
|
42543
|
+
label: string(),
|
|
42544
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42545
|
+
usdPerHour: number().nonnegative(),
|
|
42546
|
+
vramGb: number().nonnegative()
|
|
42547
|
+
});
|
|
42548
|
+
var TrainingRegionOptionSchema = object({
|
|
42549
|
+
/** `''` = any region (the provider's choice). */
|
|
42550
|
+
id: string(),
|
|
42551
|
+
label: string(),
|
|
42552
|
+
priceMultiplier: number().positive()
|
|
42553
|
+
});
|
|
42554
|
+
/**
|
|
42555
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42556
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42557
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42558
|
+
*/
|
|
42559
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42560
|
+
gpuType: string(),
|
|
42561
|
+
region: string(),
|
|
42562
|
+
costCapUsd: number().nonnegative(),
|
|
42563
|
+
maxRuntimeSec: number().int().positive(),
|
|
42564
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42565
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42566
|
+
});
|
|
42567
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42568
|
+
addonId: string(),
|
|
42569
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42570
|
+
kind: string(),
|
|
42571
|
+
label: string(),
|
|
42572
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42573
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42574
|
+
maxDatasetBytes: number().int().positive(),
|
|
42575
|
+
maxRuntimeSec: number().int().positive(),
|
|
42576
|
+
freeTierNote: string().optional(),
|
|
42577
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42578
|
+
dataResidencyNote: string(),
|
|
42579
|
+
/** Credentials are present — never the values. */
|
|
42580
|
+
configured: boolean(),
|
|
42581
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42582
|
+
});
|
|
42583
|
+
var TrainingCredentialCheckSchema = object({
|
|
42584
|
+
ok: boolean(),
|
|
42585
|
+
/** Workspace / account name, when the provider says. */
|
|
42586
|
+
account: string().optional(),
|
|
42587
|
+
reason: _enum([
|
|
42588
|
+
"missing",
|
|
42589
|
+
"invalid",
|
|
42590
|
+
"forbidden",
|
|
42591
|
+
"network",
|
|
42592
|
+
"quota"
|
|
42593
|
+
]).optional(),
|
|
42594
|
+
detail: string().optional()
|
|
42595
|
+
});
|
|
42596
|
+
var ProviderJobStateSchema = _enum([
|
|
42597
|
+
"pending",
|
|
42598
|
+
"starting",
|
|
42599
|
+
"running",
|
|
42600
|
+
"succeeded",
|
|
42601
|
+
"failed",
|
|
42602
|
+
"cancelled",
|
|
42603
|
+
"lost"
|
|
42604
|
+
]);
|
|
42605
|
+
var ProviderJobStatusSchema = object({
|
|
42606
|
+
jobKey: string(),
|
|
42607
|
+
providerJobId: string().optional(),
|
|
42608
|
+
state: ProviderJobStateSchema,
|
|
42609
|
+
startedAt: number().optional(),
|
|
42610
|
+
endedAt: number().optional(),
|
|
42611
|
+
exitCode: number().int().optional(),
|
|
42612
|
+
failureReason: string().optional(),
|
|
42613
|
+
gpuType: string(),
|
|
42614
|
+
region: string().optional(),
|
|
42615
|
+
billedSeconds: number().nonnegative(),
|
|
42616
|
+
costUsd: number().nonnegative(),
|
|
42617
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42618
|
+
costIsEstimate: boolean(),
|
|
42619
|
+
lastFetchedAt: number()
|
|
42620
|
+
});
|
|
42621
|
+
/**
|
|
42622
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42623
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42624
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42625
|
+
* in `result.json`.
|
|
42626
|
+
*/
|
|
42627
|
+
var TrainerSourceRefSchema = object({
|
|
42628
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42629
|
+
repo: string().min(1),
|
|
42630
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42631
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42632
|
+
});
|
|
42633
|
+
var JobRef = {
|
|
42634
|
+
addonId: string(),
|
|
42635
|
+
jobKey: string().uuid()
|
|
42636
|
+
};
|
|
42637
|
+
var TrainingLogLineSchema = object({
|
|
42638
|
+
ts: number(),
|
|
42639
|
+
text: string()
|
|
42640
|
+
});
|
|
42641
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42642
|
+
kind: "mutation",
|
|
42643
|
+
auth: "admin",
|
|
42644
|
+
timeoutMs: 3e4
|
|
42645
|
+
}), method(object({
|
|
42646
|
+
addonId: string(),
|
|
42647
|
+
gpuType: string(),
|
|
42648
|
+
region: string(),
|
|
42649
|
+
datasetBytes: number().int().nonnegative(),
|
|
42650
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42651
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42652
|
+
}), object({
|
|
42653
|
+
usdLow: number().nonnegative(),
|
|
42654
|
+
usdHigh: number().nonnegative(),
|
|
42655
|
+
notes: array(string()).readonly()
|
|
42656
|
+
}), { auth: "admin" }), method(object({
|
|
42657
|
+
...JobRef,
|
|
42658
|
+
ticket: PeerBytesTicketSchema
|
|
42659
|
+
}), object({
|
|
42660
|
+
bytes: number().int().nonnegative(),
|
|
42661
|
+
sha256: string()
|
|
42662
|
+
}), {
|
|
42663
|
+
kind: "mutation",
|
|
42664
|
+
auth: "admin",
|
|
42665
|
+
timeoutMs: 120 * 6e4
|
|
42666
|
+
}), method(object({
|
|
42667
|
+
...JobRef,
|
|
42668
|
+
trainer: TrainerSourceRefSchema,
|
|
42669
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42670
|
+
gpuType: string(),
|
|
42671
|
+
region: string(),
|
|
42672
|
+
maxRuntimeSec: number().int().positive()
|
|
42673
|
+
}), ProviderJobStatusSchema, {
|
|
42674
|
+
kind: "mutation",
|
|
42675
|
+
auth: "admin",
|
|
42676
|
+
timeoutMs: 30 * 6e4
|
|
42677
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42678
|
+
auth: "admin",
|
|
42679
|
+
timeoutMs: 6e4
|
|
42680
|
+
}), method(object({
|
|
42681
|
+
...JobRef,
|
|
42682
|
+
cursor: string().optional(),
|
|
42683
|
+
max: number().int().min(1).max(500)
|
|
42684
|
+
}), object({
|
|
42685
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42686
|
+
cursor: string()
|
|
42687
|
+
}), {
|
|
42688
|
+
auth: "admin",
|
|
42689
|
+
timeoutMs: 6e4
|
|
42690
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42691
|
+
kind: "mutation",
|
|
42692
|
+
auth: "admin",
|
|
42693
|
+
timeoutMs: 6e4
|
|
42694
|
+
}), method(object(JobRef), object({
|
|
42695
|
+
found: boolean(),
|
|
42696
|
+
text: string().optional()
|
|
42697
|
+
}), {
|
|
42698
|
+
kind: "mutation",
|
|
42699
|
+
auth: "admin",
|
|
42700
|
+
timeoutMs: 5 * 6e4
|
|
42701
|
+
}), method(object({
|
|
42702
|
+
...JobRef,
|
|
42703
|
+
path: _enum(["bundle.tar"])
|
|
42704
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42705
|
+
kind: "mutation",
|
|
42706
|
+
auth: "admin",
|
|
42707
|
+
timeoutMs: 5 * 6e4
|
|
42708
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42709
|
+
kind: "mutation",
|
|
42710
|
+
auth: "admin",
|
|
42711
|
+
timeoutMs: 5 * 6e4
|
|
42712
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42713
|
+
auth: "admin",
|
|
42714
|
+
timeoutMs: 2 * 6e4
|
|
42715
|
+
});
|
|
42716
|
+
/**
|
|
42717
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42718
|
+
* provided by `addon-training`.
|
|
42719
|
+
*
|
|
42720
|
+
* It owns what every provider must agree on, written once:
|
|
42721
|
+
*
|
|
42722
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42723
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42724
|
+
* the export plan) and reaches this store through the five row methods
|
|
42725
|
+
* below, so the Retrain page and the export did not change.
|
|
42726
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42727
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42728
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42729
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42730
|
+
* rollback. Nothing is ever registered automatically.
|
|
42731
|
+
*
|
|
42732
|
+
* Every method is `admin`.
|
|
42733
|
+
*/
|
|
42734
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42735
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42736
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42737
|
+
var TrainingBaseModelSchema = object({
|
|
42738
|
+
modelId: string(),
|
|
42739
|
+
label: string(),
|
|
42740
|
+
weights: string(),
|
|
42741
|
+
imgsz: number().int(),
|
|
42742
|
+
baselineOnnxUrl: string(),
|
|
42743
|
+
baselineFloors: record(string(), number()),
|
|
42744
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42745
|
+
recommended: boolean()
|
|
42746
|
+
});
|
|
42747
|
+
var TrainingPresetSchema = _enum([
|
|
42748
|
+
"quick",
|
|
42749
|
+
"standard",
|
|
42750
|
+
"thorough"
|
|
42751
|
+
]);
|
|
42752
|
+
var TrainingJobRequestSchema = object({
|
|
42753
|
+
datasetVersionId: string().min(1),
|
|
42754
|
+
/** The `training-provider` addon that runs it. */
|
|
42755
|
+
addonId: string().min(1),
|
|
42756
|
+
gpuType: string().min(1),
|
|
42757
|
+
region: string(),
|
|
42758
|
+
baseModelId: string().min(1),
|
|
42759
|
+
preset: TrainingPresetSchema,
|
|
42760
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42761
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42762
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42763
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42764
|
+
});
|
|
42765
|
+
var TrainingSplitPlanSchema = object({
|
|
42766
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42767
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42768
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42769
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42770
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42771
|
+
trainSubjects: number().int()
|
|
42772
|
+
});
|
|
42773
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42774
|
+
"unknown-dataset",
|
|
42775
|
+
"unknown-provider",
|
|
42776
|
+
"provider-not-configured",
|
|
42777
|
+
"unknown-base-model",
|
|
42778
|
+
"unknown-gpu",
|
|
42779
|
+
"dataset-too-large",
|
|
42780
|
+
"no-training-subjects",
|
|
42781
|
+
"job-already-running"
|
|
42782
|
+
]);
|
|
42783
|
+
var TrainingJobPlanSchema = object({
|
|
42784
|
+
refusal: object({
|
|
42785
|
+
reason: TrainingRefusalReasonSchema,
|
|
42786
|
+
detail: string()
|
|
42787
|
+
}).nullable(),
|
|
42788
|
+
warnings: array(string()).readonly(),
|
|
42789
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42790
|
+
estimate: object({
|
|
42791
|
+
datasetBytes: number().int(),
|
|
42792
|
+
uploadMinutesAt20Mbps: number(),
|
|
42793
|
+
gpuSecondsLow: number(),
|
|
42794
|
+
gpuSecondsHigh: number(),
|
|
42795
|
+
usdLow: number(),
|
|
42796
|
+
usdHigh: number(),
|
|
42797
|
+
notes: array(string()).readonly()
|
|
42798
|
+
}).nullable(),
|
|
42799
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42800
|
+
defaults: object({
|
|
42801
|
+
maxCostUsd: number(),
|
|
42802
|
+
maxRuntimeSec: number().int()
|
|
42803
|
+
}).nullable(),
|
|
42804
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42805
|
+
dataNotice: string()
|
|
42806
|
+
});
|
|
42807
|
+
/**
|
|
42808
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42809
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42810
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42811
|
+
* result lives after the operator acted on it.
|
|
42812
|
+
*/
|
|
42813
|
+
var TrainingJobStateSchema = _enum([
|
|
42814
|
+
"uploading",
|
|
42815
|
+
"submitted",
|
|
42816
|
+
"starting",
|
|
42817
|
+
"running",
|
|
42818
|
+
"collecting",
|
|
42819
|
+
"ready",
|
|
42820
|
+
"registered",
|
|
42821
|
+
"canary",
|
|
42822
|
+
"failed",
|
|
42823
|
+
"cancelling",
|
|
42824
|
+
"cancelled",
|
|
42825
|
+
"lost",
|
|
42826
|
+
"expired",
|
|
42827
|
+
"discarded"
|
|
42828
|
+
]);
|
|
42829
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42830
|
+
"cost-cap",
|
|
42831
|
+
"runtime-cap",
|
|
42832
|
+
"upload-failed",
|
|
42833
|
+
"submit-failed",
|
|
42834
|
+
"trainer-failed",
|
|
42835
|
+
"result-invalid",
|
|
42836
|
+
"checksum-mismatch",
|
|
42837
|
+
"fetch-failed",
|
|
42838
|
+
"provider-error",
|
|
42839
|
+
"hub-restart-during-upload"
|
|
42840
|
+
]);
|
|
42841
|
+
var TrainingProgressPointSchema = object({
|
|
42842
|
+
epoch: number().int(),
|
|
42843
|
+
map50: number().nullable(),
|
|
42844
|
+
map50_95: number().nullable()
|
|
42845
|
+
});
|
|
42846
|
+
var TrainingCanarySchema = object({
|
|
42847
|
+
deviceIds: array(number().int()).readonly(),
|
|
42848
|
+
since: number(),
|
|
42849
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42850
|
+
previous: array(object({
|
|
42851
|
+
deviceId: number().int(),
|
|
42852
|
+
nodeId: string(),
|
|
42853
|
+
deviceKey: string(),
|
|
42854
|
+
patch: object({
|
|
42855
|
+
modelId: string().optional(),
|
|
42856
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42857
|
+
}).nullable()
|
|
42858
|
+
})).readonly()
|
|
42859
|
+
});
|
|
42860
|
+
var TrainingJobSchema = object({
|
|
42861
|
+
id: string(),
|
|
42862
|
+
idempotencyKey: string(),
|
|
42863
|
+
name: string(),
|
|
42864
|
+
createdAt: number(),
|
|
42865
|
+
updatedAt: number(),
|
|
42866
|
+
state: TrainingJobStateSchema,
|
|
42867
|
+
stage: TrainingStageSchema.nullable(),
|
|
42868
|
+
failure: object({
|
|
42869
|
+
reason: TrainingFailureReasonSchema,
|
|
42870
|
+
stage: string().nullable(),
|
|
42871
|
+
detail: string()
|
|
42872
|
+
}).nullable(),
|
|
42873
|
+
request: TrainingJobRequestSchema,
|
|
42874
|
+
maxCostUsd: number().nonnegative(),
|
|
42875
|
+
maxRuntimeSec: number().int().positive(),
|
|
42876
|
+
trainer: TrainerSourceRefSchema,
|
|
42877
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42878
|
+
dataset: object({
|
|
42879
|
+
bytes: number().int(),
|
|
42880
|
+
sha256: string(),
|
|
42881
|
+
uploadedAt: number()
|
|
42882
|
+
}).nullable(),
|
|
42883
|
+
split: TrainingSplitPlanSchema,
|
|
42884
|
+
provider: object({
|
|
42885
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42886
|
+
providerJobId: string().nullable(),
|
|
42887
|
+
startedAt: number().nullable(),
|
|
42888
|
+
endedAt: number().nullable(),
|
|
42889
|
+
billedSeconds: number(),
|
|
42890
|
+
costUsd: number(),
|
|
42891
|
+
costIsEstimate: boolean(),
|
|
42892
|
+
lastPolledAt: number().nullable()
|
|
42893
|
+
}),
|
|
42894
|
+
progress: object({
|
|
42895
|
+
epoch: number().int().nullable(),
|
|
42896
|
+
epochs: number().int().nullable(),
|
|
42897
|
+
etaSec: number().nullable(),
|
|
42898
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42899
|
+
}),
|
|
42900
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42901
|
+
logTail: array(string()).readonly(),
|
|
42902
|
+
logCursor: string().nullable(),
|
|
42903
|
+
artifacts: object({
|
|
42904
|
+
bundleBytes: number().int(),
|
|
42905
|
+
bundleSha256: string(),
|
|
42906
|
+
fetchedAt: number(),
|
|
42907
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42908
|
+
expiresAt: number()
|
|
42909
|
+
}).nullable(),
|
|
42910
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42911
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42912
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42913
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42914
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42915
|
+
registeredModelIds: array(string()).readonly(),
|
|
42916
|
+
canary: TrainingCanarySchema.nullable()
|
|
42917
|
+
});
|
|
42918
|
+
var IdInput = object({ id: string().min(1) });
|
|
42919
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42920
|
+
kind: "mutation",
|
|
42921
|
+
auth: "admin"
|
|
42922
|
+
}), 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() }), {
|
|
42923
|
+
kind: "mutation",
|
|
42924
|
+
auth: "admin"
|
|
42925
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42926
|
+
auth: "admin",
|
|
42927
|
+
timeoutMs: 6e4
|
|
42928
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42929
|
+
name: string().min(1).max(120),
|
|
42930
|
+
maxCostUsd: number().positive(),
|
|
42931
|
+
maxRuntimeSec: number().int().positive(),
|
|
42932
|
+
idempotencyKey: string().min(8).max(80)
|
|
42933
|
+
}), discriminatedUnion("kind", [object({
|
|
42934
|
+
kind: literal("started"),
|
|
42935
|
+
job: TrainingJobSchema
|
|
42936
|
+
}), object({
|
|
42937
|
+
kind: literal("refused"),
|
|
42938
|
+
reason: TrainingRefusalReasonSchema,
|
|
42939
|
+
detail: string()
|
|
42940
|
+
})]), {
|
|
42941
|
+
kind: "mutation",
|
|
42942
|
+
auth: "admin",
|
|
42943
|
+
timeoutMs: 12e4
|
|
42944
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42945
|
+
kind: "mutation",
|
|
42946
|
+
auth: "admin",
|
|
42947
|
+
timeoutMs: 12e4
|
|
42948
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42949
|
+
kind: "mutation",
|
|
42950
|
+
auth: "admin",
|
|
42951
|
+
timeoutMs: 30 * 6e4
|
|
42952
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42953
|
+
kind: "mutation",
|
|
42954
|
+
auth: "admin",
|
|
42955
|
+
timeoutMs: 12e4
|
|
42956
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42957
|
+
kind: "mutation",
|
|
42958
|
+
auth: "admin",
|
|
42959
|
+
timeoutMs: 12e4
|
|
42960
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42961
|
+
kind: "mutation",
|
|
42962
|
+
auth: "admin"
|
|
42963
|
+
});
|
|
41546
42964
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
41547
42965
|
Object.freeze({
|
|
41548
42966
|
person: .5,
|
|
@@ -43691,6 +45109,12 @@ Object.freeze({
|
|
|
43691
45109
|
addonId: null,
|
|
43692
45110
|
access: "create"
|
|
43693
45111
|
},
|
|
45112
|
+
"backup.checkBackupKey": {
|
|
45113
|
+
capName: "backup",
|
|
45114
|
+
capScope: "system",
|
|
45115
|
+
addonId: null,
|
|
45116
|
+
access: "create"
|
|
45117
|
+
},
|
|
43694
45118
|
"backup.delete": {
|
|
43695
45119
|
capName: "backup",
|
|
43696
45120
|
capScope: "system",
|
|
@@ -43703,6 +45127,18 @@ Object.freeze({
|
|
|
43703
45127
|
addonId: null,
|
|
43704
45128
|
access: "delete"
|
|
43705
45129
|
},
|
|
45130
|
+
"backup.disableEncryption": {
|
|
45131
|
+
capName: "backup",
|
|
45132
|
+
capScope: "system",
|
|
45133
|
+
addonId: null,
|
|
45134
|
+
access: "create"
|
|
45135
|
+
},
|
|
45136
|
+
"backup.getEncryption": {
|
|
45137
|
+
capName: "backup",
|
|
45138
|
+
capScope: "system",
|
|
45139
|
+
addonId: null,
|
|
45140
|
+
access: "view"
|
|
45141
|
+
},
|
|
43706
45142
|
"backup.getEntries": {
|
|
43707
45143
|
capName: "backup",
|
|
43708
45144
|
capScope: "system",
|
|
@@ -43757,6 +45193,12 @@ Object.freeze({
|
|
|
43757
45193
|
addonId: null,
|
|
43758
45194
|
access: "create"
|
|
43759
45195
|
},
|
|
45196
|
+
"backup.setupEncryption": {
|
|
45197
|
+
capName: "backup",
|
|
45198
|
+
capScope: "system",
|
|
45199
|
+
addonId: null,
|
|
45200
|
+
access: "create"
|
|
45201
|
+
},
|
|
43760
45202
|
"backup.trigger": {
|
|
43761
45203
|
capName: "backup",
|
|
43762
45204
|
capScope: "system",
|
|
@@ -44309,6 +45751,12 @@ Object.freeze({
|
|
|
44309
45751
|
addonId: null,
|
|
44310
45752
|
access: "create"
|
|
44311
45753
|
},
|
|
45754
|
+
"customModelRegistry.importModelBundle": {
|
|
45755
|
+
capName: "custom-model-registry",
|
|
45756
|
+
capScope: "system",
|
|
45757
|
+
addonId: null,
|
|
45758
|
+
access: "create"
|
|
45759
|
+
},
|
|
44312
45760
|
"customModelRegistry.listModels": {
|
|
44313
45761
|
capName: "custom-model-registry",
|
|
44314
45762
|
capScope: "system",
|
|
@@ -45749,6 +47197,12 @@ Object.freeze({
|
|
|
45749
47197
|
addonId: null,
|
|
45750
47198
|
access: "view"
|
|
45751
47199
|
},
|
|
47200
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47201
|
+
capName: "keychain-admin",
|
|
47202
|
+
capScope: "system",
|
|
47203
|
+
addonId: null,
|
|
47204
|
+
access: "create"
|
|
47205
|
+
},
|
|
45752
47206
|
"keychainAdmin.deleteOrphans": {
|
|
45753
47207
|
capName: "keychain-admin",
|
|
45754
47208
|
capScope: "system",
|
|
@@ -45785,6 +47239,12 @@ Object.freeze({
|
|
|
45785
47239
|
addonId: null,
|
|
45786
47240
|
access: "delete"
|
|
45787
47241
|
},
|
|
47242
|
+
"keychainAdmin.resetReport": {
|
|
47243
|
+
capName: "keychain-admin",
|
|
47244
|
+
capScope: "system",
|
|
47245
|
+
addonId: null,
|
|
47246
|
+
access: "delete"
|
|
47247
|
+
},
|
|
45788
47248
|
"keychainAdmin.reveal": {
|
|
45789
47249
|
capName: "keychain-admin",
|
|
45790
47250
|
capScope: "system",
|
|
@@ -45797,6 +47257,12 @@ Object.freeze({
|
|
|
45797
47257
|
addonId: null,
|
|
45798
47258
|
access: "create"
|
|
45799
47259
|
},
|
|
47260
|
+
"keychainAdmin.setSystemSecret": {
|
|
47261
|
+
capName: "keychain-admin",
|
|
47262
|
+
capScope: "system",
|
|
47263
|
+
addonId: null,
|
|
47264
|
+
access: "create"
|
|
47265
|
+
},
|
|
45800
47266
|
"keychainAdmin.status": {
|
|
45801
47267
|
capName: "keychain-admin",
|
|
45802
47268
|
capScope: "system",
|
|
@@ -47243,6 +48709,12 @@ Object.freeze({
|
|
|
47243
48709
|
addonId: null,
|
|
47244
48710
|
access: "create"
|
|
47245
48711
|
},
|
|
48712
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48713
|
+
capName: "pipeline-analytics",
|
|
48714
|
+
capScope: "device",
|
|
48715
|
+
addonId: null,
|
|
48716
|
+
access: "create"
|
|
48717
|
+
},
|
|
47246
48718
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
47247
48719
|
capName: "pipeline-analytics",
|
|
47248
48720
|
capScope: "device",
|
|
@@ -47255,6 +48727,12 @@ Object.freeze({
|
|
|
47255
48727
|
addonId: null,
|
|
47256
48728
|
access: "delete"
|
|
47257
48729
|
},
|
|
48730
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48731
|
+
capName: "pipeline-analytics",
|
|
48732
|
+
capScope: "device",
|
|
48733
|
+
addonId: null,
|
|
48734
|
+
access: "delete"
|
|
48735
|
+
},
|
|
47258
48736
|
"pipelineAnalytics.deleteTracks": {
|
|
47259
48737
|
capName: "pipeline-analytics",
|
|
47260
48738
|
capScope: "device",
|
|
@@ -47477,6 +48955,12 @@ Object.freeze({
|
|
|
47477
48955
|
addonId: null,
|
|
47478
48956
|
access: "view"
|
|
47479
48957
|
},
|
|
48958
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48959
|
+
capName: "pipeline-analytics",
|
|
48960
|
+
capScope: "device",
|
|
48961
|
+
addonId: null,
|
|
48962
|
+
access: "view"
|
|
48963
|
+
},
|
|
47480
48964
|
"pipelineAnalytics.listRetrainFrames": {
|
|
47481
48965
|
capName: "pipeline-analytics",
|
|
47482
48966
|
capScope: "device",
|
|
@@ -47507,6 +48991,12 @@ Object.freeze({
|
|
|
47507
48991
|
addonId: null,
|
|
47508
48992
|
access: "view"
|
|
47509
48993
|
},
|
|
48994
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48995
|
+
capName: "pipeline-analytics",
|
|
48996
|
+
capScope: "device",
|
|
48997
|
+
addonId: null,
|
|
48998
|
+
access: "create"
|
|
48999
|
+
},
|
|
47510
49000
|
"pipelineAnalytics.ownersWithMedia": {
|
|
47511
49001
|
capName: "pipeline-analytics",
|
|
47512
49002
|
capScope: "device",
|
|
@@ -47519,6 +49009,12 @@ Object.freeze({
|
|
|
47519
49009
|
addonId: null,
|
|
47520
49010
|
access: "create"
|
|
47521
49011
|
},
|
|
49012
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49013
|
+
capName: "pipeline-analytics",
|
|
49014
|
+
capScope: "device",
|
|
49015
|
+
addonId: null,
|
|
49016
|
+
access: "view"
|
|
49017
|
+
},
|
|
47522
49018
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
47523
49019
|
capName: "pipeline-analytics",
|
|
47524
49020
|
capScope: "device",
|
|
@@ -47657,6 +49153,12 @@ Object.freeze({
|
|
|
47657
49153
|
addonId: null,
|
|
47658
49154
|
access: "create"
|
|
47659
49155
|
},
|
|
49156
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49157
|
+
capName: "pipeline-analytics",
|
|
49158
|
+
capScope: "device",
|
|
49159
|
+
addonId: null,
|
|
49160
|
+
access: "view"
|
|
49161
|
+
},
|
|
47660
49162
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
47661
49163
|
capName: "pipeline-analytics",
|
|
47662
49164
|
capScope: "device",
|
|
@@ -50033,6 +51535,174 @@ Object.freeze({
|
|
|
50033
51535
|
addonId: null,
|
|
50034
51536
|
access: "view"
|
|
50035
51537
|
},
|
|
51538
|
+
"training.canaryResult": {
|
|
51539
|
+
capName: "training",
|
|
51540
|
+
capScope: "system",
|
|
51541
|
+
addonId: null,
|
|
51542
|
+
access: "create"
|
|
51543
|
+
},
|
|
51544
|
+
"training.cancelJob": {
|
|
51545
|
+
capName: "training",
|
|
51546
|
+
capScope: "system",
|
|
51547
|
+
addonId: null,
|
|
51548
|
+
access: "create"
|
|
51549
|
+
},
|
|
51550
|
+
"training.discardResult": {
|
|
51551
|
+
capName: "training",
|
|
51552
|
+
capScope: "system",
|
|
51553
|
+
addonId: null,
|
|
51554
|
+
access: "create"
|
|
51555
|
+
},
|
|
51556
|
+
"training.findDatasetVersionIdByName": {
|
|
51557
|
+
capName: "training",
|
|
51558
|
+
capScope: "system",
|
|
51559
|
+
addonId: null,
|
|
51560
|
+
access: "view"
|
|
51561
|
+
},
|
|
51562
|
+
"training.getDatasetVersion": {
|
|
51563
|
+
capName: "training",
|
|
51564
|
+
capScope: "system",
|
|
51565
|
+
addonId: null,
|
|
51566
|
+
access: "view"
|
|
51567
|
+
},
|
|
51568
|
+
"training.getJob": {
|
|
51569
|
+
capName: "training",
|
|
51570
|
+
capScope: "system",
|
|
51571
|
+
addonId: null,
|
|
51572
|
+
access: "view"
|
|
51573
|
+
},
|
|
51574
|
+
"training.getJobResult": {
|
|
51575
|
+
capName: "training",
|
|
51576
|
+
capScope: "system",
|
|
51577
|
+
addonId: null,
|
|
51578
|
+
access: "view"
|
|
51579
|
+
},
|
|
51580
|
+
"training.listBaseModels": {
|
|
51581
|
+
capName: "training",
|
|
51582
|
+
capScope: "system",
|
|
51583
|
+
addonId: null,
|
|
51584
|
+
access: "view"
|
|
51585
|
+
},
|
|
51586
|
+
"training.listDatasetVersions": {
|
|
51587
|
+
capName: "training",
|
|
51588
|
+
capScope: "system",
|
|
51589
|
+
addonId: null,
|
|
51590
|
+
access: "view"
|
|
51591
|
+
},
|
|
51592
|
+
"training.listJobs": {
|
|
51593
|
+
capName: "training",
|
|
51594
|
+
capScope: "system",
|
|
51595
|
+
addonId: null,
|
|
51596
|
+
access: "view"
|
|
51597
|
+
},
|
|
51598
|
+
"training.planJob": {
|
|
51599
|
+
capName: "training",
|
|
51600
|
+
capScope: "system",
|
|
51601
|
+
addonId: null,
|
|
51602
|
+
access: "view"
|
|
51603
|
+
},
|
|
51604
|
+
"training.putDatasetVersion": {
|
|
51605
|
+
capName: "training",
|
|
51606
|
+
capScope: "system",
|
|
51607
|
+
addonId: null,
|
|
51608
|
+
access: "create"
|
|
51609
|
+
},
|
|
51610
|
+
"training.registerResult": {
|
|
51611
|
+
capName: "training",
|
|
51612
|
+
capScope: "system",
|
|
51613
|
+
addonId: null,
|
|
51614
|
+
access: "create"
|
|
51615
|
+
},
|
|
51616
|
+
"training.removeDatasetVersion": {
|
|
51617
|
+
capName: "training",
|
|
51618
|
+
capScope: "system",
|
|
51619
|
+
addonId: null,
|
|
51620
|
+
access: "delete"
|
|
51621
|
+
},
|
|
51622
|
+
"training.rollbackCanary": {
|
|
51623
|
+
capName: "training",
|
|
51624
|
+
capScope: "system",
|
|
51625
|
+
addonId: null,
|
|
51626
|
+
access: "create"
|
|
51627
|
+
},
|
|
51628
|
+
"training.startJob": {
|
|
51629
|
+
capName: "training",
|
|
51630
|
+
capScope: "system",
|
|
51631
|
+
addonId: null,
|
|
51632
|
+
access: "create"
|
|
51633
|
+
},
|
|
51634
|
+
"trainingProvider.cancelJob": {
|
|
51635
|
+
capName: "training-provider",
|
|
51636
|
+
capScope: "system",
|
|
51637
|
+
addonId: null,
|
|
51638
|
+
access: "create"
|
|
51639
|
+
},
|
|
51640
|
+
"trainingProvider.cleanupJob": {
|
|
51641
|
+
capName: "training-provider",
|
|
51642
|
+
capScope: "system",
|
|
51643
|
+
addonId: null,
|
|
51644
|
+
access: "create"
|
|
51645
|
+
},
|
|
51646
|
+
"trainingProvider.describe": {
|
|
51647
|
+
capName: "training-provider",
|
|
51648
|
+
capScope: "system",
|
|
51649
|
+
addonId: null,
|
|
51650
|
+
access: "view"
|
|
51651
|
+
},
|
|
51652
|
+
"trainingProvider.estimateJob": {
|
|
51653
|
+
capName: "training-provider",
|
|
51654
|
+
capScope: "system",
|
|
51655
|
+
addonId: null,
|
|
51656
|
+
access: "view"
|
|
51657
|
+
},
|
|
51658
|
+
"trainingProvider.getJob": {
|
|
51659
|
+
capName: "training-provider",
|
|
51660
|
+
capScope: "system",
|
|
51661
|
+
addonId: null,
|
|
51662
|
+
access: "view"
|
|
51663
|
+
},
|
|
51664
|
+
"trainingProvider.listJobEvents": {
|
|
51665
|
+
capName: "training-provider",
|
|
51666
|
+
capScope: "system",
|
|
51667
|
+
addonId: null,
|
|
51668
|
+
access: "view"
|
|
51669
|
+
},
|
|
51670
|
+
"trainingProvider.listJobs": {
|
|
51671
|
+
capName: "training-provider",
|
|
51672
|
+
capScope: "system",
|
|
51673
|
+
addonId: null,
|
|
51674
|
+
access: "view"
|
|
51675
|
+
},
|
|
51676
|
+
"trainingProvider.offerArtifact": {
|
|
51677
|
+
capName: "training-provider",
|
|
51678
|
+
capScope: "system",
|
|
51679
|
+
addonId: null,
|
|
51680
|
+
access: "create"
|
|
51681
|
+
},
|
|
51682
|
+
"trainingProvider.readResult": {
|
|
51683
|
+
capName: "training-provider",
|
|
51684
|
+
capScope: "system",
|
|
51685
|
+
addonId: null,
|
|
51686
|
+
access: "create"
|
|
51687
|
+
},
|
|
51688
|
+
"trainingProvider.submitJob": {
|
|
51689
|
+
capName: "training-provider",
|
|
51690
|
+
capScope: "system",
|
|
51691
|
+
addonId: null,
|
|
51692
|
+
access: "create"
|
|
51693
|
+
},
|
|
51694
|
+
"trainingProvider.uploadDataset": {
|
|
51695
|
+
capName: "training-provider",
|
|
51696
|
+
capScope: "system",
|
|
51697
|
+
addonId: null,
|
|
51698
|
+
access: "create"
|
|
51699
|
+
},
|
|
51700
|
+
"trainingProvider.validateCredentials": {
|
|
51701
|
+
capName: "training-provider",
|
|
51702
|
+
capScope: "system",
|
|
51703
|
+
addonId: null,
|
|
51704
|
+
access: "create"
|
|
51705
|
+
},
|
|
50036
51706
|
"turnProvider.getTurnServers": {
|
|
50037
51707
|
capName: "turn-provider",
|
|
50038
51708
|
capScope: "system",
|
|
@@ -50057,12 +51727,6 @@ Object.freeze({
|
|
|
50057
51727
|
addonId: null,
|
|
50058
51728
|
access: "create"
|
|
50059
51729
|
},
|
|
50060
|
-
"userManagement.createApiKey": {
|
|
50061
|
-
capName: "user-management",
|
|
50062
|
-
capScope: "system",
|
|
50063
|
-
addonId: null,
|
|
50064
|
-
access: "create"
|
|
50065
|
-
},
|
|
50066
51730
|
"userManagement.createScopedToken": {
|
|
50067
51731
|
capName: "user-management",
|
|
50068
51732
|
capScope: "system",
|
|
@@ -50099,12 +51763,6 @@ Object.freeze({
|
|
|
50099
51763
|
addonId: null,
|
|
50100
51764
|
access: "view"
|
|
50101
51765
|
},
|
|
50102
|
-
"userManagement.linkExternalIdentity": {
|
|
50103
|
-
capName: "user-management",
|
|
50104
|
-
capScope: "system",
|
|
50105
|
-
addonId: null,
|
|
50106
|
-
access: "create"
|
|
50107
|
-
},
|
|
50108
51766
|
"userManagement.listApiKeys": {
|
|
50109
51767
|
capName: "user-management",
|
|
50110
51768
|
capScope: "system",
|
|
@@ -50207,12 +51865,6 @@ Object.freeze({
|
|
|
50207
51865
|
addonId: null,
|
|
50208
51866
|
access: "create"
|
|
50209
51867
|
},
|
|
50210
|
-
"userManagement.validateApiKey": {
|
|
50211
|
-
capName: "user-management",
|
|
50212
|
-
capScope: "system",
|
|
50213
|
-
addonId: null,
|
|
50214
|
-
access: "view"
|
|
50215
|
-
},
|
|
50216
51868
|
"userManagement.validateCredentials": {
|
|
50217
51869
|
capName: "user-management",
|
|
50218
51870
|
capScope: "system",
|
|
@@ -54326,6 +55978,11 @@ Object.freeze({
|
|
|
54326
55978
|
form: "single",
|
|
54327
55979
|
optional: false
|
|
54328
55980
|
}],
|
|
55981
|
+
"training.canaryResult": [{
|
|
55982
|
+
name: "deviceIds",
|
|
55983
|
+
form: "array",
|
|
55984
|
+
optional: false
|
|
55985
|
+
}],
|
|
54329
55986
|
"update.getStatus": [{
|
|
54330
55987
|
name: "deviceId",
|
|
54331
55988
|
form: "single",
|
|
@@ -55054,6 +56711,8 @@ var STATE_SUMMARY_VARS = [
|
|
|
55054
56711
|
[...RULE_TEXT],
|
|
55055
56712
|
[...RULE_TEXT],
|
|
55056
56713
|
[...RULE_TEXT],
|
|
56714
|
+
[...RULE_TEXT],
|
|
56715
|
+
[...RULE_TEXT],
|
|
55057
56716
|
([...RULE_TEXT], [...UPDATES]),
|
|
55058
56717
|
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
55059
56718
|
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
@@ -78612,6 +80271,19 @@ function sameConnection(a, b) {
|
|
|
78612
80271
|
return a.host === b.host && a.enableHmipRf === b.enableHmipRf && a.enableBidcosRf === b.enableBidcosRf && a.enableGroups === b.enableGroups && a.enableBidcosWired === b.enableBidcosWired && a.callbackHost === b.callbackHost && a.callbackPort === b.callbackPort && a.username === b.username && a.password === b.password && a.tls === b.tls;
|
|
78613
80272
|
}
|
|
78614
80273
|
/**
|
|
80274
|
+
* Delays (ms) between background restore retries after a failed
|
|
80275
|
+
* `facade.start()` (e.g. CCU `ECONNREFUSED`). Six attempts ≈ 2+5+10+20+30+60 s.
|
|
80276
|
+
* Exported for specs that drive the schedule with fake timers.
|
|
80277
|
+
*/
|
|
80278
|
+
var RESTORE_RETRY_DELAYS_MS = [
|
|
80279
|
+
2e3,
|
|
80280
|
+
5e3,
|
|
80281
|
+
1e4,
|
|
80282
|
+
2e4,
|
|
80283
|
+
3e4,
|
|
80284
|
+
6e4
|
|
80285
|
+
];
|
|
80286
|
+
/**
|
|
78615
80287
|
* Manages N live CCU connections ("brokers"), each backed by an
|
|
78616
80288
|
* {@link HmIntegrationManager}. Replaces the old single-CCU
|
|
78617
80289
|
* `homematic-gateway.ts` singleton.
|
|
@@ -78657,6 +80329,10 @@ var HmBrokerRegistry = class {
|
|
|
78657
80329
|
* typically in tests) facade creation is skipped.
|
|
78658
80330
|
*/
|
|
78659
80331
|
#useDefaultFactory;
|
|
80332
|
+
/** Pending restore-retry timers — cleared on {@link shutdown}. */
|
|
80333
|
+
#retryTimers = /* @__PURE__ */ new Map();
|
|
80334
|
+
/** True after {@link shutdown} — blocks further restore retries. */
|
|
80335
|
+
#shuttingDown = false;
|
|
78660
80336
|
constructor(logger, deps = {}) {
|
|
78661
80337
|
this.#logger = logger;
|
|
78662
80338
|
this.#onBrokerConnected = deps.onBrokerConnected ?? (() => void 0);
|
|
@@ -78681,10 +80357,13 @@ var HmBrokerRegistry = class {
|
|
|
78681
80357
|
* Restore previously-persisted broker entries on addon boot.
|
|
78682
80358
|
*
|
|
78683
80359
|
* Seeds the id counter from existing ids so future allocations never
|
|
78684
|
-
* collide. Starts each manager best-effort: a failed start is
|
|
78685
|
-
*
|
|
80360
|
+
* collide. Starts each manager best-effort: a failed start is rolled back
|
|
80361
|
+
* out of `#managers` (so a later attempt can rebuild) and scheduled for a
|
|
80362
|
+
* bounded background retry — a transient CCU `ECONNREFUSED` must not leave
|
|
80363
|
+
* the broker dead until an operator restarts the addon.
|
|
78686
80364
|
*/
|
|
78687
80365
|
async restore(entries) {
|
|
80366
|
+
this.#shuttingDown = false;
|
|
78688
80367
|
for (const entry of entries) this.#seedCounter(entry.id);
|
|
78689
80368
|
for (const entry of entries) try {
|
|
78690
80369
|
await this.#startManager(entry);
|
|
@@ -78694,6 +80373,7 @@ var HmBrokerRegistry = class {
|
|
|
78694
80373
|
tags: { brokerId: entry.id },
|
|
78695
80374
|
meta: { error: msg }
|
|
78696
80375
|
});
|
|
80376
|
+
this.#scheduleRestoreRetry(entry, 0);
|
|
78697
80377
|
}
|
|
78698
80378
|
}
|
|
78699
80379
|
/**
|
|
@@ -78701,6 +80381,9 @@ var HmBrokerRegistry = class {
|
|
|
78701
80381
|
* shutdown.
|
|
78702
80382
|
*/
|
|
78703
80383
|
async shutdown() {
|
|
80384
|
+
this.#shuttingDown = true;
|
|
80385
|
+
for (const timer of this.#retryTimers.values()) clearTimeout(timer);
|
|
80386
|
+
this.#retryTimers.clear();
|
|
78704
80387
|
const ids = Array.from(this.#managers.keys());
|
|
78705
80388
|
await Promise.all(ids.map(async (id) => {
|
|
78706
80389
|
const mgr = this.#managers.get(id);
|
|
@@ -78892,6 +80575,10 @@ var HmBrokerRegistry = class {
|
|
|
78892
80575
|
* Build (via the factory), register, and start the manager for one entry.
|
|
78893
80576
|
* If a manager for the same id already exists (e.g. a duplicate restore
|
|
78894
80577
|
* call), skip construction and only re-index the integration FK.
|
|
80578
|
+
*
|
|
80579
|
+
* On `start()` failure the half-built manager is abandoned so a retry can
|
|
80580
|
+
* construct a fresh one — leaving it in `#managers` used to make every
|
|
80581
|
+
* subsequent `#startManager` a no-op.
|
|
78895
80582
|
*/
|
|
78896
80583
|
async #startManager(entry) {
|
|
78897
80584
|
if (this.#managers.has(entry.id)) {
|
|
@@ -78908,13 +80595,92 @@ var HmBrokerRegistry = class {
|
|
|
78908
80595
|
});
|
|
78909
80596
|
this.#managers.set(entry.id, mgr);
|
|
78910
80597
|
if (entry.integrationId !== void 0) this.#integrationToBroker.set(entry.integrationId, entry.id);
|
|
78911
|
-
|
|
80598
|
+
try {
|
|
80599
|
+
await mgr.start();
|
|
80600
|
+
} catch (err) {
|
|
80601
|
+
await this.#abandonFailedStart(entry.id, mgr);
|
|
80602
|
+
throw err;
|
|
80603
|
+
}
|
|
80604
|
+
const pending = this.#retryTimers.get(entry.id);
|
|
80605
|
+
if (pending !== void 0) {
|
|
80606
|
+
clearTimeout(pending);
|
|
80607
|
+
this.#retryTimers.delete(entry.id);
|
|
80608
|
+
}
|
|
78912
80609
|
this.#logger.info("HmBrokerRegistry: manager started", {
|
|
78913
80610
|
tags: { brokerId: entry.id },
|
|
78914
80611
|
meta: { name: entry.name }
|
|
78915
80612
|
});
|
|
78916
80613
|
}
|
|
78917
80614
|
/**
|
|
80615
|
+
* Drop a manager that never reached `connected` so a later attempt can
|
|
80616
|
+
* rebuild it. Best-effort `stop()`; never throws.
|
|
80617
|
+
*/
|
|
80618
|
+
async #abandonFailedStart(id, mgr) {
|
|
80619
|
+
this.#managers.delete(id);
|
|
80620
|
+
this.#facades.delete(id);
|
|
80621
|
+
homematicFacades.set(id, null);
|
|
80622
|
+
try {
|
|
80623
|
+
await mgr.stop();
|
|
80624
|
+
} catch (err) {
|
|
80625
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
80626
|
+
this.#logger.debug("HmBrokerRegistry: abandon stop failed", {
|
|
80627
|
+
tags: { brokerId: id },
|
|
80628
|
+
meta: { error: msg }
|
|
80629
|
+
});
|
|
80630
|
+
}
|
|
80631
|
+
}
|
|
80632
|
+
/**
|
|
80633
|
+
* Schedule attempt `attemptIndex` of {@link RESTORE_RETRY_DELAYS_MS} for
|
|
80634
|
+
* `entry`. No-ops when the registry is shutting down or the schedule is
|
|
80635
|
+
* exhausted (warns once at the end).
|
|
80636
|
+
*/
|
|
80637
|
+
#scheduleRestoreRetry(entry, attemptIndex) {
|
|
80638
|
+
if (this.#shuttingDown) return;
|
|
80639
|
+
const delay = RESTORE_RETRY_DELAYS_MS[attemptIndex];
|
|
80640
|
+
if (delay === void 0) {
|
|
80641
|
+
this.#logger.warn("HmBrokerRegistry: restore retries exhausted", {
|
|
80642
|
+
tags: { brokerId: entry.id },
|
|
80643
|
+
meta: { attempts: RESTORE_RETRY_DELAYS_MS.length }
|
|
80644
|
+
});
|
|
80645
|
+
return;
|
|
80646
|
+
}
|
|
80647
|
+
const existing = this.#retryTimers.get(entry.id);
|
|
80648
|
+
if (existing !== void 0) clearTimeout(existing);
|
|
80649
|
+
const timer = setTimeout(() => {
|
|
80650
|
+
this.#retryTimers.delete(entry.id);
|
|
80651
|
+
this.#runRestoreRetry(entry, attemptIndex);
|
|
80652
|
+
}, delay);
|
|
80653
|
+
this.#retryTimers.set(entry.id, timer);
|
|
80654
|
+
this.#logger.info("HmBrokerRegistry: scheduling restore retry", {
|
|
80655
|
+
tags: { brokerId: entry.id },
|
|
80656
|
+
meta: {
|
|
80657
|
+
attempt: attemptIndex + 1,
|
|
80658
|
+
delayMs: delay
|
|
80659
|
+
}
|
|
80660
|
+
});
|
|
80661
|
+
}
|
|
80662
|
+
async #runRestoreRetry(entry, attemptIndex) {
|
|
80663
|
+
if (this.#shuttingDown) return;
|
|
80664
|
+
if (this.#managers.has(entry.id)) return;
|
|
80665
|
+
try {
|
|
80666
|
+
await this.#startManager(entry);
|
|
80667
|
+
this.#logger.info("HmBrokerRegistry: restore retry succeeded", {
|
|
80668
|
+
tags: { brokerId: entry.id },
|
|
80669
|
+
meta: { attempt: attemptIndex + 1 }
|
|
80670
|
+
});
|
|
80671
|
+
} catch (err) {
|
|
80672
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
80673
|
+
this.#logger.warn("HmBrokerRegistry: restore retry failed", {
|
|
80674
|
+
tags: { brokerId: entry.id },
|
|
80675
|
+
meta: {
|
|
80676
|
+
attempt: attemptIndex + 1,
|
|
80677
|
+
error: msg
|
|
80678
|
+
}
|
|
80679
|
+
});
|
|
80680
|
+
this.#scheduleRestoreRetry(entry, attemptIndex + 1);
|
|
80681
|
+
}
|
|
80682
|
+
}
|
|
80683
|
+
/**
|
|
78918
80684
|
* Allocate the next monotonic id in the `hm_NNN` sequence and advance
|
|
78919
80685
|
* the counter.
|
|
78920
80686
|
*/
|
|
@@ -81371,6 +83137,19 @@ var HmContainerDevice = class HmContainerDevice extends BaseDevice {
|
|
|
81371
83137
|
}
|
|
81372
83138
|
}
|
|
81373
83139
|
/**
|
|
83140
|
+
* Stamp `feature-probe.lastProbedAt` only when the CCU device is on the
|
|
83141
|
+
* facade. An empty accessory-spec list + a stamped probe is how the kernel
|
|
83142
|
+
* orphan-prunes linked children (`device-cap-proxy` safety gate): a restore
|
|
83143
|
+
* that races a CCU `ECONNREFUSED` used to delete every accessory and fence
|
|
83144
|
+
* their identities for 5 minutes. Leaving `lastProbedAt === 0` until the
|
|
83145
|
+
* device is present keeps the gate closed; `reprobe()` on broker connect
|
|
83146
|
+
* completes the probe and spawns/reconciles children for real.
|
|
83147
|
+
*/
|
|
83148
|
+
async onProbe() {
|
|
83149
|
+
if (this.resolveHmDevice() === null) return;
|
|
83150
|
+
await super.onProbe();
|
|
83151
|
+
}
|
|
83152
|
+
/**
|
|
81374
83153
|
* Derive the accessory children LIVE from the facade descriptor. Each child
|
|
81375
83154
|
* is a {@link HmEntitySpec} (the shared per-entity decomposition) wrapped into
|
|
81376
83155
|
* an `AccessoryChildSpec`: the `stableIdSuffix` IS the spec `key`, the broker
|
|
@@ -81510,6 +83289,7 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
81510
83289
|
this.registry.setOnBrokerConnected((brokerId) => {
|
|
81511
83290
|
this.ctx.logger.info("Homematic: broker connected", { meta: { brokerId } });
|
|
81512
83291
|
this.setBrokerDevicesOnline(brokerId, true);
|
|
83292
|
+
this.reprobeBrokerContainers(brokerId);
|
|
81513
83293
|
});
|
|
81514
83294
|
this.registry.setOnBrokerDisconnected((brokerId) => {
|
|
81515
83295
|
this.setBrokerDevicesOnline(brokerId, false);
|
|
@@ -81904,6 +83684,28 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
81904
83684
|
count: n
|
|
81905
83685
|
} });
|
|
81906
83686
|
}
|
|
83687
|
+
/**
|
|
83688
|
+
* Reprobe every adopted {@link HmContainerDevice} for `brokerId` so the
|
|
83689
|
+
* kernel re-runs accessory reconcile against the live facade. Best-effort:
|
|
83690
|
+
* one container's failure must not block the rest (same discipline as HA's
|
|
83691
|
+
* post-connect reconcile).
|
|
83692
|
+
*/
|
|
83693
|
+
async reprobeBrokerContainers(brokerId) {
|
|
83694
|
+
const reg = this.ctx.kernel.deviceRegistry;
|
|
83695
|
+
if (!reg) return;
|
|
83696
|
+
const containers = reg.getAllForAddon(this.addonId).filter((d) => d instanceof HmContainerDevice && d.config.get("brokerId") === brokerId);
|
|
83697
|
+
for (const container of containers) try {
|
|
83698
|
+
await container.reprobe();
|
|
83699
|
+
} catch (err) {
|
|
83700
|
+
this.ctx.logger.warn("Homematic: container reprobe failed", {
|
|
83701
|
+
tags: { deviceId: container.id },
|
|
83702
|
+
meta: {
|
|
83703
|
+
brokerId,
|
|
83704
|
+
error: errMsg(err)
|
|
83705
|
+
}
|
|
83706
|
+
});
|
|
83707
|
+
}
|
|
83708
|
+
}
|
|
81907
83709
|
/** Return the live registry or throw if the addon is not initialised. */
|
|
81908
83710
|
requireRegistry() {
|
|
81909
83711
|
if (!this.registry) throw new Error("Homematic provider not initialised");
|