@camstack/addon-post-analysis 1.2.347 → 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-DuQPp3dT.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-BDQ6oQ7b.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-D5IzYeGQ.mjs +0 -26
|
@@ -5449,7 +5449,7 @@ var ZodIssueCode = {
|
|
|
5449
5449
|
var ZodFirstPartyTypeKind;
|
|
5450
5450
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5451
5451
|
//#endregion
|
|
5452
|
-
//#region ../types/dist/sleep-
|
|
5452
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5453
5453
|
/**
|
|
5454
5454
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5455
5455
|
* window to float samples (D455).
|
|
@@ -5566,7 +5566,7 @@ function isKeychainStoredField(field) {
|
|
|
5566
5566
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5567
5567
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5568
5568
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5569
|
-
function isRecord$
|
|
5569
|
+
function isRecord$2(value) {
|
|
5570
5570
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5571
5571
|
}
|
|
5572
5572
|
function makeSecretMarker(ref) {
|
|
@@ -5577,12 +5577,12 @@ function makeSecretMarker(ref) {
|
|
|
5577
5577
|
}
|
|
5578
5578
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5579
5579
|
function isSecretMarker(value) {
|
|
5580
|
-
if (!isRecord$
|
|
5580
|
+
if (!isRecord$2(value)) return false;
|
|
5581
5581
|
const ref = value["$secret"];
|
|
5582
5582
|
return typeof ref === "string" && ref.length > 0;
|
|
5583
5583
|
}
|
|
5584
5584
|
function isSecretClear(value) {
|
|
5585
|
-
return isRecord$
|
|
5585
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5586
5586
|
}
|
|
5587
5587
|
/**
|
|
5588
5588
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6098,6 +6098,13 @@ function globalSecretScope() {
|
|
|
6098
6098
|
function encodeSegment(value) {
|
|
6099
6099
|
return encodeURIComponent(value);
|
|
6100
6100
|
}
|
|
6101
|
+
function decodeSegment(value) {
|
|
6102
|
+
try {
|
|
6103
|
+
return decodeURIComponent(value);
|
|
6104
|
+
} catch {
|
|
6105
|
+
return null;
|
|
6106
|
+
}
|
|
6107
|
+
}
|
|
6101
6108
|
/**
|
|
6102
6109
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6103
6110
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6106,6 +6113,75 @@ function encodeSegment(value) {
|
|
|
6106
6113
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6107
6114
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6108
6115
|
}
|
|
6116
|
+
function parseScope(segments) {
|
|
6117
|
+
switch (segments[0]) {
|
|
6118
|
+
case "global": return {
|
|
6119
|
+
scope: GLOBAL_SCOPE,
|
|
6120
|
+
used: 1
|
|
6121
|
+
};
|
|
6122
|
+
case "node": {
|
|
6123
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6124
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6125
|
+
scope: {
|
|
6126
|
+
kind: "node",
|
|
6127
|
+
nodeId
|
|
6128
|
+
},
|
|
6129
|
+
used: 2
|
|
6130
|
+
};
|
|
6131
|
+
}
|
|
6132
|
+
case "device": {
|
|
6133
|
+
const raw = segments[1];
|
|
6134
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6135
|
+
return {
|
|
6136
|
+
scope: {
|
|
6137
|
+
kind: "device",
|
|
6138
|
+
deviceId: Number(raw)
|
|
6139
|
+
},
|
|
6140
|
+
used: 2
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
case "integration": {
|
|
6144
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6145
|
+
return id === null || id.length === 0 ? null : {
|
|
6146
|
+
scope: {
|
|
6147
|
+
kind: "integration",
|
|
6148
|
+
integrationId: id
|
|
6149
|
+
},
|
|
6150
|
+
used: 2
|
|
6151
|
+
};
|
|
6152
|
+
}
|
|
6153
|
+
case "row": {
|
|
6154
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6155
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6156
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6157
|
+
return {
|
|
6158
|
+
scope: {
|
|
6159
|
+
kind: "row",
|
|
6160
|
+
collection,
|
|
6161
|
+
rowId
|
|
6162
|
+
},
|
|
6163
|
+
used: 3
|
|
6164
|
+
};
|
|
6165
|
+
}
|
|
6166
|
+
default: return null;
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6170
|
+
function parseSecretRef(ref) {
|
|
6171
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6172
|
+
const segments = ref.slice(9).split("/");
|
|
6173
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6174
|
+
if (owner === null || owner.length === 0) return null;
|
|
6175
|
+
const parsed = parseScope(segments.slice(1));
|
|
6176
|
+
if (parsed === null) return null;
|
|
6177
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6178
|
+
if (fieldPath.length === 0) return null;
|
|
6179
|
+
return {
|
|
6180
|
+
owner,
|
|
6181
|
+
scope: parsed.scope,
|
|
6182
|
+
fieldPath
|
|
6183
|
+
};
|
|
6184
|
+
}
|
|
6109
6185
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6110
6186
|
var KeychainWriteRefusedError = class extends Error {
|
|
6111
6187
|
fieldPath;
|
|
@@ -6116,7 +6192,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6116
6192
|
}
|
|
6117
6193
|
};
|
|
6118
6194
|
var KEEP = { kind: "keep" };
|
|
6119
|
-
function isRecord(value) {
|
|
6195
|
+
function isRecord$1(value) {
|
|
6120
6196
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6121
6197
|
}
|
|
6122
6198
|
function defaultMintId() {
|
|
@@ -6129,7 +6205,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6129
6205
|
return out;
|
|
6130
6206
|
}
|
|
6131
6207
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6132
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6208
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6133
6209
|
return out;
|
|
6134
6210
|
}
|
|
6135
6211
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6184,7 +6260,7 @@ function rowId(row, idKey) {
|
|
|
6184
6260
|
return null;
|
|
6185
6261
|
}
|
|
6186
6262
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6187
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6263
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6188
6264
|
if (!Array.isArray(incoming)) {
|
|
6189
6265
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6190
6266
|
return {
|
|
@@ -6200,7 +6276,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6200
6276
|
const kept = /* @__PURE__ */ new Set();
|
|
6201
6277
|
const rows = [];
|
|
6202
6278
|
for (const row of incoming) {
|
|
6203
|
-
if (!isRecord(row)) {
|
|
6279
|
+
if (!isRecord$1(row)) {
|
|
6204
6280
|
rows.push(row);
|
|
6205
6281
|
continue;
|
|
6206
6282
|
}
|
|
@@ -6225,7 +6301,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6225
6301
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6226
6302
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6227
6303
|
case "object": {
|
|
6228
|
-
if (!isRecord(incoming)) {
|
|
6304
|
+
if (!isRecord$1(incoming)) {
|
|
6229
6305
|
if (incoming === void 0) return KEEP;
|
|
6230
6306
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6231
6307
|
return {
|
|
@@ -6233,7 +6309,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6233
6309
|
value: incoming
|
|
6234
6310
|
};
|
|
6235
6311
|
}
|
|
6236
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
6312
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6237
6313
|
return {
|
|
6238
6314
|
kind: "value",
|
|
6239
6315
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6292,12 +6368,19 @@ async function transformSecretWrite(input) {
|
|
|
6292
6368
|
}
|
|
6293
6369
|
};
|
|
6294
6370
|
}
|
|
6371
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6372
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6373
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6374
|
+
}
|
|
6295
6375
|
/**
|
|
6296
6376
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6297
6377
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6298
6378
|
*/
|
|
6299
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6300
|
-
const
|
|
6379
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6380
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6381
|
+
const owner = options.ownedBy;
|
|
6382
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6383
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6301
6384
|
if (refs.length === 0) return {
|
|
6302
6385
|
value,
|
|
6303
6386
|
unresolved: []
|
|
@@ -6321,10 +6404,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6321
6404
|
}
|
|
6322
6405
|
const substitute = (v) => {
|
|
6323
6406
|
if (isSecretMarker(v)) {
|
|
6407
|
+
if (!inScope(v.$secret)) return {
|
|
6408
|
+
keep: true,
|
|
6409
|
+
value: v
|
|
6410
|
+
};
|
|
6324
6411
|
const answer = answers[v.$secret];
|
|
6325
|
-
|
|
6412
|
+
if (answer?.kind === "value") return {
|
|
6326
6413
|
keep: true,
|
|
6327
6414
|
value: answer.value
|
|
6415
|
+
};
|
|
6416
|
+
return keepMarker ? {
|
|
6417
|
+
keep: true,
|
|
6418
|
+
value: v
|
|
6328
6419
|
} : {
|
|
6329
6420
|
keep: false,
|
|
6330
6421
|
value: void 0
|
|
@@ -6341,7 +6432,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6341
6432
|
value: items
|
|
6342
6433
|
};
|
|
6343
6434
|
}
|
|
6344
|
-
if (isRecord(v)) {
|
|
6435
|
+
if (isRecord$1(v)) {
|
|
6345
6436
|
const out = {};
|
|
6346
6437
|
for (const [k, child] of Object.entries(v)) {
|
|
6347
6438
|
const s = substitute(child);
|
|
@@ -6362,14 +6453,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6362
6453
|
unresolved
|
|
6363
6454
|
};
|
|
6364
6455
|
}
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6456
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6457
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6458
|
+
ref;
|
|
6459
|
+
reason;
|
|
6460
|
+
constructor(ref, reason) {
|
|
6461
|
+
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.`);
|
|
6462
|
+
this.ref = ref;
|
|
6463
|
+
this.reason = reason;
|
|
6464
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6465
|
+
}
|
|
6466
|
+
};
|
|
6467
|
+
function isRecord(value) {
|
|
6468
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6469
|
+
}
|
|
6470
|
+
function resolvedValue(pass, marker) {
|
|
6471
|
+
const answer = pass.answers[marker.$secret];
|
|
6472
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6473
|
+
}
|
|
6474
|
+
async function atMarker(pass, incoming, stored) {
|
|
6475
|
+
if (incoming === null) return stored;
|
|
6476
|
+
if (typeof incoming !== "string") return incoming;
|
|
6477
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6478
|
+
const intent = classifySecretWrite(incoming);
|
|
6479
|
+
if (intent.kind !== "set") return stored;
|
|
6480
|
+
const ref = stored.$secret;
|
|
6481
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6482
|
+
const answer = pass.answers[ref];
|
|
6483
|
+
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);
|
|
6484
|
+
try {
|
|
6485
|
+
await pass.secrets.put(ref, intent.value);
|
|
6486
|
+
} catch (err) {
|
|
6487
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6488
|
+
}
|
|
6489
|
+
pass.changedRefs.push(ref);
|
|
6490
|
+
return stored;
|
|
6491
|
+
}
|
|
6492
|
+
function inArray(pass, incoming, stored) {
|
|
6493
|
+
return incoming.map((item, index) => {
|
|
6494
|
+
const twin = stored[index];
|
|
6495
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6496
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6497
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6498
|
+
return item;
|
|
6499
|
+
});
|
|
6500
|
+
}
|
|
6501
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6502
|
+
const out = { ...incoming };
|
|
6503
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6504
|
+
const twin = stored[key];
|
|
6505
|
+
if (isSecretMarker(twin)) {
|
|
6506
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6507
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6508
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6509
|
+
}
|
|
6510
|
+
return out;
|
|
6511
|
+
}
|
|
6512
|
+
async function walk(pass, incoming, stored) {
|
|
6513
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6514
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6515
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6516
|
+
const out = { ...incoming };
|
|
6517
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6518
|
+
return out;
|
|
6519
|
+
}
|
|
6520
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6521
|
+
async function restoreUnchangedSecrets(input) {
|
|
6522
|
+
const refs = [];
|
|
6523
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6524
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6525
|
+
if (owned.length === 0) return {
|
|
6526
|
+
patch: input.patch,
|
|
6527
|
+
changedRefs: []
|
|
6528
|
+
};
|
|
6529
|
+
const pass = {
|
|
6530
|
+
secrets: input.secrets,
|
|
6531
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6532
|
+
operatorWrite: input.operatorWrite,
|
|
6533
|
+
changedRefs: []
|
|
6534
|
+
};
|
|
6535
|
+
const out = {};
|
|
6536
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6537
|
+
return {
|
|
6538
|
+
patch: out,
|
|
6539
|
+
changedRefs: pass.changedRefs
|
|
6540
|
+
};
|
|
6541
|
+
}
|
|
6542
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6543
|
+
function isJsonEqual(a, b) {
|
|
6544
|
+
if (Object.is(a, b)) return true;
|
|
6545
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6546
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6547
|
+
const keys = Object.keys(a);
|
|
6548
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6549
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6370
6550
|
}
|
|
6371
6551
|
return false;
|
|
6372
6552
|
}
|
|
6553
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6554
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6555
|
+
const out = {};
|
|
6556
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6557
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6558
|
+
out[key] = value;
|
|
6559
|
+
}
|
|
6560
|
+
return out;
|
|
6561
|
+
}
|
|
6562
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6563
|
+
function markerKeysOf(blob, owner) {
|
|
6564
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6565
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6566
|
+
return keys;
|
|
6567
|
+
}
|
|
6568
|
+
function nodeFromStored(value, owner) {
|
|
6569
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6570
|
+
if (!isRecord(value)) return null;
|
|
6571
|
+
const children = /* @__PURE__ */ new Map();
|
|
6572
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6573
|
+
const node = nodeFromStored(child, owner);
|
|
6574
|
+
if (node !== null) children.set(key, node);
|
|
6575
|
+
}
|
|
6576
|
+
return children.size > 0 ? {
|
|
6577
|
+
kind: "object",
|
|
6578
|
+
children
|
|
6579
|
+
} : null;
|
|
6580
|
+
}
|
|
6581
|
+
/**
|
|
6582
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6583
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6584
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6585
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6586
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6587
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6588
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6589
|
+
* over.
|
|
6590
|
+
*/
|
|
6591
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6592
|
+
const added = /* @__PURE__ */ new Map();
|
|
6593
|
+
for (const key of keys) {
|
|
6594
|
+
const at = key.indexOf("@");
|
|
6595
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6596
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6597
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6598
|
+
if (node !== null) added.set(base, node);
|
|
6599
|
+
}
|
|
6600
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6601
|
+
}
|
|
6373
6602
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6374
6603
|
async function readStoredAddonBlob(raw) {
|
|
6375
6604
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6378,7 +6607,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6378
6607
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6379
6608
|
return result.kind === "missing" ? {} : result.value;
|
|
6380
6609
|
}
|
|
6381
|
-
function
|
|
6610
|
+
function touchesTree(tree, patch) {
|
|
6611
|
+
if (tree.size === 0) return false;
|
|
6612
|
+
for (const key of Object.keys(patch)) {
|
|
6613
|
+
const at = key.indexOf("@");
|
|
6614
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6615
|
+
}
|
|
6616
|
+
return false;
|
|
6617
|
+
}
|
|
6618
|
+
/**
|
|
6619
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6620
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6621
|
+
*/
|
|
6622
|
+
var MarkerKeyIndex = class {
|
|
6623
|
+
owner;
|
|
6624
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6625
|
+
constructor(owner) {
|
|
6626
|
+
this.owner = owner;
|
|
6627
|
+
}
|
|
6628
|
+
seen(store, blob) {
|
|
6629
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6630
|
+
}
|
|
6631
|
+
wrote(store, patch) {
|
|
6632
|
+
const keys = this.byStore.get(store);
|
|
6633
|
+
if (keys === void 0) return;
|
|
6634
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6635
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6636
|
+
else keys.delete(key);
|
|
6637
|
+
}
|
|
6638
|
+
mayHoldMarkers(store, patch) {
|
|
6639
|
+
const keys = this.byStore.get(store);
|
|
6640
|
+
if (keys === void 0) return true;
|
|
6641
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6642
|
+
}
|
|
6643
|
+
};
|
|
6644
|
+
function createHandle(raw, opts) {
|
|
6382
6645
|
const chains = /* @__PURE__ */ new Map();
|
|
6383
6646
|
const serialize = (key, fn) => {
|
|
6384
6647
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6389,46 +6652,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6389
6652
|
});
|
|
6390
6653
|
return next;
|
|
6391
6654
|
};
|
|
6392
|
-
const
|
|
6393
|
-
|
|
6394
|
-
|
|
6655
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6656
|
+
const resolveRead = async (store, blob) => {
|
|
6657
|
+
index.seen(store, blob);
|
|
6658
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6659
|
+
unresolved: "keep-marker",
|
|
6660
|
+
ownedBy: opts.secrets.owner
|
|
6661
|
+
});
|
|
6662
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6663
|
+
return value;
|
|
6664
|
+
};
|
|
6665
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6666
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6667
|
+
await rawWrite(patch);
|
|
6668
|
+
index.wrote(store, patch);
|
|
6669
|
+
return { changed: true };
|
|
6670
|
+
}
|
|
6671
|
+
return serialize(store, async () => {
|
|
6395
6672
|
const stored = await readStored();
|
|
6673
|
+
index.seen(store, stored);
|
|
6674
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6675
|
+
const restored = await restoreUnchangedSecrets({
|
|
6676
|
+
patch,
|
|
6677
|
+
stored,
|
|
6678
|
+
secrets: opts.secrets,
|
|
6679
|
+
operatorWrite
|
|
6680
|
+
});
|
|
6396
6681
|
const result = await transformSecretWrite({
|
|
6397
|
-
tree,
|
|
6682
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6398
6683
|
secrets: opts.secrets,
|
|
6399
|
-
patch,
|
|
6684
|
+
patch: restored.patch,
|
|
6400
6685
|
stored,
|
|
6401
6686
|
...scope !== void 0 ? { scope } : {},
|
|
6402
|
-
operatorWrite
|
|
6687
|
+
operatorWrite
|
|
6403
6688
|
});
|
|
6404
|
-
|
|
6689
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6690
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6691
|
+
if (wroteBlob) {
|
|
6692
|
+
await rawWrite(effective);
|
|
6693
|
+
index.wrote(store, effective);
|
|
6694
|
+
}
|
|
6405
6695
|
const { orphaned } = await result.afterWrite();
|
|
6406
6696
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6697
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6407
6698
|
});
|
|
6408
6699
|
};
|
|
6409
|
-
const
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6700
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6701
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6702
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6703
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6704
|
+
const overrides = {
|
|
6705
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6706
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6707
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6708
|
+
return result.kind === "value" ? {
|
|
6709
|
+
kind: "value",
|
|
6710
|
+
value: await resolveRead("addon", result.value)
|
|
6711
|
+
} : result;
|
|
6712
|
+
} } : {},
|
|
6713
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6714
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6715
|
+
if (result.kind !== "present") return result;
|
|
6716
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6717
|
+
unresolved: "keep-marker",
|
|
6718
|
+
ownedBy: opts.secrets.owner
|
|
6719
|
+
});
|
|
6720
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6721
|
+
return {
|
|
6722
|
+
kind: "present",
|
|
6723
|
+
value: value[key]
|
|
6724
|
+
};
|
|
6725
|
+
} } : {},
|
|
6726
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6727
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6728
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6729
|
+
const out = /* @__PURE__ */ new Map();
|
|
6730
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6731
|
+
return out;
|
|
6732
|
+
} } : {},
|
|
6733
|
+
writeAddonStore: async (patch) => {
|
|
6734
|
+
await writeAddon(patch);
|
|
6735
|
+
},
|
|
6736
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6737
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6738
|
+
kind: "device",
|
|
6739
|
+
deviceId
|
|
6740
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6741
|
+
}
|
|
6742
|
+
};
|
|
6743
|
+
return {
|
|
6744
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6745
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6746
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6747
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6748
|
+
} }),
|
|
6749
|
+
raw: {
|
|
6750
|
+
readAddonStore: async () => {
|
|
6751
|
+
const blob = await raw.readAddonStore();
|
|
6752
|
+
index.seen("addon", blob);
|
|
6753
|
+
return blob;
|
|
6754
|
+
},
|
|
6755
|
+
readDeviceStore: async (deviceId) => {
|
|
6756
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6757
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6758
|
+
return blob;
|
|
6759
|
+
}
|
|
6760
|
+
},
|
|
6761
|
+
writeAddonStore: writeAddon
|
|
6415
6762
|
};
|
|
6416
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6417
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6418
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6419
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6420
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6421
|
-
} });
|
|
6422
6763
|
}
|
|
6423
|
-
/** The context the addon sees
|
|
6424
|
-
function
|
|
6764
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6765
|
+
function createSecretAwareContext(context, opts) {
|
|
6425
6766
|
const raw = context.settings;
|
|
6426
|
-
if (raw === void 0) return
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6767
|
+
if (raw === void 0) return {
|
|
6768
|
+
context,
|
|
6769
|
+
handle: null
|
|
6770
|
+
};
|
|
6771
|
+
const handle = createHandle(raw, opts);
|
|
6772
|
+
return {
|
|
6773
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6774
|
+
if (prop === "settings") return handle.settings;
|
|
6775
|
+
return Reflect.get(target, prop, receiver);
|
|
6776
|
+
} }),
|
|
6777
|
+
handle
|
|
6778
|
+
};
|
|
6432
6779
|
}
|
|
6433
6780
|
var LEAF = { kind: "leaf" };
|
|
6434
6781
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6603,6 +6950,14 @@ var BaseAddon = class {
|
|
|
6603
6950
|
_secretChangeUnsub = null;
|
|
6604
6951
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6605
6952
|
_operatorWriteDepth = 0;
|
|
6953
|
+
/**
|
|
6954
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6955
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6956
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6957
|
+
*/
|
|
6958
|
+
_secretSettings = null;
|
|
6959
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6960
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6606
6961
|
constructor(defaults) {
|
|
6607
6962
|
this.defaults = defaults;
|
|
6608
6963
|
this._config = { ...defaults };
|
|
@@ -6639,13 +6994,21 @@ var BaseAddon = class {
|
|
|
6639
6994
|
}
|
|
6640
6995
|
async initialize(context) {
|
|
6641
6996
|
const secrets = context.secrets;
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6997
|
+
if (secrets !== void 0) {
|
|
6998
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6999
|
+
secrets,
|
|
7000
|
+
addonTree: () => this.addonSecretTree(),
|
|
7001
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7002
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7003
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7004
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7005
|
+
});
|
|
7006
|
+
this._ctx = wrapped;
|
|
7007
|
+
this._secretSettings = handle;
|
|
7008
|
+
} else {
|
|
7009
|
+
this._ctx = context;
|
|
7010
|
+
this._secretSettings = null;
|
|
7011
|
+
}
|
|
6649
7012
|
await this.resolveConfig();
|
|
6650
7013
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6651
7014
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -6762,11 +7125,8 @@ var BaseAddon = class {
|
|
|
6762
7125
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6763
7126
|
const schema = this.globalSettingsSchema(cap);
|
|
6764
7127
|
if (!schema) return { sections: [] };
|
|
6765
|
-
const projected = await this.
|
|
6766
|
-
return hydrateSchema(schema, overlay ? {
|
|
6767
|
-
...projected,
|
|
6768
|
-
...overlay
|
|
6769
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7128
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7129
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6770
7130
|
}
|
|
6771
7131
|
/**
|
|
6772
7132
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6811,7 +7171,7 @@ var BaseAddon = class {
|
|
|
6811
7171
|
});
|
|
6812
7172
|
}
|
|
6813
7173
|
if (sections.length === 0) return null;
|
|
6814
|
-
const projected = await this.
|
|
7174
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6815
7175
|
return hydrateSchema({
|
|
6816
7176
|
...schema,
|
|
6817
7177
|
sections
|
|
@@ -6828,12 +7188,50 @@ var BaseAddon = class {
|
|
|
6828
7188
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6829
7189
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6830
7190
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7191
|
+
*
|
|
7192
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7193
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7194
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7195
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7196
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7197
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6831
7198
|
*/
|
|
6832
7199
|
async resolveGlobalStore(nodeId, cap) {
|
|
6833
7200
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7201
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7202
|
+
}
|
|
7203
|
+
projectForNode(store, nodeId, cap) {
|
|
6834
7204
|
const keys = this.perNodeKeys(cap);
|
|
6835
7205
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6836
|
-
return keys.size > 0 ? projectStore(
|
|
7206
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7207
|
+
}
|
|
7208
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7209
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7210
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7211
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7212
|
+
}
|
|
7213
|
+
/**
|
|
7214
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7215
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7216
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7217
|
+
* its value.
|
|
7218
|
+
*/
|
|
7219
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7220
|
+
const secrets = this._ctx?.secrets;
|
|
7221
|
+
const merged = {
|
|
7222
|
+
...stored,
|
|
7223
|
+
...overlay
|
|
7224
|
+
};
|
|
7225
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7226
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7227
|
+
unresolved: "keep-marker",
|
|
7228
|
+
ownedBy: secrets.owner
|
|
7229
|
+
});
|
|
7230
|
+
for (const key of Object.keys(overlay)) {
|
|
7231
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7232
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7233
|
+
}
|
|
7234
|
+
return merged;
|
|
6837
7235
|
}
|
|
6838
7236
|
/**
|
|
6839
7237
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6898,8 +7296,12 @@ var BaseAddon = class {
|
|
|
6898
7296
|
async clearSecrets(keys, nodeId) {
|
|
6899
7297
|
const tree = this.addonSecretTree();
|
|
6900
7298
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7299
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
6901
7300
|
const patch = {};
|
|
6902
|
-
for (const key of keys)
|
|
7301
|
+
for (const key of keys) {
|
|
7302
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7303
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7304
|
+
}
|
|
6903
7305
|
await this.applyGlobalPatch(patch, nodeId);
|
|
6904
7306
|
}
|
|
6905
7307
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -6907,7 +7309,11 @@ var BaseAddon = class {
|
|
|
6907
7309
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6908
7310
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6909
7311
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6910
|
-
|
|
7312
|
+
const handle = this._secretSettings;
|
|
7313
|
+
if (handle !== null) {
|
|
7314
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7315
|
+
if (!changed) return;
|
|
7316
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6911
7317
|
if (target !== localNode) return;
|
|
6912
7318
|
await this.resolveConfig();
|
|
6913
7319
|
await this.onConfigChanged();
|
|
@@ -6960,7 +7366,7 @@ var BaseAddon = class {
|
|
|
6960
7366
|
async getDeviceSettings(deviceId) {
|
|
6961
7367
|
const schema = this.deviceSettingsSchema();
|
|
6962
7368
|
if (!schema) return { sections: [] };
|
|
6963
|
-
return hydrateSchema(schema, await this.
|
|
7369
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6964
7370
|
}
|
|
6965
7371
|
async updateDeviceSettings(deviceId, patch) {
|
|
6966
7372
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7132,7 +7538,7 @@ var BaseAddon = class {
|
|
|
7132
7538
|
key,
|
|
7133
7539
|
schema,
|
|
7134
7540
|
fallback,
|
|
7135
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7541
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7136
7542
|
write: async (patch) => {
|
|
7137
7543
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7138
7544
|
},
|
|
@@ -7194,6 +7600,23 @@ var BaseAddon = class {
|
|
|
7194
7600
|
}
|
|
7195
7601
|
return value;
|
|
7196
7602
|
}
|
|
7603
|
+
/**
|
|
7604
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7605
|
+
* keychain the context's own view is already raw.
|
|
7606
|
+
*/
|
|
7607
|
+
rawSettings() {
|
|
7608
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7609
|
+
}
|
|
7610
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7611
|
+
logUnresolvedRead(unresolved) {
|
|
7612
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7613
|
+
if (fresh.length === 0) return;
|
|
7614
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7615
|
+
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) => ({
|
|
7616
|
+
ref: u.ref,
|
|
7617
|
+
reason: u.reason
|
|
7618
|
+
})) } });
|
|
7619
|
+
}
|
|
7197
7620
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7198
7621
|
scheduleSecretReresolve(delayMs) {
|
|
7199
7622
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7220,7 +7643,7 @@ var BaseAddon = class {
|
|
|
7220
7643
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7221
7644
|
*/
|
|
7222
7645
|
async readAddonStoreWithRetry() {
|
|
7223
|
-
const settings = this.
|
|
7646
|
+
const settings = this.rawSettings();
|
|
7224
7647
|
if (!settings) return {};
|
|
7225
7648
|
const delaysMs = [
|
|
7226
7649
|
150,
|
|
@@ -10134,6 +10557,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10134
10557
|
*/
|
|
10135
10558
|
var DETECTION_PIPELINE_CAP_NAME = "detection-pipeline";
|
|
10136
10559
|
/**
|
|
10560
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10561
|
+
* gets back (cloud training, D805+).
|
|
10562
|
+
*
|
|
10563
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10564
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10565
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10566
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10567
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10568
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10569
|
+
* change there, in the same piece of work.
|
|
10570
|
+
*
|
|
10571
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10572
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10573
|
+
*/
|
|
10574
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10575
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10576
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10577
|
+
var TrainingExportSchema = _enum([
|
|
10578
|
+
"onnx",
|
|
10579
|
+
"openvino-fp16",
|
|
10580
|
+
"openvino-int8",
|
|
10581
|
+
"coreml-fp16"
|
|
10582
|
+
]);
|
|
10583
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10584
|
+
object({
|
|
10585
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10586
|
+
jobKey: string().uuid(),
|
|
10587
|
+
target: object({
|
|
10588
|
+
kind: literal("detector"),
|
|
10589
|
+
step: literal("object-detection")
|
|
10590
|
+
}),
|
|
10591
|
+
base: object({
|
|
10592
|
+
modelId: string().min(1),
|
|
10593
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10594
|
+
weights: string().min(1),
|
|
10595
|
+
imgsz: number().int().positive()
|
|
10596
|
+
}),
|
|
10597
|
+
baseline: object({
|
|
10598
|
+
modelId: string().min(1),
|
|
10599
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10600
|
+
onnxUrl: string().url(),
|
|
10601
|
+
imgsz: number().int().positive(),
|
|
10602
|
+
floors: FloorsSchema
|
|
10603
|
+
}),
|
|
10604
|
+
dataset: object({
|
|
10605
|
+
versionId: string().min(1),
|
|
10606
|
+
annotationHash: string(),
|
|
10607
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10608
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10609
|
+
}),
|
|
10610
|
+
split: object({
|
|
10611
|
+
holdoutCameras: array(number().int()),
|
|
10612
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10613
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10614
|
+
valFraction: number().min(0).max(.5),
|
|
10615
|
+
seed: number().int()
|
|
10616
|
+
}),
|
|
10617
|
+
hyper: object({
|
|
10618
|
+
epochs: number().int().positive(),
|
|
10619
|
+
batch: number().int().positive(),
|
|
10620
|
+
lr0: number().positive(),
|
|
10621
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10622
|
+
freeze: number().int().nonnegative(),
|
|
10623
|
+
patience: number().int().nonnegative(),
|
|
10624
|
+
seed: number().int()
|
|
10625
|
+
}),
|
|
10626
|
+
replay: object({
|
|
10627
|
+
source: literal("coco2017"),
|
|
10628
|
+
count: number().int().nonnegative()
|
|
10629
|
+
}),
|
|
10630
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10631
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10632
|
+
floors: object({
|
|
10633
|
+
minSupport: number().int().positive(),
|
|
10634
|
+
clamp: number().min(0).max(1)
|
|
10635
|
+
}),
|
|
10636
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10637
|
+
catalog: object({
|
|
10638
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10639
|
+
name: string().min(1).max(160)
|
|
10640
|
+
})
|
|
10641
|
+
});
|
|
10642
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10643
|
+
var TrainingResultFileSchema = object({
|
|
10644
|
+
path: string().min(1),
|
|
10645
|
+
bytes: number().int().nonnegative(),
|
|
10646
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10647
|
+
format: _enum([
|
|
10648
|
+
"onnx",
|
|
10649
|
+
"openvino",
|
|
10650
|
+
"coreml",
|
|
10651
|
+
"pt"
|
|
10652
|
+
]),
|
|
10653
|
+
variant: _enum(["base", "int8"])
|
|
10654
|
+
});
|
|
10655
|
+
var DraftFormatSchema = object({
|
|
10656
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10657
|
+
url: string().min(1),
|
|
10658
|
+
sizeMB: number().nonnegative(),
|
|
10659
|
+
isDirectory: boolean().optional(),
|
|
10660
|
+
files: array(string()).optional(),
|
|
10661
|
+
runtimes: array(literal("python")).optional(),
|
|
10662
|
+
revision: string().min(1)
|
|
10663
|
+
});
|
|
10664
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10665
|
+
var TrainingCatalogDraftSchema = object({
|
|
10666
|
+
id: string().min(1),
|
|
10667
|
+
name: string().min(1),
|
|
10668
|
+
description: string(),
|
|
10669
|
+
labels: array(unknown()),
|
|
10670
|
+
inputSize: object({
|
|
10671
|
+
width: number().int().positive(),
|
|
10672
|
+
height: number().int().positive()
|
|
10673
|
+
}),
|
|
10674
|
+
preprocessMode: literal("letterbox"),
|
|
10675
|
+
defaultClassFloors: FloorsSchema,
|
|
10676
|
+
formats: object({
|
|
10677
|
+
onnx: DraftFormatSchema.optional(),
|
|
10678
|
+
openvino: DraftFormatSchema.optional(),
|
|
10679
|
+
coreml: DraftFormatSchema.optional()
|
|
10680
|
+
})
|
|
10681
|
+
});
|
|
10682
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10683
|
+
var TrainingEvalClassSchema = object({
|
|
10684
|
+
positives: number().int(),
|
|
10685
|
+
floor: number().nullable(),
|
|
10686
|
+
tp: number().int(),
|
|
10687
|
+
fp: number().int(),
|
|
10688
|
+
fn: number().int(),
|
|
10689
|
+
precision: number().nullable(),
|
|
10690
|
+
recall: number().nullable(),
|
|
10691
|
+
ap50: number().nullable(),
|
|
10692
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10693
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10694
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10695
|
+
smallFound: number().int().optional(),
|
|
10696
|
+
smallTotal: number().int().optional()
|
|
10697
|
+
}).passthrough();
|
|
10698
|
+
var TrainingEvalReportSchema = object({
|
|
10699
|
+
frames: number().int(),
|
|
10700
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10701
|
+
}).passthrough();
|
|
10702
|
+
/**
|
|
10703
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10704
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10705
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10706
|
+
*/
|
|
10707
|
+
var TrainingResultSchema = object({
|
|
10708
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10709
|
+
jobKey: string(),
|
|
10710
|
+
status: _enum(["succeeded", "failed"]),
|
|
10711
|
+
error: object({
|
|
10712
|
+
stage: string(),
|
|
10713
|
+
code: string(),
|
|
10714
|
+
message: string()
|
|
10715
|
+
}).nullable(),
|
|
10716
|
+
trainer: object({
|
|
10717
|
+
version: string(),
|
|
10718
|
+
revision: string()
|
|
10719
|
+
}),
|
|
10720
|
+
toolchain: record(string(), string().nullable()),
|
|
10721
|
+
dataset: object({
|
|
10722
|
+
versionId: string(),
|
|
10723
|
+
annotationHash: string(),
|
|
10724
|
+
sha256: string(),
|
|
10725
|
+
frames: object({
|
|
10726
|
+
train: number().int(),
|
|
10727
|
+
val: number().int(),
|
|
10728
|
+
holdout: number().int()
|
|
10729
|
+
}),
|
|
10730
|
+
holdoutCameras: array(number().int()),
|
|
10731
|
+
replayImages: number().int()
|
|
10732
|
+
}).optional(),
|
|
10733
|
+
training: object({
|
|
10734
|
+
epochsRun: number().int(),
|
|
10735
|
+
bestEpoch: number().int(),
|
|
10736
|
+
bestMap50: number(),
|
|
10737
|
+
bestMap50_95: number(),
|
|
10738
|
+
seconds: number()
|
|
10739
|
+
}).optional(),
|
|
10740
|
+
evaluation: object({
|
|
10741
|
+
holdoutFrames: number().int(),
|
|
10742
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10743
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10744
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10745
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10746
|
+
map50: record(string(), number().nullable())
|
|
10747
|
+
}).optional(),
|
|
10748
|
+
floors: object({
|
|
10749
|
+
baseline: FloorsSchema,
|
|
10750
|
+
candidate: FloorsSchema,
|
|
10751
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10752
|
+
notes: array(string())
|
|
10753
|
+
}).optional(),
|
|
10754
|
+
int8: object({
|
|
10755
|
+
kept: boolean(),
|
|
10756
|
+
map50Fp16: number().nullable(),
|
|
10757
|
+
map50Int8: number().nullable(),
|
|
10758
|
+
reason: string().nullable()
|
|
10759
|
+
}).optional(),
|
|
10760
|
+
exportsDropped: array(object({
|
|
10761
|
+
export: string(),
|
|
10762
|
+
reason: string()
|
|
10763
|
+
})).optional(),
|
|
10764
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10765
|
+
bundle: object({
|
|
10766
|
+
path: literal("bundle.tar"),
|
|
10767
|
+
bytes: number().int().nonnegative(),
|
|
10768
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10769
|
+
}).nullable().optional(),
|
|
10770
|
+
catalogDraft: object({
|
|
10771
|
+
base: TrainingCatalogDraftSchema,
|
|
10772
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10773
|
+
}).nullable().optional(),
|
|
10774
|
+
licence: string()
|
|
10775
|
+
});
|
|
10776
|
+
var TrainingStageSchema = _enum([
|
|
10777
|
+
"prepare",
|
|
10778
|
+
"replay",
|
|
10779
|
+
"train",
|
|
10780
|
+
"eval",
|
|
10781
|
+
"export",
|
|
10782
|
+
"package"
|
|
10783
|
+
]);
|
|
10784
|
+
var EventBase = {
|
|
10785
|
+
v: literal(1),
|
|
10786
|
+
ts: number()
|
|
10787
|
+
};
|
|
10788
|
+
discriminatedUnion("type", [
|
|
10789
|
+
object({
|
|
10790
|
+
...EventBase,
|
|
10791
|
+
type: literal("stage"),
|
|
10792
|
+
stage: TrainingStageSchema
|
|
10793
|
+
}),
|
|
10794
|
+
object({
|
|
10795
|
+
...EventBase,
|
|
10796
|
+
type: literal("epoch"),
|
|
10797
|
+
epoch: number().int(),
|
|
10798
|
+
epochs: number().int(),
|
|
10799
|
+
boxLoss: number().nullable().optional(),
|
|
10800
|
+
map50: number().nullable().optional(),
|
|
10801
|
+
map50_95: number().nullable().optional(),
|
|
10802
|
+
etaSec: number().nullable().optional()
|
|
10803
|
+
}),
|
|
10804
|
+
object({
|
|
10805
|
+
...EventBase,
|
|
10806
|
+
type: literal("metric"),
|
|
10807
|
+
name: string(),
|
|
10808
|
+
value: number()
|
|
10809
|
+
}),
|
|
10810
|
+
object({
|
|
10811
|
+
...EventBase,
|
|
10812
|
+
type: literal("artifact"),
|
|
10813
|
+
path: string(),
|
|
10814
|
+
bytes: number(),
|
|
10815
|
+
sha256: string()
|
|
10816
|
+
}),
|
|
10817
|
+
object({
|
|
10818
|
+
...EventBase,
|
|
10819
|
+
type: literal("done"),
|
|
10820
|
+
status: _enum(["succeeded", "failed"]),
|
|
10821
|
+
resultSha256: string().nullable().optional()
|
|
10822
|
+
}),
|
|
10823
|
+
object({
|
|
10824
|
+
...EventBase,
|
|
10825
|
+
type: literal("error"),
|
|
10826
|
+
stage: string(),
|
|
10827
|
+
code: string(),
|
|
10828
|
+
message: string()
|
|
10829
|
+
})
|
|
10830
|
+
]);
|
|
10831
|
+
/**
|
|
10137
10832
|
* Birth-decision ledger — one durable row per track-birth VERDICT (D409).
|
|
10138
10833
|
*
|
|
10139
10834
|
* ── Why this exists ────────────────────────────────────────────────────────
|
|
@@ -12901,7 +13596,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12901
13596
|
"authenticated",
|
|
12902
13597
|
"admin"
|
|
12903
13598
|
]).optional(),
|
|
12904
|
-
description: string().optional()
|
|
13599
|
+
description: string().optional(),
|
|
13600
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13601
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12905
13602
|
});
|
|
12906
13603
|
/**
|
|
12907
13604
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13851,6 +14548,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13851
14548
|
lastError: string().optional()
|
|
13852
14549
|
});
|
|
13853
14550
|
/**
|
|
14551
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14552
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14553
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14554
|
+
* with it off — which restores without a key.
|
|
14555
|
+
*/
|
|
14556
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14557
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14558
|
+
scheme: string(),
|
|
14559
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14560
|
+
keyId: string()
|
|
14561
|
+
});
|
|
14562
|
+
/**
|
|
14563
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14564
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14565
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14566
|
+
*/
|
|
14567
|
+
var BackupEncryptionStatusSchema = object({
|
|
14568
|
+
enabled: boolean(),
|
|
14569
|
+
active: object({
|
|
14570
|
+
keyId: string(),
|
|
14571
|
+
publicKey: string(),
|
|
14572
|
+
createdAt: number()
|
|
14573
|
+
}).nullable(),
|
|
14574
|
+
/** Every key ever set up, newest first. */
|
|
14575
|
+
keys: array(object({
|
|
14576
|
+
keyId: string(),
|
|
14577
|
+
createdAt: number(),
|
|
14578
|
+
retiredAt: number().nullable()
|
|
14579
|
+
})).readonly()
|
|
14580
|
+
});
|
|
14581
|
+
/**
|
|
13854
14582
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13855
14583
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13856
14584
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13862,7 +14590,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13862
14590
|
sizeBytes: number(),
|
|
13863
14591
|
label: string().optional(),
|
|
13864
14592
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13865
|
-
locations: array(string()).readonly()
|
|
14593
|
+
locations: array(string()).readonly(),
|
|
14594
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14595
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13866
14596
|
});
|
|
13867
14597
|
var BackupEntrySchema = object({
|
|
13868
14598
|
id: string(),
|
|
@@ -13871,7 +14601,8 @@ var BackupEntrySchema = object({
|
|
|
13871
14601
|
label: string().optional(),
|
|
13872
14602
|
createdAt: number(),
|
|
13873
14603
|
sizeBytes: number(),
|
|
13874
|
-
locations: array(string()).optional()
|
|
14604
|
+
locations: array(string()).optional(),
|
|
14605
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13875
14606
|
});
|
|
13876
14607
|
var ArchiveEntrySchema = object({
|
|
13877
14608
|
path: string(),
|
|
@@ -14126,11 +14857,58 @@ var backupCapability = {
|
|
|
14126
14857
|
* this list and skips entries whose path doesn't start with
|
|
14127
14858
|
* any of them.
|
|
14128
14859
|
*/
|
|
14129
|
-
locations: array(string()).optional()
|
|
14860
|
+
locations: array(string()).optional(),
|
|
14861
|
+
/**
|
|
14862
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14863
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14864
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14865
|
+
* is refused before the archive is downloaded.
|
|
14866
|
+
*/
|
|
14867
|
+
backupSecretKey: string().optional()
|
|
14130
14868
|
}), _void(), {
|
|
14131
14869
|
kind: "mutation",
|
|
14132
14870
|
auth: "admin"
|
|
14133
14871
|
}),
|
|
14872
|
+
/** The encryption setting — public keys only. */
|
|
14873
|
+
getEncryption: method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }),
|
|
14874
|
+
/**
|
|
14875
|
+
* Turn encryption on, or replace the key: generates a new key pair, keeps
|
|
14876
|
+
* the PUBLIC key, and returns the SECRET key — once. It is never stored
|
|
14877
|
+
* on the hub and cannot be shown again; archives made from now on need
|
|
14878
|
+
* it to be restored. A previous key is retired: archives made with it
|
|
14879
|
+
* still need IT.
|
|
14880
|
+
*/
|
|
14881
|
+
setupEncryption: method(object({}), object({
|
|
14882
|
+
keyId: string(),
|
|
14883
|
+
secretKey: string(),
|
|
14884
|
+
publicKey: string(),
|
|
14885
|
+
createdAt: number(),
|
|
14886
|
+
replacedKeyId: string().nullable()
|
|
14887
|
+
}), {
|
|
14888
|
+
kind: "mutation",
|
|
14889
|
+
auth: "admin"
|
|
14890
|
+
}),
|
|
14891
|
+
/** New archives are plain again. Existing encrypted archives keep needing their key. */
|
|
14892
|
+
disableEncryption: method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14893
|
+
kind: "mutation",
|
|
14894
|
+
auth: "admin"
|
|
14895
|
+
}),
|
|
14896
|
+
/**
|
|
14897
|
+
* Does this secret key parse, and which backup key is it? A mutation so
|
|
14898
|
+
* the key never travels in a URL. Nothing is stored.
|
|
14899
|
+
*/
|
|
14900
|
+
checkBackupKey: method(object({ backupSecretKey: string() }), object({
|
|
14901
|
+
valid: boolean(),
|
|
14902
|
+
keyId: string().nullable(),
|
|
14903
|
+
/** The hub knows this key (active or retired). */
|
|
14904
|
+
known: boolean(),
|
|
14905
|
+
/** It is the key new archives are encrypted to. */
|
|
14906
|
+
active: boolean(),
|
|
14907
|
+
error: string().optional()
|
|
14908
|
+
}), {
|
|
14909
|
+
kind: "mutation",
|
|
14910
|
+
auth: "admin"
|
|
14911
|
+
}),
|
|
14134
14912
|
delete: method(object({
|
|
14135
14913
|
destinationId: string(),
|
|
14136
14914
|
backupId: string()
|
|
@@ -16326,22 +17104,87 @@ var CustomModelDescriptorSchema = object({
|
|
|
16326
17104
|
stepId: string(),
|
|
16327
17105
|
entry: ModelCatalogEntrySchema
|
|
16328
17106
|
});
|
|
17107
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
17108
|
+
var ModelBundleFileSchema = object({
|
|
17109
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
17110
|
+
path: string().min(1),
|
|
17111
|
+
bytes: number().int().nonnegative(),
|
|
17112
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
17113
|
+
});
|
|
17114
|
+
var ImportModelBundleInputSchema = object({
|
|
17115
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
17116
|
+
addonId: string(),
|
|
17117
|
+
stepId: string().min(1),
|
|
17118
|
+
/**
|
|
17119
|
+
* The catalog rows to register, complete, every format URL already
|
|
17120
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
17121
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
17122
|
+
*/
|
|
17123
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
17124
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
17125
|
+
bundle: object({
|
|
17126
|
+
ticket: PeerBytesTicketSchema,
|
|
17127
|
+
bytes: number().int().positive(),
|
|
17128
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
17129
|
+
}),
|
|
17130
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
17131
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
17132
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
17133
|
+
distribute: boolean()
|
|
17134
|
+
});
|
|
17135
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
17136
|
+
kind: literal("imported"),
|
|
17137
|
+
modelIds: array(string()).readonly(),
|
|
17138
|
+
distributed: array(object({
|
|
17139
|
+
modelId: string(),
|
|
17140
|
+
nodeId: string(),
|
|
17141
|
+
format: _enum(MODEL_FORMATS),
|
|
17142
|
+
ok: boolean(),
|
|
17143
|
+
error: string().optional()
|
|
17144
|
+
})).readonly()
|
|
17145
|
+
}), object({
|
|
17146
|
+
kind: literal("refused"),
|
|
17147
|
+
reason: _enum([
|
|
17148
|
+
"transfer-failed",
|
|
17149
|
+
"checksum-mismatch",
|
|
17150
|
+
"bundle-mismatch",
|
|
17151
|
+
"invalid-entry",
|
|
17152
|
+
"id-taken"
|
|
17153
|
+
]),
|
|
17154
|
+
detail: string()
|
|
17155
|
+
})]);
|
|
16329
17156
|
var customModelRegistryCapability = {
|
|
16330
17157
|
name: "custom-model-registry",
|
|
16331
17158
|
scope: "system",
|
|
16332
17159
|
mode: "collection",
|
|
16333
17160
|
internal: true,
|
|
16334
|
-
methods: {
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16344
|
-
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" })
|
|
17161
|
+
methods: {
|
|
17162
|
+
/**
|
|
17163
|
+
* `internal: true` did not gate the mount (see the 2026-08-26 note on
|
|
17164
|
+
* `data-store-provider`) — this was reachable on the AppRouter by ANY
|
|
17165
|
+
* authenticated session at the default `auth: 'protected'`. The only
|
|
17166
|
+
* consumer, the detection-pipeline's model resolution
|
|
17167
|
+
* (`addon-pipeline/src/detection-pipeline/provider.ts`), calls
|
|
17168
|
+
* `ctx.api.customModelRegistry.listModels.query()` — UDS/Moleculer,
|
|
17169
|
+
* never tRPC — so `auth: 'admin'` costs it nothing.
|
|
17170
|
+
*/
|
|
17171
|
+
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }),
|
|
17172
|
+
/**
|
|
17173
|
+
* Register a model whose files arrive as ONE bundle tar (D806): the tar
|
|
17174
|
+
* is taken over `ctx.peerBytes`, checked against `bundle.sha256` and
|
|
17175
|
+
* every row of `files`, unpacked into the hub's flat modelsDir (directory
|
|
17176
|
+
* formats included), each format's `.revision` record written, the rows
|
|
17177
|
+
* upserted under the operator's name, the hub marked available and —
|
|
17178
|
+
* when asked — engine formats converted and the model distributed. A
|
|
17179
|
+
* model id already registered by another source is refused, never
|
|
17180
|
+
* overwritten.
|
|
17181
|
+
*/
|
|
17182
|
+
importModelBundle: method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
17183
|
+
kind: "mutation",
|
|
17184
|
+
auth: "admin",
|
|
17185
|
+
timeoutMs: 30 * 6e4
|
|
17186
|
+
})
|
|
17187
|
+
}
|
|
16345
17188
|
};
|
|
16346
17189
|
/**
|
|
16347
17190
|
* Query filter for settings-store collections.
|
|
@@ -17132,6 +17975,35 @@ var KeychainKeySourceSchema = object({
|
|
|
17132
17975
|
*/
|
|
17133
17976
|
sharesBackupWithDatabase: boolean()
|
|
17134
17977
|
});
|
|
17978
|
+
/**
|
|
17979
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
17980
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
17981
|
+
*/
|
|
17982
|
+
var KeychainResetRecordSchema = object({
|
|
17983
|
+
id: string(),
|
|
17984
|
+
at: number(),
|
|
17985
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
17986
|
+
actor: string(),
|
|
17987
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
17988
|
+
lockedReason: string().nullable(),
|
|
17989
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
17990
|
+
archived: number().int(),
|
|
17991
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
17992
|
+
archivedCollection: string().nullable(),
|
|
17993
|
+
/**
|
|
17994
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
17995
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
17996
|
+
*/
|
|
17997
|
+
archivedKeysCollection: string().nullable(),
|
|
17998
|
+
/**
|
|
17999
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
18000
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
18001
|
+
* agent forever (D797).
|
|
18002
|
+
*/
|
|
18003
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
18004
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
18005
|
+
acknowledgedAt: number().nullable()
|
|
18006
|
+
});
|
|
17135
18007
|
var KeychainStatusSchema = object({
|
|
17136
18008
|
keychain: KeychainStateSchema,
|
|
17137
18009
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -17149,7 +18021,9 @@ var KeychainStatusSchema = object({
|
|
|
17149
18021
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
17150
18022
|
retiredWraps: number().int(),
|
|
17151
18023
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
17152
|
-
secretCount: number().int()
|
|
18024
|
+
secretCount: number().int(),
|
|
18025
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
18026
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
17153
18027
|
});
|
|
17154
18028
|
/**
|
|
17155
18029
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -17171,13 +18045,14 @@ var KeychainAuditActionSchema = _enum([
|
|
|
17171
18045
|
"download-recovery-key",
|
|
17172
18046
|
"delete-orphans",
|
|
17173
18047
|
"reset",
|
|
18048
|
+
"acknowledge-reset",
|
|
17174
18049
|
"initialize"
|
|
17175
18050
|
]);
|
|
17176
18051
|
var KeychainAuditEntrySchema = object({
|
|
17177
18052
|
id: string(),
|
|
17178
18053
|
at: number(),
|
|
17179
18054
|
action: KeychainAuditActionSchema,
|
|
17180
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
18055
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
17181
18056
|
actor: string(),
|
|
17182
18057
|
ref: string().nullable(),
|
|
17183
18058
|
detail: string().nullable()
|
|
@@ -17287,6 +18162,21 @@ var keychainAdminCapability = {
|
|
|
17287
18162
|
kind: "mutation",
|
|
17288
18163
|
auth: "admin",
|
|
17289
18164
|
caller: "required"
|
|
18165
|
+
}),
|
|
18166
|
+
/**
|
|
18167
|
+
* What the last reset left to re-enter: the archived refs (owner, scope,
|
|
18168
|
+
* field — never a value) that hold no value again yet. Process-held refs
|
|
18169
|
+
* the hub regenerates itself (the session signing key) are not listed.
|
|
18170
|
+
*/
|
|
18171
|
+
resetReport: method(object({}), object({
|
|
18172
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
18173
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
18174
|
+
}), { auth: "admin" }),
|
|
18175
|
+
/** Dismiss the "keychain was reset" notice. Audited. */
|
|
18176
|
+
acknowledgeReset: method(object({}), object({ acknowledged: boolean() }), {
|
|
18177
|
+
kind: "mutation",
|
|
18178
|
+
auth: "admin",
|
|
18179
|
+
caller: "required"
|
|
17290
18180
|
})
|
|
17291
18181
|
}
|
|
17292
18182
|
};
|
|
@@ -21337,7 +22227,7 @@ var logDestinationCapability = {
|
|
|
21337
22227
|
* `login-method` — collection cap through which auth addons contribute
|
|
21338
22228
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
21339
22229
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
21340
|
-
* every auth addon (OIDC,
|
|
22230
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
21341
22231
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
21342
22232
|
* procedure aggregates them for the unauthenticated login page.
|
|
21343
22233
|
*
|
|
@@ -21345,8 +22235,7 @@ var logDestinationCapability = {
|
|
|
21345
22235
|
*
|
|
21346
22236
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
21347
22237
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
21348
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
21349
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
22238
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
21350
22239
|
* login page needs NO change.
|
|
21351
22240
|
*
|
|
21352
22241
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -21365,8 +22254,8 @@ var logDestinationCapability = {
|
|
|
21365
22254
|
* decision.
|
|
21366
22255
|
*
|
|
21367
22256
|
* Every contribution carries a `stage`:
|
|
21368
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
21369
|
-
*
|
|
22257
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
22258
|
+
* buttons; a usernameless passkey).
|
|
21370
22259
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
21371
22260
|
* returned `factors` (passkey-as-2FA today).
|
|
21372
22261
|
*
|
|
@@ -21393,7 +22282,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
21393
22282
|
* The provider names an external identity a signed-in user can link to
|
|
21394
22283
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
21395
22284
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
21396
|
-
* whatever their id. Absent / false — a login button only
|
|
22285
|
+
* whatever their id. Absent / false — a login button only.
|
|
21397
22286
|
*/
|
|
21398
22287
|
linkable: boolean().optional()
|
|
21399
22288
|
}),
|
|
@@ -26296,8 +27185,7 @@ var notificationRulesCapability = {
|
|
|
26296
27185
|
* `super_admin` — collapsed onto the single boolean because every
|
|
26297
27186
|
* non-admin caller is governed by the same scope-check rules; the
|
|
26298
27187
|
* distinction was only ever used to route role-specific procedures
|
|
26299
|
-
* which we no longer have.
|
|
26300
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
27188
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
26301
27189
|
* with `isAdmin: false` + an explicit scope list.
|
|
26302
27190
|
*/
|
|
26303
27191
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -29685,6 +30573,26 @@ var pipelineAnalyticsCapability = {
|
|
|
29685
30573
|
auth: "admin",
|
|
29686
30574
|
timeoutMs: 60 * 6e4
|
|
29687
30575
|
}),
|
|
30576
|
+
/**
|
|
30577
|
+
* OFFER the annotated archive instead of pushing it (D805): the same tar
|
|
30578
|
+
* `writeRetrainArchive` streams, behind a one-shot `ctx.peerBytes` ticket
|
|
30579
|
+
* the caller dials at once (same host). For a consumer that cannot expose
|
|
30580
|
+
* an upload URL — a training provider streaming straight into its cloud.
|
|
30581
|
+
* The answer is the plan; the bytes and their sha256 are the consumer's
|
|
30582
|
+
* to measure as they arrive.
|
|
30583
|
+
*/
|
|
30584
|
+
offerRetrainArchive: method(object({
|
|
30585
|
+
filter: RetrainExportFilterSchema,
|
|
30586
|
+
layout: RetrainExportLayoutSchema
|
|
30587
|
+
}), object({
|
|
30588
|
+
ticket: PeerBytesTicketSchema,
|
|
30589
|
+
frames: number().int(),
|
|
30590
|
+
annotations: number().int()
|
|
30591
|
+
}), {
|
|
30592
|
+
kind: "mutation",
|
|
30593
|
+
auth: "admin",
|
|
30594
|
+
timeoutMs: 12e4
|
|
30595
|
+
}),
|
|
29688
30596
|
/** The counts a selection would freeze — class × camera × day/night,
|
|
29689
30597
|
* completeness — without freezing anything. Index reads only. */
|
|
29690
30598
|
previewRetrainDataset: method(object({
|
|
@@ -34354,8 +35262,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
34354
35262
|
* `smtp-provider` — pluggable email delivery surface.
|
|
34355
35263
|
*
|
|
34356
35264
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
34357
|
-
* one for transactional / one for notifications). Consumers (
|
|
34358
|
-
*
|
|
35265
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
35266
|
+
* addons, …) walk the collection and pick the first
|
|
34359
35267
|
* ready provider OR target a specific addonId.
|
|
34360
35268
|
*
|
|
34361
35269
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -34651,7 +35559,7 @@ targets: array(object({
|
|
|
34651
35559
|
};
|
|
34652
35560
|
/**
|
|
34653
35561
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
34654
|
-
* providers (OIDC, SAML,
|
|
35562
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
34655
35563
|
* carrying the post-callback claims before redirecting back to
|
|
34656
35564
|
* `/api/auth/sso/finish`.
|
|
34657
35565
|
*
|
|
@@ -34714,7 +35622,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
34714
35622
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
34715
35623
|
* subject is unique only per issuer, so a link is bound to it.
|
|
34716
35624
|
*/
|
|
34717
|
-
issuer: string().optional()
|
|
35625
|
+
issuer: string().optional(),
|
|
35626
|
+
/**
|
|
35627
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
35628
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
35629
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
35630
|
+
* any other browser.
|
|
35631
|
+
*/
|
|
35632
|
+
browserBinding: string().optional()
|
|
34718
35633
|
});
|
|
34719
35634
|
var ssoBridgeCapability = {
|
|
34720
35635
|
name: "sso-bridge",
|
|
@@ -34732,7 +35647,7 @@ var ssoBridgeCapability = {
|
|
|
34732
35647
|
* `/api/auth/sso/finish` to become admin — a full privilege escalation
|
|
34733
35648
|
* through the exact surface this cap exists to close (see the module
|
|
34734
35649
|
* docblock). Every real caller (`oauth-grants.ts`, `main.ts`
|
|
34735
|
-
* registration, the OIDC
|
|
35650
|
+
* registration, the OIDC addon) reaches this through
|
|
34736
35651
|
* `ctx.api` / the in-process registry — never through tRPC — so
|
|
34737
35652
|
* `auth: 'admin'` costs those callers nothing.
|
|
34738
35653
|
*/
|
|
@@ -49141,16 +50056,6 @@ var ApiKeySummarySchema = object({
|
|
|
49141
50056
|
createdAt: number(),
|
|
49142
50057
|
lastUsedAt: number().optional()
|
|
49143
50058
|
});
|
|
49144
|
-
var CreateApiKeyInputSchema = object({
|
|
49145
|
-
label: string(),
|
|
49146
|
-
isAdmin: boolean().default(false),
|
|
49147
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
49148
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
49149
|
-
});
|
|
49150
|
-
var CreateApiKeyResultSchema = object({
|
|
49151
|
-
token: string(),
|
|
49152
|
-
record: ApiKeySummarySchema
|
|
49153
|
-
});
|
|
49154
50059
|
var ScopedTokenSummarySchema = object({
|
|
49155
50060
|
id: string(),
|
|
49156
50061
|
userId: string(),
|
|
@@ -49262,20 +50167,11 @@ var userManagementCapability = {
|
|
|
49262
50167
|
access: "view"
|
|
49263
50168
|
}),
|
|
49264
50169
|
listApiKeys: method(_void(), array(ApiKeySummarySchema), { auth: "admin" }),
|
|
49265
|
-
createApiKey: method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
|
|
49266
|
-
kind: "mutation",
|
|
49267
|
-
auth: "admin",
|
|
49268
|
-
access: "create"
|
|
49269
|
-
}),
|
|
49270
50170
|
revokeApiKey: method(object({ id: string() }), object({ success: literal(true) }), {
|
|
49271
50171
|
kind: "mutation",
|
|
49272
50172
|
auth: "admin",
|
|
49273
50173
|
access: "delete"
|
|
49274
50174
|
}),
|
|
49275
|
-
validateApiKey: method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
49276
|
-
kind: "mutation",
|
|
49277
|
-
access: "view"
|
|
49278
|
-
}),
|
|
49279
50175
|
createScopedToken: method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
49280
50176
|
kind: "mutation",
|
|
49281
50177
|
auth: "admin",
|
|
@@ -49365,20 +50261,6 @@ var userManagementCapability = {
|
|
|
49365
50261
|
userId: string(),
|
|
49366
50262
|
issuer: string()
|
|
49367
50263
|
}).nullable(), { auth: "admin" }),
|
|
49368
|
-
/**
|
|
49369
|
-
* Link `(provider, subject)` to `userId`. Idempotent for the same user;
|
|
49370
|
-
* REFUSES (throws) an identity already linked to another user, and a
|
|
49371
|
-
* user that does not exist.
|
|
49372
|
-
*/
|
|
49373
|
-
linkExternalIdentity: method(ExternalIdentityKeySchema.extend({
|
|
49374
|
-
userId: string(),
|
|
49375
|
-
issuer: string().min(1),
|
|
49376
|
-
label: string().optional()
|
|
49377
|
-
}), object({ success: literal(true) }), {
|
|
49378
|
-
kind: "mutation",
|
|
49379
|
-
auth: "admin",
|
|
49380
|
-
access: "create"
|
|
49381
|
-
}),
|
|
49382
50264
|
/** Remove one link of `userId`. `success: false` when it was not linked to that user. */
|
|
49383
50265
|
unlinkExternalIdentity: method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
49384
50266
|
kind: "mutation",
|
|
@@ -50089,6 +50971,531 @@ var zoneRulesCapability = {
|
|
|
50089
50971
|
*/
|
|
50090
50972
|
durability: "restored"
|
|
50091
50973
|
};
|
|
50974
|
+
/**
|
|
50975
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
50976
|
+
*
|
|
50977
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
50978
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
50979
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
50980
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
50981
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
50982
|
+
* manifest entry and nothing else.
|
|
50983
|
+
*
|
|
50984
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
50985
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
50986
|
+
* Every method is `admin`: these spend money.
|
|
50987
|
+
*
|
|
50988
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
50989
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
50990
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
50991
|
+
*
|
|
50992
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
50993
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
50994
|
+
* ticket the provider mints (D613).
|
|
50995
|
+
*/
|
|
50996
|
+
var TrainingGpuOptionSchema = object({
|
|
50997
|
+
id: string(),
|
|
50998
|
+
label: string(),
|
|
50999
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
51000
|
+
usdPerHour: number().nonnegative(),
|
|
51001
|
+
vramGb: number().nonnegative()
|
|
51002
|
+
});
|
|
51003
|
+
var TrainingRegionOptionSchema = object({
|
|
51004
|
+
/** `''` = any region (the provider's choice). */
|
|
51005
|
+
id: string(),
|
|
51006
|
+
label: string(),
|
|
51007
|
+
priceMultiplier: number().positive()
|
|
51008
|
+
});
|
|
51009
|
+
/**
|
|
51010
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
51011
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
51012
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
51013
|
+
*/
|
|
51014
|
+
var TrainingProviderDefaultsSchema = object({
|
|
51015
|
+
gpuType: string(),
|
|
51016
|
+
region: string(),
|
|
51017
|
+
costCapUsd: number().nonnegative(),
|
|
51018
|
+
maxRuntimeSec: number().int().positive(),
|
|
51019
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
51020
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
51021
|
+
});
|
|
51022
|
+
var TrainingProviderDescriptorSchema = object({
|
|
51023
|
+
addonId: string(),
|
|
51024
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
51025
|
+
kind: string(),
|
|
51026
|
+
label: string(),
|
|
51027
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
51028
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
51029
|
+
maxDatasetBytes: number().int().positive(),
|
|
51030
|
+
maxRuntimeSec: number().int().positive(),
|
|
51031
|
+
freeTierNote: string().optional(),
|
|
51032
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
51033
|
+
dataResidencyNote: string(),
|
|
51034
|
+
/** Credentials are present — never the values. */
|
|
51035
|
+
configured: boolean(),
|
|
51036
|
+
defaults: TrainingProviderDefaultsSchema
|
|
51037
|
+
});
|
|
51038
|
+
var TrainingCredentialCheckSchema = object({
|
|
51039
|
+
ok: boolean(),
|
|
51040
|
+
/** Workspace / account name, when the provider says. */
|
|
51041
|
+
account: string().optional(),
|
|
51042
|
+
reason: _enum([
|
|
51043
|
+
"missing",
|
|
51044
|
+
"invalid",
|
|
51045
|
+
"forbidden",
|
|
51046
|
+
"network",
|
|
51047
|
+
"quota"
|
|
51048
|
+
]).optional(),
|
|
51049
|
+
detail: string().optional()
|
|
51050
|
+
});
|
|
51051
|
+
var ProviderJobStateSchema = _enum([
|
|
51052
|
+
"pending",
|
|
51053
|
+
"starting",
|
|
51054
|
+
"running",
|
|
51055
|
+
"succeeded",
|
|
51056
|
+
"failed",
|
|
51057
|
+
"cancelled",
|
|
51058
|
+
"lost"
|
|
51059
|
+
]);
|
|
51060
|
+
var ProviderJobStatusSchema = object({
|
|
51061
|
+
jobKey: string(),
|
|
51062
|
+
providerJobId: string().optional(),
|
|
51063
|
+
state: ProviderJobStateSchema,
|
|
51064
|
+
startedAt: number().optional(),
|
|
51065
|
+
endedAt: number().optional(),
|
|
51066
|
+
exitCode: number().int().optional(),
|
|
51067
|
+
failureReason: string().optional(),
|
|
51068
|
+
gpuType: string(),
|
|
51069
|
+
region: string().optional(),
|
|
51070
|
+
billedSeconds: number().nonnegative(),
|
|
51071
|
+
costUsd: number().nonnegative(),
|
|
51072
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
51073
|
+
costIsEstimate: boolean(),
|
|
51074
|
+
lastFetchedAt: number()
|
|
51075
|
+
});
|
|
51076
|
+
/**
|
|
51077
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
51078
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
51079
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
51080
|
+
* in `result.json`.
|
|
51081
|
+
*/
|
|
51082
|
+
var TrainerSourceRefSchema = object({
|
|
51083
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
51084
|
+
repo: string().min(1),
|
|
51085
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
51086
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
51087
|
+
});
|
|
51088
|
+
var JobRef = {
|
|
51089
|
+
addonId: string(),
|
|
51090
|
+
jobKey: string().uuid()
|
|
51091
|
+
};
|
|
51092
|
+
var TrainingLogLineSchema = object({
|
|
51093
|
+
ts: number(),
|
|
51094
|
+
text: string()
|
|
51095
|
+
});
|
|
51096
|
+
var trainingProviderCapability = {
|
|
51097
|
+
name: "training-provider",
|
|
51098
|
+
scope: "system",
|
|
51099
|
+
mode: "collection",
|
|
51100
|
+
internal: true,
|
|
51101
|
+
methods: {
|
|
51102
|
+
/** Every provider's offer and settings. Concat-fans across providers. */
|
|
51103
|
+
describe: method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }),
|
|
51104
|
+
/** Call the provider with the stored credentials. Never returns them. */
|
|
51105
|
+
validateCredentials: method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
51106
|
+
kind: "mutation",
|
|
51107
|
+
auth: "admin",
|
|
51108
|
+
timeoutMs: 3e4
|
|
51109
|
+
}),
|
|
51110
|
+
/** USD range for a run of `gpuSeconds` on `gpuType` in `region`. */
|
|
51111
|
+
estimateJob: method(object({
|
|
51112
|
+
addonId: string(),
|
|
51113
|
+
gpuType: string(),
|
|
51114
|
+
region: string(),
|
|
51115
|
+
datasetBytes: number().int().nonnegative(),
|
|
51116
|
+
gpuSecondsLow: number().nonnegative(),
|
|
51117
|
+
gpuSecondsHigh: number().nonnegative()
|
|
51118
|
+
}), object({
|
|
51119
|
+
usdLow: number().nonnegative(),
|
|
51120
|
+
usdHigh: number().nonnegative(),
|
|
51121
|
+
notes: array(string()).readonly()
|
|
51122
|
+
}), { auth: "admin" }),
|
|
51123
|
+
/**
|
|
51124
|
+
* Take the dataset archive behind `ticket` (minted by pipeline-analytics,
|
|
51125
|
+
* same host) and land it as the job's dataset in the cloud, streamed —
|
|
51126
|
+
* nothing is staged on the hub's disk. Idempotent per `jobKey`: a second
|
|
51127
|
+
* call replaces a partial upload. Answers what actually landed.
|
|
51128
|
+
*/
|
|
51129
|
+
uploadDataset: method(object({
|
|
51130
|
+
...JobRef,
|
|
51131
|
+
ticket: PeerBytesTicketSchema
|
|
51132
|
+
}), object({
|
|
51133
|
+
bytes: number().int().nonnegative(),
|
|
51134
|
+
sha256: string()
|
|
51135
|
+
}), {
|
|
51136
|
+
kind: "mutation",
|
|
51137
|
+
auth: "admin",
|
|
51138
|
+
timeoutMs: 120 * 6e4
|
|
51139
|
+
}),
|
|
51140
|
+
/**
|
|
51141
|
+
* Start the trainer on a GPU. Looks the job up by `jobKey` first, so a
|
|
51142
|
+
* retried submit never starts a second GPU. `jobSpecJson` is written next
|
|
51143
|
+
* to the dataset as `job.json`; `maxRuntimeSec` is enforced by the
|
|
51144
|
+
* provider (a hard timeout), not by the hub.
|
|
51145
|
+
*/
|
|
51146
|
+
submitJob: method(object({
|
|
51147
|
+
...JobRef,
|
|
51148
|
+
trainer: TrainerSourceRefSchema,
|
|
51149
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
51150
|
+
gpuType: string(),
|
|
51151
|
+
region: string(),
|
|
51152
|
+
maxRuntimeSec: number().int().positive()
|
|
51153
|
+
}), ProviderJobStatusSchema, {
|
|
51154
|
+
kind: "mutation",
|
|
51155
|
+
auth: "admin",
|
|
51156
|
+
timeoutMs: 30 * 6e4
|
|
51157
|
+
}),
|
|
51158
|
+
getJob: method(object(JobRef), ProviderJobStatusSchema, {
|
|
51159
|
+
auth: "admin",
|
|
51160
|
+
timeoutMs: 6e4
|
|
51161
|
+
}),
|
|
51162
|
+
/** Stdout/stderr since `cursor` (opaque), oldest first, at most `max` lines. */
|
|
51163
|
+
listJobEvents: method(object({
|
|
51164
|
+
...JobRef,
|
|
51165
|
+
cursor: string().optional(),
|
|
51166
|
+
max: number().int().min(1).max(500)
|
|
51167
|
+
}), object({
|
|
51168
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
51169
|
+
cursor: string()
|
|
51170
|
+
}), {
|
|
51171
|
+
auth: "admin",
|
|
51172
|
+
timeoutMs: 6e4
|
|
51173
|
+
}),
|
|
51174
|
+
/** Stop the job. Idempotent: an unknown or finished job is a no-op. */
|
|
51175
|
+
cancelJob: method(object(JobRef), object({ ok: literal(true) }), {
|
|
51176
|
+
kind: "mutation",
|
|
51177
|
+
auth: "admin",
|
|
51178
|
+
timeoutMs: 6e4
|
|
51179
|
+
}),
|
|
51180
|
+
/** The job's `result.json`, as text (small, JSON). `found: false` before it exists. */
|
|
51181
|
+
readResult: method(object(JobRef), object({
|
|
51182
|
+
found: boolean(),
|
|
51183
|
+
text: string().optional()
|
|
51184
|
+
}), {
|
|
51185
|
+
kind: "mutation",
|
|
51186
|
+
auth: "admin",
|
|
51187
|
+
timeoutMs: 5 * 6e4
|
|
51188
|
+
}),
|
|
51189
|
+
/**
|
|
51190
|
+
* Offer one output file of the job (`bundle.tar`) to the caller as a
|
|
51191
|
+
* one-shot `ctx.peerBytes` ticket, streamed from the cloud — the provider
|
|
51192
|
+
* stages nothing on disk. The caller dials it at once.
|
|
51193
|
+
*/
|
|
51194
|
+
offerArtifact: method(object({
|
|
51195
|
+
...JobRef,
|
|
51196
|
+
path: _enum(["bundle.tar"])
|
|
51197
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
51198
|
+
kind: "mutation",
|
|
51199
|
+
auth: "admin",
|
|
51200
|
+
timeoutMs: 5 * 6e4
|
|
51201
|
+
}),
|
|
51202
|
+
/** Delete every cloud object tagged with `jobKey` (the dataset first). Idempotent. */
|
|
51203
|
+
cleanupJob: method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
51204
|
+
kind: "mutation",
|
|
51205
|
+
auth: "admin",
|
|
51206
|
+
timeoutMs: 5 * 6e4
|
|
51207
|
+
}),
|
|
51208
|
+
/** Every job the provider can still see — the orphan sweep diffs it against our records. */
|
|
51209
|
+
listJobs: method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
51210
|
+
auth: "admin",
|
|
51211
|
+
timeoutMs: 2 * 6e4
|
|
51212
|
+
})
|
|
51213
|
+
}
|
|
51214
|
+
};
|
|
51215
|
+
/**
|
|
51216
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
51217
|
+
* provided by `addon-training`.
|
|
51218
|
+
*
|
|
51219
|
+
* It owns what every provider must agree on, written once:
|
|
51220
|
+
*
|
|
51221
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
51222
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
51223
|
+
* the export plan) and reaches this store through the five row methods
|
|
51224
|
+
* below, so the Retrain page and the export did not change.
|
|
51225
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
51226
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
51227
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
51228
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
51229
|
+
* rollback. Nothing is ever registered automatically.
|
|
51230
|
+
*
|
|
51231
|
+
* Every method is `admin`.
|
|
51232
|
+
*/
|
|
51233
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
51234
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
51235
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
51236
|
+
var TrainingBaseModelSchema = object({
|
|
51237
|
+
modelId: string(),
|
|
51238
|
+
label: string(),
|
|
51239
|
+
weights: string(),
|
|
51240
|
+
imgsz: number().int(),
|
|
51241
|
+
baselineOnnxUrl: string(),
|
|
51242
|
+
baselineFloors: record(string(), number()),
|
|
51243
|
+
/** The base the fleet runs most — the UI's default. */
|
|
51244
|
+
recommended: boolean()
|
|
51245
|
+
});
|
|
51246
|
+
var TrainingPresetSchema = _enum([
|
|
51247
|
+
"quick",
|
|
51248
|
+
"standard",
|
|
51249
|
+
"thorough"
|
|
51250
|
+
]);
|
|
51251
|
+
var TrainingJobRequestSchema = object({
|
|
51252
|
+
datasetVersionId: string().min(1),
|
|
51253
|
+
/** The `training-provider` addon that runs it. */
|
|
51254
|
+
addonId: string().min(1),
|
|
51255
|
+
gpuType: string().min(1),
|
|
51256
|
+
region: string(),
|
|
51257
|
+
baseModelId: string().min(1),
|
|
51258
|
+
preset: TrainingPresetSchema,
|
|
51259
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
51260
|
+
freeze: number().int().nonnegative().nullable(),
|
|
51261
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
51262
|
+
holdoutCameras: array(number().int()).nullable()
|
|
51263
|
+
});
|
|
51264
|
+
var TrainingSplitPlanSchema = object({
|
|
51265
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
51266
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
51267
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
51268
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
51269
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
51270
|
+
trainSubjects: number().int()
|
|
51271
|
+
});
|
|
51272
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
51273
|
+
"unknown-dataset",
|
|
51274
|
+
"unknown-provider",
|
|
51275
|
+
"provider-not-configured",
|
|
51276
|
+
"unknown-base-model",
|
|
51277
|
+
"unknown-gpu",
|
|
51278
|
+
"dataset-too-large",
|
|
51279
|
+
"no-training-subjects",
|
|
51280
|
+
"job-already-running"
|
|
51281
|
+
]);
|
|
51282
|
+
var TrainingJobPlanSchema = object({
|
|
51283
|
+
refusal: object({
|
|
51284
|
+
reason: TrainingRefusalReasonSchema,
|
|
51285
|
+
detail: string()
|
|
51286
|
+
}).nullable(),
|
|
51287
|
+
warnings: array(string()).readonly(),
|
|
51288
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
51289
|
+
estimate: object({
|
|
51290
|
+
datasetBytes: number().int(),
|
|
51291
|
+
uploadMinutesAt20Mbps: number(),
|
|
51292
|
+
gpuSecondsLow: number(),
|
|
51293
|
+
gpuSecondsHigh: number(),
|
|
51294
|
+
usdLow: number(),
|
|
51295
|
+
usdHigh: number(),
|
|
51296
|
+
notes: array(string()).readonly()
|
|
51297
|
+
}).nullable(),
|
|
51298
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
51299
|
+
defaults: object({
|
|
51300
|
+
maxCostUsd: number(),
|
|
51301
|
+
maxRuntimeSec: number().int()
|
|
51302
|
+
}).nullable(),
|
|
51303
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
51304
|
+
dataNotice: string()
|
|
51305
|
+
});
|
|
51306
|
+
/**
|
|
51307
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
51308
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
51309
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
51310
|
+
* result lives after the operator acted on it.
|
|
51311
|
+
*/
|
|
51312
|
+
var TrainingJobStateSchema = _enum([
|
|
51313
|
+
"uploading",
|
|
51314
|
+
"submitted",
|
|
51315
|
+
"starting",
|
|
51316
|
+
"running",
|
|
51317
|
+
"collecting",
|
|
51318
|
+
"ready",
|
|
51319
|
+
"registered",
|
|
51320
|
+
"canary",
|
|
51321
|
+
"failed",
|
|
51322
|
+
"cancelling",
|
|
51323
|
+
"cancelled",
|
|
51324
|
+
"lost",
|
|
51325
|
+
"expired",
|
|
51326
|
+
"discarded"
|
|
51327
|
+
]);
|
|
51328
|
+
var TrainingFailureReasonSchema = _enum([
|
|
51329
|
+
"cost-cap",
|
|
51330
|
+
"runtime-cap",
|
|
51331
|
+
"upload-failed",
|
|
51332
|
+
"submit-failed",
|
|
51333
|
+
"trainer-failed",
|
|
51334
|
+
"result-invalid",
|
|
51335
|
+
"checksum-mismatch",
|
|
51336
|
+
"fetch-failed",
|
|
51337
|
+
"provider-error",
|
|
51338
|
+
"hub-restart-during-upload"
|
|
51339
|
+
]);
|
|
51340
|
+
var TrainingProgressPointSchema = object({
|
|
51341
|
+
epoch: number().int(),
|
|
51342
|
+
map50: number().nullable(),
|
|
51343
|
+
map50_95: number().nullable()
|
|
51344
|
+
});
|
|
51345
|
+
var TrainingCanarySchema = object({
|
|
51346
|
+
deviceIds: array(number().int()).readonly(),
|
|
51347
|
+
since: number(),
|
|
51348
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
51349
|
+
previous: array(object({
|
|
51350
|
+
deviceId: number().int(),
|
|
51351
|
+
nodeId: string(),
|
|
51352
|
+
deviceKey: string(),
|
|
51353
|
+
patch: object({
|
|
51354
|
+
modelId: string().optional(),
|
|
51355
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
51356
|
+
}).nullable()
|
|
51357
|
+
})).readonly()
|
|
51358
|
+
});
|
|
51359
|
+
var TrainingJobSchema = object({
|
|
51360
|
+
id: string(),
|
|
51361
|
+
idempotencyKey: string(),
|
|
51362
|
+
name: string(),
|
|
51363
|
+
createdAt: number(),
|
|
51364
|
+
updatedAt: number(),
|
|
51365
|
+
state: TrainingJobStateSchema,
|
|
51366
|
+
stage: TrainingStageSchema.nullable(),
|
|
51367
|
+
failure: object({
|
|
51368
|
+
reason: TrainingFailureReasonSchema,
|
|
51369
|
+
stage: string().nullable(),
|
|
51370
|
+
detail: string()
|
|
51371
|
+
}).nullable(),
|
|
51372
|
+
request: TrainingJobRequestSchema,
|
|
51373
|
+
maxCostUsd: number().nonnegative(),
|
|
51374
|
+
maxRuntimeSec: number().int().positive(),
|
|
51375
|
+
trainer: TrainerSourceRefSchema,
|
|
51376
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
51377
|
+
dataset: object({
|
|
51378
|
+
bytes: number().int(),
|
|
51379
|
+
sha256: string(),
|
|
51380
|
+
uploadedAt: number()
|
|
51381
|
+
}).nullable(),
|
|
51382
|
+
split: TrainingSplitPlanSchema,
|
|
51383
|
+
provider: object({
|
|
51384
|
+
state: ProviderJobStateSchema.nullable(),
|
|
51385
|
+
providerJobId: string().nullable(),
|
|
51386
|
+
startedAt: number().nullable(),
|
|
51387
|
+
endedAt: number().nullable(),
|
|
51388
|
+
billedSeconds: number(),
|
|
51389
|
+
costUsd: number(),
|
|
51390
|
+
costIsEstimate: boolean(),
|
|
51391
|
+
lastPolledAt: number().nullable()
|
|
51392
|
+
}),
|
|
51393
|
+
progress: object({
|
|
51394
|
+
epoch: number().int().nullable(),
|
|
51395
|
+
epochs: number().int().nullable(),
|
|
51396
|
+
etaSec: number().nullable(),
|
|
51397
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
51398
|
+
}),
|
|
51399
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
51400
|
+
logTail: array(string()).readonly(),
|
|
51401
|
+
logCursor: string().nullable(),
|
|
51402
|
+
artifacts: object({
|
|
51403
|
+
bundleBytes: number().int(),
|
|
51404
|
+
bundleSha256: string(),
|
|
51405
|
+
fetchedAt: number(),
|
|
51406
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
51407
|
+
expiresAt: number()
|
|
51408
|
+
}).nullable(),
|
|
51409
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
51410
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
51411
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
51412
|
+
cloudCleanupDueAt: number().nullable(),
|
|
51413
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
51414
|
+
registeredModelIds: array(string()).readonly(),
|
|
51415
|
+
canary: TrainingCanarySchema.nullable()
|
|
51416
|
+
});
|
|
51417
|
+
var IdInput = object({ id: string().min(1) });
|
|
51418
|
+
var trainingCapability = {
|
|
51419
|
+
name: "training",
|
|
51420
|
+
scope: "system",
|
|
51421
|
+
mode: "singleton",
|
|
51422
|
+
mount: { kind: "hub-only" },
|
|
51423
|
+
methods: {
|
|
51424
|
+
/** Store a version once. `stored: false` = that id already exists (immutable). */
|
|
51425
|
+
putDatasetVersion: method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
51426
|
+
kind: "mutation",
|
|
51427
|
+
auth: "admin"
|
|
51428
|
+
}),
|
|
51429
|
+
getDatasetVersion: method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }),
|
|
51430
|
+
/** Every version without its frame list, newest first. */
|
|
51431
|
+
listDatasetVersions: method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }),
|
|
51432
|
+
findDatasetVersionIdByName: method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }),
|
|
51433
|
+
removeDatasetVersion: method(IdInput, object({ removed: boolean() }), {
|
|
51434
|
+
kind: "mutation",
|
|
51435
|
+
auth: "admin"
|
|
51436
|
+
}),
|
|
51437
|
+
listBaseModels: method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }),
|
|
51438
|
+
/** Split, estimate, defaults and any named refusal — nothing is started. */
|
|
51439
|
+
planJob: method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
51440
|
+
auth: "admin",
|
|
51441
|
+
timeoutMs: 6e4
|
|
51442
|
+
}),
|
|
51443
|
+
/**
|
|
51444
|
+
* Start a job. The same `idempotencyKey` returns the job it already
|
|
51445
|
+
* started. Answers at once (`uploading`); the upload and the submit run in
|
|
51446
|
+
* the background and the job record says how far they got.
|
|
51447
|
+
*/
|
|
51448
|
+
startJob: method(TrainingJobRequestSchema.extend({
|
|
51449
|
+
name: string().min(1).max(120),
|
|
51450
|
+
maxCostUsd: number().positive(),
|
|
51451
|
+
maxRuntimeSec: number().int().positive(),
|
|
51452
|
+
idempotencyKey: string().min(8).max(80)
|
|
51453
|
+
}), discriminatedUnion("kind", [object({
|
|
51454
|
+
kind: literal("started"),
|
|
51455
|
+
job: TrainingJobSchema
|
|
51456
|
+
}), object({
|
|
51457
|
+
kind: literal("refused"),
|
|
51458
|
+
reason: TrainingRefusalReasonSchema,
|
|
51459
|
+
detail: string()
|
|
51460
|
+
})]), {
|
|
51461
|
+
kind: "mutation",
|
|
51462
|
+
auth: "admin",
|
|
51463
|
+
timeoutMs: 12e4
|
|
51464
|
+
}),
|
|
51465
|
+
listJobs: method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }),
|
|
51466
|
+
getJob: method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }),
|
|
51467
|
+
cancelJob: method(IdInput, TrainingJobSchema, {
|
|
51468
|
+
kind: "mutation",
|
|
51469
|
+
auth: "admin",
|
|
51470
|
+
timeoutMs: 12e4
|
|
51471
|
+
}),
|
|
51472
|
+
/** The verified `result.json` of a job in `ready` or later; null before. */
|
|
51473
|
+
getJobResult: method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }),
|
|
51474
|
+
/** Hand the verified bundle to Model Studio; optionally canary right after. */
|
|
51475
|
+
registerResult: method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
51476
|
+
kind: "mutation",
|
|
51477
|
+
auth: "admin",
|
|
51478
|
+
timeoutMs: 30 * 6e4
|
|
51479
|
+
}),
|
|
51480
|
+
/** Pin the registered model on these cameras, remembering what it replaced. */
|
|
51481
|
+
canaryResult: method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
51482
|
+
kind: "mutation",
|
|
51483
|
+
auth: "admin",
|
|
51484
|
+
timeoutMs: 12e4
|
|
51485
|
+
}),
|
|
51486
|
+
/** Put every canary camera back exactly as it was. */
|
|
51487
|
+
rollbackCanary: method(IdInput, TrainingJobSchema, {
|
|
51488
|
+
kind: "mutation",
|
|
51489
|
+
auth: "admin",
|
|
51490
|
+
timeoutMs: 12e4
|
|
51491
|
+
}),
|
|
51492
|
+
/** Delete the staged artefacts of an unregistered result. */
|
|
51493
|
+
discardResult: method(IdInput, TrainingJobSchema, {
|
|
51494
|
+
kind: "mutation",
|
|
51495
|
+
auth: "admin"
|
|
51496
|
+
})
|
|
51497
|
+
}
|
|
51498
|
+
};
|
|
50092
51499
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
50093
51500
|
Object.freeze({
|
|
50094
51501
|
person: .5,
|
|
@@ -51813,6 +53220,12 @@ Object.freeze({
|
|
|
51813
53220
|
addonId: null,
|
|
51814
53221
|
access: "create"
|
|
51815
53222
|
},
|
|
53223
|
+
"backup.checkBackupKey": {
|
|
53224
|
+
capName: "backup",
|
|
53225
|
+
capScope: "system",
|
|
53226
|
+
addonId: null,
|
|
53227
|
+
access: "create"
|
|
53228
|
+
},
|
|
51816
53229
|
"backup.delete": {
|
|
51817
53230
|
capName: "backup",
|
|
51818
53231
|
capScope: "system",
|
|
@@ -51825,6 +53238,18 @@ Object.freeze({
|
|
|
51825
53238
|
addonId: null,
|
|
51826
53239
|
access: "delete"
|
|
51827
53240
|
},
|
|
53241
|
+
"backup.disableEncryption": {
|
|
53242
|
+
capName: "backup",
|
|
53243
|
+
capScope: "system",
|
|
53244
|
+
addonId: null,
|
|
53245
|
+
access: "create"
|
|
53246
|
+
},
|
|
53247
|
+
"backup.getEncryption": {
|
|
53248
|
+
capName: "backup",
|
|
53249
|
+
capScope: "system",
|
|
53250
|
+
addonId: null,
|
|
53251
|
+
access: "view"
|
|
53252
|
+
},
|
|
51828
53253
|
"backup.getEntries": {
|
|
51829
53254
|
capName: "backup",
|
|
51830
53255
|
capScope: "system",
|
|
@@ -51879,6 +53304,12 @@ Object.freeze({
|
|
|
51879
53304
|
addonId: null,
|
|
51880
53305
|
access: "create"
|
|
51881
53306
|
},
|
|
53307
|
+
"backup.setupEncryption": {
|
|
53308
|
+
capName: "backup",
|
|
53309
|
+
capScope: "system",
|
|
53310
|
+
addonId: null,
|
|
53311
|
+
access: "create"
|
|
53312
|
+
},
|
|
51882
53313
|
"backup.trigger": {
|
|
51883
53314
|
capName: "backup",
|
|
51884
53315
|
capScope: "system",
|
|
@@ -52431,6 +53862,12 @@ Object.freeze({
|
|
|
52431
53862
|
addonId: null,
|
|
52432
53863
|
access: "create"
|
|
52433
53864
|
},
|
|
53865
|
+
"customModelRegistry.importModelBundle": {
|
|
53866
|
+
capName: "custom-model-registry",
|
|
53867
|
+
capScope: "system",
|
|
53868
|
+
addonId: null,
|
|
53869
|
+
access: "create"
|
|
53870
|
+
},
|
|
52434
53871
|
"customModelRegistry.listModels": {
|
|
52435
53872
|
capName: "custom-model-registry",
|
|
52436
53873
|
capScope: "system",
|
|
@@ -53871,6 +55308,12 @@ Object.freeze({
|
|
|
53871
55308
|
addonId: null,
|
|
53872
55309
|
access: "view"
|
|
53873
55310
|
},
|
|
55311
|
+
"keychainAdmin.acknowledgeReset": {
|
|
55312
|
+
capName: "keychain-admin",
|
|
55313
|
+
capScope: "system",
|
|
55314
|
+
addonId: null,
|
|
55315
|
+
access: "create"
|
|
55316
|
+
},
|
|
53874
55317
|
"keychainAdmin.deleteOrphans": {
|
|
53875
55318
|
capName: "keychain-admin",
|
|
53876
55319
|
capScope: "system",
|
|
@@ -53907,6 +55350,12 @@ Object.freeze({
|
|
|
53907
55350
|
addonId: null,
|
|
53908
55351
|
access: "delete"
|
|
53909
55352
|
},
|
|
55353
|
+
"keychainAdmin.resetReport": {
|
|
55354
|
+
capName: "keychain-admin",
|
|
55355
|
+
capScope: "system",
|
|
55356
|
+
addonId: null,
|
|
55357
|
+
access: "delete"
|
|
55358
|
+
},
|
|
53910
55359
|
"keychainAdmin.reveal": {
|
|
53911
55360
|
capName: "keychain-admin",
|
|
53912
55361
|
capScope: "system",
|
|
@@ -55653,6 +57102,12 @@ Object.freeze({
|
|
|
55653
57102
|
addonId: null,
|
|
55654
57103
|
access: "view"
|
|
55655
57104
|
},
|
|
57105
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
57106
|
+
capName: "pipeline-analytics",
|
|
57107
|
+
capScope: "device",
|
|
57108
|
+
addonId: null,
|
|
57109
|
+
access: "create"
|
|
57110
|
+
},
|
|
55656
57111
|
"pipelineAnalytics.ownersWithMedia": {
|
|
55657
57112
|
capName: "pipeline-analytics",
|
|
55658
57113
|
capScope: "device",
|
|
@@ -58191,6 +59646,174 @@ Object.freeze({
|
|
|
58191
59646
|
addonId: null,
|
|
58192
59647
|
access: "view"
|
|
58193
59648
|
},
|
|
59649
|
+
"training.canaryResult": {
|
|
59650
|
+
capName: "training",
|
|
59651
|
+
capScope: "system",
|
|
59652
|
+
addonId: null,
|
|
59653
|
+
access: "create"
|
|
59654
|
+
},
|
|
59655
|
+
"training.cancelJob": {
|
|
59656
|
+
capName: "training",
|
|
59657
|
+
capScope: "system",
|
|
59658
|
+
addonId: null,
|
|
59659
|
+
access: "create"
|
|
59660
|
+
},
|
|
59661
|
+
"training.discardResult": {
|
|
59662
|
+
capName: "training",
|
|
59663
|
+
capScope: "system",
|
|
59664
|
+
addonId: null,
|
|
59665
|
+
access: "create"
|
|
59666
|
+
},
|
|
59667
|
+
"training.findDatasetVersionIdByName": {
|
|
59668
|
+
capName: "training",
|
|
59669
|
+
capScope: "system",
|
|
59670
|
+
addonId: null,
|
|
59671
|
+
access: "view"
|
|
59672
|
+
},
|
|
59673
|
+
"training.getDatasetVersion": {
|
|
59674
|
+
capName: "training",
|
|
59675
|
+
capScope: "system",
|
|
59676
|
+
addonId: null,
|
|
59677
|
+
access: "view"
|
|
59678
|
+
},
|
|
59679
|
+
"training.getJob": {
|
|
59680
|
+
capName: "training",
|
|
59681
|
+
capScope: "system",
|
|
59682
|
+
addonId: null,
|
|
59683
|
+
access: "view"
|
|
59684
|
+
},
|
|
59685
|
+
"training.getJobResult": {
|
|
59686
|
+
capName: "training",
|
|
59687
|
+
capScope: "system",
|
|
59688
|
+
addonId: null,
|
|
59689
|
+
access: "view"
|
|
59690
|
+
},
|
|
59691
|
+
"training.listBaseModels": {
|
|
59692
|
+
capName: "training",
|
|
59693
|
+
capScope: "system",
|
|
59694
|
+
addonId: null,
|
|
59695
|
+
access: "view"
|
|
59696
|
+
},
|
|
59697
|
+
"training.listDatasetVersions": {
|
|
59698
|
+
capName: "training",
|
|
59699
|
+
capScope: "system",
|
|
59700
|
+
addonId: null,
|
|
59701
|
+
access: "view"
|
|
59702
|
+
},
|
|
59703
|
+
"training.listJobs": {
|
|
59704
|
+
capName: "training",
|
|
59705
|
+
capScope: "system",
|
|
59706
|
+
addonId: null,
|
|
59707
|
+
access: "view"
|
|
59708
|
+
},
|
|
59709
|
+
"training.planJob": {
|
|
59710
|
+
capName: "training",
|
|
59711
|
+
capScope: "system",
|
|
59712
|
+
addonId: null,
|
|
59713
|
+
access: "view"
|
|
59714
|
+
},
|
|
59715
|
+
"training.putDatasetVersion": {
|
|
59716
|
+
capName: "training",
|
|
59717
|
+
capScope: "system",
|
|
59718
|
+
addonId: null,
|
|
59719
|
+
access: "create"
|
|
59720
|
+
},
|
|
59721
|
+
"training.registerResult": {
|
|
59722
|
+
capName: "training",
|
|
59723
|
+
capScope: "system",
|
|
59724
|
+
addonId: null,
|
|
59725
|
+
access: "create"
|
|
59726
|
+
},
|
|
59727
|
+
"training.removeDatasetVersion": {
|
|
59728
|
+
capName: "training",
|
|
59729
|
+
capScope: "system",
|
|
59730
|
+
addonId: null,
|
|
59731
|
+
access: "delete"
|
|
59732
|
+
},
|
|
59733
|
+
"training.rollbackCanary": {
|
|
59734
|
+
capName: "training",
|
|
59735
|
+
capScope: "system",
|
|
59736
|
+
addonId: null,
|
|
59737
|
+
access: "create"
|
|
59738
|
+
},
|
|
59739
|
+
"training.startJob": {
|
|
59740
|
+
capName: "training",
|
|
59741
|
+
capScope: "system",
|
|
59742
|
+
addonId: null,
|
|
59743
|
+
access: "create"
|
|
59744
|
+
},
|
|
59745
|
+
"trainingProvider.cancelJob": {
|
|
59746
|
+
capName: "training-provider",
|
|
59747
|
+
capScope: "system",
|
|
59748
|
+
addonId: null,
|
|
59749
|
+
access: "create"
|
|
59750
|
+
},
|
|
59751
|
+
"trainingProvider.cleanupJob": {
|
|
59752
|
+
capName: "training-provider",
|
|
59753
|
+
capScope: "system",
|
|
59754
|
+
addonId: null,
|
|
59755
|
+
access: "create"
|
|
59756
|
+
},
|
|
59757
|
+
"trainingProvider.describe": {
|
|
59758
|
+
capName: "training-provider",
|
|
59759
|
+
capScope: "system",
|
|
59760
|
+
addonId: null,
|
|
59761
|
+
access: "view"
|
|
59762
|
+
},
|
|
59763
|
+
"trainingProvider.estimateJob": {
|
|
59764
|
+
capName: "training-provider",
|
|
59765
|
+
capScope: "system",
|
|
59766
|
+
addonId: null,
|
|
59767
|
+
access: "view"
|
|
59768
|
+
},
|
|
59769
|
+
"trainingProvider.getJob": {
|
|
59770
|
+
capName: "training-provider",
|
|
59771
|
+
capScope: "system",
|
|
59772
|
+
addonId: null,
|
|
59773
|
+
access: "view"
|
|
59774
|
+
},
|
|
59775
|
+
"trainingProvider.listJobEvents": {
|
|
59776
|
+
capName: "training-provider",
|
|
59777
|
+
capScope: "system",
|
|
59778
|
+
addonId: null,
|
|
59779
|
+
access: "view"
|
|
59780
|
+
},
|
|
59781
|
+
"trainingProvider.listJobs": {
|
|
59782
|
+
capName: "training-provider",
|
|
59783
|
+
capScope: "system",
|
|
59784
|
+
addonId: null,
|
|
59785
|
+
access: "view"
|
|
59786
|
+
},
|
|
59787
|
+
"trainingProvider.offerArtifact": {
|
|
59788
|
+
capName: "training-provider",
|
|
59789
|
+
capScope: "system",
|
|
59790
|
+
addonId: null,
|
|
59791
|
+
access: "create"
|
|
59792
|
+
},
|
|
59793
|
+
"trainingProvider.readResult": {
|
|
59794
|
+
capName: "training-provider",
|
|
59795
|
+
capScope: "system",
|
|
59796
|
+
addonId: null,
|
|
59797
|
+
access: "create"
|
|
59798
|
+
},
|
|
59799
|
+
"trainingProvider.submitJob": {
|
|
59800
|
+
capName: "training-provider",
|
|
59801
|
+
capScope: "system",
|
|
59802
|
+
addonId: null,
|
|
59803
|
+
access: "create"
|
|
59804
|
+
},
|
|
59805
|
+
"trainingProvider.uploadDataset": {
|
|
59806
|
+
capName: "training-provider",
|
|
59807
|
+
capScope: "system",
|
|
59808
|
+
addonId: null,
|
|
59809
|
+
access: "create"
|
|
59810
|
+
},
|
|
59811
|
+
"trainingProvider.validateCredentials": {
|
|
59812
|
+
capName: "training-provider",
|
|
59813
|
+
capScope: "system",
|
|
59814
|
+
addonId: null,
|
|
59815
|
+
access: "create"
|
|
59816
|
+
},
|
|
58194
59817
|
"turnProvider.getTurnServers": {
|
|
58195
59818
|
capName: "turn-provider",
|
|
58196
59819
|
capScope: "system",
|
|
@@ -58215,12 +59838,6 @@ Object.freeze({
|
|
|
58215
59838
|
addonId: null,
|
|
58216
59839
|
access: "create"
|
|
58217
59840
|
},
|
|
58218
|
-
"userManagement.createApiKey": {
|
|
58219
|
-
capName: "user-management",
|
|
58220
|
-
capScope: "system",
|
|
58221
|
-
addonId: null,
|
|
58222
|
-
access: "create"
|
|
58223
|
-
},
|
|
58224
59841
|
"userManagement.createScopedToken": {
|
|
58225
59842
|
capName: "user-management",
|
|
58226
59843
|
capScope: "system",
|
|
@@ -58257,12 +59874,6 @@ Object.freeze({
|
|
|
58257
59874
|
addonId: null,
|
|
58258
59875
|
access: "view"
|
|
58259
59876
|
},
|
|
58260
|
-
"userManagement.linkExternalIdentity": {
|
|
58261
|
-
capName: "user-management",
|
|
58262
|
-
capScope: "system",
|
|
58263
|
-
addonId: null,
|
|
58264
|
-
access: "create"
|
|
58265
|
-
},
|
|
58266
59877
|
"userManagement.listApiKeys": {
|
|
58267
59878
|
capName: "user-management",
|
|
58268
59879
|
capScope: "system",
|
|
@@ -58365,12 +59976,6 @@ Object.freeze({
|
|
|
58365
59976
|
addonId: null,
|
|
58366
59977
|
access: "create"
|
|
58367
59978
|
},
|
|
58368
|
-
"userManagement.validateApiKey": {
|
|
58369
|
-
capName: "user-management",
|
|
58370
|
-
capScope: "system",
|
|
58371
|
-
addonId: null,
|
|
58372
|
-
access: "view"
|
|
58373
|
-
},
|
|
58374
59979
|
"userManagement.validateCredentials": {
|
|
58375
59980
|
capName: "user-management",
|
|
58376
59981
|
capScope: "system",
|
|
@@ -60284,6 +61889,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
60284
61889
|
temperatureSensorCapability,
|
|
60285
61890
|
terminalSessionCapability,
|
|
60286
61891
|
toastCapability,
|
|
61892
|
+
trainingCapability,
|
|
61893
|
+
trainingProviderCapability,
|
|
60287
61894
|
turnProviderCapability,
|
|
60288
61895
|
updateCapability,
|
|
60289
61896
|
userManagementCapability,
|
|
@@ -62662,6 +64269,11 @@ Object.freeze({
|
|
|
62662
64269
|
form: "single",
|
|
62663
64270
|
optional: false
|
|
62664
64271
|
}],
|
|
64272
|
+
"training.canaryResult": [{
|
|
64273
|
+
name: "deviceIds",
|
|
64274
|
+
form: "array",
|
|
64275
|
+
optional: false
|
|
64276
|
+
}],
|
|
62665
64277
|
"update.getStatus": [{
|
|
62666
64278
|
name: "deviceId",
|
|
62667
64279
|
form: "single",
|