@camstack/addon-post-analysis 1.2.346 → 1.2.348
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/{clip-model-registry--UsI8Ud4.js → clip-model-registry-AqAEU7Eo.js} +1759 -147
- package/dist/{clip-model-registry-BftmbgcV.mjs → clip-model-registry-CrUfogC-.mjs} +1759 -147
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/pipeline-analytics/_stub.js +2 -2
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CeJTtS8B.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-zK8c1RbI.mjs} +3 -3
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Du_tzgi2.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DLOjWwaN.mjs +26 -0
- package/dist/pipeline-analytics/{hostInit-DkInRTZ0.mjs → hostInit-DAeozYqI.mjs} +3 -3
- package/dist/pipeline-analytics/index.js +423 -242
- package/dist/pipeline-analytics/index.mjs +423 -242
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-4Fu7jNn9.mjs +0 -26
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Cutp7k0_.mjs +0 -26
|
@@ -5480,7 +5480,7 @@ var ZodIssueCode = {
|
|
|
5480
5480
|
var ZodFirstPartyTypeKind;
|
|
5481
5481
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5482
5482
|
//#endregion
|
|
5483
|
-
//#region ../types/dist/sleep-
|
|
5483
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5484
5484
|
/**
|
|
5485
5485
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5486
5486
|
* window to float samples (D455).
|
|
@@ -5597,7 +5597,7 @@ function isKeychainStoredField(field) {
|
|
|
5597
5597
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5598
5598
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5599
5599
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5600
|
-
function isRecord$
|
|
5600
|
+
function isRecord$2(value) {
|
|
5601
5601
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5602
5602
|
}
|
|
5603
5603
|
function makeSecretMarker(ref) {
|
|
@@ -5608,12 +5608,12 @@ function makeSecretMarker(ref) {
|
|
|
5608
5608
|
}
|
|
5609
5609
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5610
5610
|
function isSecretMarker(value) {
|
|
5611
|
-
if (!isRecord$
|
|
5611
|
+
if (!isRecord$2(value)) return false;
|
|
5612
5612
|
const ref = value["$secret"];
|
|
5613
5613
|
return typeof ref === "string" && ref.length > 0;
|
|
5614
5614
|
}
|
|
5615
5615
|
function isSecretClear(value) {
|
|
5616
|
-
return isRecord$
|
|
5616
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5617
5617
|
}
|
|
5618
5618
|
/**
|
|
5619
5619
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6129,6 +6129,13 @@ function globalSecretScope() {
|
|
|
6129
6129
|
function encodeSegment(value) {
|
|
6130
6130
|
return encodeURIComponent(value);
|
|
6131
6131
|
}
|
|
6132
|
+
function decodeSegment(value) {
|
|
6133
|
+
try {
|
|
6134
|
+
return decodeURIComponent(value);
|
|
6135
|
+
} catch {
|
|
6136
|
+
return null;
|
|
6137
|
+
}
|
|
6138
|
+
}
|
|
6132
6139
|
/**
|
|
6133
6140
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6134
6141
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6137,6 +6144,75 @@ function encodeSegment(value) {
|
|
|
6137
6144
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6138
6145
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6139
6146
|
}
|
|
6147
|
+
function parseScope(segments) {
|
|
6148
|
+
switch (segments[0]) {
|
|
6149
|
+
case "global": return {
|
|
6150
|
+
scope: GLOBAL_SCOPE,
|
|
6151
|
+
used: 1
|
|
6152
|
+
};
|
|
6153
|
+
case "node": {
|
|
6154
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6155
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6156
|
+
scope: {
|
|
6157
|
+
kind: "node",
|
|
6158
|
+
nodeId
|
|
6159
|
+
},
|
|
6160
|
+
used: 2
|
|
6161
|
+
};
|
|
6162
|
+
}
|
|
6163
|
+
case "device": {
|
|
6164
|
+
const raw = segments[1];
|
|
6165
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6166
|
+
return {
|
|
6167
|
+
scope: {
|
|
6168
|
+
kind: "device",
|
|
6169
|
+
deviceId: Number(raw)
|
|
6170
|
+
},
|
|
6171
|
+
used: 2
|
|
6172
|
+
};
|
|
6173
|
+
}
|
|
6174
|
+
case "integration": {
|
|
6175
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6176
|
+
return id === null || id.length === 0 ? null : {
|
|
6177
|
+
scope: {
|
|
6178
|
+
kind: "integration",
|
|
6179
|
+
integrationId: id
|
|
6180
|
+
},
|
|
6181
|
+
used: 2
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
case "row": {
|
|
6185
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6186
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6187
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6188
|
+
return {
|
|
6189
|
+
scope: {
|
|
6190
|
+
kind: "row",
|
|
6191
|
+
collection,
|
|
6192
|
+
rowId
|
|
6193
|
+
},
|
|
6194
|
+
used: 3
|
|
6195
|
+
};
|
|
6196
|
+
}
|
|
6197
|
+
default: return null;
|
|
6198
|
+
}
|
|
6199
|
+
}
|
|
6200
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6201
|
+
function parseSecretRef(ref) {
|
|
6202
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6203
|
+
const segments = ref.slice(9).split("/");
|
|
6204
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6205
|
+
if (owner === null || owner.length === 0) return null;
|
|
6206
|
+
const parsed = parseScope(segments.slice(1));
|
|
6207
|
+
if (parsed === null) return null;
|
|
6208
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6209
|
+
if (fieldPath.length === 0) return null;
|
|
6210
|
+
return {
|
|
6211
|
+
owner,
|
|
6212
|
+
scope: parsed.scope,
|
|
6213
|
+
fieldPath
|
|
6214
|
+
};
|
|
6215
|
+
}
|
|
6140
6216
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6141
6217
|
var KeychainWriteRefusedError = class extends Error {
|
|
6142
6218
|
fieldPath;
|
|
@@ -6147,7 +6223,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6147
6223
|
}
|
|
6148
6224
|
};
|
|
6149
6225
|
var KEEP = { kind: "keep" };
|
|
6150
|
-
function isRecord(value) {
|
|
6226
|
+
function isRecord$1(value) {
|
|
6151
6227
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6152
6228
|
}
|
|
6153
6229
|
function defaultMintId() {
|
|
@@ -6160,7 +6236,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6160
6236
|
return out;
|
|
6161
6237
|
}
|
|
6162
6238
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6163
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6239
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6164
6240
|
return out;
|
|
6165
6241
|
}
|
|
6166
6242
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6215,7 +6291,7 @@ function rowId(row, idKey) {
|
|
|
6215
6291
|
return null;
|
|
6216
6292
|
}
|
|
6217
6293
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6218
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6294
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6219
6295
|
if (!Array.isArray(incoming)) {
|
|
6220
6296
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6221
6297
|
return {
|
|
@@ -6231,7 +6307,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6231
6307
|
const kept = /* @__PURE__ */ new Set();
|
|
6232
6308
|
const rows = [];
|
|
6233
6309
|
for (const row of incoming) {
|
|
6234
|
-
if (!isRecord(row)) {
|
|
6310
|
+
if (!isRecord$1(row)) {
|
|
6235
6311
|
rows.push(row);
|
|
6236
6312
|
continue;
|
|
6237
6313
|
}
|
|
@@ -6256,7 +6332,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6256
6332
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6257
6333
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6258
6334
|
case "object": {
|
|
6259
|
-
if (!isRecord(incoming)) {
|
|
6335
|
+
if (!isRecord$1(incoming)) {
|
|
6260
6336
|
if (incoming === void 0) return KEEP;
|
|
6261
6337
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6262
6338
|
return {
|
|
@@ -6264,7 +6340,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6264
6340
|
value: incoming
|
|
6265
6341
|
};
|
|
6266
6342
|
}
|
|
6267
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6343
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6268
6344
|
return {
|
|
6269
6345
|
kind: "value",
|
|
6270
6346
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6323,12 +6399,19 @@ async function transformSecretWrite(input) {
|
|
|
6323
6399
|
}
|
|
6324
6400
|
};
|
|
6325
6401
|
}
|
|
6402
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6403
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6404
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6405
|
+
}
|
|
6326
6406
|
/**
|
|
6327
6407
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6328
6408
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6329
6409
|
*/
|
|
6330
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6331
|
-
const
|
|
6410
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6411
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6412
|
+
const owner = options.ownedBy;
|
|
6413
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6414
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6332
6415
|
if (refs.length === 0) return {
|
|
6333
6416
|
value,
|
|
6334
6417
|
unresolved: []
|
|
@@ -6352,10 +6435,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6352
6435
|
}
|
|
6353
6436
|
const substitute = (v) => {
|
|
6354
6437
|
if (isSecretMarker(v)) {
|
|
6438
|
+
if (!inScope(v.$secret)) return {
|
|
6439
|
+
keep: true,
|
|
6440
|
+
value: v
|
|
6441
|
+
};
|
|
6355
6442
|
const answer = answers[v.$secret];
|
|
6356
|
-
|
|
6443
|
+
if (answer?.kind === "value") return {
|
|
6357
6444
|
keep: true,
|
|
6358
6445
|
value: answer.value
|
|
6446
|
+
};
|
|
6447
|
+
return keepMarker ? {
|
|
6448
|
+
keep: true,
|
|
6449
|
+
value: v
|
|
6359
6450
|
} : {
|
|
6360
6451
|
keep: false,
|
|
6361
6452
|
value: void 0
|
|
@@ -6372,7 +6463,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6372
6463
|
value: items
|
|
6373
6464
|
};
|
|
6374
6465
|
}
|
|
6375
|
-
if (isRecord(v)) {
|
|
6466
|
+
if (isRecord$1(v)) {
|
|
6376
6467
|
const out = {};
|
|
6377
6468
|
for (const [k, child] of Object.entries(v)) {
|
|
6378
6469
|
const s = substitute(child);
|
|
@@ -6393,14 +6484,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6393
6484
|
unresolved
|
|
6394
6485
|
};
|
|
6395
6486
|
}
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6487
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6488
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6489
|
+
ref;
|
|
6490
|
+
reason;
|
|
6491
|
+
constructor(ref, reason) {
|
|
6492
|
+
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.`);
|
|
6493
|
+
this.ref = ref;
|
|
6494
|
+
this.reason = reason;
|
|
6495
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6496
|
+
}
|
|
6497
|
+
};
|
|
6498
|
+
function isRecord(value) {
|
|
6499
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6500
|
+
}
|
|
6501
|
+
function resolvedValue(pass, marker) {
|
|
6502
|
+
const answer = pass.answers[marker.$secret];
|
|
6503
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6504
|
+
}
|
|
6505
|
+
async function atMarker(pass, incoming, stored) {
|
|
6506
|
+
if (incoming === null) return stored;
|
|
6507
|
+
if (typeof incoming !== "string") return incoming;
|
|
6508
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6509
|
+
const intent = classifySecretWrite(incoming);
|
|
6510
|
+
if (intent.kind !== "set") return stored;
|
|
6511
|
+
const ref = stored.$secret;
|
|
6512
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6513
|
+
const answer = pass.answers[ref];
|
|
6514
|
+
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);
|
|
6515
|
+
try {
|
|
6516
|
+
await pass.secrets.put(ref, intent.value);
|
|
6517
|
+
} catch (err) {
|
|
6518
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6519
|
+
}
|
|
6520
|
+
pass.changedRefs.push(ref);
|
|
6521
|
+
return stored;
|
|
6522
|
+
}
|
|
6523
|
+
function inArray(pass, incoming, stored) {
|
|
6524
|
+
return incoming.map((item, index) => {
|
|
6525
|
+
const twin = stored[index];
|
|
6526
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6527
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6528
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6529
|
+
return item;
|
|
6530
|
+
});
|
|
6531
|
+
}
|
|
6532
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6533
|
+
const out = { ...incoming };
|
|
6534
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6535
|
+
const twin = stored[key];
|
|
6536
|
+
if (isSecretMarker(twin)) {
|
|
6537
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6538
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6539
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6540
|
+
}
|
|
6541
|
+
return out;
|
|
6542
|
+
}
|
|
6543
|
+
async function walk(pass, incoming, stored) {
|
|
6544
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6545
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6546
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6547
|
+
const out = { ...incoming };
|
|
6548
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6549
|
+
return out;
|
|
6550
|
+
}
|
|
6551
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6552
|
+
async function restoreUnchangedSecrets(input) {
|
|
6553
|
+
const refs = [];
|
|
6554
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6555
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6556
|
+
if (owned.length === 0) return {
|
|
6557
|
+
patch: input.patch,
|
|
6558
|
+
changedRefs: []
|
|
6559
|
+
};
|
|
6560
|
+
const pass = {
|
|
6561
|
+
secrets: input.secrets,
|
|
6562
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6563
|
+
operatorWrite: input.operatorWrite,
|
|
6564
|
+
changedRefs: []
|
|
6565
|
+
};
|
|
6566
|
+
const out = {};
|
|
6567
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6568
|
+
return {
|
|
6569
|
+
patch: out,
|
|
6570
|
+
changedRefs: pass.changedRefs
|
|
6571
|
+
};
|
|
6572
|
+
}
|
|
6573
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6574
|
+
function isJsonEqual(a, b) {
|
|
6575
|
+
if (Object.is(a, b)) return true;
|
|
6576
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6577
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6578
|
+
const keys = Object.keys(a);
|
|
6579
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6580
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6401
6581
|
}
|
|
6402
6582
|
return false;
|
|
6403
6583
|
}
|
|
6584
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6585
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6586
|
+
const out = {};
|
|
6587
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6588
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6589
|
+
out[key] = value;
|
|
6590
|
+
}
|
|
6591
|
+
return out;
|
|
6592
|
+
}
|
|
6593
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6594
|
+
function markerKeysOf(blob, owner) {
|
|
6595
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6596
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6597
|
+
return keys;
|
|
6598
|
+
}
|
|
6599
|
+
function nodeFromStored(value, owner) {
|
|
6600
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6601
|
+
if (!isRecord(value)) return null;
|
|
6602
|
+
const children = /* @__PURE__ */ new Map();
|
|
6603
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6604
|
+
const node = nodeFromStored(child, owner);
|
|
6605
|
+
if (node !== null) children.set(key, node);
|
|
6606
|
+
}
|
|
6607
|
+
return children.size > 0 ? {
|
|
6608
|
+
kind: "object",
|
|
6609
|
+
children
|
|
6610
|
+
} : null;
|
|
6611
|
+
}
|
|
6612
|
+
/**
|
|
6613
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6614
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6615
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6616
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6617
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6618
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6619
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6620
|
+
* over.
|
|
6621
|
+
*/
|
|
6622
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6623
|
+
const added = /* @__PURE__ */ new Map();
|
|
6624
|
+
for (const key of keys) {
|
|
6625
|
+
const at = key.indexOf("@");
|
|
6626
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6627
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6628
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6629
|
+
if (node !== null) added.set(base, node);
|
|
6630
|
+
}
|
|
6631
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6632
|
+
}
|
|
6404
6633
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6405
6634
|
async function readStoredAddonBlob(raw) {
|
|
6406
6635
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6409,7 +6638,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6409
6638
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6410
6639
|
return result.kind === "missing" ? {} : result.value;
|
|
6411
6640
|
}
|
|
6412
|
-
function
|
|
6641
|
+
function touchesTree(tree, patch) {
|
|
6642
|
+
if (tree.size === 0) return false;
|
|
6643
|
+
for (const key of Object.keys(patch)) {
|
|
6644
|
+
const at = key.indexOf("@");
|
|
6645
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6646
|
+
}
|
|
6647
|
+
return false;
|
|
6648
|
+
}
|
|
6649
|
+
/**
|
|
6650
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6651
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6652
|
+
*/
|
|
6653
|
+
var MarkerKeyIndex = class {
|
|
6654
|
+
owner;
|
|
6655
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6656
|
+
constructor(owner) {
|
|
6657
|
+
this.owner = owner;
|
|
6658
|
+
}
|
|
6659
|
+
seen(store, blob) {
|
|
6660
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6661
|
+
}
|
|
6662
|
+
wrote(store, patch) {
|
|
6663
|
+
const keys = this.byStore.get(store);
|
|
6664
|
+
if (keys === void 0) return;
|
|
6665
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6666
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6667
|
+
else keys.delete(key);
|
|
6668
|
+
}
|
|
6669
|
+
mayHoldMarkers(store, patch) {
|
|
6670
|
+
const keys = this.byStore.get(store);
|
|
6671
|
+
if (keys === void 0) return true;
|
|
6672
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6673
|
+
}
|
|
6674
|
+
};
|
|
6675
|
+
function createHandle(raw, opts) {
|
|
6413
6676
|
const chains = /* @__PURE__ */ new Map();
|
|
6414
6677
|
const serialize = (key, fn) => {
|
|
6415
6678
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6420,46 +6683,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6420
6683
|
});
|
|
6421
6684
|
return next;
|
|
6422
6685
|
};
|
|
6423
|
-
const
|
|
6424
|
-
|
|
6425
|
-
|
|
6686
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6687
|
+
const resolveRead = async (store, blob) => {
|
|
6688
|
+
index.seen(store, blob);
|
|
6689
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6690
|
+
unresolved: "keep-marker",
|
|
6691
|
+
ownedBy: opts.secrets.owner
|
|
6692
|
+
});
|
|
6693
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6694
|
+
return value;
|
|
6695
|
+
};
|
|
6696
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6697
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6698
|
+
await rawWrite(patch);
|
|
6699
|
+
index.wrote(store, patch);
|
|
6700
|
+
return { changed: true };
|
|
6701
|
+
}
|
|
6702
|
+
return serialize(store, async () => {
|
|
6426
6703
|
const stored = await readStored();
|
|
6704
|
+
index.seen(store, stored);
|
|
6705
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6706
|
+
const restored = await restoreUnchangedSecrets({
|
|
6707
|
+
patch,
|
|
6708
|
+
stored,
|
|
6709
|
+
secrets: opts.secrets,
|
|
6710
|
+
operatorWrite
|
|
6711
|
+
});
|
|
6427
6712
|
const result = await transformSecretWrite({
|
|
6428
|
-
tree,
|
|
6713
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6429
6714
|
secrets: opts.secrets,
|
|
6430
|
-
patch,
|
|
6715
|
+
patch: restored.patch,
|
|
6431
6716
|
stored,
|
|
6432
6717
|
...scope !== void 0 ? { scope } : {},
|
|
6433
|
-
operatorWrite
|
|
6718
|
+
operatorWrite
|
|
6434
6719
|
});
|
|
6435
|
-
|
|
6720
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6721
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6722
|
+
if (wroteBlob) {
|
|
6723
|
+
await rawWrite(effective);
|
|
6724
|
+
index.wrote(store, effective);
|
|
6725
|
+
}
|
|
6436
6726
|
const { orphaned } = await result.afterWrite();
|
|
6437
6727
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6728
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6438
6729
|
});
|
|
6439
6730
|
};
|
|
6440
|
-
const
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6731
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6732
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6733
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6734
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6735
|
+
const overrides = {
|
|
6736
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6737
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6738
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6739
|
+
return result.kind === "value" ? {
|
|
6740
|
+
kind: "value",
|
|
6741
|
+
value: await resolveRead("addon", result.value)
|
|
6742
|
+
} : result;
|
|
6743
|
+
} } : {},
|
|
6744
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6745
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6746
|
+
if (result.kind !== "present") return result;
|
|
6747
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6748
|
+
unresolved: "keep-marker",
|
|
6749
|
+
ownedBy: opts.secrets.owner
|
|
6750
|
+
});
|
|
6751
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6752
|
+
return {
|
|
6753
|
+
kind: "present",
|
|
6754
|
+
value: value[key]
|
|
6755
|
+
};
|
|
6756
|
+
} } : {},
|
|
6757
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6758
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6759
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6760
|
+
const out = /* @__PURE__ */ new Map();
|
|
6761
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6762
|
+
return out;
|
|
6763
|
+
} } : {},
|
|
6764
|
+
writeAddonStore: async (patch) => {
|
|
6765
|
+
await writeAddon(patch);
|
|
6766
|
+
},
|
|
6767
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6768
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6769
|
+
kind: "device",
|
|
6770
|
+
deviceId
|
|
6771
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6772
|
+
}
|
|
6773
|
+
};
|
|
6774
|
+
return {
|
|
6775
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6776
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6777
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6778
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6779
|
+
} }),
|
|
6780
|
+
raw: {
|
|
6781
|
+
readAddonStore: async () => {
|
|
6782
|
+
const blob = await raw.readAddonStore();
|
|
6783
|
+
index.seen("addon", blob);
|
|
6784
|
+
return blob;
|
|
6785
|
+
},
|
|
6786
|
+
readDeviceStore: async (deviceId) => {
|
|
6787
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6788
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6789
|
+
return blob;
|
|
6790
|
+
}
|
|
6791
|
+
},
|
|
6792
|
+
writeAddonStore: writeAddon
|
|
6446
6793
|
};
|
|
6447
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6448
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6449
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6450
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6451
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6452
|
-
} });
|
|
6453
6794
|
}
|
|
6454
|
-
/** The context the addon sees
|
|
6455
|
-
function
|
|
6795
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6796
|
+
function createSecretAwareContext(context, opts) {
|
|
6456
6797
|
const raw = context.settings;
|
|
6457
|
-
if (raw === void 0) return
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6798
|
+
if (raw === void 0) return {
|
|
6799
|
+
context,
|
|
6800
|
+
handle: null
|
|
6801
|
+
};
|
|
6802
|
+
const handle = createHandle(raw, opts);
|
|
6803
|
+
return {
|
|
6804
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6805
|
+
if (prop === "settings") return handle.settings;
|
|
6806
|
+
return Reflect.get(target, prop, receiver);
|
|
6807
|
+
} }),
|
|
6808
|
+
handle
|
|
6809
|
+
};
|
|
6463
6810
|
}
|
|
6464
6811
|
var LEAF = { kind: "leaf" };
|
|
6465
6812
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6634,6 +6981,14 @@ var BaseAddon = class {
|
|
|
6634
6981
|
_secretChangeUnsub = null;
|
|
6635
6982
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6636
6983
|
_operatorWriteDepth = 0;
|
|
6984
|
+
/**
|
|
6985
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6986
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6987
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6988
|
+
*/
|
|
6989
|
+
_secretSettings = null;
|
|
6990
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6991
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6637
6992
|
constructor(defaults) {
|
|
6638
6993
|
this.defaults = defaults;
|
|
6639
6994
|
this._config = { ...defaults };
|
|
@@ -6670,13 +7025,21 @@ var BaseAddon = class {
|
|
|
6670
7025
|
}
|
|
6671
7026
|
async initialize(context) {
|
|
6672
7027
|
const secrets = context.secrets;
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
7028
|
+
if (secrets !== void 0) {
|
|
7029
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7030
|
+
secrets,
|
|
7031
|
+
addonTree: () => this.addonSecretTree(),
|
|
7032
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7033
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7034
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7035
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7036
|
+
});
|
|
7037
|
+
this._ctx = wrapped;
|
|
7038
|
+
this._secretSettings = handle;
|
|
7039
|
+
} else {
|
|
7040
|
+
this._ctx = context;
|
|
7041
|
+
this._secretSettings = null;
|
|
7042
|
+
}
|
|
6680
7043
|
await this.resolveConfig();
|
|
6681
7044
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6682
7045
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6793,11 +7156,8 @@ var BaseAddon = class {
|
|
|
6793
7156
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6794
7157
|
const schema = this.globalSettingsSchema(cap);
|
|
6795
7158
|
if (!schema) return { sections: [] };
|
|
6796
|
-
const projected = await this.
|
|
6797
|
-
return hydrateSchema(schema, overlay ? {
|
|
6798
|
-
...projected,
|
|
6799
|
-
...overlay
|
|
6800
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7159
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7160
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6801
7161
|
}
|
|
6802
7162
|
/**
|
|
6803
7163
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6842,7 +7202,7 @@ var BaseAddon = class {
|
|
|
6842
7202
|
});
|
|
6843
7203
|
}
|
|
6844
7204
|
if (sections.length === 0) return null;
|
|
6845
|
-
const projected = await this.
|
|
7205
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6846
7206
|
return hydrateSchema({
|
|
6847
7207
|
...schema,
|
|
6848
7208
|
sections
|
|
@@ -6859,12 +7219,50 @@ var BaseAddon = class {
|
|
|
6859
7219
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6860
7220
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6861
7221
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7222
|
+
*
|
|
7223
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7224
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7225
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7226
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7227
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7228
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6862
7229
|
*/
|
|
6863
7230
|
async resolveGlobalStore(nodeId, cap) {
|
|
6864
7231
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7232
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7233
|
+
}
|
|
7234
|
+
projectForNode(store, nodeId, cap) {
|
|
6865
7235
|
const keys = this.perNodeKeys(cap);
|
|
6866
7236
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6867
|
-
return keys.size > 0 ? projectStore(
|
|
7237
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7238
|
+
}
|
|
7239
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7240
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7241
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7242
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7243
|
+
}
|
|
7244
|
+
/**
|
|
7245
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7246
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7247
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7248
|
+
* its value.
|
|
7249
|
+
*/
|
|
7250
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7251
|
+
const secrets = this._ctx?.secrets;
|
|
7252
|
+
const merged = {
|
|
7253
|
+
...stored,
|
|
7254
|
+
...overlay
|
|
7255
|
+
};
|
|
7256
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7257
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7258
|
+
unresolved: "keep-marker",
|
|
7259
|
+
ownedBy: secrets.owner
|
|
7260
|
+
});
|
|
7261
|
+
for (const key of Object.keys(overlay)) {
|
|
7262
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7263
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7264
|
+
}
|
|
7265
|
+
return merged;
|
|
6868
7266
|
}
|
|
6869
7267
|
/**
|
|
6870
7268
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6929,8 +7327,12 @@ var BaseAddon = class {
|
|
|
6929
7327
|
async clearSecrets(keys, nodeId) {
|
|
6930
7328
|
const tree = this.addonSecretTree();
|
|
6931
7329
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7330
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6932
7331
|
const patch = {};
|
|
6933
|
-
for (const key of keys)
|
|
7332
|
+
for (const key of keys) {
|
|
7333
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7334
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7335
|
+
}
|
|
6934
7336
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6935
7337
|
}
|
|
6936
7338
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6938,7 +7340,11 @@ var BaseAddon = class {
|
|
|
6938
7340
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6939
7341
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6940
7342
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6941
|
-
|
|
7343
|
+
const handle = this._secretSettings;
|
|
7344
|
+
if (handle !== null) {
|
|
7345
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7346
|
+
if (!changed) return;
|
|
7347
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6942
7348
|
if (target !== localNode) return;
|
|
6943
7349
|
await this.resolveConfig();
|
|
6944
7350
|
await this.onConfigChanged();
|
|
@@ -6991,7 +7397,7 @@ var BaseAddon = class {
|
|
|
6991
7397
|
async getDeviceSettings(deviceId) {
|
|
6992
7398
|
const schema = this.deviceSettingsSchema();
|
|
6993
7399
|
if (!schema) return { sections: [] };
|
|
6994
|
-
return hydrateSchema(schema, await this.
|
|
7400
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6995
7401
|
}
|
|
6996
7402
|
async updateDeviceSettings(deviceId, patch) {
|
|
6997
7403
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7163,7 +7569,7 @@ var BaseAddon = class {
|
|
|
7163
7569
|
key,
|
|
7164
7570
|
schema,
|
|
7165
7571
|
fallback,
|
|
7166
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7572
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7167
7573
|
write: async (patch) => {
|
|
7168
7574
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7169
7575
|
},
|
|
@@ -7225,6 +7631,23 @@ var BaseAddon = class {
|
|
|
7225
7631
|
}
|
|
7226
7632
|
return value;
|
|
7227
7633
|
}
|
|
7634
|
+
/**
|
|
7635
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7636
|
+
* keychain the context's own view is already raw.
|
|
7637
|
+
*/
|
|
7638
|
+
rawSettings() {
|
|
7639
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7640
|
+
}
|
|
7641
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7642
|
+
logUnresolvedRead(unresolved) {
|
|
7643
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7644
|
+
if (fresh.length === 0) return;
|
|
7645
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7646
|
+
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) => ({
|
|
7647
|
+
ref: u.ref,
|
|
7648
|
+
reason: u.reason
|
|
7649
|
+
})) } });
|
|
7650
|
+
}
|
|
7228
7651
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7229
7652
|
scheduleSecretReresolve(delayMs) {
|
|
7230
7653
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7251,7 +7674,7 @@ var BaseAddon = class {
|
|
|
7251
7674
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7252
7675
|
*/
|
|
7253
7676
|
async readAddonStoreWithRetry() {
|
|
7254
|
-
const settings = this.
|
|
7677
|
+
const settings = this.rawSettings();
|
|
7255
7678
|
if (!settings) return {};
|
|
7256
7679
|
const delaysMs = [
|
|
7257
7680
|
150,
|
|
@@ -10165,6 +10588,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10165
10588
|
*/
|
|
10166
10589
|
var DETECTION_PIPELINE_CAP_NAME = "detection-pipeline";
|
|
10167
10590
|
/**
|
|
10591
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10592
|
+
* gets back (cloud training, D805+).
|
|
10593
|
+
*
|
|
10594
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10595
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10596
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10597
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10598
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10599
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10600
|
+
* change there, in the same piece of work.
|
|
10601
|
+
*
|
|
10602
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10603
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10604
|
+
*/
|
|
10605
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10606
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10607
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10608
|
+
var TrainingExportSchema = _enum([
|
|
10609
|
+
"onnx",
|
|
10610
|
+
"openvino-fp16",
|
|
10611
|
+
"openvino-int8",
|
|
10612
|
+
"coreml-fp16"
|
|
10613
|
+
]);
|
|
10614
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10615
|
+
object({
|
|
10616
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10617
|
+
jobKey: string().uuid(),
|
|
10618
|
+
target: object({
|
|
10619
|
+
kind: literal("detector"),
|
|
10620
|
+
step: literal("object-detection")
|
|
10621
|
+
}),
|
|
10622
|
+
base: object({
|
|
10623
|
+
modelId: string().min(1),
|
|
10624
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10625
|
+
weights: string().min(1),
|
|
10626
|
+
imgsz: number().int().positive()
|
|
10627
|
+
}),
|
|
10628
|
+
baseline: object({
|
|
10629
|
+
modelId: string().min(1),
|
|
10630
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10631
|
+
onnxUrl: string().url(),
|
|
10632
|
+
imgsz: number().int().positive(),
|
|
10633
|
+
floors: FloorsSchema
|
|
10634
|
+
}),
|
|
10635
|
+
dataset: object({
|
|
10636
|
+
versionId: string().min(1),
|
|
10637
|
+
annotationHash: string(),
|
|
10638
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10639
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10640
|
+
}),
|
|
10641
|
+
split: object({
|
|
10642
|
+
holdoutCameras: array(number().int()),
|
|
10643
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10644
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10645
|
+
valFraction: number().min(0).max(.5),
|
|
10646
|
+
seed: number().int()
|
|
10647
|
+
}),
|
|
10648
|
+
hyper: object({
|
|
10649
|
+
epochs: number().int().positive(),
|
|
10650
|
+
batch: number().int().positive(),
|
|
10651
|
+
lr0: number().positive(),
|
|
10652
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10653
|
+
freeze: number().int().nonnegative(),
|
|
10654
|
+
patience: number().int().nonnegative(),
|
|
10655
|
+
seed: number().int()
|
|
10656
|
+
}),
|
|
10657
|
+
replay: object({
|
|
10658
|
+
source: literal("coco2017"),
|
|
10659
|
+
count: number().int().nonnegative()
|
|
10660
|
+
}),
|
|
10661
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10662
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10663
|
+
floors: object({
|
|
10664
|
+
minSupport: number().int().positive(),
|
|
10665
|
+
clamp: number().min(0).max(1)
|
|
10666
|
+
}),
|
|
10667
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10668
|
+
catalog: object({
|
|
10669
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10670
|
+
name: string().min(1).max(160)
|
|
10671
|
+
})
|
|
10672
|
+
});
|
|
10673
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10674
|
+
var TrainingResultFileSchema = object({
|
|
10675
|
+
path: string().min(1),
|
|
10676
|
+
bytes: number().int().nonnegative(),
|
|
10677
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10678
|
+
format: _enum([
|
|
10679
|
+
"onnx",
|
|
10680
|
+
"openvino",
|
|
10681
|
+
"coreml",
|
|
10682
|
+
"pt"
|
|
10683
|
+
]),
|
|
10684
|
+
variant: _enum(["base", "int8"])
|
|
10685
|
+
});
|
|
10686
|
+
var DraftFormatSchema = object({
|
|
10687
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10688
|
+
url: string().min(1),
|
|
10689
|
+
sizeMB: number().nonnegative(),
|
|
10690
|
+
isDirectory: boolean().optional(),
|
|
10691
|
+
files: array(string()).optional(),
|
|
10692
|
+
runtimes: array(literal("python")).optional(),
|
|
10693
|
+
revision: string().min(1)
|
|
10694
|
+
});
|
|
10695
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10696
|
+
var TrainingCatalogDraftSchema = object({
|
|
10697
|
+
id: string().min(1),
|
|
10698
|
+
name: string().min(1),
|
|
10699
|
+
description: string(),
|
|
10700
|
+
labels: array(unknown()),
|
|
10701
|
+
inputSize: object({
|
|
10702
|
+
width: number().int().positive(),
|
|
10703
|
+
height: number().int().positive()
|
|
10704
|
+
}),
|
|
10705
|
+
preprocessMode: literal("letterbox"),
|
|
10706
|
+
defaultClassFloors: FloorsSchema,
|
|
10707
|
+
formats: object({
|
|
10708
|
+
onnx: DraftFormatSchema.optional(),
|
|
10709
|
+
openvino: DraftFormatSchema.optional(),
|
|
10710
|
+
coreml: DraftFormatSchema.optional()
|
|
10711
|
+
})
|
|
10712
|
+
});
|
|
10713
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10714
|
+
var TrainingEvalClassSchema = object({
|
|
10715
|
+
positives: number().int(),
|
|
10716
|
+
floor: number().nullable(),
|
|
10717
|
+
tp: number().int(),
|
|
10718
|
+
fp: number().int(),
|
|
10719
|
+
fn: number().int(),
|
|
10720
|
+
precision: number().nullable(),
|
|
10721
|
+
recall: number().nullable(),
|
|
10722
|
+
ap50: number().nullable(),
|
|
10723
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10724
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10725
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10726
|
+
smallFound: number().int().optional(),
|
|
10727
|
+
smallTotal: number().int().optional()
|
|
10728
|
+
}).passthrough();
|
|
10729
|
+
var TrainingEvalReportSchema = object({
|
|
10730
|
+
frames: number().int(),
|
|
10731
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10732
|
+
}).passthrough();
|
|
10733
|
+
/**
|
|
10734
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10735
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10736
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10737
|
+
*/
|
|
10738
|
+
var TrainingResultSchema = object({
|
|
10739
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10740
|
+
jobKey: string(),
|
|
10741
|
+
status: _enum(["succeeded", "failed"]),
|
|
10742
|
+
error: object({
|
|
10743
|
+
stage: string(),
|
|
10744
|
+
code: string(),
|
|
10745
|
+
message: string()
|
|
10746
|
+
}).nullable(),
|
|
10747
|
+
trainer: object({
|
|
10748
|
+
version: string(),
|
|
10749
|
+
revision: string()
|
|
10750
|
+
}),
|
|
10751
|
+
toolchain: record(string(), string().nullable()),
|
|
10752
|
+
dataset: object({
|
|
10753
|
+
versionId: string(),
|
|
10754
|
+
annotationHash: string(),
|
|
10755
|
+
sha256: string(),
|
|
10756
|
+
frames: object({
|
|
10757
|
+
train: number().int(),
|
|
10758
|
+
val: number().int(),
|
|
10759
|
+
holdout: number().int()
|
|
10760
|
+
}),
|
|
10761
|
+
holdoutCameras: array(number().int()),
|
|
10762
|
+
replayImages: number().int()
|
|
10763
|
+
}).optional(),
|
|
10764
|
+
training: object({
|
|
10765
|
+
epochsRun: number().int(),
|
|
10766
|
+
bestEpoch: number().int(),
|
|
10767
|
+
bestMap50: number(),
|
|
10768
|
+
bestMap50_95: number(),
|
|
10769
|
+
seconds: number()
|
|
10770
|
+
}).optional(),
|
|
10771
|
+
evaluation: object({
|
|
10772
|
+
holdoutFrames: number().int(),
|
|
10773
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10774
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10775
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10776
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10777
|
+
map50: record(string(), number().nullable())
|
|
10778
|
+
}).optional(),
|
|
10779
|
+
floors: object({
|
|
10780
|
+
baseline: FloorsSchema,
|
|
10781
|
+
candidate: FloorsSchema,
|
|
10782
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10783
|
+
notes: array(string())
|
|
10784
|
+
}).optional(),
|
|
10785
|
+
int8: object({
|
|
10786
|
+
kept: boolean(),
|
|
10787
|
+
map50Fp16: number().nullable(),
|
|
10788
|
+
map50Int8: number().nullable(),
|
|
10789
|
+
reason: string().nullable()
|
|
10790
|
+
}).optional(),
|
|
10791
|
+
exportsDropped: array(object({
|
|
10792
|
+
export: string(),
|
|
10793
|
+
reason: string()
|
|
10794
|
+
})).optional(),
|
|
10795
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10796
|
+
bundle: object({
|
|
10797
|
+
path: literal("bundle.tar"),
|
|
10798
|
+
bytes: number().int().nonnegative(),
|
|
10799
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10800
|
+
}).nullable().optional(),
|
|
10801
|
+
catalogDraft: object({
|
|
10802
|
+
base: TrainingCatalogDraftSchema,
|
|
10803
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10804
|
+
}).nullable().optional(),
|
|
10805
|
+
licence: string()
|
|
10806
|
+
});
|
|
10807
|
+
var TrainingStageSchema = _enum([
|
|
10808
|
+
"prepare",
|
|
10809
|
+
"replay",
|
|
10810
|
+
"train",
|
|
10811
|
+
"eval",
|
|
10812
|
+
"export",
|
|
10813
|
+
"package"
|
|
10814
|
+
]);
|
|
10815
|
+
var EventBase = {
|
|
10816
|
+
v: literal(1),
|
|
10817
|
+
ts: number()
|
|
10818
|
+
};
|
|
10819
|
+
discriminatedUnion("type", [
|
|
10820
|
+
object({
|
|
10821
|
+
...EventBase,
|
|
10822
|
+
type: literal("stage"),
|
|
10823
|
+
stage: TrainingStageSchema
|
|
10824
|
+
}),
|
|
10825
|
+
object({
|
|
10826
|
+
...EventBase,
|
|
10827
|
+
type: literal("epoch"),
|
|
10828
|
+
epoch: number().int(),
|
|
10829
|
+
epochs: number().int(),
|
|
10830
|
+
boxLoss: number().nullable().optional(),
|
|
10831
|
+
map50: number().nullable().optional(),
|
|
10832
|
+
map50_95: number().nullable().optional(),
|
|
10833
|
+
etaSec: number().nullable().optional()
|
|
10834
|
+
}),
|
|
10835
|
+
object({
|
|
10836
|
+
...EventBase,
|
|
10837
|
+
type: literal("metric"),
|
|
10838
|
+
name: string(),
|
|
10839
|
+
value: number()
|
|
10840
|
+
}),
|
|
10841
|
+
object({
|
|
10842
|
+
...EventBase,
|
|
10843
|
+
type: literal("artifact"),
|
|
10844
|
+
path: string(),
|
|
10845
|
+
bytes: number(),
|
|
10846
|
+
sha256: string()
|
|
10847
|
+
}),
|
|
10848
|
+
object({
|
|
10849
|
+
...EventBase,
|
|
10850
|
+
type: literal("done"),
|
|
10851
|
+
status: _enum(["succeeded", "failed"]),
|
|
10852
|
+
resultSha256: string().nullable().optional()
|
|
10853
|
+
}),
|
|
10854
|
+
object({
|
|
10855
|
+
...EventBase,
|
|
10856
|
+
type: literal("error"),
|
|
10857
|
+
stage: string(),
|
|
10858
|
+
code: string(),
|
|
10859
|
+
message: string()
|
|
10860
|
+
})
|
|
10861
|
+
]);
|
|
10862
|
+
/**
|
|
10168
10863
|
* Birth-decision ledger — one durable row per track-birth VERDICT (D409).
|
|
10169
10864
|
*
|
|
10170
10865
|
* ── Why this exists ────────────────────────────────────────────────────────
|
|
@@ -12932,7 +13627,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12932
13627
|
"authenticated",
|
|
12933
13628
|
"admin"
|
|
12934
13629
|
]).optional(),
|
|
12935
|
-
description: string().optional()
|
|
13630
|
+
description: string().optional(),
|
|
13631
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13632
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12936
13633
|
});
|
|
12937
13634
|
/**
|
|
12938
13635
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13882,6 +14579,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13882
14579
|
lastError: string().optional()
|
|
13883
14580
|
});
|
|
13884
14581
|
/**
|
|
14582
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14583
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14584
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14585
|
+
* with it off — which restores without a key.
|
|
14586
|
+
*/
|
|
14587
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14588
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14589
|
+
scheme: string(),
|
|
14590
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14591
|
+
keyId: string()
|
|
14592
|
+
});
|
|
14593
|
+
/**
|
|
14594
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14595
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14596
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14597
|
+
*/
|
|
14598
|
+
var BackupEncryptionStatusSchema = object({
|
|
14599
|
+
enabled: boolean(),
|
|
14600
|
+
active: object({
|
|
14601
|
+
keyId: string(),
|
|
14602
|
+
publicKey: string(),
|
|
14603
|
+
createdAt: number()
|
|
14604
|
+
}).nullable(),
|
|
14605
|
+
/** Every key ever set up, newest first. */
|
|
14606
|
+
keys: array(object({
|
|
14607
|
+
keyId: string(),
|
|
14608
|
+
createdAt: number(),
|
|
14609
|
+
retiredAt: number().nullable()
|
|
14610
|
+
})).readonly()
|
|
14611
|
+
});
|
|
14612
|
+
/**
|
|
13885
14613
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13886
14614
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13887
14615
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13893,7 +14621,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13893
14621
|
sizeBytes: number(),
|
|
13894
14622
|
label: string().optional(),
|
|
13895
14623
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13896
|
-
locations: array(string()).readonly()
|
|
14624
|
+
locations: array(string()).readonly(),
|
|
14625
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14626
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13897
14627
|
});
|
|
13898
14628
|
var BackupEntrySchema = object({
|
|
13899
14629
|
id: string(),
|
|
@@ -13902,7 +14632,8 @@ var BackupEntrySchema = object({
|
|
|
13902
14632
|
label: string().optional(),
|
|
13903
14633
|
createdAt: number(),
|
|
13904
14634
|
sizeBytes: number(),
|
|
13905
|
-
locations: array(string()).optional()
|
|
14635
|
+
locations: array(string()).optional(),
|
|
14636
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13906
14637
|
});
|
|
13907
14638
|
var ArchiveEntrySchema = object({
|
|
13908
14639
|
path: string(),
|
|
@@ -14157,11 +14888,58 @@ var backupCapability = {
|
|
|
14157
14888
|
* this list and skips entries whose path doesn't start with
|
|
14158
14889
|
* any of them.
|
|
14159
14890
|
*/
|
|
14160
|
-
locations: array(string()).optional()
|
|
14891
|
+
locations: array(string()).optional(),
|
|
14892
|
+
/**
|
|
14893
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14894
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14895
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14896
|
+
* is refused before the archive is downloaded.
|
|
14897
|
+
*/
|
|
14898
|
+
backupSecretKey: string().optional()
|
|
14161
14899
|
}), _void(), {
|
|
14162
14900
|
kind: "mutation",
|
|
14163
14901
|
auth: "admin"
|
|
14164
14902
|
}),
|
|
14903
|
+
/** The encryption setting — public keys only. */
|
|
14904
|
+
getEncryption: method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }),
|
|
14905
|
+
/**
|
|
14906
|
+
* Turn encryption on, or replace the key: generates a new key pair, keeps
|
|
14907
|
+
* the PUBLIC key, and returns the SECRET key — once. It is never stored
|
|
14908
|
+
* on the hub and cannot be shown again; archives made from now on need
|
|
14909
|
+
* it to be restored. A previous key is retired: archives made with it
|
|
14910
|
+
* still need IT.
|
|
14911
|
+
*/
|
|
14912
|
+
setupEncryption: method(object({}), object({
|
|
14913
|
+
keyId: string(),
|
|
14914
|
+
secretKey: string(),
|
|
14915
|
+
publicKey: string(),
|
|
14916
|
+
createdAt: number(),
|
|
14917
|
+
replacedKeyId: string().nullable()
|
|
14918
|
+
}), {
|
|
14919
|
+
kind: "mutation",
|
|
14920
|
+
auth: "admin"
|
|
14921
|
+
}),
|
|
14922
|
+
/** New archives are plain again. Existing encrypted archives keep needing their key. */
|
|
14923
|
+
disableEncryption: method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14924
|
+
kind: "mutation",
|
|
14925
|
+
auth: "admin"
|
|
14926
|
+
}),
|
|
14927
|
+
/**
|
|
14928
|
+
* Does this secret key parse, and which backup key is it? A mutation so
|
|
14929
|
+
* the key never travels in a URL. Nothing is stored.
|
|
14930
|
+
*/
|
|
14931
|
+
checkBackupKey: method(object({ backupSecretKey: string() }), object({
|
|
14932
|
+
valid: boolean(),
|
|
14933
|
+
keyId: string().nullable(),
|
|
14934
|
+
/** The hub knows this key (active or retired). */
|
|
14935
|
+
known: boolean(),
|
|
14936
|
+
/** It is the key new archives are encrypted to. */
|
|
14937
|
+
active: boolean(),
|
|
14938
|
+
error: string().optional()
|
|
14939
|
+
}), {
|
|
14940
|
+
kind: "mutation",
|
|
14941
|
+
auth: "admin"
|
|
14942
|
+
}),
|
|
14165
14943
|
delete: method(object({
|
|
14166
14944
|
destinationId: string(),
|
|
14167
14945
|
backupId: string()
|
|
@@ -16357,22 +17135,87 @@ var CustomModelDescriptorSchema = object({
|
|
|
16357
17135
|
stepId: string(),
|
|
16358
17136
|
entry: ModelCatalogEntrySchema
|
|
16359
17137
|
});
|
|
17138
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
17139
|
+
var ModelBundleFileSchema = object({
|
|
17140
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
17141
|
+
path: string().min(1),
|
|
17142
|
+
bytes: number().int().nonnegative(),
|
|
17143
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
17144
|
+
});
|
|
17145
|
+
var ImportModelBundleInputSchema = object({
|
|
17146
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
17147
|
+
addonId: string(),
|
|
17148
|
+
stepId: string().min(1),
|
|
17149
|
+
/**
|
|
17150
|
+
* The catalog rows to register, complete, every format URL already
|
|
17151
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
17152
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
17153
|
+
*/
|
|
17154
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
17155
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
17156
|
+
bundle: object({
|
|
17157
|
+
ticket: PeerBytesTicketSchema,
|
|
17158
|
+
bytes: number().int().positive(),
|
|
17159
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
17160
|
+
}),
|
|
17161
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
17162
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
17163
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
17164
|
+
distribute: boolean()
|
|
17165
|
+
});
|
|
17166
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
17167
|
+
kind: literal("imported"),
|
|
17168
|
+
modelIds: array(string()).readonly(),
|
|
17169
|
+
distributed: array(object({
|
|
17170
|
+
modelId: string(),
|
|
17171
|
+
nodeId: string(),
|
|
17172
|
+
format: _enum(MODEL_FORMATS),
|
|
17173
|
+
ok: boolean(),
|
|
17174
|
+
error: string().optional()
|
|
17175
|
+
})).readonly()
|
|
17176
|
+
}), object({
|
|
17177
|
+
kind: literal("refused"),
|
|
17178
|
+
reason: _enum([
|
|
17179
|
+
"transfer-failed",
|
|
17180
|
+
"checksum-mismatch",
|
|
17181
|
+
"bundle-mismatch",
|
|
17182
|
+
"invalid-entry",
|
|
17183
|
+
"id-taken"
|
|
17184
|
+
]),
|
|
17185
|
+
detail: string()
|
|
17186
|
+
})]);
|
|
16360
17187
|
var customModelRegistryCapability = {
|
|
16361
17188
|
name: "custom-model-registry",
|
|
16362
17189
|
scope: "system",
|
|
16363
17190
|
mode: "collection",
|
|
16364
17191
|
internal: true,
|
|
16365
|
-
methods: {
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16373
|
-
|
|
16374
|
-
|
|
16375
|
-
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" })
|
|
17192
|
+
methods: {
|
|
17193
|
+
/**
|
|
17194
|
+
* `internal: true` did not gate the mount (see the 2026-08-26 note on
|
|
17195
|
+
* `data-store-provider`) — this was reachable on the AppRouter by ANY
|
|
17196
|
+
* authenticated session at the default `auth: 'protected'`. The only
|
|
17197
|
+
* consumer, the detection-pipeline's model resolution
|
|
17198
|
+
* (`addon-pipeline/src/detection-pipeline/provider.ts`), calls
|
|
17199
|
+
* `ctx.api.customModelRegistry.listModels.query()` — UDS/Moleculer,
|
|
17200
|
+
* never tRPC — so `auth: 'admin'` costs it nothing.
|
|
17201
|
+
*/
|
|
17202
|
+
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }),
|
|
17203
|
+
/**
|
|
17204
|
+
* Register a model whose files arrive as ONE bundle tar (D806): the tar
|
|
17205
|
+
* is taken over `ctx.peerBytes`, checked against `bundle.sha256` and
|
|
17206
|
+
* every row of `files`, unpacked into the hub's flat modelsDir (directory
|
|
17207
|
+
* formats included), each format's `.revision` record written, the rows
|
|
17208
|
+
* upserted under the operator's name, the hub marked available and —
|
|
17209
|
+
* when asked — engine formats converted and the model distributed. A
|
|
17210
|
+
* model id already registered by another source is refused, never
|
|
17211
|
+
* overwritten.
|
|
17212
|
+
*/
|
|
17213
|
+
importModelBundle: method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
17214
|
+
kind: "mutation",
|
|
17215
|
+
auth: "admin",
|
|
17216
|
+
timeoutMs: 30 * 6e4
|
|
17217
|
+
})
|
|
17218
|
+
}
|
|
16376
17219
|
};
|
|
16377
17220
|
/**
|
|
16378
17221
|
* Query filter for settings-store collections.
|
|
@@ -17163,6 +18006,35 @@ var KeychainKeySourceSchema = object({
|
|
|
17163
18006
|
*/
|
|
17164
18007
|
sharesBackupWithDatabase: boolean()
|
|
17165
18008
|
});
|
|
18009
|
+
/**
|
|
18010
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
18011
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
18012
|
+
*/
|
|
18013
|
+
var KeychainResetRecordSchema = object({
|
|
18014
|
+
id: string(),
|
|
18015
|
+
at: number(),
|
|
18016
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
18017
|
+
actor: string(),
|
|
18018
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
18019
|
+
lockedReason: string().nullable(),
|
|
18020
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
18021
|
+
archived: number().int(),
|
|
18022
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
18023
|
+
archivedCollection: string().nullable(),
|
|
18024
|
+
/**
|
|
18025
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
18026
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
18027
|
+
*/
|
|
18028
|
+
archivedKeysCollection: string().nullable(),
|
|
18029
|
+
/**
|
|
18030
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
18031
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
18032
|
+
* agent forever (D797).
|
|
18033
|
+
*/
|
|
18034
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
18035
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
18036
|
+
acknowledgedAt: number().nullable()
|
|
18037
|
+
});
|
|
17166
18038
|
var KeychainStatusSchema = object({
|
|
17167
18039
|
keychain: KeychainStateSchema,
|
|
17168
18040
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -17180,7 +18052,9 @@ var KeychainStatusSchema = object({
|
|
|
17180
18052
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
17181
18053
|
retiredWraps: number().int(),
|
|
17182
18054
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
17183
|
-
secretCount: number().int()
|
|
18055
|
+
secretCount: number().int(),
|
|
18056
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
18057
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
17184
18058
|
});
|
|
17185
18059
|
/**
|
|
17186
18060
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -17202,13 +18076,14 @@ var KeychainAuditActionSchema = _enum([
|
|
|
17202
18076
|
"download-recovery-key",
|
|
17203
18077
|
"delete-orphans",
|
|
17204
18078
|
"reset",
|
|
18079
|
+
"acknowledge-reset",
|
|
17205
18080
|
"initialize"
|
|
17206
18081
|
]);
|
|
17207
18082
|
var KeychainAuditEntrySchema = object({
|
|
17208
18083
|
id: string(),
|
|
17209
18084
|
at: number(),
|
|
17210
18085
|
action: KeychainAuditActionSchema,
|
|
17211
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
18086
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
17212
18087
|
actor: string(),
|
|
17213
18088
|
ref: string().nullable(),
|
|
17214
18089
|
detail: string().nullable()
|
|
@@ -17318,6 +18193,21 @@ var keychainAdminCapability = {
|
|
|
17318
18193
|
kind: "mutation",
|
|
17319
18194
|
auth: "admin",
|
|
17320
18195
|
caller: "required"
|
|
18196
|
+
}),
|
|
18197
|
+
/**
|
|
18198
|
+
* What the last reset left to re-enter: the archived refs (owner, scope,
|
|
18199
|
+
* field — never a value) that hold no value again yet. Process-held refs
|
|
18200
|
+
* the hub regenerates itself (the session signing key) are not listed.
|
|
18201
|
+
*/
|
|
18202
|
+
resetReport: method(object({}), object({
|
|
18203
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
18204
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
18205
|
+
}), { auth: "admin" }),
|
|
18206
|
+
/** Dismiss the "keychain was reset" notice. Audited. */
|
|
18207
|
+
acknowledgeReset: method(object({}), object({ acknowledged: boolean() }), {
|
|
18208
|
+
kind: "mutation",
|
|
18209
|
+
auth: "admin",
|
|
18210
|
+
caller: "required"
|
|
17321
18211
|
})
|
|
17322
18212
|
}
|
|
17323
18213
|
};
|
|
@@ -21368,7 +22258,7 @@ var logDestinationCapability = {
|
|
|
21368
22258
|
* `login-method` — collection cap through which auth addons contribute
|
|
21369
22259
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
21370
22260
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
21371
|
-
* every auth addon (OIDC,
|
|
22261
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
21372
22262
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
21373
22263
|
* procedure aggregates them for the unauthenticated login page.
|
|
21374
22264
|
*
|
|
@@ -21376,8 +22266,7 @@ var logDestinationCapability = {
|
|
|
21376
22266
|
*
|
|
21377
22267
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
21378
22268
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
21379
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
21380
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
22269
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
21381
22270
|
* login page needs NO change.
|
|
21382
22271
|
*
|
|
21383
22272
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -21396,8 +22285,8 @@ var logDestinationCapability = {
|
|
|
21396
22285
|
* decision.
|
|
21397
22286
|
*
|
|
21398
22287
|
* Every contribution carries a `stage`:
|
|
21399
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
21400
|
-
*
|
|
22288
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
22289
|
+
* buttons; a usernameless passkey).
|
|
21401
22290
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
21402
22291
|
* returned `factors` (passkey-as-2FA today).
|
|
21403
22292
|
*
|
|
@@ -21424,7 +22313,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
21424
22313
|
* The provider names an external identity a signed-in user can link to
|
|
21425
22314
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
21426
22315
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
21427
|
-
* whatever their id. Absent / false — a login button only
|
|
22316
|
+
* whatever their id. Absent / false — a login button only.
|
|
21428
22317
|
*/
|
|
21429
22318
|
linkable: boolean().optional()
|
|
21430
22319
|
}),
|
|
@@ -26327,8 +27216,7 @@ var notificationRulesCapability = {
|
|
|
26327
27216
|
* `super_admin` — collapsed onto the single boolean because every
|
|
26328
27217
|
* non-admin caller is governed by the same scope-check rules; the
|
|
26329
27218
|
* distinction was only ever used to route role-specific procedures
|
|
26330
|
-
* which we no longer have.
|
|
26331
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
27219
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
26332
27220
|
* with `isAdmin: false` + an explicit scope list.
|
|
26333
27221
|
*/
|
|
26334
27222
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -29716,6 +30604,26 @@ var pipelineAnalyticsCapability = {
|
|
|
29716
30604
|
auth: "admin",
|
|
29717
30605
|
timeoutMs: 60 * 6e4
|
|
29718
30606
|
}),
|
|
30607
|
+
/**
|
|
30608
|
+
* OFFER the annotated archive instead of pushing it (D805): the same tar
|
|
30609
|
+
* `writeRetrainArchive` streams, behind a one-shot `ctx.peerBytes` ticket
|
|
30610
|
+
* the caller dials at once (same host). For a consumer that cannot expose
|
|
30611
|
+
* an upload URL — a training provider streaming straight into its cloud.
|
|
30612
|
+
* The answer is the plan; the bytes and their sha256 are the consumer's
|
|
30613
|
+
* to measure as they arrive.
|
|
30614
|
+
*/
|
|
30615
|
+
offerRetrainArchive: method(object({
|
|
30616
|
+
filter: RetrainExportFilterSchema,
|
|
30617
|
+
layout: RetrainExportLayoutSchema
|
|
30618
|
+
}), object({
|
|
30619
|
+
ticket: PeerBytesTicketSchema,
|
|
30620
|
+
frames: number().int(),
|
|
30621
|
+
annotations: number().int()
|
|
30622
|
+
}), {
|
|
30623
|
+
kind: "mutation",
|
|
30624
|
+
auth: "admin",
|
|
30625
|
+
timeoutMs: 12e4
|
|
30626
|
+
}),
|
|
29719
30627
|
/** The counts a selection would freeze — class × camera × day/night,
|
|
29720
30628
|
* completeness — without freezing anything. Index reads only. */
|
|
29721
30629
|
previewRetrainDataset: method(object({
|
|
@@ -34385,8 +35293,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
34385
35293
|
* `smtp-provider` — pluggable email delivery surface.
|
|
34386
35294
|
*
|
|
34387
35295
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
34388
|
-
* one for transactional / one for notifications). Consumers (
|
|
34389
|
-
*
|
|
35296
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
35297
|
+
* addons, …) walk the collection and pick the first
|
|
34390
35298
|
* ready provider OR target a specific addonId.
|
|
34391
35299
|
*
|
|
34392
35300
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -34682,7 +35590,7 @@ targets: array(object({
|
|
|
34682
35590
|
};
|
|
34683
35591
|
/**
|
|
34684
35592
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
34685
|
-
* providers (OIDC, SAML,
|
|
35593
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
34686
35594
|
* carrying the post-callback claims before redirecting back to
|
|
34687
35595
|
* `/api/auth/sso/finish`.
|
|
34688
35596
|
*
|
|
@@ -34745,7 +35653,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
34745
35653
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
34746
35654
|
* subject is unique only per issuer, so a link is bound to it.
|
|
34747
35655
|
*/
|
|
34748
|
-
issuer: string().optional()
|
|
35656
|
+
issuer: string().optional(),
|
|
35657
|
+
/**
|
|
35658
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
35659
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
35660
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
35661
|
+
* any other browser.
|
|
35662
|
+
*/
|
|
35663
|
+
browserBinding: string().optional()
|
|
34749
35664
|
});
|
|
34750
35665
|
var ssoBridgeCapability = {
|
|
34751
35666
|
name: "sso-bridge",
|
|
@@ -34763,7 +35678,7 @@ var ssoBridgeCapability = {
|
|
|
34763
35678
|
* `/api/auth/sso/finish` to become admin — a full privilege escalation
|
|
34764
35679
|
* through the exact surface this cap exists to close (see the module
|
|
34765
35680
|
* docblock). Every real caller (`oauth-grants.ts`, `main.ts`
|
|
34766
|
-
* registration, the OIDC
|
|
35681
|
+
* registration, the OIDC addon) reaches this through
|
|
34767
35682
|
* `ctx.api` / the in-process registry — never through tRPC — so
|
|
34768
35683
|
* `auth: 'admin'` costs those callers nothing.
|
|
34769
35684
|
*/
|
|
@@ -49172,16 +50087,6 @@ var ApiKeySummarySchema = object({
|
|
|
49172
50087
|
createdAt: number(),
|
|
49173
50088
|
lastUsedAt: number().optional()
|
|
49174
50089
|
});
|
|
49175
|
-
var CreateApiKeyInputSchema = object({
|
|
49176
|
-
label: string(),
|
|
49177
|
-
isAdmin: boolean().default(false),
|
|
49178
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
49179
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
49180
|
-
});
|
|
49181
|
-
var CreateApiKeyResultSchema = object({
|
|
49182
|
-
token: string(),
|
|
49183
|
-
record: ApiKeySummarySchema
|
|
49184
|
-
});
|
|
49185
50090
|
var ScopedTokenSummarySchema = object({
|
|
49186
50091
|
id: string(),
|
|
49187
50092
|
userId: string(),
|
|
@@ -49293,20 +50198,11 @@ var userManagementCapability = {
|
|
|
49293
50198
|
access: "view"
|
|
49294
50199
|
}),
|
|
49295
50200
|
listApiKeys: method(_void(), array(ApiKeySummarySchema), { auth: "admin" }),
|
|
49296
|
-
createApiKey: method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
|
|
49297
|
-
kind: "mutation",
|
|
49298
|
-
auth: "admin",
|
|
49299
|
-
access: "create"
|
|
49300
|
-
}),
|
|
49301
50201
|
revokeApiKey: method(object({ id: string() }), object({ success: literal(true) }), {
|
|
49302
50202
|
kind: "mutation",
|
|
49303
50203
|
auth: "admin",
|
|
49304
50204
|
access: "delete"
|
|
49305
50205
|
}),
|
|
49306
|
-
validateApiKey: method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
49307
|
-
kind: "mutation",
|
|
49308
|
-
access: "view"
|
|
49309
|
-
}),
|
|
49310
50206
|
createScopedToken: method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
49311
50207
|
kind: "mutation",
|
|
49312
50208
|
auth: "admin",
|
|
@@ -49396,20 +50292,6 @@ var userManagementCapability = {
|
|
|
49396
50292
|
userId: string(),
|
|
49397
50293
|
issuer: string()
|
|
49398
50294
|
}).nullable(), { auth: "admin" }),
|
|
49399
|
-
/**
|
|
49400
|
-
* Link `(provider, subject)` to `userId`. Idempotent for the same user;
|
|
49401
|
-
* REFUSES (throws) an identity already linked to another user, and a
|
|
49402
|
-
* user that does not exist.
|
|
49403
|
-
*/
|
|
49404
|
-
linkExternalIdentity: method(ExternalIdentityKeySchema.extend({
|
|
49405
|
-
userId: string(),
|
|
49406
|
-
issuer: string().min(1),
|
|
49407
|
-
label: string().optional()
|
|
49408
|
-
}), object({ success: literal(true) }), {
|
|
49409
|
-
kind: "mutation",
|
|
49410
|
-
auth: "admin",
|
|
49411
|
-
access: "create"
|
|
49412
|
-
}),
|
|
49413
50295
|
/** Remove one link of `userId`. `success: false` when it was not linked to that user. */
|
|
49414
50296
|
unlinkExternalIdentity: method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
49415
50297
|
kind: "mutation",
|
|
@@ -50120,6 +51002,531 @@ var zoneRulesCapability = {
|
|
|
50120
51002
|
*/
|
|
50121
51003
|
durability: "restored"
|
|
50122
51004
|
};
|
|
51005
|
+
/**
|
|
51006
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
51007
|
+
*
|
|
51008
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
51009
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
51010
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
51011
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
51012
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
51013
|
+
* manifest entry and nothing else.
|
|
51014
|
+
*
|
|
51015
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
51016
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
51017
|
+
* Every method is `admin`: these spend money.
|
|
51018
|
+
*
|
|
51019
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
51020
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
51021
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
51022
|
+
*
|
|
51023
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
51024
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
51025
|
+
* ticket the provider mints (D613).
|
|
51026
|
+
*/
|
|
51027
|
+
var TrainingGpuOptionSchema = object({
|
|
51028
|
+
id: string(),
|
|
51029
|
+
label: string(),
|
|
51030
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
51031
|
+
usdPerHour: number().nonnegative(),
|
|
51032
|
+
vramGb: number().nonnegative()
|
|
51033
|
+
});
|
|
51034
|
+
var TrainingRegionOptionSchema = object({
|
|
51035
|
+
/** `''` = any region (the provider's choice). */
|
|
51036
|
+
id: string(),
|
|
51037
|
+
label: string(),
|
|
51038
|
+
priceMultiplier: number().positive()
|
|
51039
|
+
});
|
|
51040
|
+
/**
|
|
51041
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
51042
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
51043
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
51044
|
+
*/
|
|
51045
|
+
var TrainingProviderDefaultsSchema = object({
|
|
51046
|
+
gpuType: string(),
|
|
51047
|
+
region: string(),
|
|
51048
|
+
costCapUsd: number().nonnegative(),
|
|
51049
|
+
maxRuntimeSec: number().int().positive(),
|
|
51050
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
51051
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
51052
|
+
});
|
|
51053
|
+
var TrainingProviderDescriptorSchema = object({
|
|
51054
|
+
addonId: string(),
|
|
51055
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
51056
|
+
kind: string(),
|
|
51057
|
+
label: string(),
|
|
51058
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
51059
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
51060
|
+
maxDatasetBytes: number().int().positive(),
|
|
51061
|
+
maxRuntimeSec: number().int().positive(),
|
|
51062
|
+
freeTierNote: string().optional(),
|
|
51063
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
51064
|
+
dataResidencyNote: string(),
|
|
51065
|
+
/** Credentials are present — never the values. */
|
|
51066
|
+
configured: boolean(),
|
|
51067
|
+
defaults: TrainingProviderDefaultsSchema
|
|
51068
|
+
});
|
|
51069
|
+
var TrainingCredentialCheckSchema = object({
|
|
51070
|
+
ok: boolean(),
|
|
51071
|
+
/** Workspace / account name, when the provider says. */
|
|
51072
|
+
account: string().optional(),
|
|
51073
|
+
reason: _enum([
|
|
51074
|
+
"missing",
|
|
51075
|
+
"invalid",
|
|
51076
|
+
"forbidden",
|
|
51077
|
+
"network",
|
|
51078
|
+
"quota"
|
|
51079
|
+
]).optional(),
|
|
51080
|
+
detail: string().optional()
|
|
51081
|
+
});
|
|
51082
|
+
var ProviderJobStateSchema = _enum([
|
|
51083
|
+
"pending",
|
|
51084
|
+
"starting",
|
|
51085
|
+
"running",
|
|
51086
|
+
"succeeded",
|
|
51087
|
+
"failed",
|
|
51088
|
+
"cancelled",
|
|
51089
|
+
"lost"
|
|
51090
|
+
]);
|
|
51091
|
+
var ProviderJobStatusSchema = object({
|
|
51092
|
+
jobKey: string(),
|
|
51093
|
+
providerJobId: string().optional(),
|
|
51094
|
+
state: ProviderJobStateSchema,
|
|
51095
|
+
startedAt: number().optional(),
|
|
51096
|
+
endedAt: number().optional(),
|
|
51097
|
+
exitCode: number().int().optional(),
|
|
51098
|
+
failureReason: string().optional(),
|
|
51099
|
+
gpuType: string(),
|
|
51100
|
+
region: string().optional(),
|
|
51101
|
+
billedSeconds: number().nonnegative(),
|
|
51102
|
+
costUsd: number().nonnegative(),
|
|
51103
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
51104
|
+
costIsEstimate: boolean(),
|
|
51105
|
+
lastFetchedAt: number()
|
|
51106
|
+
});
|
|
51107
|
+
/**
|
|
51108
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
51109
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
51110
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
51111
|
+
* in `result.json`.
|
|
51112
|
+
*/
|
|
51113
|
+
var TrainerSourceRefSchema = object({
|
|
51114
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
51115
|
+
repo: string().min(1),
|
|
51116
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
51117
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
51118
|
+
});
|
|
51119
|
+
var JobRef = {
|
|
51120
|
+
addonId: string(),
|
|
51121
|
+
jobKey: string().uuid()
|
|
51122
|
+
};
|
|
51123
|
+
var TrainingLogLineSchema = object({
|
|
51124
|
+
ts: number(),
|
|
51125
|
+
text: string()
|
|
51126
|
+
});
|
|
51127
|
+
var trainingProviderCapability = {
|
|
51128
|
+
name: "training-provider",
|
|
51129
|
+
scope: "system",
|
|
51130
|
+
mode: "collection",
|
|
51131
|
+
internal: true,
|
|
51132
|
+
methods: {
|
|
51133
|
+
/** Every provider's offer and settings. Concat-fans across providers. */
|
|
51134
|
+
describe: method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }),
|
|
51135
|
+
/** Call the provider with the stored credentials. Never returns them. */
|
|
51136
|
+
validateCredentials: method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
51137
|
+
kind: "mutation",
|
|
51138
|
+
auth: "admin",
|
|
51139
|
+
timeoutMs: 3e4
|
|
51140
|
+
}),
|
|
51141
|
+
/** USD range for a run of `gpuSeconds` on `gpuType` in `region`. */
|
|
51142
|
+
estimateJob: method(object({
|
|
51143
|
+
addonId: string(),
|
|
51144
|
+
gpuType: string(),
|
|
51145
|
+
region: string(),
|
|
51146
|
+
datasetBytes: number().int().nonnegative(),
|
|
51147
|
+
gpuSecondsLow: number().nonnegative(),
|
|
51148
|
+
gpuSecondsHigh: number().nonnegative()
|
|
51149
|
+
}), object({
|
|
51150
|
+
usdLow: number().nonnegative(),
|
|
51151
|
+
usdHigh: number().nonnegative(),
|
|
51152
|
+
notes: array(string()).readonly()
|
|
51153
|
+
}), { auth: "admin" }),
|
|
51154
|
+
/**
|
|
51155
|
+
* Take the dataset archive behind `ticket` (minted by pipeline-analytics,
|
|
51156
|
+
* same host) and land it as the job's dataset in the cloud, streamed —
|
|
51157
|
+
* nothing is staged on the hub's disk. Idempotent per `jobKey`: a second
|
|
51158
|
+
* call replaces a partial upload. Answers what actually landed.
|
|
51159
|
+
*/
|
|
51160
|
+
uploadDataset: method(object({
|
|
51161
|
+
...JobRef,
|
|
51162
|
+
ticket: PeerBytesTicketSchema
|
|
51163
|
+
}), object({
|
|
51164
|
+
bytes: number().int().nonnegative(),
|
|
51165
|
+
sha256: string()
|
|
51166
|
+
}), {
|
|
51167
|
+
kind: "mutation",
|
|
51168
|
+
auth: "admin",
|
|
51169
|
+
timeoutMs: 120 * 6e4
|
|
51170
|
+
}),
|
|
51171
|
+
/**
|
|
51172
|
+
* Start the trainer on a GPU. Looks the job up by `jobKey` first, so a
|
|
51173
|
+
* retried submit never starts a second GPU. `jobSpecJson` is written next
|
|
51174
|
+
* to the dataset as `job.json`; `maxRuntimeSec` is enforced by the
|
|
51175
|
+
* provider (a hard timeout), not by the hub.
|
|
51176
|
+
*/
|
|
51177
|
+
submitJob: method(object({
|
|
51178
|
+
...JobRef,
|
|
51179
|
+
trainer: TrainerSourceRefSchema,
|
|
51180
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
51181
|
+
gpuType: string(),
|
|
51182
|
+
region: string(),
|
|
51183
|
+
maxRuntimeSec: number().int().positive()
|
|
51184
|
+
}), ProviderJobStatusSchema, {
|
|
51185
|
+
kind: "mutation",
|
|
51186
|
+
auth: "admin",
|
|
51187
|
+
timeoutMs: 30 * 6e4
|
|
51188
|
+
}),
|
|
51189
|
+
getJob: method(object(JobRef), ProviderJobStatusSchema, {
|
|
51190
|
+
auth: "admin",
|
|
51191
|
+
timeoutMs: 6e4
|
|
51192
|
+
}),
|
|
51193
|
+
/** Stdout/stderr since `cursor` (opaque), oldest first, at most `max` lines. */
|
|
51194
|
+
listJobEvents: method(object({
|
|
51195
|
+
...JobRef,
|
|
51196
|
+
cursor: string().optional(),
|
|
51197
|
+
max: number().int().min(1).max(500)
|
|
51198
|
+
}), object({
|
|
51199
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
51200
|
+
cursor: string()
|
|
51201
|
+
}), {
|
|
51202
|
+
auth: "admin",
|
|
51203
|
+
timeoutMs: 6e4
|
|
51204
|
+
}),
|
|
51205
|
+
/** Stop the job. Idempotent: an unknown or finished job is a no-op. */
|
|
51206
|
+
cancelJob: method(object(JobRef), object({ ok: literal(true) }), {
|
|
51207
|
+
kind: "mutation",
|
|
51208
|
+
auth: "admin",
|
|
51209
|
+
timeoutMs: 6e4
|
|
51210
|
+
}),
|
|
51211
|
+
/** The job's `result.json`, as text (small, JSON). `found: false` before it exists. */
|
|
51212
|
+
readResult: method(object(JobRef), object({
|
|
51213
|
+
found: boolean(),
|
|
51214
|
+
text: string().optional()
|
|
51215
|
+
}), {
|
|
51216
|
+
kind: "mutation",
|
|
51217
|
+
auth: "admin",
|
|
51218
|
+
timeoutMs: 5 * 6e4
|
|
51219
|
+
}),
|
|
51220
|
+
/**
|
|
51221
|
+
* Offer one output file of the job (`bundle.tar`) to the caller as a
|
|
51222
|
+
* one-shot `ctx.peerBytes` ticket, streamed from the cloud — the provider
|
|
51223
|
+
* stages nothing on disk. The caller dials it at once.
|
|
51224
|
+
*/
|
|
51225
|
+
offerArtifact: method(object({
|
|
51226
|
+
...JobRef,
|
|
51227
|
+
path: _enum(["bundle.tar"])
|
|
51228
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
51229
|
+
kind: "mutation",
|
|
51230
|
+
auth: "admin",
|
|
51231
|
+
timeoutMs: 5 * 6e4
|
|
51232
|
+
}),
|
|
51233
|
+
/** Delete every cloud object tagged with `jobKey` (the dataset first). Idempotent. */
|
|
51234
|
+
cleanupJob: method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
51235
|
+
kind: "mutation",
|
|
51236
|
+
auth: "admin",
|
|
51237
|
+
timeoutMs: 5 * 6e4
|
|
51238
|
+
}),
|
|
51239
|
+
/** Every job the provider can still see — the orphan sweep diffs it against our records. */
|
|
51240
|
+
listJobs: method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
51241
|
+
auth: "admin",
|
|
51242
|
+
timeoutMs: 2 * 6e4
|
|
51243
|
+
})
|
|
51244
|
+
}
|
|
51245
|
+
};
|
|
51246
|
+
/**
|
|
51247
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
51248
|
+
* provided by `addon-training`.
|
|
51249
|
+
*
|
|
51250
|
+
* It owns what every provider must agree on, written once:
|
|
51251
|
+
*
|
|
51252
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
51253
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
51254
|
+
* the export plan) and reaches this store through the five row methods
|
|
51255
|
+
* below, so the Retrain page and the export did not change.
|
|
51256
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
51257
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
51258
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
51259
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
51260
|
+
* rollback. Nothing is ever registered automatically.
|
|
51261
|
+
*
|
|
51262
|
+
* Every method is `admin`.
|
|
51263
|
+
*/
|
|
51264
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
51265
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
51266
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
51267
|
+
var TrainingBaseModelSchema = object({
|
|
51268
|
+
modelId: string(),
|
|
51269
|
+
label: string(),
|
|
51270
|
+
weights: string(),
|
|
51271
|
+
imgsz: number().int(),
|
|
51272
|
+
baselineOnnxUrl: string(),
|
|
51273
|
+
baselineFloors: record(string(), number()),
|
|
51274
|
+
/** The base the fleet runs most — the UI's default. */
|
|
51275
|
+
recommended: boolean()
|
|
51276
|
+
});
|
|
51277
|
+
var TrainingPresetSchema = _enum([
|
|
51278
|
+
"quick",
|
|
51279
|
+
"standard",
|
|
51280
|
+
"thorough"
|
|
51281
|
+
]);
|
|
51282
|
+
var TrainingJobRequestSchema = object({
|
|
51283
|
+
datasetVersionId: string().min(1),
|
|
51284
|
+
/** The `training-provider` addon that runs it. */
|
|
51285
|
+
addonId: string().min(1),
|
|
51286
|
+
gpuType: string().min(1),
|
|
51287
|
+
region: string(),
|
|
51288
|
+
baseModelId: string().min(1),
|
|
51289
|
+
preset: TrainingPresetSchema,
|
|
51290
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
51291
|
+
freeze: number().int().nonnegative().nullable(),
|
|
51292
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
51293
|
+
holdoutCameras: array(number().int()).nullable()
|
|
51294
|
+
});
|
|
51295
|
+
var TrainingSplitPlanSchema = object({
|
|
51296
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
51297
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
51298
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
51299
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
51300
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
51301
|
+
trainSubjects: number().int()
|
|
51302
|
+
});
|
|
51303
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
51304
|
+
"unknown-dataset",
|
|
51305
|
+
"unknown-provider",
|
|
51306
|
+
"provider-not-configured",
|
|
51307
|
+
"unknown-base-model",
|
|
51308
|
+
"unknown-gpu",
|
|
51309
|
+
"dataset-too-large",
|
|
51310
|
+
"no-training-subjects",
|
|
51311
|
+
"job-already-running"
|
|
51312
|
+
]);
|
|
51313
|
+
var TrainingJobPlanSchema = object({
|
|
51314
|
+
refusal: object({
|
|
51315
|
+
reason: TrainingRefusalReasonSchema,
|
|
51316
|
+
detail: string()
|
|
51317
|
+
}).nullable(),
|
|
51318
|
+
warnings: array(string()).readonly(),
|
|
51319
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
51320
|
+
estimate: object({
|
|
51321
|
+
datasetBytes: number().int(),
|
|
51322
|
+
uploadMinutesAt20Mbps: number(),
|
|
51323
|
+
gpuSecondsLow: number(),
|
|
51324
|
+
gpuSecondsHigh: number(),
|
|
51325
|
+
usdLow: number(),
|
|
51326
|
+
usdHigh: number(),
|
|
51327
|
+
notes: array(string()).readonly()
|
|
51328
|
+
}).nullable(),
|
|
51329
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
51330
|
+
defaults: object({
|
|
51331
|
+
maxCostUsd: number(),
|
|
51332
|
+
maxRuntimeSec: number().int()
|
|
51333
|
+
}).nullable(),
|
|
51334
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
51335
|
+
dataNotice: string()
|
|
51336
|
+
});
|
|
51337
|
+
/**
|
|
51338
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
51339
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
51340
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
51341
|
+
* result lives after the operator acted on it.
|
|
51342
|
+
*/
|
|
51343
|
+
var TrainingJobStateSchema = _enum([
|
|
51344
|
+
"uploading",
|
|
51345
|
+
"submitted",
|
|
51346
|
+
"starting",
|
|
51347
|
+
"running",
|
|
51348
|
+
"collecting",
|
|
51349
|
+
"ready",
|
|
51350
|
+
"registered",
|
|
51351
|
+
"canary",
|
|
51352
|
+
"failed",
|
|
51353
|
+
"cancelling",
|
|
51354
|
+
"cancelled",
|
|
51355
|
+
"lost",
|
|
51356
|
+
"expired",
|
|
51357
|
+
"discarded"
|
|
51358
|
+
]);
|
|
51359
|
+
var TrainingFailureReasonSchema = _enum([
|
|
51360
|
+
"cost-cap",
|
|
51361
|
+
"runtime-cap",
|
|
51362
|
+
"upload-failed",
|
|
51363
|
+
"submit-failed",
|
|
51364
|
+
"trainer-failed",
|
|
51365
|
+
"result-invalid",
|
|
51366
|
+
"checksum-mismatch",
|
|
51367
|
+
"fetch-failed",
|
|
51368
|
+
"provider-error",
|
|
51369
|
+
"hub-restart-during-upload"
|
|
51370
|
+
]);
|
|
51371
|
+
var TrainingProgressPointSchema = object({
|
|
51372
|
+
epoch: number().int(),
|
|
51373
|
+
map50: number().nullable(),
|
|
51374
|
+
map50_95: number().nullable()
|
|
51375
|
+
});
|
|
51376
|
+
var TrainingCanarySchema = object({
|
|
51377
|
+
deviceIds: array(number().int()).readonly(),
|
|
51378
|
+
since: number(),
|
|
51379
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
51380
|
+
previous: array(object({
|
|
51381
|
+
deviceId: number().int(),
|
|
51382
|
+
nodeId: string(),
|
|
51383
|
+
deviceKey: string(),
|
|
51384
|
+
patch: object({
|
|
51385
|
+
modelId: string().optional(),
|
|
51386
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
51387
|
+
}).nullable()
|
|
51388
|
+
})).readonly()
|
|
51389
|
+
});
|
|
51390
|
+
var TrainingJobSchema = object({
|
|
51391
|
+
id: string(),
|
|
51392
|
+
idempotencyKey: string(),
|
|
51393
|
+
name: string(),
|
|
51394
|
+
createdAt: number(),
|
|
51395
|
+
updatedAt: number(),
|
|
51396
|
+
state: TrainingJobStateSchema,
|
|
51397
|
+
stage: TrainingStageSchema.nullable(),
|
|
51398
|
+
failure: object({
|
|
51399
|
+
reason: TrainingFailureReasonSchema,
|
|
51400
|
+
stage: string().nullable(),
|
|
51401
|
+
detail: string()
|
|
51402
|
+
}).nullable(),
|
|
51403
|
+
request: TrainingJobRequestSchema,
|
|
51404
|
+
maxCostUsd: number().nonnegative(),
|
|
51405
|
+
maxRuntimeSec: number().int().positive(),
|
|
51406
|
+
trainer: TrainerSourceRefSchema,
|
|
51407
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
51408
|
+
dataset: object({
|
|
51409
|
+
bytes: number().int(),
|
|
51410
|
+
sha256: string(),
|
|
51411
|
+
uploadedAt: number()
|
|
51412
|
+
}).nullable(),
|
|
51413
|
+
split: TrainingSplitPlanSchema,
|
|
51414
|
+
provider: object({
|
|
51415
|
+
state: ProviderJobStateSchema.nullable(),
|
|
51416
|
+
providerJobId: string().nullable(),
|
|
51417
|
+
startedAt: number().nullable(),
|
|
51418
|
+
endedAt: number().nullable(),
|
|
51419
|
+
billedSeconds: number(),
|
|
51420
|
+
costUsd: number(),
|
|
51421
|
+
costIsEstimate: boolean(),
|
|
51422
|
+
lastPolledAt: number().nullable()
|
|
51423
|
+
}),
|
|
51424
|
+
progress: object({
|
|
51425
|
+
epoch: number().int().nullable(),
|
|
51426
|
+
epochs: number().int().nullable(),
|
|
51427
|
+
etaSec: number().nullable(),
|
|
51428
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
51429
|
+
}),
|
|
51430
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
51431
|
+
logTail: array(string()).readonly(),
|
|
51432
|
+
logCursor: string().nullable(),
|
|
51433
|
+
artifacts: object({
|
|
51434
|
+
bundleBytes: number().int(),
|
|
51435
|
+
bundleSha256: string(),
|
|
51436
|
+
fetchedAt: number(),
|
|
51437
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
51438
|
+
expiresAt: number()
|
|
51439
|
+
}).nullable(),
|
|
51440
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
51441
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
51442
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
51443
|
+
cloudCleanupDueAt: number().nullable(),
|
|
51444
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
51445
|
+
registeredModelIds: array(string()).readonly(),
|
|
51446
|
+
canary: TrainingCanarySchema.nullable()
|
|
51447
|
+
});
|
|
51448
|
+
var IdInput = object({ id: string().min(1) });
|
|
51449
|
+
var trainingCapability = {
|
|
51450
|
+
name: "training",
|
|
51451
|
+
scope: "system",
|
|
51452
|
+
mode: "singleton",
|
|
51453
|
+
mount: { kind: "hub-only" },
|
|
51454
|
+
methods: {
|
|
51455
|
+
/** Store a version once. `stored: false` = that id already exists (immutable). */
|
|
51456
|
+
putDatasetVersion: method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
51457
|
+
kind: "mutation",
|
|
51458
|
+
auth: "admin"
|
|
51459
|
+
}),
|
|
51460
|
+
getDatasetVersion: method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }),
|
|
51461
|
+
/** Every version without its frame list, newest first. */
|
|
51462
|
+
listDatasetVersions: method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }),
|
|
51463
|
+
findDatasetVersionIdByName: method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }),
|
|
51464
|
+
removeDatasetVersion: method(IdInput, object({ removed: boolean() }), {
|
|
51465
|
+
kind: "mutation",
|
|
51466
|
+
auth: "admin"
|
|
51467
|
+
}),
|
|
51468
|
+
listBaseModels: method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }),
|
|
51469
|
+
/** Split, estimate, defaults and any named refusal — nothing is started. */
|
|
51470
|
+
planJob: method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
51471
|
+
auth: "admin",
|
|
51472
|
+
timeoutMs: 6e4
|
|
51473
|
+
}),
|
|
51474
|
+
/**
|
|
51475
|
+
* Start a job. The same `idempotencyKey` returns the job it already
|
|
51476
|
+
* started. Answers at once (`uploading`); the upload and the submit run in
|
|
51477
|
+
* the background and the job record says how far they got.
|
|
51478
|
+
*/
|
|
51479
|
+
startJob: method(TrainingJobRequestSchema.extend({
|
|
51480
|
+
name: string().min(1).max(120),
|
|
51481
|
+
maxCostUsd: number().positive(),
|
|
51482
|
+
maxRuntimeSec: number().int().positive(),
|
|
51483
|
+
idempotencyKey: string().min(8).max(80)
|
|
51484
|
+
}), discriminatedUnion("kind", [object({
|
|
51485
|
+
kind: literal("started"),
|
|
51486
|
+
job: TrainingJobSchema
|
|
51487
|
+
}), object({
|
|
51488
|
+
kind: literal("refused"),
|
|
51489
|
+
reason: TrainingRefusalReasonSchema,
|
|
51490
|
+
detail: string()
|
|
51491
|
+
})]), {
|
|
51492
|
+
kind: "mutation",
|
|
51493
|
+
auth: "admin",
|
|
51494
|
+
timeoutMs: 12e4
|
|
51495
|
+
}),
|
|
51496
|
+
listJobs: method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }),
|
|
51497
|
+
getJob: method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }),
|
|
51498
|
+
cancelJob: method(IdInput, TrainingJobSchema, {
|
|
51499
|
+
kind: "mutation",
|
|
51500
|
+
auth: "admin",
|
|
51501
|
+
timeoutMs: 12e4
|
|
51502
|
+
}),
|
|
51503
|
+
/** The verified `result.json` of a job in `ready` or later; null before. */
|
|
51504
|
+
getJobResult: method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }),
|
|
51505
|
+
/** Hand the verified bundle to Model Studio; optionally canary right after. */
|
|
51506
|
+
registerResult: method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
51507
|
+
kind: "mutation",
|
|
51508
|
+
auth: "admin",
|
|
51509
|
+
timeoutMs: 30 * 6e4
|
|
51510
|
+
}),
|
|
51511
|
+
/** Pin the registered model on these cameras, remembering what it replaced. */
|
|
51512
|
+
canaryResult: method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
51513
|
+
kind: "mutation",
|
|
51514
|
+
auth: "admin",
|
|
51515
|
+
timeoutMs: 12e4
|
|
51516
|
+
}),
|
|
51517
|
+
/** Put every canary camera back exactly as it was. */
|
|
51518
|
+
rollbackCanary: method(IdInput, TrainingJobSchema, {
|
|
51519
|
+
kind: "mutation",
|
|
51520
|
+
auth: "admin",
|
|
51521
|
+
timeoutMs: 12e4
|
|
51522
|
+
}),
|
|
51523
|
+
/** Delete the staged artefacts of an unregistered result. */
|
|
51524
|
+
discardResult: method(IdInput, TrainingJobSchema, {
|
|
51525
|
+
kind: "mutation",
|
|
51526
|
+
auth: "admin"
|
|
51527
|
+
})
|
|
51528
|
+
}
|
|
51529
|
+
};
|
|
50123
51530
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
50124
51531
|
Object.freeze({
|
|
50125
51532
|
person: .5,
|
|
@@ -51844,6 +53251,12 @@ Object.freeze({
|
|
|
51844
53251
|
addonId: null,
|
|
51845
53252
|
access: "create"
|
|
51846
53253
|
},
|
|
53254
|
+
"backup.checkBackupKey": {
|
|
53255
|
+
capName: "backup",
|
|
53256
|
+
capScope: "system",
|
|
53257
|
+
addonId: null,
|
|
53258
|
+
access: "create"
|
|
53259
|
+
},
|
|
51847
53260
|
"backup.delete": {
|
|
51848
53261
|
capName: "backup",
|
|
51849
53262
|
capScope: "system",
|
|
@@ -51856,6 +53269,18 @@ Object.freeze({
|
|
|
51856
53269
|
addonId: null,
|
|
51857
53270
|
access: "delete"
|
|
51858
53271
|
},
|
|
53272
|
+
"backup.disableEncryption": {
|
|
53273
|
+
capName: "backup",
|
|
53274
|
+
capScope: "system",
|
|
53275
|
+
addonId: null,
|
|
53276
|
+
access: "create"
|
|
53277
|
+
},
|
|
53278
|
+
"backup.getEncryption": {
|
|
53279
|
+
capName: "backup",
|
|
53280
|
+
capScope: "system",
|
|
53281
|
+
addonId: null,
|
|
53282
|
+
access: "view"
|
|
53283
|
+
},
|
|
51859
53284
|
"backup.getEntries": {
|
|
51860
53285
|
capName: "backup",
|
|
51861
53286
|
capScope: "system",
|
|
@@ -51910,6 +53335,12 @@ Object.freeze({
|
|
|
51910
53335
|
addonId: null,
|
|
51911
53336
|
access: "create"
|
|
51912
53337
|
},
|
|
53338
|
+
"backup.setupEncryption": {
|
|
53339
|
+
capName: "backup",
|
|
53340
|
+
capScope: "system",
|
|
53341
|
+
addonId: null,
|
|
53342
|
+
access: "create"
|
|
53343
|
+
},
|
|
51913
53344
|
"backup.trigger": {
|
|
51914
53345
|
capName: "backup",
|
|
51915
53346
|
capScope: "system",
|
|
@@ -52462,6 +53893,12 @@ Object.freeze({
|
|
|
52462
53893
|
addonId: null,
|
|
52463
53894
|
access: "create"
|
|
52464
53895
|
},
|
|
53896
|
+
"customModelRegistry.importModelBundle": {
|
|
53897
|
+
capName: "custom-model-registry",
|
|
53898
|
+
capScope: "system",
|
|
53899
|
+
addonId: null,
|
|
53900
|
+
access: "create"
|
|
53901
|
+
},
|
|
52465
53902
|
"customModelRegistry.listModels": {
|
|
52466
53903
|
capName: "custom-model-registry",
|
|
52467
53904
|
capScope: "system",
|
|
@@ -53902,6 +55339,12 @@ Object.freeze({
|
|
|
53902
55339
|
addonId: null,
|
|
53903
55340
|
access: "view"
|
|
53904
55341
|
},
|
|
55342
|
+
"keychainAdmin.acknowledgeReset": {
|
|
55343
|
+
capName: "keychain-admin",
|
|
55344
|
+
capScope: "system",
|
|
55345
|
+
addonId: null,
|
|
55346
|
+
access: "create"
|
|
55347
|
+
},
|
|
53905
55348
|
"keychainAdmin.deleteOrphans": {
|
|
53906
55349
|
capName: "keychain-admin",
|
|
53907
55350
|
capScope: "system",
|
|
@@ -53938,6 +55381,12 @@ Object.freeze({
|
|
|
53938
55381
|
addonId: null,
|
|
53939
55382
|
access: "delete"
|
|
53940
55383
|
},
|
|
55384
|
+
"keychainAdmin.resetReport": {
|
|
55385
|
+
capName: "keychain-admin",
|
|
55386
|
+
capScope: "system",
|
|
55387
|
+
addonId: null,
|
|
55388
|
+
access: "delete"
|
|
55389
|
+
},
|
|
53941
55390
|
"keychainAdmin.reveal": {
|
|
53942
55391
|
capName: "keychain-admin",
|
|
53943
55392
|
capScope: "system",
|
|
@@ -55684,6 +57133,12 @@ Object.freeze({
|
|
|
55684
57133
|
addonId: null,
|
|
55685
57134
|
access: "view"
|
|
55686
57135
|
},
|
|
57136
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
57137
|
+
capName: "pipeline-analytics",
|
|
57138
|
+
capScope: "device",
|
|
57139
|
+
addonId: null,
|
|
57140
|
+
access: "create"
|
|
57141
|
+
},
|
|
55687
57142
|
"pipelineAnalytics.ownersWithMedia": {
|
|
55688
57143
|
capName: "pipeline-analytics",
|
|
55689
57144
|
capScope: "device",
|
|
@@ -58222,6 +59677,174 @@ Object.freeze({
|
|
|
58222
59677
|
addonId: null,
|
|
58223
59678
|
access: "view"
|
|
58224
59679
|
},
|
|
59680
|
+
"training.canaryResult": {
|
|
59681
|
+
capName: "training",
|
|
59682
|
+
capScope: "system",
|
|
59683
|
+
addonId: null,
|
|
59684
|
+
access: "create"
|
|
59685
|
+
},
|
|
59686
|
+
"training.cancelJob": {
|
|
59687
|
+
capName: "training",
|
|
59688
|
+
capScope: "system",
|
|
59689
|
+
addonId: null,
|
|
59690
|
+
access: "create"
|
|
59691
|
+
},
|
|
59692
|
+
"training.discardResult": {
|
|
59693
|
+
capName: "training",
|
|
59694
|
+
capScope: "system",
|
|
59695
|
+
addonId: null,
|
|
59696
|
+
access: "create"
|
|
59697
|
+
},
|
|
59698
|
+
"training.findDatasetVersionIdByName": {
|
|
59699
|
+
capName: "training",
|
|
59700
|
+
capScope: "system",
|
|
59701
|
+
addonId: null,
|
|
59702
|
+
access: "view"
|
|
59703
|
+
},
|
|
59704
|
+
"training.getDatasetVersion": {
|
|
59705
|
+
capName: "training",
|
|
59706
|
+
capScope: "system",
|
|
59707
|
+
addonId: null,
|
|
59708
|
+
access: "view"
|
|
59709
|
+
},
|
|
59710
|
+
"training.getJob": {
|
|
59711
|
+
capName: "training",
|
|
59712
|
+
capScope: "system",
|
|
59713
|
+
addonId: null,
|
|
59714
|
+
access: "view"
|
|
59715
|
+
},
|
|
59716
|
+
"training.getJobResult": {
|
|
59717
|
+
capName: "training",
|
|
59718
|
+
capScope: "system",
|
|
59719
|
+
addonId: null,
|
|
59720
|
+
access: "view"
|
|
59721
|
+
},
|
|
59722
|
+
"training.listBaseModels": {
|
|
59723
|
+
capName: "training",
|
|
59724
|
+
capScope: "system",
|
|
59725
|
+
addonId: null,
|
|
59726
|
+
access: "view"
|
|
59727
|
+
},
|
|
59728
|
+
"training.listDatasetVersions": {
|
|
59729
|
+
capName: "training",
|
|
59730
|
+
capScope: "system",
|
|
59731
|
+
addonId: null,
|
|
59732
|
+
access: "view"
|
|
59733
|
+
},
|
|
59734
|
+
"training.listJobs": {
|
|
59735
|
+
capName: "training",
|
|
59736
|
+
capScope: "system",
|
|
59737
|
+
addonId: null,
|
|
59738
|
+
access: "view"
|
|
59739
|
+
},
|
|
59740
|
+
"training.planJob": {
|
|
59741
|
+
capName: "training",
|
|
59742
|
+
capScope: "system",
|
|
59743
|
+
addonId: null,
|
|
59744
|
+
access: "view"
|
|
59745
|
+
},
|
|
59746
|
+
"training.putDatasetVersion": {
|
|
59747
|
+
capName: "training",
|
|
59748
|
+
capScope: "system",
|
|
59749
|
+
addonId: null,
|
|
59750
|
+
access: "create"
|
|
59751
|
+
},
|
|
59752
|
+
"training.registerResult": {
|
|
59753
|
+
capName: "training",
|
|
59754
|
+
capScope: "system",
|
|
59755
|
+
addonId: null,
|
|
59756
|
+
access: "create"
|
|
59757
|
+
},
|
|
59758
|
+
"training.removeDatasetVersion": {
|
|
59759
|
+
capName: "training",
|
|
59760
|
+
capScope: "system",
|
|
59761
|
+
addonId: null,
|
|
59762
|
+
access: "delete"
|
|
59763
|
+
},
|
|
59764
|
+
"training.rollbackCanary": {
|
|
59765
|
+
capName: "training",
|
|
59766
|
+
capScope: "system",
|
|
59767
|
+
addonId: null,
|
|
59768
|
+
access: "create"
|
|
59769
|
+
},
|
|
59770
|
+
"training.startJob": {
|
|
59771
|
+
capName: "training",
|
|
59772
|
+
capScope: "system",
|
|
59773
|
+
addonId: null,
|
|
59774
|
+
access: "create"
|
|
59775
|
+
},
|
|
59776
|
+
"trainingProvider.cancelJob": {
|
|
59777
|
+
capName: "training-provider",
|
|
59778
|
+
capScope: "system",
|
|
59779
|
+
addonId: null,
|
|
59780
|
+
access: "create"
|
|
59781
|
+
},
|
|
59782
|
+
"trainingProvider.cleanupJob": {
|
|
59783
|
+
capName: "training-provider",
|
|
59784
|
+
capScope: "system",
|
|
59785
|
+
addonId: null,
|
|
59786
|
+
access: "create"
|
|
59787
|
+
},
|
|
59788
|
+
"trainingProvider.describe": {
|
|
59789
|
+
capName: "training-provider",
|
|
59790
|
+
capScope: "system",
|
|
59791
|
+
addonId: null,
|
|
59792
|
+
access: "view"
|
|
59793
|
+
},
|
|
59794
|
+
"trainingProvider.estimateJob": {
|
|
59795
|
+
capName: "training-provider",
|
|
59796
|
+
capScope: "system",
|
|
59797
|
+
addonId: null,
|
|
59798
|
+
access: "view"
|
|
59799
|
+
},
|
|
59800
|
+
"trainingProvider.getJob": {
|
|
59801
|
+
capName: "training-provider",
|
|
59802
|
+
capScope: "system",
|
|
59803
|
+
addonId: null,
|
|
59804
|
+
access: "view"
|
|
59805
|
+
},
|
|
59806
|
+
"trainingProvider.listJobEvents": {
|
|
59807
|
+
capName: "training-provider",
|
|
59808
|
+
capScope: "system",
|
|
59809
|
+
addonId: null,
|
|
59810
|
+
access: "view"
|
|
59811
|
+
},
|
|
59812
|
+
"trainingProvider.listJobs": {
|
|
59813
|
+
capName: "training-provider",
|
|
59814
|
+
capScope: "system",
|
|
59815
|
+
addonId: null,
|
|
59816
|
+
access: "view"
|
|
59817
|
+
},
|
|
59818
|
+
"trainingProvider.offerArtifact": {
|
|
59819
|
+
capName: "training-provider",
|
|
59820
|
+
capScope: "system",
|
|
59821
|
+
addonId: null,
|
|
59822
|
+
access: "create"
|
|
59823
|
+
},
|
|
59824
|
+
"trainingProvider.readResult": {
|
|
59825
|
+
capName: "training-provider",
|
|
59826
|
+
capScope: "system",
|
|
59827
|
+
addonId: null,
|
|
59828
|
+
access: "create"
|
|
59829
|
+
},
|
|
59830
|
+
"trainingProvider.submitJob": {
|
|
59831
|
+
capName: "training-provider",
|
|
59832
|
+
capScope: "system",
|
|
59833
|
+
addonId: null,
|
|
59834
|
+
access: "create"
|
|
59835
|
+
},
|
|
59836
|
+
"trainingProvider.uploadDataset": {
|
|
59837
|
+
capName: "training-provider",
|
|
59838
|
+
capScope: "system",
|
|
59839
|
+
addonId: null,
|
|
59840
|
+
access: "create"
|
|
59841
|
+
},
|
|
59842
|
+
"trainingProvider.validateCredentials": {
|
|
59843
|
+
capName: "training-provider",
|
|
59844
|
+
capScope: "system",
|
|
59845
|
+
addonId: null,
|
|
59846
|
+
access: "create"
|
|
59847
|
+
},
|
|
58225
59848
|
"turnProvider.getTurnServers": {
|
|
58226
59849
|
capName: "turn-provider",
|
|
58227
59850
|
capScope: "system",
|
|
@@ -58246,12 +59869,6 @@ Object.freeze({
|
|
|
58246
59869
|
addonId: null,
|
|
58247
59870
|
access: "create"
|
|
58248
59871
|
},
|
|
58249
|
-
"userManagement.createApiKey": {
|
|
58250
|
-
capName: "user-management",
|
|
58251
|
-
capScope: "system",
|
|
58252
|
-
addonId: null,
|
|
58253
|
-
access: "create"
|
|
58254
|
-
},
|
|
58255
59872
|
"userManagement.createScopedToken": {
|
|
58256
59873
|
capName: "user-management",
|
|
58257
59874
|
capScope: "system",
|
|
@@ -58288,12 +59905,6 @@ Object.freeze({
|
|
|
58288
59905
|
addonId: null,
|
|
58289
59906
|
access: "view"
|
|
58290
59907
|
},
|
|
58291
|
-
"userManagement.linkExternalIdentity": {
|
|
58292
|
-
capName: "user-management",
|
|
58293
|
-
capScope: "system",
|
|
58294
|
-
addonId: null,
|
|
58295
|
-
access: "create"
|
|
58296
|
-
},
|
|
58297
59908
|
"userManagement.listApiKeys": {
|
|
58298
59909
|
capName: "user-management",
|
|
58299
59910
|
capScope: "system",
|
|
@@ -58396,12 +60007,6 @@ Object.freeze({
|
|
|
58396
60007
|
addonId: null,
|
|
58397
60008
|
access: "create"
|
|
58398
60009
|
},
|
|
58399
|
-
"userManagement.validateApiKey": {
|
|
58400
|
-
capName: "user-management",
|
|
58401
|
-
capScope: "system",
|
|
58402
|
-
addonId: null,
|
|
58403
|
-
access: "view"
|
|
58404
|
-
},
|
|
58405
60010
|
"userManagement.validateCredentials": {
|
|
58406
60011
|
capName: "user-management",
|
|
58407
60012
|
capScope: "system",
|
|
@@ -60315,6 +61920,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
60315
61920
|
temperatureSensorCapability,
|
|
60316
61921
|
terminalSessionCapability,
|
|
60317
61922
|
toastCapability,
|
|
61923
|
+
trainingCapability,
|
|
61924
|
+
trainingProviderCapability,
|
|
60318
61925
|
turnProviderCapability,
|
|
60319
61926
|
updateCapability,
|
|
60320
61927
|
userManagementCapability,
|
|
@@ -62693,6 +64300,11 @@ Object.freeze({
|
|
|
62693
64300
|
form: "single",
|
|
62694
64301
|
optional: false
|
|
62695
64302
|
}],
|
|
64303
|
+
"training.canaryResult": [{
|
|
64304
|
+
name: "deviceIds",
|
|
64305
|
+
form: "array",
|
|
64306
|
+
optional: false
|
|
64307
|
+
}],
|
|
62696
64308
|
"update.getStatus": [{
|
|
62697
64309
|
name: "deviceId",
|
|
62698
64310
|
form: "single",
|