@camstack/addon-provider-tuya 0.2.122 → 0.2.123
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.mjs
CHANGED
|
@@ -6196,7 +6196,7 @@ var ZodIssueCode = {
|
|
|
6196
6196
|
var ZodFirstPartyTypeKind;
|
|
6197
6197
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6198
6198
|
//#endregion
|
|
6199
|
-
//#region ../types/dist/sleep-
|
|
6199
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
6200
6200
|
/**
|
|
6201
6201
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6202
6202
|
* window to float samples (D455).
|
|
@@ -6313,7 +6313,7 @@ function isKeychainStoredField(field) {
|
|
|
6313
6313
|
var SECRET_CLEAR = { $secretClear: true };
|
|
6314
6314
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6315
6315
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
6316
|
-
function isRecord$
|
|
6316
|
+
function isRecord$2(value) {
|
|
6317
6317
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6318
6318
|
}
|
|
6319
6319
|
function makeSecretMarker(ref) {
|
|
@@ -6324,12 +6324,12 @@ function makeSecretMarker(ref) {
|
|
|
6324
6324
|
}
|
|
6325
6325
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6326
6326
|
function isSecretMarker(value) {
|
|
6327
|
-
if (!isRecord$
|
|
6327
|
+
if (!isRecord$2(value)) return false;
|
|
6328
6328
|
const ref = value["$secret"];
|
|
6329
6329
|
return typeof ref === "string" && ref.length > 0;
|
|
6330
6330
|
}
|
|
6331
6331
|
function isSecretClear(value) {
|
|
6332
|
-
return isRecord$
|
|
6332
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
6333
6333
|
}
|
|
6334
6334
|
/**
|
|
6335
6335
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6845,6 +6845,13 @@ function globalSecretScope() {
|
|
|
6845
6845
|
function encodeSegment(value) {
|
|
6846
6846
|
return encodeURIComponent(value);
|
|
6847
6847
|
}
|
|
6848
|
+
function decodeSegment(value) {
|
|
6849
|
+
try {
|
|
6850
|
+
return decodeURIComponent(value);
|
|
6851
|
+
} catch {
|
|
6852
|
+
return null;
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6848
6855
|
/**
|
|
6849
6856
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6850
6857
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6853,6 +6860,75 @@ function encodeSegment(value) {
|
|
|
6853
6860
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6854
6861
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6855
6862
|
}
|
|
6863
|
+
function parseScope(segments) {
|
|
6864
|
+
switch (segments[0]) {
|
|
6865
|
+
case "global": return {
|
|
6866
|
+
scope: GLOBAL_SCOPE,
|
|
6867
|
+
used: 1
|
|
6868
|
+
};
|
|
6869
|
+
case "node": {
|
|
6870
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6871
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6872
|
+
scope: {
|
|
6873
|
+
kind: "node",
|
|
6874
|
+
nodeId
|
|
6875
|
+
},
|
|
6876
|
+
used: 2
|
|
6877
|
+
};
|
|
6878
|
+
}
|
|
6879
|
+
case "device": {
|
|
6880
|
+
const raw = segments[1];
|
|
6881
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6882
|
+
return {
|
|
6883
|
+
scope: {
|
|
6884
|
+
kind: "device",
|
|
6885
|
+
deviceId: Number(raw)
|
|
6886
|
+
},
|
|
6887
|
+
used: 2
|
|
6888
|
+
};
|
|
6889
|
+
}
|
|
6890
|
+
case "integration": {
|
|
6891
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6892
|
+
return id === null || id.length === 0 ? null : {
|
|
6893
|
+
scope: {
|
|
6894
|
+
kind: "integration",
|
|
6895
|
+
integrationId: id
|
|
6896
|
+
},
|
|
6897
|
+
used: 2
|
|
6898
|
+
};
|
|
6899
|
+
}
|
|
6900
|
+
case "row": {
|
|
6901
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6902
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6903
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6904
|
+
return {
|
|
6905
|
+
scope: {
|
|
6906
|
+
kind: "row",
|
|
6907
|
+
collection,
|
|
6908
|
+
rowId
|
|
6909
|
+
},
|
|
6910
|
+
used: 3
|
|
6911
|
+
};
|
|
6912
|
+
}
|
|
6913
|
+
default: return null;
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6917
|
+
function parseSecretRef(ref) {
|
|
6918
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6919
|
+
const segments = ref.slice(9).split("/");
|
|
6920
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6921
|
+
if (owner === null || owner.length === 0) return null;
|
|
6922
|
+
const parsed = parseScope(segments.slice(1));
|
|
6923
|
+
if (parsed === null) return null;
|
|
6924
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6925
|
+
if (fieldPath.length === 0) return null;
|
|
6926
|
+
return {
|
|
6927
|
+
owner,
|
|
6928
|
+
scope: parsed.scope,
|
|
6929
|
+
fieldPath
|
|
6930
|
+
};
|
|
6931
|
+
}
|
|
6856
6932
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6857
6933
|
var KeychainWriteRefusedError = class extends Error {
|
|
6858
6934
|
fieldPath;
|
|
@@ -6863,7 +6939,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6863
6939
|
}
|
|
6864
6940
|
};
|
|
6865
6941
|
var KEEP = { kind: "keep" };
|
|
6866
|
-
function isRecord(value) {
|
|
6942
|
+
function isRecord$1(value) {
|
|
6867
6943
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6868
6944
|
}
|
|
6869
6945
|
function defaultMintId() {
|
|
@@ -6876,7 +6952,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6876
6952
|
return out;
|
|
6877
6953
|
}
|
|
6878
6954
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6879
|
-
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6955
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6880
6956
|
return out;
|
|
6881
6957
|
}
|
|
6882
6958
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6931,7 +7007,7 @@ function rowId(row, idKey) {
|
|
|
6931
7007
|
return null;
|
|
6932
7008
|
}
|
|
6933
7009
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6934
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
7010
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6935
7011
|
if (!Array.isArray(incoming)) {
|
|
6936
7012
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6937
7013
|
return {
|
|
@@ -6947,7 +7023,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6947
7023
|
const kept = /* @__PURE__ */ new Set();
|
|
6948
7024
|
const rows = [];
|
|
6949
7025
|
for (const row of incoming) {
|
|
6950
|
-
if (!isRecord(row)) {
|
|
7026
|
+
if (!isRecord$1(row)) {
|
|
6951
7027
|
rows.push(row);
|
|
6952
7028
|
continue;
|
|
6953
7029
|
}
|
|
@@ -6972,7 +7048,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6972
7048
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6973
7049
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6974
7050
|
case "object": {
|
|
6975
|
-
if (!isRecord(incoming)) {
|
|
7051
|
+
if (!isRecord$1(incoming)) {
|
|
6976
7052
|
if (incoming === void 0) return KEEP;
|
|
6977
7053
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6978
7054
|
return {
|
|
@@ -6980,7 +7056,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6980
7056
|
value: incoming
|
|
6981
7057
|
};
|
|
6982
7058
|
}
|
|
6983
|
-
const storedObj = isRecord(stored) ? stored : {};
|
|
7059
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6984
7060
|
return {
|
|
6985
7061
|
kind: "value",
|
|
6986
7062
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7039,12 +7115,19 @@ async function transformSecretWrite(input) {
|
|
|
7039
7115
|
}
|
|
7040
7116
|
};
|
|
7041
7117
|
}
|
|
7118
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
7119
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
7120
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
7121
|
+
}
|
|
7042
7122
|
/**
|
|
7043
7123
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7044
7124
|
* reference when there is no marker (no allocation, no keychain call).
|
|
7045
7125
|
*/
|
|
7046
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
7047
|
-
const
|
|
7126
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
7127
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
7128
|
+
const owner = options.ownedBy;
|
|
7129
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
7130
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
7048
7131
|
if (refs.length === 0) return {
|
|
7049
7132
|
value,
|
|
7050
7133
|
unresolved: []
|
|
@@ -7068,10 +7151,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7068
7151
|
}
|
|
7069
7152
|
const substitute = (v) => {
|
|
7070
7153
|
if (isSecretMarker(v)) {
|
|
7154
|
+
if (!inScope(v.$secret)) return {
|
|
7155
|
+
keep: true,
|
|
7156
|
+
value: v
|
|
7157
|
+
};
|
|
7071
7158
|
const answer = answers[v.$secret];
|
|
7072
|
-
|
|
7159
|
+
if (answer?.kind === "value") return {
|
|
7073
7160
|
keep: true,
|
|
7074
7161
|
value: answer.value
|
|
7162
|
+
};
|
|
7163
|
+
return keepMarker ? {
|
|
7164
|
+
keep: true,
|
|
7165
|
+
value: v
|
|
7075
7166
|
} : {
|
|
7076
7167
|
keep: false,
|
|
7077
7168
|
value: void 0
|
|
@@ -7088,7 +7179,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7088
7179
|
value: items
|
|
7089
7180
|
};
|
|
7090
7181
|
}
|
|
7091
|
-
if (isRecord(v)) {
|
|
7182
|
+
if (isRecord$1(v)) {
|
|
7092
7183
|
const out = {};
|
|
7093
7184
|
for (const [k, child] of Object.entries(v)) {
|
|
7094
7185
|
const s = substitute(child);
|
|
@@ -7109,14 +7200,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
7109
7200
|
unresolved
|
|
7110
7201
|
};
|
|
7111
7202
|
}
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7203
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
7204
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
7205
|
+
ref;
|
|
7206
|
+
reason;
|
|
7207
|
+
constructor(ref, reason) {
|
|
7208
|
+
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.`);
|
|
7209
|
+
this.ref = ref;
|
|
7210
|
+
this.reason = reason;
|
|
7211
|
+
this.name = "SecretOverwriteRefusedError";
|
|
7212
|
+
}
|
|
7213
|
+
};
|
|
7214
|
+
function isRecord(value) {
|
|
7215
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7216
|
+
}
|
|
7217
|
+
function resolvedValue(pass, marker) {
|
|
7218
|
+
const answer = pass.answers[marker.$secret];
|
|
7219
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
7220
|
+
}
|
|
7221
|
+
async function atMarker(pass, incoming, stored) {
|
|
7222
|
+
if (incoming === null) return stored;
|
|
7223
|
+
if (typeof incoming !== "string") return incoming;
|
|
7224
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
7225
|
+
const intent = classifySecretWrite(incoming);
|
|
7226
|
+
if (intent.kind !== "set") return stored;
|
|
7227
|
+
const ref = stored.$secret;
|
|
7228
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
7229
|
+
const answer = pass.answers[ref];
|
|
7230
|
+
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);
|
|
7231
|
+
try {
|
|
7232
|
+
await pass.secrets.put(ref, intent.value);
|
|
7233
|
+
} catch (err) {
|
|
7234
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
7235
|
+
}
|
|
7236
|
+
pass.changedRefs.push(ref);
|
|
7237
|
+
return stored;
|
|
7238
|
+
}
|
|
7239
|
+
function inArray(pass, incoming, stored) {
|
|
7240
|
+
return incoming.map((item, index) => {
|
|
7241
|
+
const twin = stored[index];
|
|
7242
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7243
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
7244
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7245
|
+
return item;
|
|
7246
|
+
});
|
|
7247
|
+
}
|
|
7248
|
+
function inArrayRow(pass, incoming, stored) {
|
|
7249
|
+
const out = { ...incoming };
|
|
7250
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
7251
|
+
const twin = stored[key];
|
|
7252
|
+
if (isSecretMarker(twin)) {
|
|
7253
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7254
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7255
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7256
|
+
}
|
|
7257
|
+
return out;
|
|
7258
|
+
}
|
|
7259
|
+
async function walk(pass, incoming, stored) {
|
|
7260
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7261
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7262
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
7263
|
+
const out = { ...incoming };
|
|
7264
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7265
|
+
return out;
|
|
7266
|
+
}
|
|
7267
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
7268
|
+
async function restoreUnchangedSecrets(input) {
|
|
7269
|
+
const refs = [];
|
|
7270
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
7271
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
7272
|
+
if (owned.length === 0) return {
|
|
7273
|
+
patch: input.patch,
|
|
7274
|
+
changedRefs: []
|
|
7275
|
+
};
|
|
7276
|
+
const pass = {
|
|
7277
|
+
secrets: input.secrets,
|
|
7278
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
7279
|
+
operatorWrite: input.operatorWrite,
|
|
7280
|
+
changedRefs: []
|
|
7281
|
+
};
|
|
7282
|
+
const out = {};
|
|
7283
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
7284
|
+
return {
|
|
7285
|
+
patch: out,
|
|
7286
|
+
changedRefs: pass.changedRefs
|
|
7287
|
+
};
|
|
7288
|
+
}
|
|
7289
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
7290
|
+
function isJsonEqual(a, b) {
|
|
7291
|
+
if (Object.is(a, b)) return true;
|
|
7292
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7293
|
+
if (isRecord(a) && isRecord(b)) {
|
|
7294
|
+
const keys = Object.keys(a);
|
|
7295
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
7296
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
7117
7297
|
}
|
|
7118
7298
|
return false;
|
|
7119
7299
|
}
|
|
7300
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
7301
|
+
function dropUnchangedKeys(patch, stored) {
|
|
7302
|
+
const out = {};
|
|
7303
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
7304
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
7305
|
+
out[key] = value;
|
|
7306
|
+
}
|
|
7307
|
+
return out;
|
|
7308
|
+
}
|
|
7309
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
7310
|
+
function markerKeysOf(blob, owner) {
|
|
7311
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7312
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
7313
|
+
return keys;
|
|
7314
|
+
}
|
|
7315
|
+
function nodeFromStored(value, owner) {
|
|
7316
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7317
|
+
if (!isRecord(value)) return null;
|
|
7318
|
+
const children = /* @__PURE__ */ new Map();
|
|
7319
|
+
for (const [key, child] of Object.entries(value)) {
|
|
7320
|
+
const node = nodeFromStored(child, owner);
|
|
7321
|
+
if (node !== null) children.set(key, node);
|
|
7322
|
+
}
|
|
7323
|
+
return children.size > 0 ? {
|
|
7324
|
+
kind: "object",
|
|
7325
|
+
children
|
|
7326
|
+
} : null;
|
|
7327
|
+
}
|
|
7328
|
+
/**
|
|
7329
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
7330
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
7331
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
7332
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
7333
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
7334
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
7335
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
7336
|
+
* over.
|
|
7337
|
+
*/
|
|
7338
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
7339
|
+
const added = /* @__PURE__ */ new Map();
|
|
7340
|
+
for (const key of keys) {
|
|
7341
|
+
const at = key.indexOf("@");
|
|
7342
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
7343
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
7344
|
+
const node = nodeFromStored(stored[key], owner);
|
|
7345
|
+
if (node !== null) added.set(base, node);
|
|
7346
|
+
}
|
|
7347
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
7348
|
+
}
|
|
7120
7349
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7121
7350
|
async function readStoredAddonBlob(raw) {
|
|
7122
7351
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -7125,7 +7354,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
7125
7354
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7126
7355
|
return result.kind === "missing" ? {} : result.value;
|
|
7127
7356
|
}
|
|
7128
|
-
function
|
|
7357
|
+
function touchesTree(tree, patch) {
|
|
7358
|
+
if (tree.size === 0) return false;
|
|
7359
|
+
for (const key of Object.keys(patch)) {
|
|
7360
|
+
const at = key.indexOf("@");
|
|
7361
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7362
|
+
}
|
|
7363
|
+
return false;
|
|
7364
|
+
}
|
|
7365
|
+
/**
|
|
7366
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
7367
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
7368
|
+
*/
|
|
7369
|
+
var MarkerKeyIndex = class {
|
|
7370
|
+
owner;
|
|
7371
|
+
byStore = /* @__PURE__ */ new Map();
|
|
7372
|
+
constructor(owner) {
|
|
7373
|
+
this.owner = owner;
|
|
7374
|
+
}
|
|
7375
|
+
seen(store, blob) {
|
|
7376
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
7377
|
+
}
|
|
7378
|
+
wrote(store, patch) {
|
|
7379
|
+
const keys = this.byStore.get(store);
|
|
7380
|
+
if (keys === void 0) return;
|
|
7381
|
+
const now = markerKeysOf(patch, this.owner);
|
|
7382
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
7383
|
+
else keys.delete(key);
|
|
7384
|
+
}
|
|
7385
|
+
mayHoldMarkers(store, patch) {
|
|
7386
|
+
const keys = this.byStore.get(store);
|
|
7387
|
+
if (keys === void 0) return true;
|
|
7388
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
7389
|
+
}
|
|
7390
|
+
};
|
|
7391
|
+
function createHandle(raw, opts) {
|
|
7129
7392
|
const chains = /* @__PURE__ */ new Map();
|
|
7130
7393
|
const serialize = (key, fn) => {
|
|
7131
7394
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -7136,46 +7399,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
7136
7399
|
});
|
|
7137
7400
|
return next;
|
|
7138
7401
|
};
|
|
7139
|
-
const
|
|
7140
|
-
|
|
7141
|
-
|
|
7402
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
7403
|
+
const resolveRead = async (store, blob) => {
|
|
7404
|
+
index.seen(store, blob);
|
|
7405
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
7406
|
+
unresolved: "keep-marker",
|
|
7407
|
+
ownedBy: opts.secrets.owner
|
|
7408
|
+
});
|
|
7409
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7410
|
+
return value;
|
|
7411
|
+
};
|
|
7412
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
7413
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
7414
|
+
await rawWrite(patch);
|
|
7415
|
+
index.wrote(store, patch);
|
|
7416
|
+
return { changed: true };
|
|
7417
|
+
}
|
|
7418
|
+
return serialize(store, async () => {
|
|
7142
7419
|
const stored = await readStored();
|
|
7420
|
+
index.seen(store, stored);
|
|
7421
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
7422
|
+
const restored = await restoreUnchangedSecrets({
|
|
7423
|
+
patch,
|
|
7424
|
+
stored,
|
|
7425
|
+
secrets: opts.secrets,
|
|
7426
|
+
operatorWrite
|
|
7427
|
+
});
|
|
7143
7428
|
const result = await transformSecretWrite({
|
|
7144
|
-
tree,
|
|
7429
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
7145
7430
|
secrets: opts.secrets,
|
|
7146
|
-
patch,
|
|
7431
|
+
patch: restored.patch,
|
|
7147
7432
|
stored,
|
|
7148
7433
|
...scope !== void 0 ? { scope } : {},
|
|
7149
|
-
operatorWrite
|
|
7434
|
+
operatorWrite
|
|
7150
7435
|
});
|
|
7151
|
-
|
|
7436
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7437
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7438
|
+
if (wroteBlob) {
|
|
7439
|
+
await rawWrite(effective);
|
|
7440
|
+
index.wrote(store, effective);
|
|
7441
|
+
}
|
|
7152
7442
|
const { orphaned } = await result.afterWrite();
|
|
7153
7443
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7444
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
7154
7445
|
});
|
|
7155
7446
|
};
|
|
7156
|
-
const
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7447
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7448
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7449
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7450
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7451
|
+
const overrides = {
|
|
7452
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7453
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7454
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7455
|
+
return result.kind === "value" ? {
|
|
7456
|
+
kind: "value",
|
|
7457
|
+
value: await resolveRead("addon", result.value)
|
|
7458
|
+
} : result;
|
|
7459
|
+
} } : {},
|
|
7460
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7461
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7462
|
+
if (result.kind !== "present") return result;
|
|
7463
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7464
|
+
unresolved: "keep-marker",
|
|
7465
|
+
ownedBy: opts.secrets.owner
|
|
7466
|
+
});
|
|
7467
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7468
|
+
return {
|
|
7469
|
+
kind: "present",
|
|
7470
|
+
value: value[key]
|
|
7471
|
+
};
|
|
7472
|
+
} } : {},
|
|
7473
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7474
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7475
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7476
|
+
const out = /* @__PURE__ */ new Map();
|
|
7477
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7478
|
+
return out;
|
|
7479
|
+
} } : {},
|
|
7480
|
+
writeAddonStore: async (patch) => {
|
|
7481
|
+
await writeAddon(patch);
|
|
7482
|
+
},
|
|
7483
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7484
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7485
|
+
kind: "device",
|
|
7486
|
+
deviceId
|
|
7487
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7488
|
+
}
|
|
7489
|
+
};
|
|
7490
|
+
return {
|
|
7491
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7492
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7493
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7494
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7495
|
+
} }),
|
|
7496
|
+
raw: {
|
|
7497
|
+
readAddonStore: async () => {
|
|
7498
|
+
const blob = await raw.readAddonStore();
|
|
7499
|
+
index.seen("addon", blob);
|
|
7500
|
+
return blob;
|
|
7501
|
+
},
|
|
7502
|
+
readDeviceStore: async (deviceId) => {
|
|
7503
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7504
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7505
|
+
return blob;
|
|
7506
|
+
}
|
|
7507
|
+
},
|
|
7508
|
+
writeAddonStore: writeAddon
|
|
7162
7509
|
};
|
|
7163
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
7164
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
7165
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
7166
|
-
const value = Reflect.get(target, prop, receiver);
|
|
7167
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
7168
|
-
} });
|
|
7169
7510
|
}
|
|
7170
|
-
/** The context the addon sees
|
|
7171
|
-
function
|
|
7511
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7512
|
+
function createSecretAwareContext(context, opts) {
|
|
7172
7513
|
const raw = context.settings;
|
|
7173
|
-
if (raw === void 0) return
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7514
|
+
if (raw === void 0) return {
|
|
7515
|
+
context,
|
|
7516
|
+
handle: null
|
|
7517
|
+
};
|
|
7518
|
+
const handle = createHandle(raw, opts);
|
|
7519
|
+
return {
|
|
7520
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7521
|
+
if (prop === "settings") return handle.settings;
|
|
7522
|
+
return Reflect.get(target, prop, receiver);
|
|
7523
|
+
} }),
|
|
7524
|
+
handle
|
|
7525
|
+
};
|
|
7179
7526
|
}
|
|
7180
7527
|
var LEAF = { kind: "leaf" };
|
|
7181
7528
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -7350,6 +7697,14 @@ var BaseAddon = class {
|
|
|
7350
7697
|
_secretChangeUnsub = null;
|
|
7351
7698
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7352
7699
|
_operatorWriteDepth = 0;
|
|
7700
|
+
/**
|
|
7701
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7702
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7703
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7704
|
+
*/
|
|
7705
|
+
_secretSettings = null;
|
|
7706
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7707
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
7353
7708
|
constructor(defaults) {
|
|
7354
7709
|
this.defaults = defaults;
|
|
7355
7710
|
this._config = { ...defaults };
|
|
@@ -7386,13 +7741,21 @@ var BaseAddon = class {
|
|
|
7386
7741
|
}
|
|
7387
7742
|
async initialize(context) {
|
|
7388
7743
|
const secrets = context.secrets;
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7744
|
+
if (secrets !== void 0) {
|
|
7745
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7746
|
+
secrets,
|
|
7747
|
+
addonTree: () => this.addonSecretTree(),
|
|
7748
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7749
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7750
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7751
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7752
|
+
});
|
|
7753
|
+
this._ctx = wrapped;
|
|
7754
|
+
this._secretSettings = handle;
|
|
7755
|
+
} else {
|
|
7756
|
+
this._ctx = context;
|
|
7757
|
+
this._secretSettings = null;
|
|
7758
|
+
}
|
|
7396
7759
|
await this.resolveConfig();
|
|
7397
7760
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7398
7761
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7509,11 +7872,8 @@ var BaseAddon = class {
|
|
|
7509
7872
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7510
7873
|
const schema = this.globalSettingsSchema(cap);
|
|
7511
7874
|
if (!schema) return { sections: [] };
|
|
7512
|
-
const projected = await this.
|
|
7513
|
-
return hydrateSchema(schema, overlay ? {
|
|
7514
|
-
...projected,
|
|
7515
|
-
...overlay
|
|
7516
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7875
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7876
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7517
7877
|
}
|
|
7518
7878
|
/**
|
|
7519
7879
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7558,7 +7918,7 @@ var BaseAddon = class {
|
|
|
7558
7918
|
});
|
|
7559
7919
|
}
|
|
7560
7920
|
if (sections.length === 0) return null;
|
|
7561
|
-
const projected = await this.
|
|
7921
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7562
7922
|
return hydrateSchema({
|
|
7563
7923
|
...schema,
|
|
7564
7924
|
sections
|
|
@@ -7575,12 +7935,50 @@ var BaseAddon = class {
|
|
|
7575
7935
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7576
7936
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7577
7937
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7938
|
+
*
|
|
7939
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7940
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7941
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7942
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7943
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7944
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7578
7945
|
*/
|
|
7579
7946
|
async resolveGlobalStore(nodeId, cap) {
|
|
7580
7947
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7948
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7949
|
+
}
|
|
7950
|
+
projectForNode(store, nodeId, cap) {
|
|
7581
7951
|
const keys = this.perNodeKeys(cap);
|
|
7582
7952
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7583
|
-
return keys.size > 0 ? projectStore(
|
|
7953
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7954
|
+
}
|
|
7955
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7956
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7957
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7958
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7959
|
+
}
|
|
7960
|
+
/**
|
|
7961
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7962
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7963
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7964
|
+
* its value.
|
|
7965
|
+
*/
|
|
7966
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7967
|
+
const secrets = this._ctx?.secrets;
|
|
7968
|
+
const merged = {
|
|
7969
|
+
...stored,
|
|
7970
|
+
...overlay
|
|
7971
|
+
};
|
|
7972
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7973
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7974
|
+
unresolved: "keep-marker",
|
|
7975
|
+
ownedBy: secrets.owner
|
|
7976
|
+
});
|
|
7977
|
+
for (const key of Object.keys(overlay)) {
|
|
7978
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7979
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7980
|
+
}
|
|
7981
|
+
return merged;
|
|
7584
7982
|
}
|
|
7585
7983
|
/**
|
|
7586
7984
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7645,8 +8043,12 @@ var BaseAddon = class {
|
|
|
7645
8043
|
async clearSecrets(keys, nodeId) {
|
|
7646
8044
|
const tree = this.addonSecretTree();
|
|
7647
8045
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8046
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7648
8047
|
const patch = {};
|
|
7649
|
-
for (const key of keys)
|
|
8048
|
+
for (const key of keys) {
|
|
8049
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8050
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8051
|
+
}
|
|
7650
8052
|
await this.applyGlobalPatch(patch, nodeId);
|
|
7651
8053
|
}
|
|
7652
8054
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -7654,7 +8056,11 @@ var BaseAddon = class {
|
|
|
7654
8056
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7655
8057
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7656
8058
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7657
|
-
|
|
8059
|
+
const handle = this._secretSettings;
|
|
8060
|
+
if (handle !== null) {
|
|
8061
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
8062
|
+
if (!changed) return;
|
|
8063
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7658
8064
|
if (target !== localNode) return;
|
|
7659
8065
|
await this.resolveConfig();
|
|
7660
8066
|
await this.onConfigChanged();
|
|
@@ -7707,7 +8113,7 @@ var BaseAddon = class {
|
|
|
7707
8113
|
async getDeviceSettings(deviceId) {
|
|
7708
8114
|
const schema = this.deviceSettingsSchema();
|
|
7709
8115
|
if (!schema) return { sections: [] };
|
|
7710
|
-
return hydrateSchema(schema, await this.
|
|
8116
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7711
8117
|
}
|
|
7712
8118
|
async updateDeviceSettings(deviceId, patch) {
|
|
7713
8119
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7879,7 +8285,7 @@ var BaseAddon = class {
|
|
|
7879
8285
|
key,
|
|
7880
8286
|
schema,
|
|
7881
8287
|
fallback,
|
|
7882
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
8288
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7883
8289
|
write: async (patch) => {
|
|
7884
8290
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7885
8291
|
},
|
|
@@ -7941,6 +8347,23 @@ var BaseAddon = class {
|
|
|
7941
8347
|
}
|
|
7942
8348
|
return value;
|
|
7943
8349
|
}
|
|
8350
|
+
/**
|
|
8351
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
8352
|
+
* keychain the context's own view is already raw.
|
|
8353
|
+
*/
|
|
8354
|
+
rawSettings() {
|
|
8355
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
8356
|
+
}
|
|
8357
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
8358
|
+
logUnresolvedRead(unresolved) {
|
|
8359
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
8360
|
+
if (fresh.length === 0) return;
|
|
8361
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
8362
|
+
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) => ({
|
|
8363
|
+
ref: u.ref,
|
|
8364
|
+
reason: u.reason
|
|
8365
|
+
})) } });
|
|
8366
|
+
}
|
|
7944
8367
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7945
8368
|
scheduleSecretReresolve(delayMs) {
|
|
7946
8369
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7967,7 +8390,7 @@ var BaseAddon = class {
|
|
|
7967
8390
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7968
8391
|
*/
|
|
7969
8392
|
async readAddonStoreWithRetry() {
|
|
7970
|
-
const settings = this.
|
|
8393
|
+
const settings = this.rawSettings();
|
|
7971
8394
|
if (!settings) return {};
|
|
7972
8395
|
const delaysMs = [
|
|
7973
8396
|
150,
|
|
@@ -10270,6 +10693,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
10270
10693
|
fetchedAt: number()
|
|
10271
10694
|
});
|
|
10272
10695
|
/**
|
|
10696
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10697
|
+
* gets back (cloud training, D805+).
|
|
10698
|
+
*
|
|
10699
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10700
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10701
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10702
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10703
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10704
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10705
|
+
* change there, in the same piece of work.
|
|
10706
|
+
*
|
|
10707
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10708
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10709
|
+
*/
|
|
10710
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10711
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10712
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10713
|
+
var TrainingExportSchema = _enum([
|
|
10714
|
+
"onnx",
|
|
10715
|
+
"openvino-fp16",
|
|
10716
|
+
"openvino-int8",
|
|
10717
|
+
"coreml-fp16"
|
|
10718
|
+
]);
|
|
10719
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10720
|
+
object({
|
|
10721
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10722
|
+
jobKey: string().uuid(),
|
|
10723
|
+
target: object({
|
|
10724
|
+
kind: literal("detector"),
|
|
10725
|
+
step: literal("object-detection")
|
|
10726
|
+
}),
|
|
10727
|
+
base: object({
|
|
10728
|
+
modelId: string().min(1),
|
|
10729
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10730
|
+
weights: string().min(1),
|
|
10731
|
+
imgsz: number().int().positive()
|
|
10732
|
+
}),
|
|
10733
|
+
baseline: object({
|
|
10734
|
+
modelId: string().min(1),
|
|
10735
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10736
|
+
onnxUrl: string().url(),
|
|
10737
|
+
imgsz: number().int().positive(),
|
|
10738
|
+
floors: FloorsSchema
|
|
10739
|
+
}),
|
|
10740
|
+
dataset: object({
|
|
10741
|
+
versionId: string().min(1),
|
|
10742
|
+
annotationHash: string(),
|
|
10743
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10744
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10745
|
+
}),
|
|
10746
|
+
split: object({
|
|
10747
|
+
holdoutCameras: array(number().int()),
|
|
10748
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10749
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10750
|
+
valFraction: number().min(0).max(.5),
|
|
10751
|
+
seed: number().int()
|
|
10752
|
+
}),
|
|
10753
|
+
hyper: object({
|
|
10754
|
+
epochs: number().int().positive(),
|
|
10755
|
+
batch: number().int().positive(),
|
|
10756
|
+
lr0: number().positive(),
|
|
10757
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10758
|
+
freeze: number().int().nonnegative(),
|
|
10759
|
+
patience: number().int().nonnegative(),
|
|
10760
|
+
seed: number().int()
|
|
10761
|
+
}),
|
|
10762
|
+
replay: object({
|
|
10763
|
+
source: literal("coco2017"),
|
|
10764
|
+
count: number().int().nonnegative()
|
|
10765
|
+
}),
|
|
10766
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10767
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10768
|
+
floors: object({
|
|
10769
|
+
minSupport: number().int().positive(),
|
|
10770
|
+
clamp: number().min(0).max(1)
|
|
10771
|
+
}),
|
|
10772
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10773
|
+
catalog: object({
|
|
10774
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10775
|
+
name: string().min(1).max(160)
|
|
10776
|
+
})
|
|
10777
|
+
});
|
|
10778
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10779
|
+
var TrainingResultFileSchema = object({
|
|
10780
|
+
path: string().min(1),
|
|
10781
|
+
bytes: number().int().nonnegative(),
|
|
10782
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10783
|
+
format: _enum([
|
|
10784
|
+
"onnx",
|
|
10785
|
+
"openvino",
|
|
10786
|
+
"coreml",
|
|
10787
|
+
"pt"
|
|
10788
|
+
]),
|
|
10789
|
+
variant: _enum(["base", "int8"])
|
|
10790
|
+
});
|
|
10791
|
+
var DraftFormatSchema = object({
|
|
10792
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10793
|
+
url: string().min(1),
|
|
10794
|
+
sizeMB: number().nonnegative(),
|
|
10795
|
+
isDirectory: boolean().optional(),
|
|
10796
|
+
files: array(string()).optional(),
|
|
10797
|
+
runtimes: array(literal("python")).optional(),
|
|
10798
|
+
revision: string().min(1)
|
|
10799
|
+
});
|
|
10800
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10801
|
+
var TrainingCatalogDraftSchema = object({
|
|
10802
|
+
id: string().min(1),
|
|
10803
|
+
name: string().min(1),
|
|
10804
|
+
description: string(),
|
|
10805
|
+
labels: array(unknown()),
|
|
10806
|
+
inputSize: object({
|
|
10807
|
+
width: number().int().positive(),
|
|
10808
|
+
height: number().int().positive()
|
|
10809
|
+
}),
|
|
10810
|
+
preprocessMode: literal("letterbox"),
|
|
10811
|
+
defaultClassFloors: FloorsSchema,
|
|
10812
|
+
formats: object({
|
|
10813
|
+
onnx: DraftFormatSchema.optional(),
|
|
10814
|
+
openvino: DraftFormatSchema.optional(),
|
|
10815
|
+
coreml: DraftFormatSchema.optional()
|
|
10816
|
+
})
|
|
10817
|
+
});
|
|
10818
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10819
|
+
var TrainingEvalClassSchema = object({
|
|
10820
|
+
positives: number().int(),
|
|
10821
|
+
floor: number().nullable(),
|
|
10822
|
+
tp: number().int(),
|
|
10823
|
+
fp: number().int(),
|
|
10824
|
+
fn: number().int(),
|
|
10825
|
+
precision: number().nullable(),
|
|
10826
|
+
recall: number().nullable(),
|
|
10827
|
+
ap50: number().nullable(),
|
|
10828
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10829
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10830
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10831
|
+
smallFound: number().int().optional(),
|
|
10832
|
+
smallTotal: number().int().optional()
|
|
10833
|
+
}).passthrough();
|
|
10834
|
+
var TrainingEvalReportSchema = object({
|
|
10835
|
+
frames: number().int(),
|
|
10836
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10837
|
+
}).passthrough();
|
|
10838
|
+
/**
|
|
10839
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10840
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10841
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10842
|
+
*/
|
|
10843
|
+
var TrainingResultSchema = object({
|
|
10844
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10845
|
+
jobKey: string(),
|
|
10846
|
+
status: _enum(["succeeded", "failed"]),
|
|
10847
|
+
error: object({
|
|
10848
|
+
stage: string(),
|
|
10849
|
+
code: string(),
|
|
10850
|
+
message: string()
|
|
10851
|
+
}).nullable(),
|
|
10852
|
+
trainer: object({
|
|
10853
|
+
version: string(),
|
|
10854
|
+
revision: string()
|
|
10855
|
+
}),
|
|
10856
|
+
toolchain: record(string(), string().nullable()),
|
|
10857
|
+
dataset: object({
|
|
10858
|
+
versionId: string(),
|
|
10859
|
+
annotationHash: string(),
|
|
10860
|
+
sha256: string(),
|
|
10861
|
+
frames: object({
|
|
10862
|
+
train: number().int(),
|
|
10863
|
+
val: number().int(),
|
|
10864
|
+
holdout: number().int()
|
|
10865
|
+
}),
|
|
10866
|
+
holdoutCameras: array(number().int()),
|
|
10867
|
+
replayImages: number().int()
|
|
10868
|
+
}).optional(),
|
|
10869
|
+
training: object({
|
|
10870
|
+
epochsRun: number().int(),
|
|
10871
|
+
bestEpoch: number().int(),
|
|
10872
|
+
bestMap50: number(),
|
|
10873
|
+
bestMap50_95: number(),
|
|
10874
|
+
seconds: number()
|
|
10875
|
+
}).optional(),
|
|
10876
|
+
evaluation: object({
|
|
10877
|
+
holdoutFrames: number().int(),
|
|
10878
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10879
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10880
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10881
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10882
|
+
map50: record(string(), number().nullable())
|
|
10883
|
+
}).optional(),
|
|
10884
|
+
floors: object({
|
|
10885
|
+
baseline: FloorsSchema,
|
|
10886
|
+
candidate: FloorsSchema,
|
|
10887
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10888
|
+
notes: array(string())
|
|
10889
|
+
}).optional(),
|
|
10890
|
+
int8: object({
|
|
10891
|
+
kept: boolean(),
|
|
10892
|
+
map50Fp16: number().nullable(),
|
|
10893
|
+
map50Int8: number().nullable(),
|
|
10894
|
+
reason: string().nullable()
|
|
10895
|
+
}).optional(),
|
|
10896
|
+
exportsDropped: array(object({
|
|
10897
|
+
export: string(),
|
|
10898
|
+
reason: string()
|
|
10899
|
+
})).optional(),
|
|
10900
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10901
|
+
bundle: object({
|
|
10902
|
+
path: literal("bundle.tar"),
|
|
10903
|
+
bytes: number().int().nonnegative(),
|
|
10904
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10905
|
+
}).nullable().optional(),
|
|
10906
|
+
catalogDraft: object({
|
|
10907
|
+
base: TrainingCatalogDraftSchema,
|
|
10908
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10909
|
+
}).nullable().optional(),
|
|
10910
|
+
licence: string()
|
|
10911
|
+
});
|
|
10912
|
+
var TrainingStageSchema = _enum([
|
|
10913
|
+
"prepare",
|
|
10914
|
+
"replay",
|
|
10915
|
+
"train",
|
|
10916
|
+
"eval",
|
|
10917
|
+
"export",
|
|
10918
|
+
"package"
|
|
10919
|
+
]);
|
|
10920
|
+
var EventBase = {
|
|
10921
|
+
v: literal(1),
|
|
10922
|
+
ts: number()
|
|
10923
|
+
};
|
|
10924
|
+
discriminatedUnion("type", [
|
|
10925
|
+
object({
|
|
10926
|
+
...EventBase,
|
|
10927
|
+
type: literal("stage"),
|
|
10928
|
+
stage: TrainingStageSchema
|
|
10929
|
+
}),
|
|
10930
|
+
object({
|
|
10931
|
+
...EventBase,
|
|
10932
|
+
type: literal("epoch"),
|
|
10933
|
+
epoch: number().int(),
|
|
10934
|
+
epochs: number().int(),
|
|
10935
|
+
boxLoss: number().nullable().optional(),
|
|
10936
|
+
map50: number().nullable().optional(),
|
|
10937
|
+
map50_95: number().nullable().optional(),
|
|
10938
|
+
etaSec: number().nullable().optional()
|
|
10939
|
+
}),
|
|
10940
|
+
object({
|
|
10941
|
+
...EventBase,
|
|
10942
|
+
type: literal("metric"),
|
|
10943
|
+
name: string(),
|
|
10944
|
+
value: number()
|
|
10945
|
+
}),
|
|
10946
|
+
object({
|
|
10947
|
+
...EventBase,
|
|
10948
|
+
type: literal("artifact"),
|
|
10949
|
+
path: string(),
|
|
10950
|
+
bytes: number(),
|
|
10951
|
+
sha256: string()
|
|
10952
|
+
}),
|
|
10953
|
+
object({
|
|
10954
|
+
...EventBase,
|
|
10955
|
+
type: literal("done"),
|
|
10956
|
+
status: _enum(["succeeded", "failed"]),
|
|
10957
|
+
resultSha256: string().nullable().optional()
|
|
10958
|
+
}),
|
|
10959
|
+
object({
|
|
10960
|
+
...EventBase,
|
|
10961
|
+
type: literal("error"),
|
|
10962
|
+
stage: string(),
|
|
10963
|
+
code: string(),
|
|
10964
|
+
message: string()
|
|
10965
|
+
})
|
|
10966
|
+
]);
|
|
10967
|
+
/**
|
|
10273
10968
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
10274
10969
|
*
|
|
10275
10970
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12597,7 +13292,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12597
13292
|
"authenticated",
|
|
12598
13293
|
"admin"
|
|
12599
13294
|
]).optional(),
|
|
12600
|
-
description: string().optional()
|
|
13295
|
+
description: string().optional(),
|
|
13296
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13297
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12601
13298
|
});
|
|
12602
13299
|
/**
|
|
12603
13300
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13302,6 +13999,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13302
13999
|
lastError: string().optional()
|
|
13303
14000
|
});
|
|
13304
14001
|
/**
|
|
14002
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
14003
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
14004
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
14005
|
+
* with it off — which restores without a key.
|
|
14006
|
+
*/
|
|
14007
|
+
var BackupArchiveEncryptionSchema = object({
|
|
14008
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
14009
|
+
scheme: string(),
|
|
14010
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
14011
|
+
keyId: string()
|
|
14012
|
+
});
|
|
14013
|
+
/**
|
|
14014
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
14015
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
14016
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
14017
|
+
*/
|
|
14018
|
+
var BackupEncryptionStatusSchema = object({
|
|
14019
|
+
enabled: boolean(),
|
|
14020
|
+
active: object({
|
|
14021
|
+
keyId: string(),
|
|
14022
|
+
publicKey: string(),
|
|
14023
|
+
createdAt: number()
|
|
14024
|
+
}).nullable(),
|
|
14025
|
+
/** Every key ever set up, newest first. */
|
|
14026
|
+
keys: array(object({
|
|
14027
|
+
keyId: string(),
|
|
14028
|
+
createdAt: number(),
|
|
14029
|
+
retiredAt: number().nullable()
|
|
14030
|
+
})).readonly()
|
|
14031
|
+
});
|
|
14032
|
+
/**
|
|
13305
14033
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13306
14034
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13307
14035
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13313,7 +14041,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13313
14041
|
sizeBytes: number(),
|
|
13314
14042
|
label: string().optional(),
|
|
13315
14043
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13316
|
-
locations: array(string()).readonly()
|
|
14044
|
+
locations: array(string()).readonly(),
|
|
14045
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
14046
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13317
14047
|
});
|
|
13318
14048
|
var BackupEntrySchema = object({
|
|
13319
14049
|
id: string(),
|
|
@@ -13322,7 +14052,8 @@ var BackupEntrySchema = object({
|
|
|
13322
14052
|
label: string().optional(),
|
|
13323
14053
|
createdAt: number(),
|
|
13324
14054
|
sizeBytes: number(),
|
|
13325
|
-
locations: array(string()).optional()
|
|
14055
|
+
locations: array(string()).optional(),
|
|
14056
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13326
14057
|
});
|
|
13327
14058
|
var ArchiveEntrySchema = object({
|
|
13328
14059
|
path: string(),
|
|
@@ -13511,10 +14242,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13511
14242
|
* this list and skips entries whose path doesn't start with
|
|
13512
14243
|
* any of them.
|
|
13513
14244
|
*/
|
|
13514
|
-
locations: array(string()).optional()
|
|
14245
|
+
locations: array(string()).optional(),
|
|
14246
|
+
/**
|
|
14247
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
14248
|
+
* one). The archive is decrypted into the hub's private staging
|
|
14249
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
14250
|
+
* is refused before the archive is downloaded.
|
|
14251
|
+
*/
|
|
14252
|
+
backupSecretKey: string().optional()
|
|
13515
14253
|
}), _void(), {
|
|
13516
14254
|
kind: "mutation",
|
|
13517
14255
|
auth: "admin"
|
|
14256
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
14257
|
+
keyId: string(),
|
|
14258
|
+
secretKey: string(),
|
|
14259
|
+
publicKey: string(),
|
|
14260
|
+
createdAt: number(),
|
|
14261
|
+
replacedKeyId: string().nullable()
|
|
14262
|
+
}), {
|
|
14263
|
+
kind: "mutation",
|
|
14264
|
+
auth: "admin"
|
|
14265
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14266
|
+
kind: "mutation",
|
|
14267
|
+
auth: "admin"
|
|
14268
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14269
|
+
valid: boolean(),
|
|
14270
|
+
keyId: string().nullable(),
|
|
14271
|
+
/** The hub knows this key (active or retired). */
|
|
14272
|
+
known: boolean(),
|
|
14273
|
+
/** It is the key new archives are encrypted to. */
|
|
14274
|
+
active: boolean(),
|
|
14275
|
+
error: string().optional()
|
|
14276
|
+
}), {
|
|
14277
|
+
kind: "mutation",
|
|
14278
|
+
auth: "admin"
|
|
13518
14279
|
}), method(object({
|
|
13519
14280
|
destinationId: string(),
|
|
13520
14281
|
backupId: string()
|
|
@@ -15240,7 +16001,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
15240
16001
|
stepId: string(),
|
|
15241
16002
|
entry: ModelCatalogEntrySchema
|
|
15242
16003
|
});
|
|
15243
|
-
|
|
16004
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
16005
|
+
var ModelBundleFileSchema = object({
|
|
16006
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
16007
|
+
path: string().min(1),
|
|
16008
|
+
bytes: number().int().nonnegative(),
|
|
16009
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16010
|
+
});
|
|
16011
|
+
var ImportModelBundleInputSchema = object({
|
|
16012
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
16013
|
+
addonId: string(),
|
|
16014
|
+
stepId: string().min(1),
|
|
16015
|
+
/**
|
|
16016
|
+
* The catalog rows to register, complete, every format URL already
|
|
16017
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
16018
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
16019
|
+
*/
|
|
16020
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
16021
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
16022
|
+
bundle: object({
|
|
16023
|
+
ticket: PeerBytesTicketSchema,
|
|
16024
|
+
bytes: number().int().positive(),
|
|
16025
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
16026
|
+
}),
|
|
16027
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
16028
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
16029
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
16030
|
+
distribute: boolean()
|
|
16031
|
+
});
|
|
16032
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
16033
|
+
kind: literal("imported"),
|
|
16034
|
+
modelIds: array(string()).readonly(),
|
|
16035
|
+
distributed: array(object({
|
|
16036
|
+
modelId: string(),
|
|
16037
|
+
nodeId: string(),
|
|
16038
|
+
format: _enum(MODEL_FORMATS),
|
|
16039
|
+
ok: boolean(),
|
|
16040
|
+
error: string().optional()
|
|
16041
|
+
})).readonly()
|
|
16042
|
+
}), object({
|
|
16043
|
+
kind: literal("refused"),
|
|
16044
|
+
reason: _enum([
|
|
16045
|
+
"transfer-failed",
|
|
16046
|
+
"checksum-mismatch",
|
|
16047
|
+
"bundle-mismatch",
|
|
16048
|
+
"invalid-entry",
|
|
16049
|
+
"id-taken"
|
|
16050
|
+
]),
|
|
16051
|
+
detail: string()
|
|
16052
|
+
})]);
|
|
16053
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
16054
|
+
kind: "mutation",
|
|
16055
|
+
auth: "admin",
|
|
16056
|
+
timeoutMs: 30 * 6e4
|
|
16057
|
+
});
|
|
15244
16058
|
/**
|
|
15245
16059
|
* Query filter for settings-store collections.
|
|
15246
16060
|
*/
|
|
@@ -15719,6 +16533,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15719
16533
|
*/
|
|
15720
16534
|
sharesBackupWithDatabase: boolean()
|
|
15721
16535
|
});
|
|
16536
|
+
/**
|
|
16537
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16538
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16539
|
+
*/
|
|
16540
|
+
var KeychainResetRecordSchema = object({
|
|
16541
|
+
id: string(),
|
|
16542
|
+
at: number(),
|
|
16543
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16544
|
+
actor: string(),
|
|
16545
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16546
|
+
lockedReason: string().nullable(),
|
|
16547
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16548
|
+
archived: number().int(),
|
|
16549
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16550
|
+
archivedCollection: string().nullable(),
|
|
16551
|
+
/**
|
|
16552
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16553
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16554
|
+
*/
|
|
16555
|
+
archivedKeysCollection: string().nullable(),
|
|
16556
|
+
/**
|
|
16557
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16558
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16559
|
+
* agent forever (D797).
|
|
16560
|
+
*/
|
|
16561
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16562
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16563
|
+
acknowledgedAt: number().nullable()
|
|
16564
|
+
});
|
|
15722
16565
|
var KeychainStatusSchema = object({
|
|
15723
16566
|
keychain: KeychainStateSchema,
|
|
15724
16567
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15736,7 +16579,9 @@ var KeychainStatusSchema = object({
|
|
|
15736
16579
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15737
16580
|
retiredWraps: number().int(),
|
|
15738
16581
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15739
|
-
secretCount: number().int()
|
|
16582
|
+
secretCount: number().int(),
|
|
16583
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16584
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15740
16585
|
});
|
|
15741
16586
|
/**
|
|
15742
16587
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15758,17 +16603,26 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15758
16603
|
"download-recovery-key",
|
|
15759
16604
|
"delete-orphans",
|
|
15760
16605
|
"reset",
|
|
16606
|
+
"acknowledge-reset",
|
|
15761
16607
|
"initialize"
|
|
15762
16608
|
]);
|
|
15763
16609
|
var KeychainAuditEntrySchema = object({
|
|
15764
16610
|
id: string(),
|
|
15765
16611
|
at: number(),
|
|
15766
16612
|
action: KeychainAuditActionSchema,
|
|
15767
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16613
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15768
16614
|
actor: string(),
|
|
15769
16615
|
ref: string().nullable(),
|
|
15770
16616
|
detail: string().nullable()
|
|
15771
16617
|
});
|
|
16618
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16619
|
+
/**
|
|
16620
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16621
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16622
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16623
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16624
|
+
*/
|
|
16625
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15772
16626
|
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({
|
|
15773
16627
|
value: string(),
|
|
15774
16628
|
version: number().int()
|
|
@@ -15776,6 +16630,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15776
16630
|
kind: "mutation",
|
|
15777
16631
|
auth: "admin",
|
|
15778
16632
|
caller: "required"
|
|
16633
|
+
}), method(object({
|
|
16634
|
+
name: SystemHeldSecretNameSchema,
|
|
16635
|
+
value: string().min(16)
|
|
16636
|
+
}), object({
|
|
16637
|
+
ref: string(),
|
|
16638
|
+
version: number().int()
|
|
16639
|
+
}), {
|
|
16640
|
+
kind: "mutation",
|
|
16641
|
+
auth: "admin",
|
|
16642
|
+
caller: "required"
|
|
15779
16643
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15780
16644
|
deleted: array(string()).readonly(),
|
|
15781
16645
|
kept: array(object({
|
|
@@ -15805,13 +16669,20 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15805
16669
|
kind: "mutation",
|
|
15806
16670
|
auth: "admin",
|
|
15807
16671
|
caller: "required"
|
|
15808
|
-
}), method(object({ confirm: literal(
|
|
16672
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15809
16673
|
archivedCollection: string().nullable(),
|
|
15810
16674
|
archived: number().int()
|
|
15811
16675
|
}), {
|
|
15812
16676
|
kind: "mutation",
|
|
15813
16677
|
auth: "admin",
|
|
15814
16678
|
caller: "required"
|
|
16679
|
+
}), method(object({}), object({
|
|
16680
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16681
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16682
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16683
|
+
kind: "mutation",
|
|
16684
|
+
auth: "admin",
|
|
16685
|
+
caller: "required"
|
|
15815
16686
|
});
|
|
15816
16687
|
method(_void(), object({
|
|
15817
16688
|
id: string(),
|
|
@@ -18662,7 +19533,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18662
19533
|
* `login-method` — collection cap through which auth addons contribute
|
|
18663
19534
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18664
19535
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18665
|
-
* every auth addon (OIDC,
|
|
19536
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18666
19537
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18667
19538
|
* procedure aggregates them for the unauthenticated login page.
|
|
18668
19539
|
*
|
|
@@ -18670,8 +19541,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18670
19541
|
*
|
|
18671
19542
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18672
19543
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18673
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18674
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19544
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18675
19545
|
* login page needs NO change.
|
|
18676
19546
|
*
|
|
18677
19547
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18690,8 +19560,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18690
19560
|
* decision.
|
|
18691
19561
|
*
|
|
18692
19562
|
* Every contribution carries a `stage`:
|
|
18693
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18694
|
-
*
|
|
19563
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19564
|
+
* buttons; a usernameless passkey).
|
|
18695
19565
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18696
19566
|
* returned `factors` (passkey-as-2FA today).
|
|
18697
19567
|
*
|
|
@@ -18718,7 +19588,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18718
19588
|
* The provider names an external identity a signed-in user can link to
|
|
18719
19589
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18720
19590
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18721
|
-
* whatever their id. Absent / false — a login button only
|
|
19591
|
+
* whatever their id. Absent / false — a login button only.
|
|
18722
19592
|
*/
|
|
18723
19593
|
linkable: boolean().optional()
|
|
18724
19594
|
}),
|
|
@@ -22573,8 +23443,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22573
23443
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22574
23444
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22575
23445
|
* distinction was only ever used to route role-specific procedures
|
|
22576
|
-
* which we no longer have.
|
|
22577
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
23446
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22578
23447
|
* with `isAdmin: false` + an explicit scope list.
|
|
22579
23448
|
*/
|
|
22580
23449
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24249,6 +25118,9 @@ var RetrainExportFilterSchema = object({
|
|
|
24249
25118
|
frameIds: array(string()).max(2e4).optional(),
|
|
24250
25119
|
/** Only frames in at least one of these named collections. */
|
|
24251
25120
|
collectionIds: array(string()).max(200).optional(),
|
|
25121
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
25122
|
+
* unknown id selects nothing. */
|
|
25123
|
+
datasetVersionId: string().optional(),
|
|
24252
25124
|
batchId: string().optional(),
|
|
24253
25125
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24254
25126
|
completeOnly: boolean().optional()
|
|
@@ -24416,6 +25288,67 @@ var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
24416
25288
|
]),
|
|
24417
25289
|
detail: string().optional()
|
|
24418
25290
|
})]);
|
|
25291
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
25292
|
+
var RetrainDatasetSelectionSchema = object({
|
|
25293
|
+
deviceIds: array(number()).readonly().optional(),
|
|
25294
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
25295
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
25296
|
+
});
|
|
25297
|
+
/** The counts a dataset is judged by. */
|
|
25298
|
+
var RetrainDatasetStatsSchema = object({
|
|
25299
|
+
frames: number().int(),
|
|
25300
|
+
completeFrames: number().int(),
|
|
25301
|
+
/** `completeFrames / frames`, 0..1. */
|
|
25302
|
+
completeness: number(),
|
|
25303
|
+
/** Boxes to learn (model errors excluded). */
|
|
25304
|
+
subjects: number().int(),
|
|
25305
|
+
modelErrors: number().int(),
|
|
25306
|
+
/** Complete frames with no subject. */
|
|
25307
|
+
hardNegatives: number().int(),
|
|
25308
|
+
/** Subjects per class × camera × day/night. */
|
|
25309
|
+
cells: array(object({
|
|
25310
|
+
macroClass: string(),
|
|
25311
|
+
deviceId: number(),
|
|
25312
|
+
lighting: _enum([
|
|
25313
|
+
"day",
|
|
25314
|
+
"night",
|
|
25315
|
+
"unknown"
|
|
25316
|
+
]),
|
|
25317
|
+
subjects: number().int(),
|
|
25318
|
+
frames: number().int()
|
|
25319
|
+
})).readonly(),
|
|
25320
|
+
cameras: array(object({
|
|
25321
|
+
deviceId: number(),
|
|
25322
|
+
frames: number().int(),
|
|
25323
|
+
completeFrames: number().int()
|
|
25324
|
+
})).readonly()
|
|
25325
|
+
});
|
|
25326
|
+
/** An immutable dataset version, without its frame list. */
|
|
25327
|
+
var RetrainDatasetVersionSchema = object({
|
|
25328
|
+
id: string(),
|
|
25329
|
+
name: string(),
|
|
25330
|
+
createdAt: number(),
|
|
25331
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25332
|
+
layout: RetrainExportLayoutSchema,
|
|
25333
|
+
completeOnly: boolean(),
|
|
25334
|
+
frameCount: number().int(),
|
|
25335
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
25336
|
+
annotationHash: string(),
|
|
25337
|
+
/** The export manifest schema the version was cut under. */
|
|
25338
|
+
manifestSchema: string(),
|
|
25339
|
+
stats: RetrainDatasetStatsSchema
|
|
25340
|
+
});
|
|
25341
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
25342
|
+
kind: literal("created"),
|
|
25343
|
+
version: RetrainDatasetVersionSchema
|
|
25344
|
+
}), object({
|
|
25345
|
+
kind: literal("refused"),
|
|
25346
|
+
reason: _enum([
|
|
25347
|
+
"empty-name",
|
|
25348
|
+
"duplicate-name",
|
|
25349
|
+
"no-frames"
|
|
25350
|
+
])
|
|
25351
|
+
})]);
|
|
24419
25352
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24420
25353
|
var RetrainTransitionResultSchema = object({
|
|
24421
25354
|
trackId: string(),
|
|
@@ -25205,6 +26138,47 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
25205
26138
|
kind: "mutation",
|
|
25206
26139
|
auth: "admin",
|
|
25207
26140
|
timeoutMs: 60 * 6e4
|
|
26141
|
+
}), method(object({
|
|
26142
|
+
filter: RetrainExportFilterSchema,
|
|
26143
|
+
layout: RetrainExportLayoutSchema
|
|
26144
|
+
}), object({
|
|
26145
|
+
ticket: PeerBytesTicketSchema,
|
|
26146
|
+
frames: number().int(),
|
|
26147
|
+
annotations: number().int()
|
|
26148
|
+
}), {
|
|
26149
|
+
kind: "mutation",
|
|
26150
|
+
auth: "admin",
|
|
26151
|
+
timeoutMs: 12e4
|
|
26152
|
+
}), method(object({
|
|
26153
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26154
|
+
completeOnly: boolean().optional()
|
|
26155
|
+
}), RetrainDatasetStatsSchema, {
|
|
26156
|
+
kind: "query",
|
|
26157
|
+
auth: "admin"
|
|
26158
|
+
}), method(object({
|
|
26159
|
+
name: string().max(120),
|
|
26160
|
+
selection: RetrainDatasetSelectionSchema,
|
|
26161
|
+
layout: RetrainExportLayoutSchema,
|
|
26162
|
+
completeOnly: boolean()
|
|
26163
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
26164
|
+
kind: "mutation",
|
|
26165
|
+
auth: "admin",
|
|
26166
|
+
timeoutMs: 12e4
|
|
26167
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
26168
|
+
kind: "query",
|
|
26169
|
+
auth: "admin"
|
|
26170
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
26171
|
+
kind: "mutation",
|
|
26172
|
+
auth: "admin"
|
|
26173
|
+
}), method(object({ id: string() }), object({
|
|
26174
|
+
found: boolean(),
|
|
26175
|
+
annotationHash: string(),
|
|
26176
|
+
matches: boolean(),
|
|
26177
|
+
missingFrames: number().int()
|
|
26178
|
+
}), {
|
|
26179
|
+
kind: "query",
|
|
26180
|
+
auth: "admin",
|
|
26181
|
+
timeoutMs: 12e4
|
|
25208
26182
|
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25209
26183
|
kind: "query",
|
|
25210
26184
|
auth: "admin"
|
|
@@ -28783,8 +29757,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28783
29757
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28784
29758
|
*
|
|
28785
29759
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28786
|
-
* one for transactional / one for notifications). Consumers (
|
|
28787
|
-
*
|
|
29760
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29761
|
+
* addons, …) walk the collection and pick the first
|
|
28788
29762
|
* ready provider OR target a specific addonId.
|
|
28789
29763
|
*
|
|
28790
29764
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28963,7 +29937,7 @@ targets: array(object({
|
|
|
28963
29937
|
})));
|
|
28964
29938
|
/**
|
|
28965
29939
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28966
|
-
* providers (OIDC, SAML,
|
|
29940
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28967
29941
|
* carrying the post-callback claims before redirecting back to
|
|
28968
29942
|
* `/api/auth/sso/finish`.
|
|
28969
29943
|
*
|
|
@@ -29026,7 +30000,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
29026
30000
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29027
30001
|
* subject is unique only per issuer, so a link is bound to it.
|
|
29028
30002
|
*/
|
|
29029
|
-
issuer: string().optional()
|
|
30003
|
+
issuer: string().optional(),
|
|
30004
|
+
/**
|
|
30005
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
30006
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
30007
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
30008
|
+
* any other browser.
|
|
30009
|
+
*/
|
|
30010
|
+
browserBinding: string().optional()
|
|
29030
30011
|
});
|
|
29031
30012
|
method(object({
|
|
29032
30013
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -41293,16 +42274,6 @@ var ApiKeySummarySchema = object({
|
|
|
41293
42274
|
createdAt: number(),
|
|
41294
42275
|
lastUsedAt: number().optional()
|
|
41295
42276
|
});
|
|
41296
|
-
var CreateApiKeyInputSchema = object({
|
|
41297
|
-
label: string(),
|
|
41298
|
-
isAdmin: boolean().default(false),
|
|
41299
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
41300
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
41301
|
-
});
|
|
41302
|
-
var CreateApiKeyResultSchema = object({
|
|
41303
|
-
token: string(),
|
|
41304
|
-
record: ApiKeySummarySchema
|
|
41305
|
-
});
|
|
41306
42277
|
var ScopedTokenSummarySchema = object({
|
|
41307
42278
|
id: string(),
|
|
41308
42279
|
userId: string(),
|
|
@@ -41401,17 +42372,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41401
42372
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
41402
42373
|
kind: "mutation",
|
|
41403
42374
|
access: "view"
|
|
41404
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
41405
|
-
kind: "mutation",
|
|
41406
|
-
auth: "admin",
|
|
41407
|
-
access: "create"
|
|
41408
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42375
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41409
42376
|
kind: "mutation",
|
|
41410
42377
|
auth: "admin",
|
|
41411
42378
|
access: "delete"
|
|
41412
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
41413
|
-
kind: "mutation",
|
|
41414
|
-
access: "view"
|
|
41415
42379
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
41416
42380
|
kind: "mutation",
|
|
41417
42381
|
auth: "admin",
|
|
@@ -41485,15 +42449,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
41485
42449
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
41486
42450
|
userId: string(),
|
|
41487
42451
|
issuer: string()
|
|
41488
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
41489
|
-
userId: string(),
|
|
41490
|
-
issuer: string().min(1),
|
|
41491
|
-
label: string().optional()
|
|
41492
|
-
}), object({ success: literal(true) }), {
|
|
41493
|
-
kind: "mutation",
|
|
41494
|
-
auth: "admin",
|
|
41495
|
-
access: "create"
|
|
41496
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42452
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41497
42453
|
kind: "mutation",
|
|
41498
42454
|
auth: "admin",
|
|
41499
42455
|
access: "delete"
|
|
@@ -42198,6 +43154,451 @@ var zoneRulesCapability = {
|
|
|
42198
43154
|
*/
|
|
42199
43155
|
durability: "restored"
|
|
42200
43156
|
};
|
|
43157
|
+
/**
|
|
43158
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43159
|
+
*
|
|
43160
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43161
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43162
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43163
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43164
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43165
|
+
* manifest entry and nothing else.
|
|
43166
|
+
*
|
|
43167
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43168
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43169
|
+
* Every method is `admin`: these spend money.
|
|
43170
|
+
*
|
|
43171
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43172
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43173
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43174
|
+
*
|
|
43175
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43176
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43177
|
+
* ticket the provider mints (D613).
|
|
43178
|
+
*/
|
|
43179
|
+
var TrainingGpuOptionSchema = object({
|
|
43180
|
+
id: string(),
|
|
43181
|
+
label: string(),
|
|
43182
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43183
|
+
usdPerHour: number().nonnegative(),
|
|
43184
|
+
vramGb: number().nonnegative()
|
|
43185
|
+
});
|
|
43186
|
+
var TrainingRegionOptionSchema = object({
|
|
43187
|
+
/** `''` = any region (the provider's choice). */
|
|
43188
|
+
id: string(),
|
|
43189
|
+
label: string(),
|
|
43190
|
+
priceMultiplier: number().positive()
|
|
43191
|
+
});
|
|
43192
|
+
/**
|
|
43193
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43194
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43195
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43196
|
+
*/
|
|
43197
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43198
|
+
gpuType: string(),
|
|
43199
|
+
region: string(),
|
|
43200
|
+
costCapUsd: number().nonnegative(),
|
|
43201
|
+
maxRuntimeSec: number().int().positive(),
|
|
43202
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43203
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43204
|
+
});
|
|
43205
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43206
|
+
addonId: string(),
|
|
43207
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43208
|
+
kind: string(),
|
|
43209
|
+
label: string(),
|
|
43210
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43211
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43212
|
+
maxDatasetBytes: number().int().positive(),
|
|
43213
|
+
maxRuntimeSec: number().int().positive(),
|
|
43214
|
+
freeTierNote: string().optional(),
|
|
43215
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43216
|
+
dataResidencyNote: string(),
|
|
43217
|
+
/** Credentials are present — never the values. */
|
|
43218
|
+
configured: boolean(),
|
|
43219
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43220
|
+
});
|
|
43221
|
+
var TrainingCredentialCheckSchema = object({
|
|
43222
|
+
ok: boolean(),
|
|
43223
|
+
/** Workspace / account name, when the provider says. */
|
|
43224
|
+
account: string().optional(),
|
|
43225
|
+
reason: _enum([
|
|
43226
|
+
"missing",
|
|
43227
|
+
"invalid",
|
|
43228
|
+
"forbidden",
|
|
43229
|
+
"network",
|
|
43230
|
+
"quota"
|
|
43231
|
+
]).optional(),
|
|
43232
|
+
detail: string().optional()
|
|
43233
|
+
});
|
|
43234
|
+
var ProviderJobStateSchema = _enum([
|
|
43235
|
+
"pending",
|
|
43236
|
+
"starting",
|
|
43237
|
+
"running",
|
|
43238
|
+
"succeeded",
|
|
43239
|
+
"failed",
|
|
43240
|
+
"cancelled",
|
|
43241
|
+
"lost"
|
|
43242
|
+
]);
|
|
43243
|
+
var ProviderJobStatusSchema = object({
|
|
43244
|
+
jobKey: string(),
|
|
43245
|
+
providerJobId: string().optional(),
|
|
43246
|
+
state: ProviderJobStateSchema,
|
|
43247
|
+
startedAt: number().optional(),
|
|
43248
|
+
endedAt: number().optional(),
|
|
43249
|
+
exitCode: number().int().optional(),
|
|
43250
|
+
failureReason: string().optional(),
|
|
43251
|
+
gpuType: string(),
|
|
43252
|
+
region: string().optional(),
|
|
43253
|
+
billedSeconds: number().nonnegative(),
|
|
43254
|
+
costUsd: number().nonnegative(),
|
|
43255
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43256
|
+
costIsEstimate: boolean(),
|
|
43257
|
+
lastFetchedAt: number()
|
|
43258
|
+
});
|
|
43259
|
+
/**
|
|
43260
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43261
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43262
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43263
|
+
* in `result.json`.
|
|
43264
|
+
*/
|
|
43265
|
+
var TrainerSourceRefSchema = object({
|
|
43266
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43267
|
+
repo: string().min(1),
|
|
43268
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43269
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43270
|
+
});
|
|
43271
|
+
var JobRef = {
|
|
43272
|
+
addonId: string(),
|
|
43273
|
+
jobKey: string().uuid()
|
|
43274
|
+
};
|
|
43275
|
+
var TrainingLogLineSchema = object({
|
|
43276
|
+
ts: number(),
|
|
43277
|
+
text: string()
|
|
43278
|
+
});
|
|
43279
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43280
|
+
kind: "mutation",
|
|
43281
|
+
auth: "admin",
|
|
43282
|
+
timeoutMs: 3e4
|
|
43283
|
+
}), method(object({
|
|
43284
|
+
addonId: string(),
|
|
43285
|
+
gpuType: string(),
|
|
43286
|
+
region: string(),
|
|
43287
|
+
datasetBytes: number().int().nonnegative(),
|
|
43288
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43289
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43290
|
+
}), object({
|
|
43291
|
+
usdLow: number().nonnegative(),
|
|
43292
|
+
usdHigh: number().nonnegative(),
|
|
43293
|
+
notes: array(string()).readonly()
|
|
43294
|
+
}), { auth: "admin" }), method(object({
|
|
43295
|
+
...JobRef,
|
|
43296
|
+
ticket: PeerBytesTicketSchema
|
|
43297
|
+
}), object({
|
|
43298
|
+
bytes: number().int().nonnegative(),
|
|
43299
|
+
sha256: string()
|
|
43300
|
+
}), {
|
|
43301
|
+
kind: "mutation",
|
|
43302
|
+
auth: "admin",
|
|
43303
|
+
timeoutMs: 120 * 6e4
|
|
43304
|
+
}), method(object({
|
|
43305
|
+
...JobRef,
|
|
43306
|
+
trainer: TrainerSourceRefSchema,
|
|
43307
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43308
|
+
gpuType: string(),
|
|
43309
|
+
region: string(),
|
|
43310
|
+
maxRuntimeSec: number().int().positive()
|
|
43311
|
+
}), ProviderJobStatusSchema, {
|
|
43312
|
+
kind: "mutation",
|
|
43313
|
+
auth: "admin",
|
|
43314
|
+
timeoutMs: 30 * 6e4
|
|
43315
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43316
|
+
auth: "admin",
|
|
43317
|
+
timeoutMs: 6e4
|
|
43318
|
+
}), method(object({
|
|
43319
|
+
...JobRef,
|
|
43320
|
+
cursor: string().optional(),
|
|
43321
|
+
max: number().int().min(1).max(500)
|
|
43322
|
+
}), object({
|
|
43323
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43324
|
+
cursor: string()
|
|
43325
|
+
}), {
|
|
43326
|
+
auth: "admin",
|
|
43327
|
+
timeoutMs: 6e4
|
|
43328
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43329
|
+
kind: "mutation",
|
|
43330
|
+
auth: "admin",
|
|
43331
|
+
timeoutMs: 6e4
|
|
43332
|
+
}), method(object(JobRef), object({
|
|
43333
|
+
found: boolean(),
|
|
43334
|
+
text: string().optional()
|
|
43335
|
+
}), {
|
|
43336
|
+
kind: "mutation",
|
|
43337
|
+
auth: "admin",
|
|
43338
|
+
timeoutMs: 5 * 6e4
|
|
43339
|
+
}), method(object({
|
|
43340
|
+
...JobRef,
|
|
43341
|
+
path: _enum(["bundle.tar"])
|
|
43342
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43343
|
+
kind: "mutation",
|
|
43344
|
+
auth: "admin",
|
|
43345
|
+
timeoutMs: 5 * 6e4
|
|
43346
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43347
|
+
kind: "mutation",
|
|
43348
|
+
auth: "admin",
|
|
43349
|
+
timeoutMs: 5 * 6e4
|
|
43350
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43351
|
+
auth: "admin",
|
|
43352
|
+
timeoutMs: 2 * 6e4
|
|
43353
|
+
});
|
|
43354
|
+
/**
|
|
43355
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43356
|
+
* provided by `addon-training`.
|
|
43357
|
+
*
|
|
43358
|
+
* It owns what every provider must agree on, written once:
|
|
43359
|
+
*
|
|
43360
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43361
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43362
|
+
* the export plan) and reaches this store through the five row methods
|
|
43363
|
+
* below, so the Retrain page and the export did not change.
|
|
43364
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43365
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43366
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43367
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43368
|
+
* rollback. Nothing is ever registered automatically.
|
|
43369
|
+
*
|
|
43370
|
+
* Every method is `admin`.
|
|
43371
|
+
*/
|
|
43372
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43373
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43374
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43375
|
+
var TrainingBaseModelSchema = object({
|
|
43376
|
+
modelId: string(),
|
|
43377
|
+
label: string(),
|
|
43378
|
+
weights: string(),
|
|
43379
|
+
imgsz: number().int(),
|
|
43380
|
+
baselineOnnxUrl: string(),
|
|
43381
|
+
baselineFloors: record(string(), number()),
|
|
43382
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43383
|
+
recommended: boolean()
|
|
43384
|
+
});
|
|
43385
|
+
var TrainingPresetSchema = _enum([
|
|
43386
|
+
"quick",
|
|
43387
|
+
"standard",
|
|
43388
|
+
"thorough"
|
|
43389
|
+
]);
|
|
43390
|
+
var TrainingJobRequestSchema = object({
|
|
43391
|
+
datasetVersionId: string().min(1),
|
|
43392
|
+
/** The `training-provider` addon that runs it. */
|
|
43393
|
+
addonId: string().min(1),
|
|
43394
|
+
gpuType: string().min(1),
|
|
43395
|
+
region: string(),
|
|
43396
|
+
baseModelId: string().min(1),
|
|
43397
|
+
preset: TrainingPresetSchema,
|
|
43398
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43399
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43400
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43401
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43402
|
+
});
|
|
43403
|
+
var TrainingSplitPlanSchema = object({
|
|
43404
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43405
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43406
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43407
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43408
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43409
|
+
trainSubjects: number().int()
|
|
43410
|
+
});
|
|
43411
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43412
|
+
"unknown-dataset",
|
|
43413
|
+
"unknown-provider",
|
|
43414
|
+
"provider-not-configured",
|
|
43415
|
+
"unknown-base-model",
|
|
43416
|
+
"unknown-gpu",
|
|
43417
|
+
"dataset-too-large",
|
|
43418
|
+
"no-training-subjects",
|
|
43419
|
+
"job-already-running"
|
|
43420
|
+
]);
|
|
43421
|
+
var TrainingJobPlanSchema = object({
|
|
43422
|
+
refusal: object({
|
|
43423
|
+
reason: TrainingRefusalReasonSchema,
|
|
43424
|
+
detail: string()
|
|
43425
|
+
}).nullable(),
|
|
43426
|
+
warnings: array(string()).readonly(),
|
|
43427
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43428
|
+
estimate: object({
|
|
43429
|
+
datasetBytes: number().int(),
|
|
43430
|
+
uploadMinutesAt20Mbps: number(),
|
|
43431
|
+
gpuSecondsLow: number(),
|
|
43432
|
+
gpuSecondsHigh: number(),
|
|
43433
|
+
usdLow: number(),
|
|
43434
|
+
usdHigh: number(),
|
|
43435
|
+
notes: array(string()).readonly()
|
|
43436
|
+
}).nullable(),
|
|
43437
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43438
|
+
defaults: object({
|
|
43439
|
+
maxCostUsd: number(),
|
|
43440
|
+
maxRuntimeSec: number().int()
|
|
43441
|
+
}).nullable(),
|
|
43442
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43443
|
+
dataNotice: string()
|
|
43444
|
+
});
|
|
43445
|
+
/**
|
|
43446
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43447
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43448
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43449
|
+
* result lives after the operator acted on it.
|
|
43450
|
+
*/
|
|
43451
|
+
var TrainingJobStateSchema = _enum([
|
|
43452
|
+
"uploading",
|
|
43453
|
+
"submitted",
|
|
43454
|
+
"starting",
|
|
43455
|
+
"running",
|
|
43456
|
+
"collecting",
|
|
43457
|
+
"ready",
|
|
43458
|
+
"registered",
|
|
43459
|
+
"canary",
|
|
43460
|
+
"failed",
|
|
43461
|
+
"cancelling",
|
|
43462
|
+
"cancelled",
|
|
43463
|
+
"lost",
|
|
43464
|
+
"expired",
|
|
43465
|
+
"discarded"
|
|
43466
|
+
]);
|
|
43467
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43468
|
+
"cost-cap",
|
|
43469
|
+
"runtime-cap",
|
|
43470
|
+
"upload-failed",
|
|
43471
|
+
"submit-failed",
|
|
43472
|
+
"trainer-failed",
|
|
43473
|
+
"result-invalid",
|
|
43474
|
+
"checksum-mismatch",
|
|
43475
|
+
"fetch-failed",
|
|
43476
|
+
"provider-error",
|
|
43477
|
+
"hub-restart-during-upload"
|
|
43478
|
+
]);
|
|
43479
|
+
var TrainingProgressPointSchema = object({
|
|
43480
|
+
epoch: number().int(),
|
|
43481
|
+
map50: number().nullable(),
|
|
43482
|
+
map50_95: number().nullable()
|
|
43483
|
+
});
|
|
43484
|
+
var TrainingCanarySchema = object({
|
|
43485
|
+
deviceIds: array(number().int()).readonly(),
|
|
43486
|
+
since: number(),
|
|
43487
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43488
|
+
previous: array(object({
|
|
43489
|
+
deviceId: number().int(),
|
|
43490
|
+
nodeId: string(),
|
|
43491
|
+
deviceKey: string(),
|
|
43492
|
+
patch: object({
|
|
43493
|
+
modelId: string().optional(),
|
|
43494
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43495
|
+
}).nullable()
|
|
43496
|
+
})).readonly()
|
|
43497
|
+
});
|
|
43498
|
+
var TrainingJobSchema = object({
|
|
43499
|
+
id: string(),
|
|
43500
|
+
idempotencyKey: string(),
|
|
43501
|
+
name: string(),
|
|
43502
|
+
createdAt: number(),
|
|
43503
|
+
updatedAt: number(),
|
|
43504
|
+
state: TrainingJobStateSchema,
|
|
43505
|
+
stage: TrainingStageSchema.nullable(),
|
|
43506
|
+
failure: object({
|
|
43507
|
+
reason: TrainingFailureReasonSchema,
|
|
43508
|
+
stage: string().nullable(),
|
|
43509
|
+
detail: string()
|
|
43510
|
+
}).nullable(),
|
|
43511
|
+
request: TrainingJobRequestSchema,
|
|
43512
|
+
maxCostUsd: number().nonnegative(),
|
|
43513
|
+
maxRuntimeSec: number().int().positive(),
|
|
43514
|
+
trainer: TrainerSourceRefSchema,
|
|
43515
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43516
|
+
dataset: object({
|
|
43517
|
+
bytes: number().int(),
|
|
43518
|
+
sha256: string(),
|
|
43519
|
+
uploadedAt: number()
|
|
43520
|
+
}).nullable(),
|
|
43521
|
+
split: TrainingSplitPlanSchema,
|
|
43522
|
+
provider: object({
|
|
43523
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43524
|
+
providerJobId: string().nullable(),
|
|
43525
|
+
startedAt: number().nullable(),
|
|
43526
|
+
endedAt: number().nullable(),
|
|
43527
|
+
billedSeconds: number(),
|
|
43528
|
+
costUsd: number(),
|
|
43529
|
+
costIsEstimate: boolean(),
|
|
43530
|
+
lastPolledAt: number().nullable()
|
|
43531
|
+
}),
|
|
43532
|
+
progress: object({
|
|
43533
|
+
epoch: number().int().nullable(),
|
|
43534
|
+
epochs: number().int().nullable(),
|
|
43535
|
+
etaSec: number().nullable(),
|
|
43536
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43537
|
+
}),
|
|
43538
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43539
|
+
logTail: array(string()).readonly(),
|
|
43540
|
+
logCursor: string().nullable(),
|
|
43541
|
+
artifacts: object({
|
|
43542
|
+
bundleBytes: number().int(),
|
|
43543
|
+
bundleSha256: string(),
|
|
43544
|
+
fetchedAt: number(),
|
|
43545
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43546
|
+
expiresAt: number()
|
|
43547
|
+
}).nullable(),
|
|
43548
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43549
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43550
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43551
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43552
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43553
|
+
registeredModelIds: array(string()).readonly(),
|
|
43554
|
+
canary: TrainingCanarySchema.nullable()
|
|
43555
|
+
});
|
|
43556
|
+
var IdInput = object({ id: string().min(1) });
|
|
43557
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43558
|
+
kind: "mutation",
|
|
43559
|
+
auth: "admin"
|
|
43560
|
+
}), 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() }), {
|
|
43561
|
+
kind: "mutation",
|
|
43562
|
+
auth: "admin"
|
|
43563
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43564
|
+
auth: "admin",
|
|
43565
|
+
timeoutMs: 6e4
|
|
43566
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43567
|
+
name: string().min(1).max(120),
|
|
43568
|
+
maxCostUsd: number().positive(),
|
|
43569
|
+
maxRuntimeSec: number().int().positive(),
|
|
43570
|
+
idempotencyKey: string().min(8).max(80)
|
|
43571
|
+
}), discriminatedUnion("kind", [object({
|
|
43572
|
+
kind: literal("started"),
|
|
43573
|
+
job: TrainingJobSchema
|
|
43574
|
+
}), object({
|
|
43575
|
+
kind: literal("refused"),
|
|
43576
|
+
reason: TrainingRefusalReasonSchema,
|
|
43577
|
+
detail: string()
|
|
43578
|
+
})]), {
|
|
43579
|
+
kind: "mutation",
|
|
43580
|
+
auth: "admin",
|
|
43581
|
+
timeoutMs: 12e4
|
|
43582
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43583
|
+
kind: "mutation",
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 12e4
|
|
43586
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43587
|
+
kind: "mutation",
|
|
43588
|
+
auth: "admin",
|
|
43589
|
+
timeoutMs: 30 * 6e4
|
|
43590
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43591
|
+
kind: "mutation",
|
|
43592
|
+
auth: "admin",
|
|
43593
|
+
timeoutMs: 12e4
|
|
43594
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43595
|
+
kind: "mutation",
|
|
43596
|
+
auth: "admin",
|
|
43597
|
+
timeoutMs: 12e4
|
|
43598
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43599
|
+
kind: "mutation",
|
|
43600
|
+
auth: "admin"
|
|
43601
|
+
});
|
|
42201
43602
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
42202
43603
|
Object.freeze({
|
|
42203
43604
|
person: .5,
|
|
@@ -44346,6 +45747,12 @@ Object.freeze({
|
|
|
44346
45747
|
addonId: null,
|
|
44347
45748
|
access: "create"
|
|
44348
45749
|
},
|
|
45750
|
+
"backup.checkBackupKey": {
|
|
45751
|
+
capName: "backup",
|
|
45752
|
+
capScope: "system",
|
|
45753
|
+
addonId: null,
|
|
45754
|
+
access: "create"
|
|
45755
|
+
},
|
|
44349
45756
|
"backup.delete": {
|
|
44350
45757
|
capName: "backup",
|
|
44351
45758
|
capScope: "system",
|
|
@@ -44358,6 +45765,18 @@ Object.freeze({
|
|
|
44358
45765
|
addonId: null,
|
|
44359
45766
|
access: "delete"
|
|
44360
45767
|
},
|
|
45768
|
+
"backup.disableEncryption": {
|
|
45769
|
+
capName: "backup",
|
|
45770
|
+
capScope: "system",
|
|
45771
|
+
addonId: null,
|
|
45772
|
+
access: "create"
|
|
45773
|
+
},
|
|
45774
|
+
"backup.getEncryption": {
|
|
45775
|
+
capName: "backup",
|
|
45776
|
+
capScope: "system",
|
|
45777
|
+
addonId: null,
|
|
45778
|
+
access: "view"
|
|
45779
|
+
},
|
|
44361
45780
|
"backup.getEntries": {
|
|
44362
45781
|
capName: "backup",
|
|
44363
45782
|
capScope: "system",
|
|
@@ -44412,6 +45831,12 @@ Object.freeze({
|
|
|
44412
45831
|
addonId: null,
|
|
44413
45832
|
access: "create"
|
|
44414
45833
|
},
|
|
45834
|
+
"backup.setupEncryption": {
|
|
45835
|
+
capName: "backup",
|
|
45836
|
+
capScope: "system",
|
|
45837
|
+
addonId: null,
|
|
45838
|
+
access: "create"
|
|
45839
|
+
},
|
|
44415
45840
|
"backup.trigger": {
|
|
44416
45841
|
capName: "backup",
|
|
44417
45842
|
capScope: "system",
|
|
@@ -44964,6 +46389,12 @@ Object.freeze({
|
|
|
44964
46389
|
addonId: null,
|
|
44965
46390
|
access: "create"
|
|
44966
46391
|
},
|
|
46392
|
+
"customModelRegistry.importModelBundle": {
|
|
46393
|
+
capName: "custom-model-registry",
|
|
46394
|
+
capScope: "system",
|
|
46395
|
+
addonId: null,
|
|
46396
|
+
access: "create"
|
|
46397
|
+
},
|
|
44967
46398
|
"customModelRegistry.listModels": {
|
|
44968
46399
|
capName: "custom-model-registry",
|
|
44969
46400
|
capScope: "system",
|
|
@@ -46404,6 +47835,12 @@ Object.freeze({
|
|
|
46404
47835
|
addonId: null,
|
|
46405
47836
|
access: "view"
|
|
46406
47837
|
},
|
|
47838
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47839
|
+
capName: "keychain-admin",
|
|
47840
|
+
capScope: "system",
|
|
47841
|
+
addonId: null,
|
|
47842
|
+
access: "create"
|
|
47843
|
+
},
|
|
46407
47844
|
"keychainAdmin.deleteOrphans": {
|
|
46408
47845
|
capName: "keychain-admin",
|
|
46409
47846
|
capScope: "system",
|
|
@@ -46440,6 +47877,12 @@ Object.freeze({
|
|
|
46440
47877
|
addonId: null,
|
|
46441
47878
|
access: "delete"
|
|
46442
47879
|
},
|
|
47880
|
+
"keychainAdmin.resetReport": {
|
|
47881
|
+
capName: "keychain-admin",
|
|
47882
|
+
capScope: "system",
|
|
47883
|
+
addonId: null,
|
|
47884
|
+
access: "delete"
|
|
47885
|
+
},
|
|
46443
47886
|
"keychainAdmin.reveal": {
|
|
46444
47887
|
capName: "keychain-admin",
|
|
46445
47888
|
capScope: "system",
|
|
@@ -46452,6 +47895,12 @@ Object.freeze({
|
|
|
46452
47895
|
addonId: null,
|
|
46453
47896
|
access: "create"
|
|
46454
47897
|
},
|
|
47898
|
+
"keychainAdmin.setSystemSecret": {
|
|
47899
|
+
capName: "keychain-admin",
|
|
47900
|
+
capScope: "system",
|
|
47901
|
+
addonId: null,
|
|
47902
|
+
access: "create"
|
|
47903
|
+
},
|
|
46455
47904
|
"keychainAdmin.status": {
|
|
46456
47905
|
capName: "keychain-admin",
|
|
46457
47906
|
capScope: "system",
|
|
@@ -47898,6 +49347,12 @@ Object.freeze({
|
|
|
47898
49347
|
addonId: null,
|
|
47899
49348
|
access: "create"
|
|
47900
49349
|
},
|
|
49350
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49351
|
+
capName: "pipeline-analytics",
|
|
49352
|
+
capScope: "device",
|
|
49353
|
+
addonId: null,
|
|
49354
|
+
access: "create"
|
|
49355
|
+
},
|
|
47901
49356
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
47902
49357
|
capName: "pipeline-analytics",
|
|
47903
49358
|
capScope: "device",
|
|
@@ -47910,6 +49365,12 @@ Object.freeze({
|
|
|
47910
49365
|
addonId: null,
|
|
47911
49366
|
access: "delete"
|
|
47912
49367
|
},
|
|
49368
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49369
|
+
capName: "pipeline-analytics",
|
|
49370
|
+
capScope: "device",
|
|
49371
|
+
addonId: null,
|
|
49372
|
+
access: "delete"
|
|
49373
|
+
},
|
|
47913
49374
|
"pipelineAnalytics.deleteTracks": {
|
|
47914
49375
|
capName: "pipeline-analytics",
|
|
47915
49376
|
capScope: "device",
|
|
@@ -48132,6 +49593,12 @@ Object.freeze({
|
|
|
48132
49593
|
addonId: null,
|
|
48133
49594
|
access: "view"
|
|
48134
49595
|
},
|
|
49596
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49597
|
+
capName: "pipeline-analytics",
|
|
49598
|
+
capScope: "device",
|
|
49599
|
+
addonId: null,
|
|
49600
|
+
access: "view"
|
|
49601
|
+
},
|
|
48135
49602
|
"pipelineAnalytics.listRetrainFrames": {
|
|
48136
49603
|
capName: "pipeline-analytics",
|
|
48137
49604
|
capScope: "device",
|
|
@@ -48162,6 +49629,12 @@ Object.freeze({
|
|
|
48162
49629
|
addonId: null,
|
|
48163
49630
|
access: "view"
|
|
48164
49631
|
},
|
|
49632
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49633
|
+
capName: "pipeline-analytics",
|
|
49634
|
+
capScope: "device",
|
|
49635
|
+
addonId: null,
|
|
49636
|
+
access: "create"
|
|
49637
|
+
},
|
|
48165
49638
|
"pipelineAnalytics.ownersWithMedia": {
|
|
48166
49639
|
capName: "pipeline-analytics",
|
|
48167
49640
|
capScope: "device",
|
|
@@ -48174,6 +49647,12 @@ Object.freeze({
|
|
|
48174
49647
|
addonId: null,
|
|
48175
49648
|
access: "create"
|
|
48176
49649
|
},
|
|
49650
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49651
|
+
capName: "pipeline-analytics",
|
|
49652
|
+
capScope: "device",
|
|
49653
|
+
addonId: null,
|
|
49654
|
+
access: "view"
|
|
49655
|
+
},
|
|
48177
49656
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
48178
49657
|
capName: "pipeline-analytics",
|
|
48179
49658
|
capScope: "device",
|
|
@@ -48312,6 +49791,12 @@ Object.freeze({
|
|
|
48312
49791
|
addonId: null,
|
|
48313
49792
|
access: "create"
|
|
48314
49793
|
},
|
|
49794
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49795
|
+
capName: "pipeline-analytics",
|
|
49796
|
+
capScope: "device",
|
|
49797
|
+
addonId: null,
|
|
49798
|
+
access: "view"
|
|
49799
|
+
},
|
|
48315
49800
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
48316
49801
|
capName: "pipeline-analytics",
|
|
48317
49802
|
capScope: "device",
|
|
@@ -50688,6 +52173,174 @@ Object.freeze({
|
|
|
50688
52173
|
addonId: null,
|
|
50689
52174
|
access: "view"
|
|
50690
52175
|
},
|
|
52176
|
+
"training.canaryResult": {
|
|
52177
|
+
capName: "training",
|
|
52178
|
+
capScope: "system",
|
|
52179
|
+
addonId: null,
|
|
52180
|
+
access: "create"
|
|
52181
|
+
},
|
|
52182
|
+
"training.cancelJob": {
|
|
52183
|
+
capName: "training",
|
|
52184
|
+
capScope: "system",
|
|
52185
|
+
addonId: null,
|
|
52186
|
+
access: "create"
|
|
52187
|
+
},
|
|
52188
|
+
"training.discardResult": {
|
|
52189
|
+
capName: "training",
|
|
52190
|
+
capScope: "system",
|
|
52191
|
+
addonId: null,
|
|
52192
|
+
access: "create"
|
|
52193
|
+
},
|
|
52194
|
+
"training.findDatasetVersionIdByName": {
|
|
52195
|
+
capName: "training",
|
|
52196
|
+
capScope: "system",
|
|
52197
|
+
addonId: null,
|
|
52198
|
+
access: "view"
|
|
52199
|
+
},
|
|
52200
|
+
"training.getDatasetVersion": {
|
|
52201
|
+
capName: "training",
|
|
52202
|
+
capScope: "system",
|
|
52203
|
+
addonId: null,
|
|
52204
|
+
access: "view"
|
|
52205
|
+
},
|
|
52206
|
+
"training.getJob": {
|
|
52207
|
+
capName: "training",
|
|
52208
|
+
capScope: "system",
|
|
52209
|
+
addonId: null,
|
|
52210
|
+
access: "view"
|
|
52211
|
+
},
|
|
52212
|
+
"training.getJobResult": {
|
|
52213
|
+
capName: "training",
|
|
52214
|
+
capScope: "system",
|
|
52215
|
+
addonId: null,
|
|
52216
|
+
access: "view"
|
|
52217
|
+
},
|
|
52218
|
+
"training.listBaseModels": {
|
|
52219
|
+
capName: "training",
|
|
52220
|
+
capScope: "system",
|
|
52221
|
+
addonId: null,
|
|
52222
|
+
access: "view"
|
|
52223
|
+
},
|
|
52224
|
+
"training.listDatasetVersions": {
|
|
52225
|
+
capName: "training",
|
|
52226
|
+
capScope: "system",
|
|
52227
|
+
addonId: null,
|
|
52228
|
+
access: "view"
|
|
52229
|
+
},
|
|
52230
|
+
"training.listJobs": {
|
|
52231
|
+
capName: "training",
|
|
52232
|
+
capScope: "system",
|
|
52233
|
+
addonId: null,
|
|
52234
|
+
access: "view"
|
|
52235
|
+
},
|
|
52236
|
+
"training.planJob": {
|
|
52237
|
+
capName: "training",
|
|
52238
|
+
capScope: "system",
|
|
52239
|
+
addonId: null,
|
|
52240
|
+
access: "view"
|
|
52241
|
+
},
|
|
52242
|
+
"training.putDatasetVersion": {
|
|
52243
|
+
capName: "training",
|
|
52244
|
+
capScope: "system",
|
|
52245
|
+
addonId: null,
|
|
52246
|
+
access: "create"
|
|
52247
|
+
},
|
|
52248
|
+
"training.registerResult": {
|
|
52249
|
+
capName: "training",
|
|
52250
|
+
capScope: "system",
|
|
52251
|
+
addonId: null,
|
|
52252
|
+
access: "create"
|
|
52253
|
+
},
|
|
52254
|
+
"training.removeDatasetVersion": {
|
|
52255
|
+
capName: "training",
|
|
52256
|
+
capScope: "system",
|
|
52257
|
+
addonId: null,
|
|
52258
|
+
access: "delete"
|
|
52259
|
+
},
|
|
52260
|
+
"training.rollbackCanary": {
|
|
52261
|
+
capName: "training",
|
|
52262
|
+
capScope: "system",
|
|
52263
|
+
addonId: null,
|
|
52264
|
+
access: "create"
|
|
52265
|
+
},
|
|
52266
|
+
"training.startJob": {
|
|
52267
|
+
capName: "training",
|
|
52268
|
+
capScope: "system",
|
|
52269
|
+
addonId: null,
|
|
52270
|
+
access: "create"
|
|
52271
|
+
},
|
|
52272
|
+
"trainingProvider.cancelJob": {
|
|
52273
|
+
capName: "training-provider",
|
|
52274
|
+
capScope: "system",
|
|
52275
|
+
addonId: null,
|
|
52276
|
+
access: "create"
|
|
52277
|
+
},
|
|
52278
|
+
"trainingProvider.cleanupJob": {
|
|
52279
|
+
capName: "training-provider",
|
|
52280
|
+
capScope: "system",
|
|
52281
|
+
addonId: null,
|
|
52282
|
+
access: "create"
|
|
52283
|
+
},
|
|
52284
|
+
"trainingProvider.describe": {
|
|
52285
|
+
capName: "training-provider",
|
|
52286
|
+
capScope: "system",
|
|
52287
|
+
addonId: null,
|
|
52288
|
+
access: "view"
|
|
52289
|
+
},
|
|
52290
|
+
"trainingProvider.estimateJob": {
|
|
52291
|
+
capName: "training-provider",
|
|
52292
|
+
capScope: "system",
|
|
52293
|
+
addonId: null,
|
|
52294
|
+
access: "view"
|
|
52295
|
+
},
|
|
52296
|
+
"trainingProvider.getJob": {
|
|
52297
|
+
capName: "training-provider",
|
|
52298
|
+
capScope: "system",
|
|
52299
|
+
addonId: null,
|
|
52300
|
+
access: "view"
|
|
52301
|
+
},
|
|
52302
|
+
"trainingProvider.listJobEvents": {
|
|
52303
|
+
capName: "training-provider",
|
|
52304
|
+
capScope: "system",
|
|
52305
|
+
addonId: null,
|
|
52306
|
+
access: "view"
|
|
52307
|
+
},
|
|
52308
|
+
"trainingProvider.listJobs": {
|
|
52309
|
+
capName: "training-provider",
|
|
52310
|
+
capScope: "system",
|
|
52311
|
+
addonId: null,
|
|
52312
|
+
access: "view"
|
|
52313
|
+
},
|
|
52314
|
+
"trainingProvider.offerArtifact": {
|
|
52315
|
+
capName: "training-provider",
|
|
52316
|
+
capScope: "system",
|
|
52317
|
+
addonId: null,
|
|
52318
|
+
access: "create"
|
|
52319
|
+
},
|
|
52320
|
+
"trainingProvider.readResult": {
|
|
52321
|
+
capName: "training-provider",
|
|
52322
|
+
capScope: "system",
|
|
52323
|
+
addonId: null,
|
|
52324
|
+
access: "create"
|
|
52325
|
+
},
|
|
52326
|
+
"trainingProvider.submitJob": {
|
|
52327
|
+
capName: "training-provider",
|
|
52328
|
+
capScope: "system",
|
|
52329
|
+
addonId: null,
|
|
52330
|
+
access: "create"
|
|
52331
|
+
},
|
|
52332
|
+
"trainingProvider.uploadDataset": {
|
|
52333
|
+
capName: "training-provider",
|
|
52334
|
+
capScope: "system",
|
|
52335
|
+
addonId: null,
|
|
52336
|
+
access: "create"
|
|
52337
|
+
},
|
|
52338
|
+
"trainingProvider.validateCredentials": {
|
|
52339
|
+
capName: "training-provider",
|
|
52340
|
+
capScope: "system",
|
|
52341
|
+
addonId: null,
|
|
52342
|
+
access: "create"
|
|
52343
|
+
},
|
|
50691
52344
|
"turnProvider.getTurnServers": {
|
|
50692
52345
|
capName: "turn-provider",
|
|
50693
52346
|
capScope: "system",
|
|
@@ -50712,12 +52365,6 @@ Object.freeze({
|
|
|
50712
52365
|
addonId: null,
|
|
50713
52366
|
access: "create"
|
|
50714
52367
|
},
|
|
50715
|
-
"userManagement.createApiKey": {
|
|
50716
|
-
capName: "user-management",
|
|
50717
|
-
capScope: "system",
|
|
50718
|
-
addonId: null,
|
|
50719
|
-
access: "create"
|
|
50720
|
-
},
|
|
50721
52368
|
"userManagement.createScopedToken": {
|
|
50722
52369
|
capName: "user-management",
|
|
50723
52370
|
capScope: "system",
|
|
@@ -50754,12 +52401,6 @@ Object.freeze({
|
|
|
50754
52401
|
addonId: null,
|
|
50755
52402
|
access: "view"
|
|
50756
52403
|
},
|
|
50757
|
-
"userManagement.linkExternalIdentity": {
|
|
50758
|
-
capName: "user-management",
|
|
50759
|
-
capScope: "system",
|
|
50760
|
-
addonId: null,
|
|
50761
|
-
access: "create"
|
|
50762
|
-
},
|
|
50763
52404
|
"userManagement.listApiKeys": {
|
|
50764
52405
|
capName: "user-management",
|
|
50765
52406
|
capScope: "system",
|
|
@@ -50862,12 +52503,6 @@ Object.freeze({
|
|
|
50862
52503
|
addonId: null,
|
|
50863
52504
|
access: "create"
|
|
50864
52505
|
},
|
|
50865
|
-
"userManagement.validateApiKey": {
|
|
50866
|
-
capName: "user-management",
|
|
50867
|
-
capScope: "system",
|
|
50868
|
-
addonId: null,
|
|
50869
|
-
access: "view"
|
|
50870
|
-
},
|
|
50871
52506
|
"userManagement.validateCredentials": {
|
|
50872
52507
|
capName: "user-management",
|
|
50873
52508
|
capScope: "system",
|
|
@@ -54981,6 +56616,11 @@ Object.freeze({
|
|
|
54981
56616
|
form: "single",
|
|
54982
56617
|
optional: false
|
|
54983
56618
|
}],
|
|
56619
|
+
"training.canaryResult": [{
|
|
56620
|
+
name: "deviceIds",
|
|
56621
|
+
form: "array",
|
|
56622
|
+
optional: false
|
|
56623
|
+
}],
|
|
54984
56624
|
"update.getStatus": [{
|
|
54985
56625
|
name: "deviceId",
|
|
54986
56626
|
form: "single",
|