@camstack/addon-provider-petkit 0.2.123 → 0.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1771 -131
- package/dist/addon.mjs +1771 -131
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -6479,7 +6479,7 @@ var ZodIssueCode = {
|
|
|
6479
6479
|
var ZodFirstPartyTypeKind;
|
|
6480
6480
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6481
6481
|
//#endregion
|
|
6482
|
-
//#region ../types/dist/sleep-
|
|
6482
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6483
6483
|
/**
|
|
6484
6484
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6485
6485
|
* window to float samples (D455).
|
|
@@ -6596,7 +6596,7 @@ function isKeychainStoredField(field) {
|
|
|
6596
6596
|
var SECRET_CLEAR = { $secretClear: true };
|
|
6597
6597
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6598
6598
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
6599
|
-
function isRecord$
|
|
6599
|
+
function isRecord$2(value) {
|
|
6600
6600
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6601
6601
|
}
|
|
6602
6602
|
function makeSecretMarker(ref) {
|
|
@@ -6607,12 +6607,12 @@ function makeSecretMarker(ref) {
|
|
|
6607
6607
|
}
|
|
6608
6608
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6609
6609
|
function isSecretMarker(value) {
|
|
6610
|
-
if (!isRecord$
|
|
6610
|
+
if (!isRecord$2(value)) return false;
|
|
6611
6611
|
const ref = value["$secret"];
|
|
6612
6612
|
return typeof ref === "string" && ref.length > 0;
|
|
6613
6613
|
}
|
|
6614
6614
|
function isSecretClear(value) {
|
|
6615
|
-
return isRecord$
|
|
6615
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6616
6616
|
}
|
|
6617
6617
|
/**
|
|
6618
6618
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -7128,6 +7128,13 @@ function globalSecretScope() {
|
|
|
7128
7128
|
function encodeSegment(value) {
|
|
7129
7129
|
return encodeURIComponent(value);
|
|
7130
7130
|
}
|
|
7131
|
+
function decodeSegment(value) {
|
|
7132
|
+
try {
|
|
7133
|
+
return decodeURIComponent(value);
|
|
7134
|
+
} catch {
|
|
7135
|
+
return null;
|
|
7136
|
+
}
|
|
7137
|
+
}
|
|
7131
7138
|
/**
|
|
7132
7139
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
7133
7140
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -7136,6 +7143,75 @@ function encodeSegment(value) {
|
|
|
7136
7143
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
7137
7144
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
7138
7145
|
}
|
|
7146
|
+
function parseScope(segments) {
|
|
7147
|
+
switch (segments[0]) {
|
|
7148
|
+
case "global": return {
|
|
7149
|
+
scope: GLOBAL_SCOPE,
|
|
7150
|
+
used: 1
|
|
7151
|
+
};
|
|
7152
|
+
case "node": {
|
|
7153
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7154
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
7155
|
+
scope: {
|
|
7156
|
+
kind: "node",
|
|
7157
|
+
nodeId
|
|
7158
|
+
},
|
|
7159
|
+
used: 2
|
|
7160
|
+
};
|
|
7161
|
+
}
|
|
7162
|
+
case "device": {
|
|
7163
|
+
const raw = segments[1];
|
|
7164
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
7165
|
+
return {
|
|
7166
|
+
scope: {
|
|
7167
|
+
kind: "device",
|
|
7168
|
+
deviceId: Number(raw)
|
|
7169
|
+
},
|
|
7170
|
+
used: 2
|
|
7171
|
+
};
|
|
7172
|
+
}
|
|
7173
|
+
case "integration": {
|
|
7174
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7175
|
+
return id === null || id.length === 0 ? null : {
|
|
7176
|
+
scope: {
|
|
7177
|
+
kind: "integration",
|
|
7178
|
+
integrationId: id
|
|
7179
|
+
},
|
|
7180
|
+
used: 2
|
|
7181
|
+
};
|
|
7182
|
+
}
|
|
7183
|
+
case "row": {
|
|
7184
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
7185
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
7186
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
7187
|
+
return {
|
|
7188
|
+
scope: {
|
|
7189
|
+
kind: "row",
|
|
7190
|
+
collection,
|
|
7191
|
+
rowId
|
|
7192
|
+
},
|
|
7193
|
+
used: 3
|
|
7194
|
+
};
|
|
7195
|
+
}
|
|
7196
|
+
default: return null;
|
|
7197
|
+
}
|
|
7198
|
+
}
|
|
7199
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
7200
|
+
function parseSecretRef(ref) {
|
|
7201
|
+
if (!ref.startsWith("secret://")) return null;
|
|
7202
|
+
const segments = ref.slice(9).split("/");
|
|
7203
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
7204
|
+
if (owner === null || owner.length === 0) return null;
|
|
7205
|
+
const parsed = parseScope(segments.slice(1));
|
|
7206
|
+
if (parsed === null) return null;
|
|
7207
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
7208
|
+
if (fieldPath.length === 0) return null;
|
|
7209
|
+
return {
|
|
7210
|
+
owner,
|
|
7211
|
+
scope: parsed.scope,
|
|
7212
|
+
fieldPath
|
|
7213
|
+
};
|
|
7214
|
+
}
|
|
7139
7215
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7140
7216
|
var KeychainWriteRefusedError = class extends Error {
|
|
7141
7217
|
fieldPath;
|
|
@@ -7146,7 +7222,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
7146
7222
|
}
|
|
7147
7223
|
};
|
|
7148
7224
|
var KEEP = { kind: "keep" };
|
|
7149
|
-
function isRecord(value) {
|
|
7225
|
+
function isRecord$1(value) {
|
|
7150
7226
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7151
7227
|
}
|
|
7152
7228
|
function defaultMintId() {
|
|
@@ -7159,7 +7235,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
7159
7235
|
return out;
|
|
7160
7236
|
}
|
|
7161
7237
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
7162
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7238
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7163
7239
|
return out;
|
|
7164
7240
|
}
|
|
7165
7241
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -7214,7 +7290,7 @@ function rowId(row, idKey) {
|
|
|
7214
7290
|
return null;
|
|
7215
7291
|
}
|
|
7216
7292
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7217
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
7293
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
7218
7294
|
if (!Array.isArray(incoming)) {
|
|
7219
7295
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7220
7296
|
return {
|
|
@@ -7230,7 +7306,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
7230
7306
|
const kept = /* @__PURE__ */ new Set();
|
|
7231
7307
|
const rows = [];
|
|
7232
7308
|
for (const row of incoming) {
|
|
7233
|
-
if (!isRecord(row)) {
|
|
7309
|
+
if (!isRecord$1(row)) {
|
|
7234
7310
|
rows.push(row);
|
|
7235
7311
|
continue;
|
|
7236
7312
|
}
|
|
@@ -7255,7 +7331,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7255
7331
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7256
7332
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7257
7333
|
case "object": {
|
|
7258
|
-
if (!isRecord(incoming)) {
|
|
7334
|
+
if (!isRecord$1(incoming)) {
|
|
7259
7335
|
if (incoming === void 0) return KEEP;
|
|
7260
7336
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7261
7337
|
return {
|
|
@@ -7263,7 +7339,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7263
7339
|
value: incoming
|
|
7264
7340
|
};
|
|
7265
7341
|
}
|
|
7266
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
7342
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
7267
7343
|
return {
|
|
7268
7344
|
kind: "value",
|
|
7269
7345
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7322,12 +7398,19 @@ async function transformSecretWrite(input) {
|
|
|
7322
7398
|
}
|
|
7323
7399
|
};
|
|
7324
7400
|
}
|
|
7401
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7402
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7403
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7404
|
+
}
|
|
7325
7405
|
/**
|
|
7326
7406
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7327
7407
|
* reference when there is no marker (no allocation, no keychain call).
|
|
7328
7408
|
*/
|
|
7329
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
7330
|
-
const
|
|
7409
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7410
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7411
|
+
const owner = options.ownedBy;
|
|
7412
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7413
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7331
7414
|
if (refs.length === 0) return {
|
|
7332
7415
|
value,
|
|
7333
7416
|
unresolved: []
|
|
@@ -7351,10 +7434,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7351
7434
|
}
|
|
7352
7435
|
const substitute = (v) => {
|
|
7353
7436
|
if (isSecretMarker(v)) {
|
|
7437
|
+
if (!inScope(v.$secret)) return {
|
|
7438
|
+
keep: true,
|
|
7439
|
+
value: v
|
|
7440
|
+
};
|
|
7354
7441
|
const answer = answers[v.$secret];
|
|
7355
|
-
|
|
7442
|
+
if (answer?.kind === "value") return {
|
|
7356
7443
|
keep: true,
|
|
7357
7444
|
value: answer.value
|
|
7445
|
+
};
|
|
7446
|
+
return keepMarker ? {
|
|
7447
|
+
keep: true,
|
|
7448
|
+
value: v
|
|
7358
7449
|
} : {
|
|
7359
7450
|
keep: false,
|
|
7360
7451
|
value: void 0
|
|
@@ -7371,7 +7462,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7371
7462
|
value: items
|
|
7372
7463
|
};
|
|
7373
7464
|
}
|
|
7374
|
-
if (isRecord(v)) {
|
|
7465
|
+
if (isRecord$1(v)) {
|
|
7375
7466
|
const out = {};
|
|
7376
7467
|
for (const [k, child] of Object.entries(v)) {
|
|
7377
7468
|
const s = substitute(child);
|
|
@@ -7392,14 +7483,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7392
7483
|
unresolved
|
|
7393
7484
|
};
|
|
7394
7485
|
}
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7486
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7487
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7488
|
+
ref;
|
|
7489
|
+
reason;
|
|
7490
|
+
constructor(ref, reason) {
|
|
7491
|
+
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.`);
|
|
7492
|
+
this.ref = ref;
|
|
7493
|
+
this.reason = reason;
|
|
7494
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7495
|
+
}
|
|
7496
|
+
};
|
|
7497
|
+
function isRecord(value) {
|
|
7498
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7499
|
+
}
|
|
7500
|
+
function resolvedValue(pass, marker) {
|
|
7501
|
+
const answer = pass.answers[marker.$secret];
|
|
7502
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7503
|
+
}
|
|
7504
|
+
async function atMarker(pass, incoming, stored) {
|
|
7505
|
+
if (incoming === null) return stored;
|
|
7506
|
+
if (typeof incoming !== "string") return incoming;
|
|
7507
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7508
|
+
const intent = classifySecretWrite(incoming);
|
|
7509
|
+
if (intent.kind !== "set") return stored;
|
|
7510
|
+
const ref = stored.$secret;
|
|
7511
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7512
|
+
const answer = pass.answers[ref];
|
|
7513
|
+
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);
|
|
7514
|
+
try {
|
|
7515
|
+
await pass.secrets.put(ref, intent.value);
|
|
7516
|
+
} catch (err) {
|
|
7517
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7518
|
+
}
|
|
7519
|
+
pass.changedRefs.push(ref);
|
|
7520
|
+
return stored;
|
|
7521
|
+
}
|
|
7522
|
+
function inArray(pass, incoming, stored) {
|
|
7523
|
+
return incoming.map((item, index) => {
|
|
7524
|
+
const twin = stored[index];
|
|
7525
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7526
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7527
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7528
|
+
return item;
|
|
7529
|
+
});
|
|
7530
|
+
}
|
|
7531
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7532
|
+
const out = { ...incoming };
|
|
7533
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7534
|
+
const twin = stored[key];
|
|
7535
|
+
if (isSecretMarker(twin)) {
|
|
7536
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7537
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7538
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7539
|
+
}
|
|
7540
|
+
return out;
|
|
7541
|
+
}
|
|
7542
|
+
async function walk(pass, incoming, stored) {
|
|
7543
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7544
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7545
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7546
|
+
const out = { ...incoming };
|
|
7547
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7548
|
+
return out;
|
|
7549
|
+
}
|
|
7550
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7551
|
+
async function restoreUnchangedSecrets(input) {
|
|
7552
|
+
const refs = [];
|
|
7553
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7554
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7555
|
+
if (owned.length === 0) return {
|
|
7556
|
+
patch: input.patch,
|
|
7557
|
+
changedRefs: []
|
|
7558
|
+
};
|
|
7559
|
+
const pass = {
|
|
7560
|
+
secrets: input.secrets,
|
|
7561
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7562
|
+
operatorWrite: input.operatorWrite,
|
|
7563
|
+
changedRefs: []
|
|
7564
|
+
};
|
|
7565
|
+
const out = {};
|
|
7566
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7567
|
+
return {
|
|
7568
|
+
patch: out,
|
|
7569
|
+
changedRefs: pass.changedRefs
|
|
7570
|
+
};
|
|
7571
|
+
}
|
|
7572
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7573
|
+
function isJsonEqual(a, b) {
|
|
7574
|
+
if (Object.is(a, b)) return true;
|
|
7575
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7576
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7577
|
+
const keys = Object.keys(a);
|
|
7578
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7579
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7400
7580
|
}
|
|
7401
7581
|
return false;
|
|
7402
7582
|
}
|
|
7583
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7584
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7585
|
+
const out = {};
|
|
7586
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7587
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7588
|
+
out[key] = value;
|
|
7589
|
+
}
|
|
7590
|
+
return out;
|
|
7591
|
+
}
|
|
7592
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7593
|
+
function markerKeysOf(blob, owner) {
|
|
7594
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7595
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7596
|
+
return keys;
|
|
7597
|
+
}
|
|
7598
|
+
function nodeFromStored(value, owner) {
|
|
7599
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7600
|
+
if (!isRecord(value)) return null;
|
|
7601
|
+
const children = /* @__PURE__ */ new Map();
|
|
7602
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7603
|
+
const node = nodeFromStored(child, owner);
|
|
7604
|
+
if (node !== null) children.set(key, node);
|
|
7605
|
+
}
|
|
7606
|
+
return children.size > 0 ? {
|
|
7607
|
+
kind: "object",
|
|
7608
|
+
children
|
|
7609
|
+
} : null;
|
|
7610
|
+
}
|
|
7611
|
+
/**
|
|
7612
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7613
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7614
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7615
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7616
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7617
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7618
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7619
|
+
* over.
|
|
7620
|
+
*/
|
|
7621
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7622
|
+
const added = /* @__PURE__ */ new Map();
|
|
7623
|
+
for (const key of keys) {
|
|
7624
|
+
const at = key.indexOf("@");
|
|
7625
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7626
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7627
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7628
|
+
if (node !== null) added.set(base, node);
|
|
7629
|
+
}
|
|
7630
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7631
|
+
}
|
|
7403
7632
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7404
7633
|
async function readStoredAddonBlob(raw) {
|
|
7405
7634
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -7408,7 +7637,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
7408
7637
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7409
7638
|
return result.kind === "missing" ? {} : result.value;
|
|
7410
7639
|
}
|
|
7411
|
-
function
|
|
7640
|
+
function touchesTree(tree, patch) {
|
|
7641
|
+
if (tree.size === 0) return false;
|
|
7642
|
+
for (const key of Object.keys(patch)) {
|
|
7643
|
+
const at = key.indexOf("@");
|
|
7644
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7645
|
+
}
|
|
7646
|
+
return false;
|
|
7647
|
+
}
|
|
7648
|
+
/**
|
|
7649
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7650
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7651
|
+
*/
|
|
7652
|
+
var MarkerKeyIndex = class {
|
|
7653
|
+
owner;
|
|
7654
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7655
|
+
constructor(owner) {
|
|
7656
|
+
this.owner = owner;
|
|
7657
|
+
}
|
|
7658
|
+
seen(store, blob) {
|
|
7659
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7660
|
+
}
|
|
7661
|
+
wrote(store, patch) {
|
|
7662
|
+
const keys = this.byStore.get(store);
|
|
7663
|
+
if (keys === void 0) return;
|
|
7664
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7665
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7666
|
+
else keys.delete(key);
|
|
7667
|
+
}
|
|
7668
|
+
mayHoldMarkers(store, patch) {
|
|
7669
|
+
const keys = this.byStore.get(store);
|
|
7670
|
+
if (keys === void 0) return true;
|
|
7671
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7672
|
+
}
|
|
7673
|
+
};
|
|
7674
|
+
function createHandle(raw, opts) {
|
|
7412
7675
|
const chains = /* @__PURE__ */ new Map();
|
|
7413
7676
|
const serialize = (key, fn) => {
|
|
7414
7677
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -7419,46 +7682,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
7419
7682
|
});
|
|
7420
7683
|
return next;
|
|
7421
7684
|
};
|
|
7422
|
-
const
|
|
7423
|
-
|
|
7424
|
-
|
|
7685
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7686
|
+
const resolveRead = async (store, blob) => {
|
|
7687
|
+
index.seen(store, blob);
|
|
7688
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7689
|
+
unresolved: "keep-marker",
|
|
7690
|
+
ownedBy: opts.secrets.owner
|
|
7691
|
+
});
|
|
7692
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7693
|
+
return value;
|
|
7694
|
+
};
|
|
7695
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7696
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7697
|
+
await rawWrite(patch);
|
|
7698
|
+
index.wrote(store, patch);
|
|
7699
|
+
return { changed: true };
|
|
7700
|
+
}
|
|
7701
|
+
return serialize(store, async () => {
|
|
7425
7702
|
const stored = await readStored();
|
|
7703
|
+
index.seen(store, stored);
|
|
7704
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7705
|
+
const restored = await restoreUnchangedSecrets({
|
|
7706
|
+
patch,
|
|
7707
|
+
stored,
|
|
7708
|
+
secrets: opts.secrets,
|
|
7709
|
+
operatorWrite
|
|
7710
|
+
});
|
|
7426
7711
|
const result = await transformSecretWrite({
|
|
7427
|
-
tree,
|
|
7712
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7428
7713
|
secrets: opts.secrets,
|
|
7429
|
-
patch,
|
|
7714
|
+
patch: restored.patch,
|
|
7430
7715
|
stored,
|
|
7431
7716
|
...scope !== void 0 ? { scope } : {},
|
|
7432
|
-
operatorWrite
|
|
7717
|
+
operatorWrite
|
|
7433
7718
|
});
|
|
7434
|
-
|
|
7719
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7720
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7721
|
+
if (wroteBlob) {
|
|
7722
|
+
await rawWrite(effective);
|
|
7723
|
+
index.wrote(store, effective);
|
|
7724
|
+
}
|
|
7435
7725
|
const { orphaned } = await result.afterWrite();
|
|
7436
7726
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7727
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7437
7728
|
});
|
|
7438
7729
|
};
|
|
7439
|
-
const
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7730
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7731
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7732
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7733
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7734
|
+
const overrides = {
|
|
7735
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7736
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7737
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7738
|
+
return result.kind === "value" ? {
|
|
7739
|
+
kind: "value",
|
|
7740
|
+
value: await resolveRead("addon", result.value)
|
|
7741
|
+
} : result;
|
|
7742
|
+
} } : {},
|
|
7743
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7744
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7745
|
+
if (result.kind !== "present") return result;
|
|
7746
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7747
|
+
unresolved: "keep-marker",
|
|
7748
|
+
ownedBy: opts.secrets.owner
|
|
7749
|
+
});
|
|
7750
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7751
|
+
return {
|
|
7752
|
+
kind: "present",
|
|
7753
|
+
value: value[key]
|
|
7754
|
+
};
|
|
7755
|
+
} } : {},
|
|
7756
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7757
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7758
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7759
|
+
const out = /* @__PURE__ */ new Map();
|
|
7760
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7761
|
+
return out;
|
|
7762
|
+
} } : {},
|
|
7763
|
+
writeAddonStore: async (patch) => {
|
|
7764
|
+
await writeAddon(patch);
|
|
7765
|
+
},
|
|
7766
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7767
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7768
|
+
kind: "device",
|
|
7769
|
+
deviceId
|
|
7770
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7771
|
+
}
|
|
7772
|
+
};
|
|
7773
|
+
return {
|
|
7774
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7775
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7776
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7777
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7778
|
+
} }),
|
|
7779
|
+
raw: {
|
|
7780
|
+
readAddonStore: async () => {
|
|
7781
|
+
const blob = await raw.readAddonStore();
|
|
7782
|
+
index.seen("addon", blob);
|
|
7783
|
+
return blob;
|
|
7784
|
+
},
|
|
7785
|
+
readDeviceStore: async (deviceId) => {
|
|
7786
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7787
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7788
|
+
return blob;
|
|
7789
|
+
}
|
|
7790
|
+
},
|
|
7791
|
+
writeAddonStore: writeAddon
|
|
7445
7792
|
};
|
|
7446
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
7447
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
7448
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
7449
|
-
const value = Reflect.get(target, prop, receiver);
|
|
7450
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
7451
|
-
} });
|
|
7452
7793
|
}
|
|
7453
|
-
/** The context the addon sees
|
|
7454
|
-
function
|
|
7794
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7795
|
+
function createSecretAwareContext(context, opts) {
|
|
7455
7796
|
const raw = context.settings;
|
|
7456
|
-
if (raw === void 0) return
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7797
|
+
if (raw === void 0) return {
|
|
7798
|
+
context,
|
|
7799
|
+
handle: null
|
|
7800
|
+
};
|
|
7801
|
+
const handle = createHandle(raw, opts);
|
|
7802
|
+
return {
|
|
7803
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7804
|
+
if (prop === "settings") return handle.settings;
|
|
7805
|
+
return Reflect.get(target, prop, receiver);
|
|
7806
|
+
} }),
|
|
7807
|
+
handle
|
|
7808
|
+
};
|
|
7462
7809
|
}
|
|
7463
7810
|
var LEAF = { kind: "leaf" };
|
|
7464
7811
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -7633,6 +7980,14 @@ var BaseAddon = class {
|
|
|
7633
7980
|
_secretChangeUnsub = null;
|
|
7634
7981
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7635
7982
|
_operatorWriteDepth = 0;
|
|
7983
|
+
/**
|
|
7984
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7985
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7986
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7987
|
+
*/
|
|
7988
|
+
_secretSettings = null;
|
|
7989
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7990
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
7636
7991
|
constructor(defaults) {
|
|
7637
7992
|
this.defaults = defaults;
|
|
7638
7993
|
this._config = { ...defaults };
|
|
@@ -7669,13 +8024,21 @@ var BaseAddon = class {
|
|
|
7669
8024
|
}
|
|
7670
8025
|
async initialize(context) {
|
|
7671
8026
|
const secrets = context.secrets;
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
8027
|
+
if (secrets !== void 0) {
|
|
8028
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
8029
|
+
secrets,
|
|
8030
|
+
addonTree: () => this.addonSecretTree(),
|
|
8031
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
8032
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
8033
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
8034
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
8035
|
+
});
|
|
8036
|
+
this._ctx = wrapped;
|
|
8037
|
+
this._secretSettings = handle;
|
|
8038
|
+
} else {
|
|
8039
|
+
this._ctx = context;
|
|
8040
|
+
this._secretSettings = null;
|
|
8041
|
+
}
|
|
7679
8042
|
await this.resolveConfig();
|
|
7680
8043
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7681
8044
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7792,11 +8155,8 @@ var BaseAddon = class {
|
|
|
7792
8155
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7793
8156
|
const schema = this.globalSettingsSchema(cap);
|
|
7794
8157
|
if (!schema) return { sections: [] };
|
|
7795
|
-
const projected = await this.
|
|
7796
|
-
return hydrateSchema(schema, overlay ? {
|
|
7797
|
-
...projected,
|
|
7798
|
-
...overlay
|
|
7799
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
8158
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
8159
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7800
8160
|
}
|
|
7801
8161
|
/**
|
|
7802
8162
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7841,7 +8201,7 @@ var BaseAddon = class {
|
|
|
7841
8201
|
});
|
|
7842
8202
|
}
|
|
7843
8203
|
if (sections.length === 0) return null;
|
|
7844
|
-
const projected = await this.
|
|
8204
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7845
8205
|
return hydrateSchema({
|
|
7846
8206
|
...schema,
|
|
7847
8207
|
sections
|
|
@@ -7858,12 +8218,50 @@ var BaseAddon = class {
|
|
|
7858
8218
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7859
8219
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7860
8220
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
8221
|
+
*
|
|
8222
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
8223
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
8224
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
8225
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
8226
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
8227
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7861
8228
|
*/
|
|
7862
8229
|
async resolveGlobalStore(nodeId, cap) {
|
|
7863
8230
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
8231
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8232
|
+
}
|
|
8233
|
+
projectForNode(store, nodeId, cap) {
|
|
7864
8234
|
const keys = this.perNodeKeys(cap);
|
|
7865
8235
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7866
|
-
return keys.size > 0 ? projectStore(
|
|
8236
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
8237
|
+
}
|
|
8238
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
8239
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
8240
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
8241
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
8242
|
+
}
|
|
8243
|
+
/**
|
|
8244
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
8245
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
8246
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
8247
|
+
* its value.
|
|
8248
|
+
*/
|
|
8249
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
8250
|
+
const secrets = this._ctx?.secrets;
|
|
8251
|
+
const merged = {
|
|
8252
|
+
...stored,
|
|
8253
|
+
...overlay
|
|
8254
|
+
};
|
|
8255
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
8256
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
8257
|
+
unresolved: "keep-marker",
|
|
8258
|
+
ownedBy: secrets.owner
|
|
8259
|
+
});
|
|
8260
|
+
for (const key of Object.keys(overlay)) {
|
|
8261
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
8262
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
8263
|
+
}
|
|
8264
|
+
return merged;
|
|
7867
8265
|
}
|
|
7868
8266
|
/**
|
|
7869
8267
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7928,8 +8326,12 @@ var BaseAddon = class {
|
|
|
7928
8326
|
async clearSecrets(keys, nodeId) {
|
|
7929
8327
|
const tree = this.addonSecretTree();
|
|
7930
8328
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8329
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7931
8330
|
const patch = {};
|
|
7932
|
-
for (const key of keys)
|
|
8331
|
+
for (const key of keys) {
|
|
8332
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8333
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8334
|
+
}
|
|
7933
8335
|
await this.applyGlobalPatch(patch, nodeId);
|
|
7934
8336
|
}
|
|
7935
8337
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -7937,7 +8339,11 @@ var BaseAddon = class {
|
|
|
7937
8339
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7938
8340
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7939
8341
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7940
|
-
|
|
8342
|
+
const handle = this._secretSettings;
|
|
8343
|
+
if (handle !== null) {
|
|
8344
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8345
|
+
if (!changed) return;
|
|
8346
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7941
8347
|
if (target !== localNode) return;
|
|
7942
8348
|
await this.resolveConfig();
|
|
7943
8349
|
await this.onConfigChanged();
|
|
@@ -7990,7 +8396,7 @@ var BaseAddon = class {
|
|
|
7990
8396
|
async getDeviceSettings(deviceId) {
|
|
7991
8397
|
const schema = this.deviceSettingsSchema();
|
|
7992
8398
|
if (!schema) return { sections: [] };
|
|
7993
|
-
return hydrateSchema(schema, await this.
|
|
8399
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7994
8400
|
}
|
|
7995
8401
|
async updateDeviceSettings(deviceId, patch) {
|
|
7996
8402
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -8162,7 +8568,7 @@ var BaseAddon = class {
|
|
|
8162
8568
|
key,
|
|
8163
8569
|
schema,
|
|
8164
8570
|
fallback,
|
|
8165
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
8571
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
8166
8572
|
write: async (patch) => {
|
|
8167
8573
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
8168
8574
|
},
|
|
@@ -8224,6 +8630,23 @@ var BaseAddon = class {
|
|
|
8224
8630
|
}
|
|
8225
8631
|
return value;
|
|
8226
8632
|
}
|
|
8633
|
+
/**
|
|
8634
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8635
|
+
* keychain the context's own view is already raw.
|
|
8636
|
+
*/
|
|
8637
|
+
rawSettings() {
|
|
8638
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8639
|
+
}
|
|
8640
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8641
|
+
logUnresolvedRead(unresolved) {
|
|
8642
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8643
|
+
if (fresh.length === 0) return;
|
|
8644
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8645
|
+
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) => ({
|
|
8646
|
+
ref: u.ref,
|
|
8647
|
+
reason: u.reason
|
|
8648
|
+
})) } });
|
|
8649
|
+
}
|
|
8227
8650
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8228
8651
|
scheduleSecretReresolve(delayMs) {
|
|
8229
8652
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -8250,7 +8673,7 @@ var BaseAddon = class {
|
|
|
8250
8673
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
8251
8674
|
*/
|
|
8252
8675
|
async readAddonStoreWithRetry() {
|
|
8253
|
-
const settings = this.
|
|
8676
|
+
const settings = this.rawSettings();
|
|
8254
8677
|
if (!settings) return {};
|
|
8255
8678
|
const delaysMs = [
|
|
8256
8679
|
150,
|
|
@@ -10553,6 +10976,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10553
10976
|
fetchedAt: number()
|
|
10554
10977
|
});
|
|
10555
10978
|
/**
|
|
10979
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10980
|
+
* gets back (cloud training, D805+).
|
|
10981
|
+
*
|
|
10982
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10983
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10984
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10985
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10986
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10987
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10988
|
+
* change there, in the same piece of work.
|
|
10989
|
+
*
|
|
10990
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10991
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10992
|
+
*/
|
|
10993
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10994
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10995
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10996
|
+
var TrainingExportSchema = _enum([
|
|
10997
|
+
"onnx",
|
|
10998
|
+
"openvino-fp16",
|
|
10999
|
+
"openvino-int8",
|
|
11000
|
+
"coreml-fp16"
|
|
11001
|
+
]);
|
|
11002
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
11003
|
+
object({
|
|
11004
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
11005
|
+
jobKey: string().uuid(),
|
|
11006
|
+
target: object({
|
|
11007
|
+
kind: literal("detector"),
|
|
11008
|
+
step: literal("object-detection")
|
|
11009
|
+
}),
|
|
11010
|
+
base: object({
|
|
11011
|
+
modelId: string().min(1),
|
|
11012
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
11013
|
+
weights: string().min(1),
|
|
11014
|
+
imgsz: number().int().positive()
|
|
11015
|
+
}),
|
|
11016
|
+
baseline: object({
|
|
11017
|
+
modelId: string().min(1),
|
|
11018
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
11019
|
+
onnxUrl: string().url(),
|
|
11020
|
+
imgsz: number().int().positive(),
|
|
11021
|
+
floors: FloorsSchema
|
|
11022
|
+
}),
|
|
11023
|
+
dataset: object({
|
|
11024
|
+
versionId: string().min(1),
|
|
11025
|
+
annotationHash: string(),
|
|
11026
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
11027
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11028
|
+
}),
|
|
11029
|
+
split: object({
|
|
11030
|
+
holdoutCameras: array(number().int()),
|
|
11031
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
11032
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
11033
|
+
valFraction: number().min(0).max(.5),
|
|
11034
|
+
seed: number().int()
|
|
11035
|
+
}),
|
|
11036
|
+
hyper: object({
|
|
11037
|
+
epochs: number().int().positive(),
|
|
11038
|
+
batch: number().int().positive(),
|
|
11039
|
+
lr0: number().positive(),
|
|
11040
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
11041
|
+
freeze: number().int().nonnegative(),
|
|
11042
|
+
patience: number().int().nonnegative(),
|
|
11043
|
+
seed: number().int()
|
|
11044
|
+
}),
|
|
11045
|
+
replay: object({
|
|
11046
|
+
source: literal("coco2017"),
|
|
11047
|
+
count: number().int().nonnegative()
|
|
11048
|
+
}),
|
|
11049
|
+
exports: array(TrainingExportSchema).min(1),
|
|
11050
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
11051
|
+
floors: object({
|
|
11052
|
+
minSupport: number().int().positive(),
|
|
11053
|
+
clamp: number().min(0).max(1)
|
|
11054
|
+
}),
|
|
11055
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
11056
|
+
catalog: object({
|
|
11057
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
11058
|
+
name: string().min(1).max(160)
|
|
11059
|
+
})
|
|
11060
|
+
});
|
|
11061
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
11062
|
+
var TrainingResultFileSchema = object({
|
|
11063
|
+
path: string().min(1),
|
|
11064
|
+
bytes: number().int().nonnegative(),
|
|
11065
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
11066
|
+
format: _enum([
|
|
11067
|
+
"onnx",
|
|
11068
|
+
"openvino",
|
|
11069
|
+
"coreml",
|
|
11070
|
+
"pt"
|
|
11071
|
+
]),
|
|
11072
|
+
variant: _enum(["base", "int8"])
|
|
11073
|
+
});
|
|
11074
|
+
var DraftFormatSchema = object({
|
|
11075
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
11076
|
+
url: string().min(1),
|
|
11077
|
+
sizeMB: number().nonnegative(),
|
|
11078
|
+
isDirectory: boolean().optional(),
|
|
11079
|
+
files: array(string()).optional(),
|
|
11080
|
+
runtimes: array(literal("python")).optional(),
|
|
11081
|
+
revision: string().min(1)
|
|
11082
|
+
});
|
|
11083
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
11084
|
+
var TrainingCatalogDraftSchema = object({
|
|
11085
|
+
id: string().min(1),
|
|
11086
|
+
name: string().min(1),
|
|
11087
|
+
description: string(),
|
|
11088
|
+
labels: array(unknown()),
|
|
11089
|
+
inputSize: object({
|
|
11090
|
+
width: number().int().positive(),
|
|
11091
|
+
height: number().int().positive()
|
|
11092
|
+
}),
|
|
11093
|
+
preprocessMode: literal("letterbox"),
|
|
11094
|
+
defaultClassFloors: FloorsSchema,
|
|
11095
|
+
formats: object({
|
|
11096
|
+
onnx: DraftFormatSchema.optional(),
|
|
11097
|
+
openvino: DraftFormatSchema.optional(),
|
|
11098
|
+
coreml: DraftFormatSchema.optional()
|
|
11099
|
+
})
|
|
11100
|
+
});
|
|
11101
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
11102
|
+
var TrainingEvalClassSchema = object({
|
|
11103
|
+
positives: number().int(),
|
|
11104
|
+
floor: number().nullable(),
|
|
11105
|
+
tp: number().int(),
|
|
11106
|
+
fp: number().int(),
|
|
11107
|
+
fn: number().int(),
|
|
11108
|
+
precision: number().nullable(),
|
|
11109
|
+
recall: number().nullable(),
|
|
11110
|
+
ap50: number().nullable(),
|
|
11111
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
11112
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
11113
|
+
fpByCamera: record(string(), number()).optional(),
|
|
11114
|
+
smallFound: number().int().optional(),
|
|
11115
|
+
smallTotal: number().int().optional()
|
|
11116
|
+
}).passthrough();
|
|
11117
|
+
var TrainingEvalReportSchema = object({
|
|
11118
|
+
frames: number().int(),
|
|
11119
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
11120
|
+
}).passthrough();
|
|
11121
|
+
/**
|
|
11122
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
11123
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
11124
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
11125
|
+
*/
|
|
11126
|
+
var TrainingResultSchema = object({
|
|
11127
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
11128
|
+
jobKey: string(),
|
|
11129
|
+
status: _enum(["succeeded", "failed"]),
|
|
11130
|
+
error: object({
|
|
11131
|
+
stage: string(),
|
|
11132
|
+
code: string(),
|
|
11133
|
+
message: string()
|
|
11134
|
+
}).nullable(),
|
|
11135
|
+
trainer: object({
|
|
11136
|
+
version: string(),
|
|
11137
|
+
revision: string()
|
|
11138
|
+
}),
|
|
11139
|
+
toolchain: record(string(), string().nullable()),
|
|
11140
|
+
dataset: object({
|
|
11141
|
+
versionId: string(),
|
|
11142
|
+
annotationHash: string(),
|
|
11143
|
+
sha256: string(),
|
|
11144
|
+
frames: object({
|
|
11145
|
+
train: number().int(),
|
|
11146
|
+
val: number().int(),
|
|
11147
|
+
holdout: number().int()
|
|
11148
|
+
}),
|
|
11149
|
+
holdoutCameras: array(number().int()),
|
|
11150
|
+
replayImages: number().int()
|
|
11151
|
+
}).optional(),
|
|
11152
|
+
training: object({
|
|
11153
|
+
epochsRun: number().int(),
|
|
11154
|
+
bestEpoch: number().int(),
|
|
11155
|
+
bestMap50: number(),
|
|
11156
|
+
bestMap50_95: number(),
|
|
11157
|
+
seconds: number()
|
|
11158
|
+
}).optional(),
|
|
11159
|
+
evaluation: object({
|
|
11160
|
+
holdoutFrames: number().int(),
|
|
11161
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
11162
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
11163
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
11164
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
11165
|
+
map50: record(string(), number().nullable())
|
|
11166
|
+
}).optional(),
|
|
11167
|
+
floors: object({
|
|
11168
|
+
baseline: FloorsSchema,
|
|
11169
|
+
candidate: FloorsSchema,
|
|
11170
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
11171
|
+
notes: array(string())
|
|
11172
|
+
}).optional(),
|
|
11173
|
+
int8: object({
|
|
11174
|
+
kept: boolean(),
|
|
11175
|
+
map50Fp16: number().nullable(),
|
|
11176
|
+
map50Int8: number().nullable(),
|
|
11177
|
+
reason: string().nullable()
|
|
11178
|
+
}).optional(),
|
|
11179
|
+
exportsDropped: array(object({
|
|
11180
|
+
export: string(),
|
|
11181
|
+
reason: string()
|
|
11182
|
+
})).optional(),
|
|
11183
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
11184
|
+
bundle: object({
|
|
11185
|
+
path: literal("bundle.tar"),
|
|
11186
|
+
bytes: number().int().nonnegative(),
|
|
11187
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
11188
|
+
}).nullable().optional(),
|
|
11189
|
+
catalogDraft: object({
|
|
11190
|
+
base: TrainingCatalogDraftSchema,
|
|
11191
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
11192
|
+
}).nullable().optional(),
|
|
11193
|
+
licence: string()
|
|
11194
|
+
});
|
|
11195
|
+
var TrainingStageSchema = _enum([
|
|
11196
|
+
"prepare",
|
|
11197
|
+
"replay",
|
|
11198
|
+
"train",
|
|
11199
|
+
"eval",
|
|
11200
|
+
"export",
|
|
11201
|
+
"package"
|
|
11202
|
+
]);
|
|
11203
|
+
var EventBase = {
|
|
11204
|
+
v: literal(1),
|
|
11205
|
+
ts: number()
|
|
11206
|
+
};
|
|
11207
|
+
discriminatedUnion("type", [
|
|
11208
|
+
object({
|
|
11209
|
+
...EventBase,
|
|
11210
|
+
type: literal("stage"),
|
|
11211
|
+
stage: TrainingStageSchema
|
|
11212
|
+
}),
|
|
11213
|
+
object({
|
|
11214
|
+
...EventBase,
|
|
11215
|
+
type: literal("epoch"),
|
|
11216
|
+
epoch: number().int(),
|
|
11217
|
+
epochs: number().int(),
|
|
11218
|
+
boxLoss: number().nullable().optional(),
|
|
11219
|
+
map50: number().nullable().optional(),
|
|
11220
|
+
map50_95: number().nullable().optional(),
|
|
11221
|
+
etaSec: number().nullable().optional()
|
|
11222
|
+
}),
|
|
11223
|
+
object({
|
|
11224
|
+
...EventBase,
|
|
11225
|
+
type: literal("metric"),
|
|
11226
|
+
name: string(),
|
|
11227
|
+
value: number()
|
|
11228
|
+
}),
|
|
11229
|
+
object({
|
|
11230
|
+
...EventBase,
|
|
11231
|
+
type: literal("artifact"),
|
|
11232
|
+
path: string(),
|
|
11233
|
+
bytes: number(),
|
|
11234
|
+
sha256: string()
|
|
11235
|
+
}),
|
|
11236
|
+
object({
|
|
11237
|
+
...EventBase,
|
|
11238
|
+
type: literal("done"),
|
|
11239
|
+
status: _enum(["succeeded", "failed"]),
|
|
11240
|
+
resultSha256: string().nullable().optional()
|
|
11241
|
+
}),
|
|
11242
|
+
object({
|
|
11243
|
+
...EventBase,
|
|
11244
|
+
type: literal("error"),
|
|
11245
|
+
stage: string(),
|
|
11246
|
+
code: string(),
|
|
11247
|
+
message: string()
|
|
11248
|
+
})
|
|
11249
|
+
]);
|
|
11250
|
+
/**
|
|
10556
11251
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
10557
11252
|
*
|
|
10558
11253
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12880,7 +13575,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12880
13575
|
"authenticated",
|
|
12881
13576
|
"admin"
|
|
12882
13577
|
]).optional(),
|
|
12883
|
-
description: string().optional()
|
|
13578
|
+
description: string().optional(),
|
|
13579
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13580
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12884
13581
|
});
|
|
12885
13582
|
/**
|
|
12886
13583
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13585,6 +14282,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13585
14282
|
lastError: string().optional()
|
|
13586
14283
|
});
|
|
13587
14284
|
/**
|
|
14285
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14286
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14287
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14288
|
+
* with it off — which restores without a key.
|
|
14289
|
+
*/
|
|
14290
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14291
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14292
|
+
scheme: string(),
|
|
14293
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14294
|
+
keyId: string()
|
|
14295
|
+
});
|
|
14296
|
+
/**
|
|
14297
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14298
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14299
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14300
|
+
*/
|
|
14301
|
+
var BackupEncryptionStatusSchema = object({
|
|
14302
|
+
enabled: boolean(),
|
|
14303
|
+
active: object({
|
|
14304
|
+
keyId: string(),
|
|
14305
|
+
publicKey: string(),
|
|
14306
|
+
createdAt: number()
|
|
14307
|
+
}).nullable(),
|
|
14308
|
+
/** Every key ever set up, newest first. */
|
|
14309
|
+
keys: array(object({
|
|
14310
|
+
keyId: string(),
|
|
14311
|
+
createdAt: number(),
|
|
14312
|
+
retiredAt: number().nullable()
|
|
14313
|
+
})).readonly()
|
|
14314
|
+
});
|
|
14315
|
+
/**
|
|
13588
14316
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13589
14317
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13590
14318
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13596,7 +14324,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13596
14324
|
sizeBytes: number(),
|
|
13597
14325
|
label: string().optional(),
|
|
13598
14326
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13599
|
-
locations: array(string()).readonly()
|
|
14327
|
+
locations: array(string()).readonly(),
|
|
14328
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14329
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13600
14330
|
});
|
|
13601
14331
|
var BackupEntrySchema = object({
|
|
13602
14332
|
id: string(),
|
|
@@ -13605,7 +14335,8 @@ var BackupEntrySchema = object({
|
|
|
13605
14335
|
label: string().optional(),
|
|
13606
14336
|
createdAt: number(),
|
|
13607
14337
|
sizeBytes: number(),
|
|
13608
|
-
locations: array(string()).optional()
|
|
14338
|
+
locations: array(string()).optional(),
|
|
14339
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13609
14340
|
});
|
|
13610
14341
|
var ArchiveEntrySchema = object({
|
|
13611
14342
|
path: string(),
|
|
@@ -13794,10 +14525,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13794
14525
|
* this list and skips entries whose path doesn't start with
|
|
13795
14526
|
* any of them.
|
|
13796
14527
|
*/
|
|
13797
|
-
locations: array(string()).optional()
|
|
14528
|
+
locations: array(string()).optional(),
|
|
14529
|
+
/**
|
|
14530
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14531
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14532
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14533
|
+
* is refused before the archive is downloaded.
|
|
14534
|
+
*/
|
|
14535
|
+
backupSecretKey: string().optional()
|
|
13798
14536
|
}), _void(), {
|
|
13799
14537
|
kind: "mutation",
|
|
13800
14538
|
auth: "admin"
|
|
14539
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14540
|
+
keyId: string(),
|
|
14541
|
+
secretKey: string(),
|
|
14542
|
+
publicKey: string(),
|
|
14543
|
+
createdAt: number(),
|
|
14544
|
+
replacedKeyId: string().nullable()
|
|
14545
|
+
}), {
|
|
14546
|
+
kind: "mutation",
|
|
14547
|
+
auth: "admin"
|
|
14548
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14549
|
+
kind: "mutation",
|
|
14550
|
+
auth: "admin"
|
|
14551
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14552
|
+
valid: boolean(),
|
|
14553
|
+
keyId: string().nullable(),
|
|
14554
|
+
/** The hub knows this key (active or retired). */
|
|
14555
|
+
known: boolean(),
|
|
14556
|
+
/** It is the key new archives are encrypted to. */
|
|
14557
|
+
active: boolean(),
|
|
14558
|
+
error: string().optional()
|
|
14559
|
+
}), {
|
|
14560
|
+
kind: "mutation",
|
|
14561
|
+
auth: "admin"
|
|
13801
14562
|
}), method(object({
|
|
13802
14563
|
destinationId: string(),
|
|
13803
14564
|
backupId: string()
|
|
@@ -15523,7 +16284,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
15523
16284
|
stepId: string(),
|
|
15524
16285
|
entry: ModelCatalogEntrySchema
|
|
15525
16286
|
});
|
|
15526
|
-
|
|
16287
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16288
|
+
var ModelBundleFileSchema = object({
|
|
16289
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16290
|
+
path: string().min(1),
|
|
16291
|
+
bytes: number().int().nonnegative(),
|
|
16292
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16293
|
+
});
|
|
16294
|
+
var ImportModelBundleInputSchema = object({
|
|
16295
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16296
|
+
addonId: string(),
|
|
16297
|
+
stepId: string().min(1),
|
|
16298
|
+
/**
|
|
16299
|
+
* The catalog rows to register, complete, every format URL already
|
|
16300
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16301
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16302
|
+
*/
|
|
16303
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16304
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16305
|
+
bundle: object({
|
|
16306
|
+
ticket: PeerBytesTicketSchema,
|
|
16307
|
+
bytes: number().int().positive(),
|
|
16308
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16309
|
+
}),
|
|
16310
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16311
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16312
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16313
|
+
distribute: boolean()
|
|
16314
|
+
});
|
|
16315
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16316
|
+
kind: literal("imported"),
|
|
16317
|
+
modelIds: array(string()).readonly(),
|
|
16318
|
+
distributed: array(object({
|
|
16319
|
+
modelId: string(),
|
|
16320
|
+
nodeId: string(),
|
|
16321
|
+
format: _enum(MODEL_FORMATS),
|
|
16322
|
+
ok: boolean(),
|
|
16323
|
+
error: string().optional()
|
|
16324
|
+
})).readonly()
|
|
16325
|
+
}), object({
|
|
16326
|
+
kind: literal("refused"),
|
|
16327
|
+
reason: _enum([
|
|
16328
|
+
"transfer-failed",
|
|
16329
|
+
"checksum-mismatch",
|
|
16330
|
+
"bundle-mismatch",
|
|
16331
|
+
"invalid-entry",
|
|
16332
|
+
"id-taken"
|
|
16333
|
+
]),
|
|
16334
|
+
detail: string()
|
|
16335
|
+
})]);
|
|
16336
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16337
|
+
kind: "mutation",
|
|
16338
|
+
auth: "admin",
|
|
16339
|
+
timeoutMs: 30 * 6e4
|
|
16340
|
+
});
|
|
15527
16341
|
/**
|
|
15528
16342
|
* Query filter for settings-store collections.
|
|
15529
16343
|
*/
|
|
@@ -16002,6 +16816,35 @@ var KeychainKeySourceSchema = object({
|
|
|
16002
16816
|
*/
|
|
16003
16817
|
sharesBackupWithDatabase: boolean()
|
|
16004
16818
|
});
|
|
16819
|
+
/**
|
|
16820
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16821
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16822
|
+
*/
|
|
16823
|
+
var KeychainResetRecordSchema = object({
|
|
16824
|
+
id: string(),
|
|
16825
|
+
at: number(),
|
|
16826
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16827
|
+
actor: string(),
|
|
16828
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16829
|
+
lockedReason: string().nullable(),
|
|
16830
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16831
|
+
archived: number().int(),
|
|
16832
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16833
|
+
archivedCollection: string().nullable(),
|
|
16834
|
+
/**
|
|
16835
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16836
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16837
|
+
*/
|
|
16838
|
+
archivedKeysCollection: string().nullable(),
|
|
16839
|
+
/**
|
|
16840
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16841
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16842
|
+
* agent forever (D797).
|
|
16843
|
+
*/
|
|
16844
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16845
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16846
|
+
acknowledgedAt: number().nullable()
|
|
16847
|
+
});
|
|
16005
16848
|
var KeychainStatusSchema = object({
|
|
16006
16849
|
keychain: KeychainStateSchema,
|
|
16007
16850
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -16019,7 +16862,9 @@ var KeychainStatusSchema = object({
|
|
|
16019
16862
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
16020
16863
|
retiredWraps: number().int(),
|
|
16021
16864
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
16022
|
-
secretCount: number().int()
|
|
16865
|
+
secretCount: number().int(),
|
|
16866
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16867
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
16023
16868
|
});
|
|
16024
16869
|
/**
|
|
16025
16870
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -16041,17 +16886,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
16041
16886
|
"download-recovery-key",
|
|
16042
16887
|
"delete-orphans",
|
|
16043
16888
|
"reset",
|
|
16889
|
+
"acknowledge-reset",
|
|
16044
16890
|
"initialize"
|
|
16045
16891
|
]);
|
|
16046
16892
|
var KeychainAuditEntrySchema = object({
|
|
16047
16893
|
id: string(),
|
|
16048
16894
|
at: number(),
|
|
16049
16895
|
action: KeychainAuditActionSchema,
|
|
16050
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16896
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
16051
16897
|
actor: string(),
|
|
16052
16898
|
ref: string().nullable(),
|
|
16053
16899
|
detail: string().nullable()
|
|
16054
16900
|
});
|
|
16901
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16902
|
+
/**
|
|
16903
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16904
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16905
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16906
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16907
|
+
*/
|
|
16908
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
16055
16909
|
method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
|
|
16056
16910
|
value: string(),
|
|
16057
16911
|
version: number().int()
|
|
@@ -16059,6 +16913,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16059
16913
|
kind: "mutation",
|
|
16060
16914
|
auth: "admin",
|
|
16061
16915
|
caller: "required"
|
|
16916
|
+
}), method(object({
|
|
16917
|
+
name: SystemHeldSecretNameSchema,
|
|
16918
|
+
value: string().min(16)
|
|
16919
|
+
}), object({
|
|
16920
|
+
ref: string(),
|
|
16921
|
+
version: number().int()
|
|
16922
|
+
}), {
|
|
16923
|
+
kind: "mutation",
|
|
16924
|
+
auth: "admin",
|
|
16925
|
+
caller: "required"
|
|
16062
16926
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16063
16927
|
deleted: array(string()).readonly(),
|
|
16064
16928
|
kept: array(object({
|
|
@@ -16088,13 +16952,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16088
16952
|
kind: "mutation",
|
|
16089
16953
|
auth: "admin",
|
|
16090
16954
|
caller: "required"
|
|
16091
|
-
}), method(object({ confirm: literal(
|
|
16955
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
16092
16956
|
archivedCollection: string().nullable(),
|
|
16093
16957
|
archived: number().int()
|
|
16094
16958
|
}), {
|
|
16095
16959
|
kind: "mutation",
|
|
16096
16960
|
auth: "admin",
|
|
16097
16961
|
caller: "required"
|
|
16962
|
+
}), method(object({}), object({
|
|
16963
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16964
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16965
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16966
|
+
kind: "mutation",
|
|
16967
|
+
auth: "admin",
|
|
16968
|
+
caller: "required"
|
|
16098
16969
|
});
|
|
16099
16970
|
method(_void(), object({
|
|
16100
16971
|
id: string(),
|
|
@@ -18945,7 +19816,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18945
19816
|
* `login-method` — collection cap through which auth addons contribute
|
|
18946
19817
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18947
19818
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18948
|
-
* every auth addon (OIDC,
|
|
19819
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18949
19820
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18950
19821
|
* procedure aggregates them for the unauthenticated login page.
|
|
18951
19822
|
*
|
|
@@ -18953,8 +19824,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18953
19824
|
*
|
|
18954
19825
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18955
19826
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18956
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18957
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19827
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18958
19828
|
* login page needs NO change.
|
|
18959
19829
|
*
|
|
18960
19830
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18973,8 +19843,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18973
19843
|
* decision.
|
|
18974
19844
|
*
|
|
18975
19845
|
* Every contribution carries a `stage`:
|
|
18976
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18977
|
-
*
|
|
19846
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19847
|
+
* buttons; a usernameless passkey).
|
|
18978
19848
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18979
19849
|
* returned `factors` (passkey-as-2FA today).
|
|
18980
19850
|
*
|
|
@@ -19001,7 +19871,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
19001
19871
|
* The provider names an external identity a signed-in user can link to
|
|
19002
19872
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
19003
19873
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
19004
|
-
* whatever their id. Absent / false — a login button only
|
|
19874
|
+
* whatever their id. Absent / false — a login button only.
|
|
19005
19875
|
*/
|
|
19006
19876
|
linkable: boolean().optional()
|
|
19007
19877
|
}),
|
|
@@ -22856,8 +23726,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22856
23726
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22857
23727
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22858
23728
|
* distinction was only ever used to route role-specific procedures
|
|
22859
|
-
* which we no longer have.
|
|
22860
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23729
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22861
23730
|
* with `isAdmin: false` + an explicit scope list.
|
|
22862
23731
|
*/
|
|
22863
23732
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24532,6 +25401,9 @@ var RetrainExportFilterSchema = object({
|
|
|
24532
25401
|
frameIds: array(string()).max(2e4).optional(),
|
|
24533
25402
|
/** Only frames in at least one of these named collections. */
|
|
24534
25403
|
collectionIds: array(string()).max(200).optional(),
|
|
25404
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25405
|
+
* unknown id selects nothing. */
|
|
25406
|
+
datasetVersionId: string().optional(),
|
|
24535
25407
|
batchId: string().optional(),
|
|
24536
25408
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24537
25409
|
completeOnly: boolean().optional()
|
|
@@ -24699,6 +25571,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24699
25571
|
]),
|
|
24700
25572
|
detail: string().optional()
|
|
24701
25573
|
})]);
|
|
25574
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25575
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25576
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25577
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25578
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25579
|
+
});
|
|
25580
|
+
/** The counts a dataset is judged by. */
|
|
25581
|
+
var RetrainDatasetStatsSchema = object({
|
|
25582
|
+
frames: number().int(),
|
|
25583
|
+
completeFrames: number().int(),
|
|
25584
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25585
|
+
completeness: number(),
|
|
25586
|
+
/** Boxes to learn (model errors excluded). */
|
|
25587
|
+
subjects: number().int(),
|
|
25588
|
+
modelErrors: number().int(),
|
|
25589
|
+
/** Complete frames with no subject. */
|
|
25590
|
+
hardNegatives: number().int(),
|
|
25591
|
+
/** Subjects per class × camera × day/night. */
|
|
25592
|
+
cells: array(object({
|
|
25593
|
+
macroClass: string(),
|
|
25594
|
+
deviceId: number(),
|
|
25595
|
+
lighting: _enum([
|
|
25596
|
+
"day",
|
|
25597
|
+
"night",
|
|
25598
|
+
"unknown"
|
|
25599
|
+
]),
|
|
25600
|
+
subjects: number().int(),
|
|
25601
|
+
frames: number().int()
|
|
25602
|
+
})).readonly(),
|
|
25603
|
+
cameras: array(object({
|
|
25604
|
+
deviceId: number(),
|
|
25605
|
+
frames: number().int(),
|
|
25606
|
+
completeFrames: number().int()
|
|
25607
|
+
})).readonly()
|
|
25608
|
+
});
|
|
25609
|
+
/** An immutable dataset version, without its frame list. */
|
|
25610
|
+
var RetrainDatasetVersionSchema = object({
|
|
25611
|
+
id: string(),
|
|
25612
|
+
name: string(),
|
|
25613
|
+
createdAt: number(),
|
|
25614
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25615
|
+
layout: RetrainExportLayoutSchema,
|
|
25616
|
+
completeOnly: boolean(),
|
|
25617
|
+
frameCount: number().int(),
|
|
25618
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25619
|
+
annotationHash: string(),
|
|
25620
|
+
/** The export manifest schema the version was cut under. */
|
|
25621
|
+
manifestSchema: string(),
|
|
25622
|
+
stats: RetrainDatasetStatsSchema
|
|
25623
|
+
});
|
|
25624
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25625
|
+
kind: literal("created"),
|
|
25626
|
+
version: RetrainDatasetVersionSchema
|
|
25627
|
+
}), object({
|
|
25628
|
+
kind: literal("refused"),
|
|
25629
|
+
reason: _enum([
|
|
25630
|
+
"empty-name",
|
|
25631
|
+
"duplicate-name",
|
|
25632
|
+
"no-frames"
|
|
25633
|
+
])
|
|
25634
|
+
})]);
|
|
24702
25635
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24703
25636
|
var RetrainTransitionResultSchema = object({
|
|
24704
25637
|
trackId: string(),
|
|
@@ -25488,6 +26421,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
25488
26421
|
kind: "mutation",
|
|
25489
26422
|
auth: "admin",
|
|
25490
26423
|
timeoutMs: 60 * 6e4
|
|
26424
|
+
}), method(object({
|
|
26425
|
+
filter: RetrainExportFilterSchema,
|
|
26426
|
+
layout: RetrainExportLayoutSchema
|
|
26427
|
+
}), object({
|
|
26428
|
+
ticket: PeerBytesTicketSchema,
|
|
26429
|
+
frames: number().int(),
|
|
26430
|
+
annotations: number().int()
|
|
26431
|
+
}), {
|
|
26432
|
+
kind: "mutation",
|
|
26433
|
+
auth: "admin",
|
|
26434
|
+
timeoutMs: 12e4
|
|
26435
|
+
}), method(object({
|
|
26436
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26437
|
+
completeOnly: boolean().optional()
|
|
26438
|
+
}), RetrainDatasetStatsSchema, {
|
|
26439
|
+
kind: "query",
|
|
26440
|
+
auth: "admin"
|
|
26441
|
+
}), method(object({
|
|
26442
|
+
name: string().max(120),
|
|
26443
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26444
|
+
layout: RetrainExportLayoutSchema,
|
|
26445
|
+
completeOnly: boolean()
|
|
26446
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26447
|
+
kind: "mutation",
|
|
26448
|
+
auth: "admin",
|
|
26449
|
+
timeoutMs: 12e4
|
|
26450
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26451
|
+
kind: "query",
|
|
26452
|
+
auth: "admin"
|
|
26453
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26454
|
+
kind: "mutation",
|
|
26455
|
+
auth: "admin"
|
|
26456
|
+
}), method(object({ id: string() }), object({
|
|
26457
|
+
found: boolean(),
|
|
26458
|
+
annotationHash: string(),
|
|
26459
|
+
matches: boolean(),
|
|
26460
|
+
missingFrames: number().int()
|
|
26461
|
+
}), {
|
|
26462
|
+
kind: "query",
|
|
26463
|
+
auth: "admin",
|
|
26464
|
+
timeoutMs: 12e4
|
|
25491
26465
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25492
26466
|
kind: "query",
|
|
25493
26467
|
auth: "admin"
|
|
@@ -29066,8 +30040,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
29066
30040
|
* `smtp-provider` — pluggable email delivery surface.
|
|
29067
30041
|
*
|
|
29068
30042
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
29069
|
-
* one for transactional / one for notifications). Consumers (
|
|
29070
|
-
*
|
|
30043
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
30044
|
+
* addons, …) walk the collection and pick the first
|
|
29071
30045
|
* ready provider OR target a specific addonId.
|
|
29072
30046
|
*
|
|
29073
30047
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -29246,7 +30220,7 @@ targets: array(object({
|
|
|
29246
30220
|
})));
|
|
29247
30221
|
/**
|
|
29248
30222
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
29249
|
-
* providers (OIDC, SAML,
|
|
30223
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
29250
30224
|
* carrying the post-callback claims before redirecting back to
|
|
29251
30225
|
* `/api/auth/sso/finish`.
|
|
29252
30226
|
*
|
|
@@ -29309,7 +30283,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
29309
30283
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29310
30284
|
* subject is unique only per issuer, so a link is bound to it.
|
|
29311
30285
|
*/
|
|
29312
|
-
issuer: string().optional()
|
|
30286
|
+
issuer: string().optional(),
|
|
30287
|
+
/**
|
|
30288
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30289
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30290
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30291
|
+
* any other browser.
|
|
30292
|
+
*/
|
|
30293
|
+
browserBinding: string().optional()
|
|
29313
30294
|
});
|
|
29314
30295
|
method(object({
|
|
29315
30296
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -41576,16 +42557,6 @@ var ApiKeySummarySchema = object({
|
|
|
41576
42557
|
createdAt: number(),
|
|
41577
42558
|
lastUsedAt: number().optional()
|
|
41578
42559
|
});
|
|
41579
|
-
var CreateApiKeyInputSchema = object({
|
|
41580
|
-
label: string(),
|
|
41581
|
-
isAdmin: boolean().default(false),
|
|
41582
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
41583
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
41584
|
-
});
|
|
41585
|
-
var CreateApiKeyResultSchema = object({
|
|
41586
|
-
token: string(),
|
|
41587
|
-
record: ApiKeySummarySchema
|
|
41588
|
-
});
|
|
41589
42560
|
var ScopedTokenSummarySchema = object({
|
|
41590
42561
|
id: string(),
|
|
41591
42562
|
userId: string(),
|
|
@@ -41684,17 +42655,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41684
42655
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
41685
42656
|
kind: "mutation",
|
|
41686
42657
|
access: "view"
|
|
41687
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
41688
|
-
kind: "mutation",
|
|
41689
|
-
auth: "admin",
|
|
41690
|
-
access: "create"
|
|
41691
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42658
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41692
42659
|
kind: "mutation",
|
|
41693
42660
|
auth: "admin",
|
|
41694
42661
|
access: "delete"
|
|
41695
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
41696
|
-
kind: "mutation",
|
|
41697
|
-
access: "view"
|
|
41698
42662
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
41699
42663
|
kind: "mutation",
|
|
41700
42664
|
auth: "admin",
|
|
@@ -41768,15 +42732,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41768
42732
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
41769
42733
|
userId: string(),
|
|
41770
42734
|
issuer: string()
|
|
41771
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
41772
|
-
userId: string(),
|
|
41773
|
-
issuer: string().min(1),
|
|
41774
|
-
label: string().optional()
|
|
41775
|
-
}), object({ success: literal(true) }), {
|
|
41776
|
-
kind: "mutation",
|
|
41777
|
-
auth: "admin",
|
|
41778
|
-
access: "create"
|
|
41779
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42735
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41780
42736
|
kind: "mutation",
|
|
41781
42737
|
auth: "admin",
|
|
41782
42738
|
access: "delete"
|
|
@@ -42481,6 +43437,451 @@ var zoneRulesCapability = {
|
|
|
42481
43437
|
*/
|
|
42482
43438
|
durability: "restored"
|
|
42483
43439
|
};
|
|
43440
|
+
/**
|
|
43441
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43442
|
+
*
|
|
43443
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43444
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43445
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43446
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43447
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43448
|
+
* manifest entry and nothing else.
|
|
43449
|
+
*
|
|
43450
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43451
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43452
|
+
* Every method is `admin`: these spend money.
|
|
43453
|
+
*
|
|
43454
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43455
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43456
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43457
|
+
*
|
|
43458
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43459
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43460
|
+
* ticket the provider mints (D613).
|
|
43461
|
+
*/
|
|
43462
|
+
var TrainingGpuOptionSchema = object({
|
|
43463
|
+
id: string(),
|
|
43464
|
+
label: string(),
|
|
43465
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43466
|
+
usdPerHour: number().nonnegative(),
|
|
43467
|
+
vramGb: number().nonnegative()
|
|
43468
|
+
});
|
|
43469
|
+
var TrainingRegionOptionSchema = object({
|
|
43470
|
+
/** `''` = any region (the provider's choice). */
|
|
43471
|
+
id: string(),
|
|
43472
|
+
label: string(),
|
|
43473
|
+
priceMultiplier: number().positive()
|
|
43474
|
+
});
|
|
43475
|
+
/**
|
|
43476
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43477
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43478
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43479
|
+
*/
|
|
43480
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43481
|
+
gpuType: string(),
|
|
43482
|
+
region: string(),
|
|
43483
|
+
costCapUsd: number().nonnegative(),
|
|
43484
|
+
maxRuntimeSec: number().int().positive(),
|
|
43485
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43486
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43487
|
+
});
|
|
43488
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43489
|
+
addonId: string(),
|
|
43490
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43491
|
+
kind: string(),
|
|
43492
|
+
label: string(),
|
|
43493
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43494
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43495
|
+
maxDatasetBytes: number().int().positive(),
|
|
43496
|
+
maxRuntimeSec: number().int().positive(),
|
|
43497
|
+
freeTierNote: string().optional(),
|
|
43498
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43499
|
+
dataResidencyNote: string(),
|
|
43500
|
+
/** Credentials are present — never the values. */
|
|
43501
|
+
configured: boolean(),
|
|
43502
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43503
|
+
});
|
|
43504
|
+
var TrainingCredentialCheckSchema = object({
|
|
43505
|
+
ok: boolean(),
|
|
43506
|
+
/** Workspace / account name, when the provider says. */
|
|
43507
|
+
account: string().optional(),
|
|
43508
|
+
reason: _enum([
|
|
43509
|
+
"missing",
|
|
43510
|
+
"invalid",
|
|
43511
|
+
"forbidden",
|
|
43512
|
+
"network",
|
|
43513
|
+
"quota"
|
|
43514
|
+
]).optional(),
|
|
43515
|
+
detail: string().optional()
|
|
43516
|
+
});
|
|
43517
|
+
var ProviderJobStateSchema = _enum([
|
|
43518
|
+
"pending",
|
|
43519
|
+
"starting",
|
|
43520
|
+
"running",
|
|
43521
|
+
"succeeded",
|
|
43522
|
+
"failed",
|
|
43523
|
+
"cancelled",
|
|
43524
|
+
"lost"
|
|
43525
|
+
]);
|
|
43526
|
+
var ProviderJobStatusSchema = object({
|
|
43527
|
+
jobKey: string(),
|
|
43528
|
+
providerJobId: string().optional(),
|
|
43529
|
+
state: ProviderJobStateSchema,
|
|
43530
|
+
startedAt: number().optional(),
|
|
43531
|
+
endedAt: number().optional(),
|
|
43532
|
+
exitCode: number().int().optional(),
|
|
43533
|
+
failureReason: string().optional(),
|
|
43534
|
+
gpuType: string(),
|
|
43535
|
+
region: string().optional(),
|
|
43536
|
+
billedSeconds: number().nonnegative(),
|
|
43537
|
+
costUsd: number().nonnegative(),
|
|
43538
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43539
|
+
costIsEstimate: boolean(),
|
|
43540
|
+
lastFetchedAt: number()
|
|
43541
|
+
});
|
|
43542
|
+
/**
|
|
43543
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43544
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43545
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43546
|
+
* in `result.json`.
|
|
43547
|
+
*/
|
|
43548
|
+
var TrainerSourceRefSchema = object({
|
|
43549
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43550
|
+
repo: string().min(1),
|
|
43551
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43552
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43553
|
+
});
|
|
43554
|
+
var JobRef = {
|
|
43555
|
+
addonId: string(),
|
|
43556
|
+
jobKey: string().uuid()
|
|
43557
|
+
};
|
|
43558
|
+
var TrainingLogLineSchema = object({
|
|
43559
|
+
ts: number(),
|
|
43560
|
+
text: string()
|
|
43561
|
+
});
|
|
43562
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43563
|
+
kind: "mutation",
|
|
43564
|
+
auth: "admin",
|
|
43565
|
+
timeoutMs: 3e4
|
|
43566
|
+
}), method(object({
|
|
43567
|
+
addonId: string(),
|
|
43568
|
+
gpuType: string(),
|
|
43569
|
+
region: string(),
|
|
43570
|
+
datasetBytes: number().int().nonnegative(),
|
|
43571
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43572
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43573
|
+
}), object({
|
|
43574
|
+
usdLow: number().nonnegative(),
|
|
43575
|
+
usdHigh: number().nonnegative(),
|
|
43576
|
+
notes: array(string()).readonly()
|
|
43577
|
+
}), { auth: "admin" }), method(object({
|
|
43578
|
+
...JobRef,
|
|
43579
|
+
ticket: PeerBytesTicketSchema
|
|
43580
|
+
}), object({
|
|
43581
|
+
bytes: number().int().nonnegative(),
|
|
43582
|
+
sha256: string()
|
|
43583
|
+
}), {
|
|
43584
|
+
kind: "mutation",
|
|
43585
|
+
auth: "admin",
|
|
43586
|
+
timeoutMs: 120 * 6e4
|
|
43587
|
+
}), method(object({
|
|
43588
|
+
...JobRef,
|
|
43589
|
+
trainer: TrainerSourceRefSchema,
|
|
43590
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43591
|
+
gpuType: string(),
|
|
43592
|
+
region: string(),
|
|
43593
|
+
maxRuntimeSec: number().int().positive()
|
|
43594
|
+
}), ProviderJobStatusSchema, {
|
|
43595
|
+
kind: "mutation",
|
|
43596
|
+
auth: "admin",
|
|
43597
|
+
timeoutMs: 30 * 6e4
|
|
43598
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43599
|
+
auth: "admin",
|
|
43600
|
+
timeoutMs: 6e4
|
|
43601
|
+
}), method(object({
|
|
43602
|
+
...JobRef,
|
|
43603
|
+
cursor: string().optional(),
|
|
43604
|
+
max: number().int().min(1).max(500)
|
|
43605
|
+
}), object({
|
|
43606
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43607
|
+
cursor: string()
|
|
43608
|
+
}), {
|
|
43609
|
+
auth: "admin",
|
|
43610
|
+
timeoutMs: 6e4
|
|
43611
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43612
|
+
kind: "mutation",
|
|
43613
|
+
auth: "admin",
|
|
43614
|
+
timeoutMs: 6e4
|
|
43615
|
+
}), method(object(JobRef), object({
|
|
43616
|
+
found: boolean(),
|
|
43617
|
+
text: string().optional()
|
|
43618
|
+
}), {
|
|
43619
|
+
kind: "mutation",
|
|
43620
|
+
auth: "admin",
|
|
43621
|
+
timeoutMs: 5 * 6e4
|
|
43622
|
+
}), method(object({
|
|
43623
|
+
...JobRef,
|
|
43624
|
+
path: _enum(["bundle.tar"])
|
|
43625
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43626
|
+
kind: "mutation",
|
|
43627
|
+
auth: "admin",
|
|
43628
|
+
timeoutMs: 5 * 6e4
|
|
43629
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43630
|
+
kind: "mutation",
|
|
43631
|
+
auth: "admin",
|
|
43632
|
+
timeoutMs: 5 * 6e4
|
|
43633
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43634
|
+
auth: "admin",
|
|
43635
|
+
timeoutMs: 2 * 6e4
|
|
43636
|
+
});
|
|
43637
|
+
/**
|
|
43638
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43639
|
+
* provided by `addon-training`.
|
|
43640
|
+
*
|
|
43641
|
+
* It owns what every provider must agree on, written once:
|
|
43642
|
+
*
|
|
43643
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43644
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43645
|
+
* the export plan) and reaches this store through the five row methods
|
|
43646
|
+
* below, so the Retrain page and the export did not change.
|
|
43647
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43648
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43649
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43650
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43651
|
+
* rollback. Nothing is ever registered automatically.
|
|
43652
|
+
*
|
|
43653
|
+
* Every method is `admin`.
|
|
43654
|
+
*/
|
|
43655
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43656
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43657
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43658
|
+
var TrainingBaseModelSchema = object({
|
|
43659
|
+
modelId: string(),
|
|
43660
|
+
label: string(),
|
|
43661
|
+
weights: string(),
|
|
43662
|
+
imgsz: number().int(),
|
|
43663
|
+
baselineOnnxUrl: string(),
|
|
43664
|
+
baselineFloors: record(string(), number()),
|
|
43665
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43666
|
+
recommended: boolean()
|
|
43667
|
+
});
|
|
43668
|
+
var TrainingPresetSchema = _enum([
|
|
43669
|
+
"quick",
|
|
43670
|
+
"standard",
|
|
43671
|
+
"thorough"
|
|
43672
|
+
]);
|
|
43673
|
+
var TrainingJobRequestSchema = object({
|
|
43674
|
+
datasetVersionId: string().min(1),
|
|
43675
|
+
/** The `training-provider` addon that runs it. */
|
|
43676
|
+
addonId: string().min(1),
|
|
43677
|
+
gpuType: string().min(1),
|
|
43678
|
+
region: string(),
|
|
43679
|
+
baseModelId: string().min(1),
|
|
43680
|
+
preset: TrainingPresetSchema,
|
|
43681
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43682
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43683
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43684
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43685
|
+
});
|
|
43686
|
+
var TrainingSplitPlanSchema = object({
|
|
43687
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43688
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43689
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43690
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43691
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43692
|
+
trainSubjects: number().int()
|
|
43693
|
+
});
|
|
43694
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43695
|
+
"unknown-dataset",
|
|
43696
|
+
"unknown-provider",
|
|
43697
|
+
"provider-not-configured",
|
|
43698
|
+
"unknown-base-model",
|
|
43699
|
+
"unknown-gpu",
|
|
43700
|
+
"dataset-too-large",
|
|
43701
|
+
"no-training-subjects",
|
|
43702
|
+
"job-already-running"
|
|
43703
|
+
]);
|
|
43704
|
+
var TrainingJobPlanSchema = object({
|
|
43705
|
+
refusal: object({
|
|
43706
|
+
reason: TrainingRefusalReasonSchema,
|
|
43707
|
+
detail: string()
|
|
43708
|
+
}).nullable(),
|
|
43709
|
+
warnings: array(string()).readonly(),
|
|
43710
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43711
|
+
estimate: object({
|
|
43712
|
+
datasetBytes: number().int(),
|
|
43713
|
+
uploadMinutesAt20Mbps: number(),
|
|
43714
|
+
gpuSecondsLow: number(),
|
|
43715
|
+
gpuSecondsHigh: number(),
|
|
43716
|
+
usdLow: number(),
|
|
43717
|
+
usdHigh: number(),
|
|
43718
|
+
notes: array(string()).readonly()
|
|
43719
|
+
}).nullable(),
|
|
43720
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43721
|
+
defaults: object({
|
|
43722
|
+
maxCostUsd: number(),
|
|
43723
|
+
maxRuntimeSec: number().int()
|
|
43724
|
+
}).nullable(),
|
|
43725
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43726
|
+
dataNotice: string()
|
|
43727
|
+
});
|
|
43728
|
+
/**
|
|
43729
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43730
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43731
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43732
|
+
* result lives after the operator acted on it.
|
|
43733
|
+
*/
|
|
43734
|
+
var TrainingJobStateSchema = _enum([
|
|
43735
|
+
"uploading",
|
|
43736
|
+
"submitted",
|
|
43737
|
+
"starting",
|
|
43738
|
+
"running",
|
|
43739
|
+
"collecting",
|
|
43740
|
+
"ready",
|
|
43741
|
+
"registered",
|
|
43742
|
+
"canary",
|
|
43743
|
+
"failed",
|
|
43744
|
+
"cancelling",
|
|
43745
|
+
"cancelled",
|
|
43746
|
+
"lost",
|
|
43747
|
+
"expired",
|
|
43748
|
+
"discarded"
|
|
43749
|
+
]);
|
|
43750
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43751
|
+
"cost-cap",
|
|
43752
|
+
"runtime-cap",
|
|
43753
|
+
"upload-failed",
|
|
43754
|
+
"submit-failed",
|
|
43755
|
+
"trainer-failed",
|
|
43756
|
+
"result-invalid",
|
|
43757
|
+
"checksum-mismatch",
|
|
43758
|
+
"fetch-failed",
|
|
43759
|
+
"provider-error",
|
|
43760
|
+
"hub-restart-during-upload"
|
|
43761
|
+
]);
|
|
43762
|
+
var TrainingProgressPointSchema = object({
|
|
43763
|
+
epoch: number().int(),
|
|
43764
|
+
map50: number().nullable(),
|
|
43765
|
+
map50_95: number().nullable()
|
|
43766
|
+
});
|
|
43767
|
+
var TrainingCanarySchema = object({
|
|
43768
|
+
deviceIds: array(number().int()).readonly(),
|
|
43769
|
+
since: number(),
|
|
43770
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43771
|
+
previous: array(object({
|
|
43772
|
+
deviceId: number().int(),
|
|
43773
|
+
nodeId: string(),
|
|
43774
|
+
deviceKey: string(),
|
|
43775
|
+
patch: object({
|
|
43776
|
+
modelId: string().optional(),
|
|
43777
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43778
|
+
}).nullable()
|
|
43779
|
+
})).readonly()
|
|
43780
|
+
});
|
|
43781
|
+
var TrainingJobSchema = object({
|
|
43782
|
+
id: string(),
|
|
43783
|
+
idempotencyKey: string(),
|
|
43784
|
+
name: string(),
|
|
43785
|
+
createdAt: number(),
|
|
43786
|
+
updatedAt: number(),
|
|
43787
|
+
state: TrainingJobStateSchema,
|
|
43788
|
+
stage: TrainingStageSchema.nullable(),
|
|
43789
|
+
failure: object({
|
|
43790
|
+
reason: TrainingFailureReasonSchema,
|
|
43791
|
+
stage: string().nullable(),
|
|
43792
|
+
detail: string()
|
|
43793
|
+
}).nullable(),
|
|
43794
|
+
request: TrainingJobRequestSchema,
|
|
43795
|
+
maxCostUsd: number().nonnegative(),
|
|
43796
|
+
maxRuntimeSec: number().int().positive(),
|
|
43797
|
+
trainer: TrainerSourceRefSchema,
|
|
43798
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43799
|
+
dataset: object({
|
|
43800
|
+
bytes: number().int(),
|
|
43801
|
+
sha256: string(),
|
|
43802
|
+
uploadedAt: number()
|
|
43803
|
+
}).nullable(),
|
|
43804
|
+
split: TrainingSplitPlanSchema,
|
|
43805
|
+
provider: object({
|
|
43806
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43807
|
+
providerJobId: string().nullable(),
|
|
43808
|
+
startedAt: number().nullable(),
|
|
43809
|
+
endedAt: number().nullable(),
|
|
43810
|
+
billedSeconds: number(),
|
|
43811
|
+
costUsd: number(),
|
|
43812
|
+
costIsEstimate: boolean(),
|
|
43813
|
+
lastPolledAt: number().nullable()
|
|
43814
|
+
}),
|
|
43815
|
+
progress: object({
|
|
43816
|
+
epoch: number().int().nullable(),
|
|
43817
|
+
epochs: number().int().nullable(),
|
|
43818
|
+
etaSec: number().nullable(),
|
|
43819
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43820
|
+
}),
|
|
43821
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43822
|
+
logTail: array(string()).readonly(),
|
|
43823
|
+
logCursor: string().nullable(),
|
|
43824
|
+
artifacts: object({
|
|
43825
|
+
bundleBytes: number().int(),
|
|
43826
|
+
bundleSha256: string(),
|
|
43827
|
+
fetchedAt: number(),
|
|
43828
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43829
|
+
expiresAt: number()
|
|
43830
|
+
}).nullable(),
|
|
43831
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43832
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43833
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43834
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43835
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43836
|
+
registeredModelIds: array(string()).readonly(),
|
|
43837
|
+
canary: TrainingCanarySchema.nullable()
|
|
43838
|
+
});
|
|
43839
|
+
var IdInput = object({ id: string().min(1) });
|
|
43840
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43841
|
+
kind: "mutation",
|
|
43842
|
+
auth: "admin"
|
|
43843
|
+
}), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
|
|
43844
|
+
kind: "mutation",
|
|
43845
|
+
auth: "admin"
|
|
43846
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43847
|
+
auth: "admin",
|
|
43848
|
+
timeoutMs: 6e4
|
|
43849
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43850
|
+
name: string().min(1).max(120),
|
|
43851
|
+
maxCostUsd: number().positive(),
|
|
43852
|
+
maxRuntimeSec: number().int().positive(),
|
|
43853
|
+
idempotencyKey: string().min(8).max(80)
|
|
43854
|
+
}), discriminatedUnion("kind", [object({
|
|
43855
|
+
kind: literal("started"),
|
|
43856
|
+
job: TrainingJobSchema
|
|
43857
|
+
}), object({
|
|
43858
|
+
kind: literal("refused"),
|
|
43859
|
+
reason: TrainingRefusalReasonSchema,
|
|
43860
|
+
detail: string()
|
|
43861
|
+
})]), {
|
|
43862
|
+
kind: "mutation",
|
|
43863
|
+
auth: "admin",
|
|
43864
|
+
timeoutMs: 12e4
|
|
43865
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43866
|
+
kind: "mutation",
|
|
43867
|
+
auth: "admin",
|
|
43868
|
+
timeoutMs: 12e4
|
|
43869
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43870
|
+
kind: "mutation",
|
|
43871
|
+
auth: "admin",
|
|
43872
|
+
timeoutMs: 30 * 6e4
|
|
43873
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43874
|
+
kind: "mutation",
|
|
43875
|
+
auth: "admin",
|
|
43876
|
+
timeoutMs: 12e4
|
|
43877
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43878
|
+
kind: "mutation",
|
|
43879
|
+
auth: "admin",
|
|
43880
|
+
timeoutMs: 12e4
|
|
43881
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43882
|
+
kind: "mutation",
|
|
43883
|
+
auth: "admin"
|
|
43884
|
+
});
|
|
42484
43885
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
42485
43886
|
Object.freeze({
|
|
42486
43887
|
person: .5,
|
|
@@ -44629,6 +46030,12 @@ Object.freeze({
|
|
|
44629
46030
|
addonId: null,
|
|
44630
46031
|
access: "create"
|
|
44631
46032
|
},
|
|
46033
|
+
"backup.checkBackupKey": {
|
|
46034
|
+
capName: "backup",
|
|
46035
|
+
capScope: "system",
|
|
46036
|
+
addonId: null,
|
|
46037
|
+
access: "create"
|
|
46038
|
+
},
|
|
44632
46039
|
"backup.delete": {
|
|
44633
46040
|
capName: "backup",
|
|
44634
46041
|
capScope: "system",
|
|
@@ -44641,6 +46048,18 @@ Object.freeze({
|
|
|
44641
46048
|
addonId: null,
|
|
44642
46049
|
access: "delete"
|
|
44643
46050
|
},
|
|
46051
|
+
"backup.disableEncryption": {
|
|
46052
|
+
capName: "backup",
|
|
46053
|
+
capScope: "system",
|
|
46054
|
+
addonId: null,
|
|
46055
|
+
access: "create"
|
|
46056
|
+
},
|
|
46057
|
+
"backup.getEncryption": {
|
|
46058
|
+
capName: "backup",
|
|
46059
|
+
capScope: "system",
|
|
46060
|
+
addonId: null,
|
|
46061
|
+
access: "view"
|
|
46062
|
+
},
|
|
44644
46063
|
"backup.getEntries": {
|
|
44645
46064
|
capName: "backup",
|
|
44646
46065
|
capScope: "system",
|
|
@@ -44695,6 +46114,12 @@ Object.freeze({
|
|
|
44695
46114
|
addonId: null,
|
|
44696
46115
|
access: "create"
|
|
44697
46116
|
},
|
|
46117
|
+
"backup.setupEncryption": {
|
|
46118
|
+
capName: "backup",
|
|
46119
|
+
capScope: "system",
|
|
46120
|
+
addonId: null,
|
|
46121
|
+
access: "create"
|
|
46122
|
+
},
|
|
44698
46123
|
"backup.trigger": {
|
|
44699
46124
|
capName: "backup",
|
|
44700
46125
|
capScope: "system",
|
|
@@ -45247,6 +46672,12 @@ Object.freeze({
|
|
|
45247
46672
|
addonId: null,
|
|
45248
46673
|
access: "create"
|
|
45249
46674
|
},
|
|
46675
|
+
"customModelRegistry.importModelBundle": {
|
|
46676
|
+
capName: "custom-model-registry",
|
|
46677
|
+
capScope: "system",
|
|
46678
|
+
addonId: null,
|
|
46679
|
+
access: "create"
|
|
46680
|
+
},
|
|
45250
46681
|
"customModelRegistry.listModels": {
|
|
45251
46682
|
capName: "custom-model-registry",
|
|
45252
46683
|
capScope: "system",
|
|
@@ -46687,6 +48118,12 @@ Object.freeze({
|
|
|
46687
48118
|
addonId: null,
|
|
46688
48119
|
access: "view"
|
|
46689
48120
|
},
|
|
48121
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48122
|
+
capName: "keychain-admin",
|
|
48123
|
+
capScope: "system",
|
|
48124
|
+
addonId: null,
|
|
48125
|
+
access: "create"
|
|
48126
|
+
},
|
|
46690
48127
|
"keychainAdmin.deleteOrphans": {
|
|
46691
48128
|
capName: "keychain-admin",
|
|
46692
48129
|
capScope: "system",
|
|
@@ -46723,6 +48160,12 @@ Object.freeze({
|
|
|
46723
48160
|
addonId: null,
|
|
46724
48161
|
access: "delete"
|
|
46725
48162
|
},
|
|
48163
|
+
"keychainAdmin.resetReport": {
|
|
48164
|
+
capName: "keychain-admin",
|
|
48165
|
+
capScope: "system",
|
|
48166
|
+
addonId: null,
|
|
48167
|
+
access: "delete"
|
|
48168
|
+
},
|
|
46726
48169
|
"keychainAdmin.reveal": {
|
|
46727
48170
|
capName: "keychain-admin",
|
|
46728
48171
|
capScope: "system",
|
|
@@ -46735,6 +48178,12 @@ Object.freeze({
|
|
|
46735
48178
|
addonId: null,
|
|
46736
48179
|
access: "create"
|
|
46737
48180
|
},
|
|
48181
|
+
"keychainAdmin.setSystemSecret": {
|
|
48182
|
+
capName: "keychain-admin",
|
|
48183
|
+
capScope: "system",
|
|
48184
|
+
addonId: null,
|
|
48185
|
+
access: "create"
|
|
48186
|
+
},
|
|
46738
48187
|
"keychainAdmin.status": {
|
|
46739
48188
|
capName: "keychain-admin",
|
|
46740
48189
|
capScope: "system",
|
|
@@ -48181,6 +49630,12 @@ Object.freeze({
|
|
|
48181
49630
|
addonId: null,
|
|
48182
49631
|
access: "create"
|
|
48183
49632
|
},
|
|
49633
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49634
|
+
capName: "pipeline-analytics",
|
|
49635
|
+
capScope: "device",
|
|
49636
|
+
addonId: null,
|
|
49637
|
+
access: "create"
|
|
49638
|
+
},
|
|
48184
49639
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
48185
49640
|
capName: "pipeline-analytics",
|
|
48186
49641
|
capScope: "device",
|
|
@@ -48193,6 +49648,12 @@ Object.freeze({
|
|
|
48193
49648
|
addonId: null,
|
|
48194
49649
|
access: "delete"
|
|
48195
49650
|
},
|
|
49651
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49652
|
+
capName: "pipeline-analytics",
|
|
49653
|
+
capScope: "device",
|
|
49654
|
+
addonId: null,
|
|
49655
|
+
access: "delete"
|
|
49656
|
+
},
|
|
48196
49657
|
"pipelineAnalytics.deleteTracks": {
|
|
48197
49658
|
capName: "pipeline-analytics",
|
|
48198
49659
|
capScope: "device",
|
|
@@ -48415,6 +49876,12 @@ Object.freeze({
|
|
|
48415
49876
|
addonId: null,
|
|
48416
49877
|
access: "view"
|
|
48417
49878
|
},
|
|
49879
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49880
|
+
capName: "pipeline-analytics",
|
|
49881
|
+
capScope: "device",
|
|
49882
|
+
addonId: null,
|
|
49883
|
+
access: "view"
|
|
49884
|
+
},
|
|
48418
49885
|
"pipelineAnalytics.listRetrainFrames": {
|
|
48419
49886
|
capName: "pipeline-analytics",
|
|
48420
49887
|
capScope: "device",
|
|
@@ -48445,6 +49912,12 @@ Object.freeze({
|
|
|
48445
49912
|
addonId: null,
|
|
48446
49913
|
access: "view"
|
|
48447
49914
|
},
|
|
49915
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49916
|
+
capName: "pipeline-analytics",
|
|
49917
|
+
capScope: "device",
|
|
49918
|
+
addonId: null,
|
|
49919
|
+
access: "create"
|
|
49920
|
+
},
|
|
48448
49921
|
"pipelineAnalytics.ownersWithMedia": {
|
|
48449
49922
|
capName: "pipeline-analytics",
|
|
48450
49923
|
capScope: "device",
|
|
@@ -48457,6 +49930,12 @@ Object.freeze({
|
|
|
48457
49930
|
addonId: null,
|
|
48458
49931
|
access: "create"
|
|
48459
49932
|
},
|
|
49933
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49934
|
+
capName: "pipeline-analytics",
|
|
49935
|
+
capScope: "device",
|
|
49936
|
+
addonId: null,
|
|
49937
|
+
access: "view"
|
|
49938
|
+
},
|
|
48460
49939
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
48461
49940
|
capName: "pipeline-analytics",
|
|
48462
49941
|
capScope: "device",
|
|
@@ -48595,6 +50074,12 @@ Object.freeze({
|
|
|
48595
50074
|
addonId: null,
|
|
48596
50075
|
access: "create"
|
|
48597
50076
|
},
|
|
50077
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50078
|
+
capName: "pipeline-analytics",
|
|
50079
|
+
capScope: "device",
|
|
50080
|
+
addonId: null,
|
|
50081
|
+
access: "view"
|
|
50082
|
+
},
|
|
48598
50083
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
48599
50084
|
capName: "pipeline-analytics",
|
|
48600
50085
|
capScope: "device",
|
|
@@ -50971,6 +52456,174 @@ Object.freeze({
|
|
|
50971
52456
|
addonId: null,
|
|
50972
52457
|
access: "view"
|
|
50973
52458
|
},
|
|
52459
|
+
"training.canaryResult": {
|
|
52460
|
+
capName: "training",
|
|
52461
|
+
capScope: "system",
|
|
52462
|
+
addonId: null,
|
|
52463
|
+
access: "create"
|
|
52464
|
+
},
|
|
52465
|
+
"training.cancelJob": {
|
|
52466
|
+
capName: "training",
|
|
52467
|
+
capScope: "system",
|
|
52468
|
+
addonId: null,
|
|
52469
|
+
access: "create"
|
|
52470
|
+
},
|
|
52471
|
+
"training.discardResult": {
|
|
52472
|
+
capName: "training",
|
|
52473
|
+
capScope: "system",
|
|
52474
|
+
addonId: null,
|
|
52475
|
+
access: "create"
|
|
52476
|
+
},
|
|
52477
|
+
"training.findDatasetVersionIdByName": {
|
|
52478
|
+
capName: "training",
|
|
52479
|
+
capScope: "system",
|
|
52480
|
+
addonId: null,
|
|
52481
|
+
access: "view"
|
|
52482
|
+
},
|
|
52483
|
+
"training.getDatasetVersion": {
|
|
52484
|
+
capName: "training",
|
|
52485
|
+
capScope: "system",
|
|
52486
|
+
addonId: null,
|
|
52487
|
+
access: "view"
|
|
52488
|
+
},
|
|
52489
|
+
"training.getJob": {
|
|
52490
|
+
capName: "training",
|
|
52491
|
+
capScope: "system",
|
|
52492
|
+
addonId: null,
|
|
52493
|
+
access: "view"
|
|
52494
|
+
},
|
|
52495
|
+
"training.getJobResult": {
|
|
52496
|
+
capName: "training",
|
|
52497
|
+
capScope: "system",
|
|
52498
|
+
addonId: null,
|
|
52499
|
+
access: "view"
|
|
52500
|
+
},
|
|
52501
|
+
"training.listBaseModels": {
|
|
52502
|
+
capName: "training",
|
|
52503
|
+
capScope: "system",
|
|
52504
|
+
addonId: null,
|
|
52505
|
+
access: "view"
|
|
52506
|
+
},
|
|
52507
|
+
"training.listDatasetVersions": {
|
|
52508
|
+
capName: "training",
|
|
52509
|
+
capScope: "system",
|
|
52510
|
+
addonId: null,
|
|
52511
|
+
access: "view"
|
|
52512
|
+
},
|
|
52513
|
+
"training.listJobs": {
|
|
52514
|
+
capName: "training",
|
|
52515
|
+
capScope: "system",
|
|
52516
|
+
addonId: null,
|
|
52517
|
+
access: "view"
|
|
52518
|
+
},
|
|
52519
|
+
"training.planJob": {
|
|
52520
|
+
capName: "training",
|
|
52521
|
+
capScope: "system",
|
|
52522
|
+
addonId: null,
|
|
52523
|
+
access: "view"
|
|
52524
|
+
},
|
|
52525
|
+
"training.putDatasetVersion": {
|
|
52526
|
+
capName: "training",
|
|
52527
|
+
capScope: "system",
|
|
52528
|
+
addonId: null,
|
|
52529
|
+
access: "create"
|
|
52530
|
+
},
|
|
52531
|
+
"training.registerResult": {
|
|
52532
|
+
capName: "training",
|
|
52533
|
+
capScope: "system",
|
|
52534
|
+
addonId: null,
|
|
52535
|
+
access: "create"
|
|
52536
|
+
},
|
|
52537
|
+
"training.removeDatasetVersion": {
|
|
52538
|
+
capName: "training",
|
|
52539
|
+
capScope: "system",
|
|
52540
|
+
addonId: null,
|
|
52541
|
+
access: "delete"
|
|
52542
|
+
},
|
|
52543
|
+
"training.rollbackCanary": {
|
|
52544
|
+
capName: "training",
|
|
52545
|
+
capScope: "system",
|
|
52546
|
+
addonId: null,
|
|
52547
|
+
access: "create"
|
|
52548
|
+
},
|
|
52549
|
+
"training.startJob": {
|
|
52550
|
+
capName: "training",
|
|
52551
|
+
capScope: "system",
|
|
52552
|
+
addonId: null,
|
|
52553
|
+
access: "create"
|
|
52554
|
+
},
|
|
52555
|
+
"trainingProvider.cancelJob": {
|
|
52556
|
+
capName: "training-provider",
|
|
52557
|
+
capScope: "system",
|
|
52558
|
+
addonId: null,
|
|
52559
|
+
access: "create"
|
|
52560
|
+
},
|
|
52561
|
+
"trainingProvider.cleanupJob": {
|
|
52562
|
+
capName: "training-provider",
|
|
52563
|
+
capScope: "system",
|
|
52564
|
+
addonId: null,
|
|
52565
|
+
access: "create"
|
|
52566
|
+
},
|
|
52567
|
+
"trainingProvider.describe": {
|
|
52568
|
+
capName: "training-provider",
|
|
52569
|
+
capScope: "system",
|
|
52570
|
+
addonId: null,
|
|
52571
|
+
access: "view"
|
|
52572
|
+
},
|
|
52573
|
+
"trainingProvider.estimateJob": {
|
|
52574
|
+
capName: "training-provider",
|
|
52575
|
+
capScope: "system",
|
|
52576
|
+
addonId: null,
|
|
52577
|
+
access: "view"
|
|
52578
|
+
},
|
|
52579
|
+
"trainingProvider.getJob": {
|
|
52580
|
+
capName: "training-provider",
|
|
52581
|
+
capScope: "system",
|
|
52582
|
+
addonId: null,
|
|
52583
|
+
access: "view"
|
|
52584
|
+
},
|
|
52585
|
+
"trainingProvider.listJobEvents": {
|
|
52586
|
+
capName: "training-provider",
|
|
52587
|
+
capScope: "system",
|
|
52588
|
+
addonId: null,
|
|
52589
|
+
access: "view"
|
|
52590
|
+
},
|
|
52591
|
+
"trainingProvider.listJobs": {
|
|
52592
|
+
capName: "training-provider",
|
|
52593
|
+
capScope: "system",
|
|
52594
|
+
addonId: null,
|
|
52595
|
+
access: "view"
|
|
52596
|
+
},
|
|
52597
|
+
"trainingProvider.offerArtifact": {
|
|
52598
|
+
capName: "training-provider",
|
|
52599
|
+
capScope: "system",
|
|
52600
|
+
addonId: null,
|
|
52601
|
+
access: "create"
|
|
52602
|
+
},
|
|
52603
|
+
"trainingProvider.readResult": {
|
|
52604
|
+
capName: "training-provider",
|
|
52605
|
+
capScope: "system",
|
|
52606
|
+
addonId: null,
|
|
52607
|
+
access: "create"
|
|
52608
|
+
},
|
|
52609
|
+
"trainingProvider.submitJob": {
|
|
52610
|
+
capName: "training-provider",
|
|
52611
|
+
capScope: "system",
|
|
52612
|
+
addonId: null,
|
|
52613
|
+
access: "create"
|
|
52614
|
+
},
|
|
52615
|
+
"trainingProvider.uploadDataset": {
|
|
52616
|
+
capName: "training-provider",
|
|
52617
|
+
capScope: "system",
|
|
52618
|
+
addonId: null,
|
|
52619
|
+
access: "create"
|
|
52620
|
+
},
|
|
52621
|
+
"trainingProvider.validateCredentials": {
|
|
52622
|
+
capName: "training-provider",
|
|
52623
|
+
capScope: "system",
|
|
52624
|
+
addonId: null,
|
|
52625
|
+
access: "create"
|
|
52626
|
+
},
|
|
50974
52627
|
"turnProvider.getTurnServers": {
|
|
50975
52628
|
capName: "turn-provider",
|
|
50976
52629
|
capScope: "system",
|
|
@@ -50995,12 +52648,6 @@ Object.freeze({
|
|
|
50995
52648
|
addonId: null,
|
|
50996
52649
|
access: "create"
|
|
50997
52650
|
},
|
|
50998
|
-
"userManagement.createApiKey": {
|
|
50999
|
-
capName: "user-management",
|
|
51000
|
-
capScope: "system",
|
|
51001
|
-
addonId: null,
|
|
51002
|
-
access: "create"
|
|
51003
|
-
},
|
|
51004
52651
|
"userManagement.createScopedToken": {
|
|
51005
52652
|
capName: "user-management",
|
|
51006
52653
|
capScope: "system",
|
|
@@ -51037,12 +52684,6 @@ Object.freeze({
|
|
|
51037
52684
|
addonId: null,
|
|
51038
52685
|
access: "view"
|
|
51039
52686
|
},
|
|
51040
|
-
"userManagement.linkExternalIdentity": {
|
|
51041
|
-
capName: "user-management",
|
|
51042
|
-
capScope: "system",
|
|
51043
|
-
addonId: null,
|
|
51044
|
-
access: "create"
|
|
51045
|
-
},
|
|
51046
52687
|
"userManagement.listApiKeys": {
|
|
51047
52688
|
capName: "user-management",
|
|
51048
52689
|
capScope: "system",
|
|
@@ -51145,12 +52786,6 @@ Object.freeze({
|
|
|
51145
52786
|
addonId: null,
|
|
51146
52787
|
access: "create"
|
|
51147
52788
|
},
|
|
51148
|
-
"userManagement.validateApiKey": {
|
|
51149
|
-
capName: "user-management",
|
|
51150
|
-
capScope: "system",
|
|
51151
|
-
addonId: null,
|
|
51152
|
-
access: "view"
|
|
51153
|
-
},
|
|
51154
52789
|
"userManagement.validateCredentials": {
|
|
51155
52790
|
capName: "user-management",
|
|
51156
52791
|
capScope: "system",
|
|
@@ -55264,6 +56899,11 @@ Object.freeze({
|
|
|
55264
56899
|
form: "single",
|
|
55265
56900
|
optional: false
|
|
55266
56901
|
}],
|
|
56902
|
+
"training.canaryResult": [{
|
|
56903
|
+
name: "deviceIds",
|
|
56904
|
+
form: "array",
|
|
56905
|
+
optional: false
|
|
56906
|
+
}],
|
|
55267
56907
|
"update.getStatus": [{
|
|
55268
56908
|
name: "deviceId",
|
|
55269
56909
|
form: "single",
|