@camstack/addon-import-alexa 0.2.122 → 0.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +3555 -126
- package/dist/addon.mjs +3555 -126
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
39
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region ../types/dist/event-category-
|
|
41
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
42
42
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
43
43
|
EventCategory["SystemBoot"] = "system.boot";
|
|
44
44
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -117,6 +117,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
117
117
|
*/
|
|
118
118
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
119
119
|
/**
|
|
120
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
121
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
122
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
123
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
124
|
+
*/
|
|
125
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
126
|
+
/**
|
|
120
127
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
121
128
|
* transitions from `failed` back to `healthy` (typically via the
|
|
122
129
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5409,7 +5416,7 @@ var ZodIssueCode = {
|
|
|
5409
5416
|
var ZodFirstPartyTypeKind;
|
|
5410
5417
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5411
5418
|
//#endregion
|
|
5412
|
-
//#region ../types/dist/sleep-
|
|
5419
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5413
5420
|
/**
|
|
5414
5421
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5415
5422
|
* window to float samples (D455).
|
|
@@ -5488,6 +5495,97 @@ function buildAlawTable() {
|
|
|
5488
5495
|
}
|
|
5489
5496
|
buildUlawTable();
|
|
5490
5497
|
buildAlawTable();
|
|
5498
|
+
/** Is this field's stored value a credential? */
|
|
5499
|
+
function isSecretConfigField(field) {
|
|
5500
|
+
if (field.type === "password") return true;
|
|
5501
|
+
return "secret" in field && field.secret === true;
|
|
5502
|
+
}
|
|
5503
|
+
/**
|
|
5504
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5505
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5506
|
+
*/
|
|
5507
|
+
function isKeychainStoredField(field) {
|
|
5508
|
+
if (!isSecretConfigField(field)) return false;
|
|
5509
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5510
|
+
return !("storage" in field && field.storage === "inline");
|
|
5511
|
+
}
|
|
5512
|
+
/**
|
|
5513
|
+
* What a settings blob holds where a secret used to be.
|
|
5514
|
+
*
|
|
5515
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5516
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5517
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5518
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5519
|
+
*
|
|
5520
|
+
* The same shapes travel to and from the admin UI:
|
|
5521
|
+
*
|
|
5522
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5523
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5524
|
+
* value is set, never the value.
|
|
5525
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5526
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5527
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5528
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5529
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5530
|
+
*
|
|
5531
|
+
* Pure and browser-safe.
|
|
5532
|
+
*/
|
|
5533
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5534
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5535
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5536
|
+
function isRecord$2(value) {
|
|
5537
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5538
|
+
}
|
|
5539
|
+
function makeSecretMarker(ref) {
|
|
5540
|
+
return {
|
|
5541
|
+
$secret: ref,
|
|
5542
|
+
v: 1
|
|
5543
|
+
};
|
|
5544
|
+
}
|
|
5545
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5546
|
+
function isSecretMarker(value) {
|
|
5547
|
+
if (!isRecord$2(value)) return false;
|
|
5548
|
+
const ref = value["$secret"];
|
|
5549
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5550
|
+
}
|
|
5551
|
+
function isSecretClear(value) {
|
|
5552
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5553
|
+
}
|
|
5554
|
+
/**
|
|
5555
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5556
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5557
|
+
* survives this function.
|
|
5558
|
+
*/
|
|
5559
|
+
function toSecretFieldView(stored) {
|
|
5560
|
+
if (isSecretMarker(stored)) return {
|
|
5561
|
+
$secret: stored.$secret,
|
|
5562
|
+
v: 1,
|
|
5563
|
+
set: true
|
|
5564
|
+
};
|
|
5565
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5566
|
+
$secret: null,
|
|
5567
|
+
v: 1,
|
|
5568
|
+
set: true,
|
|
5569
|
+
inline: true
|
|
5570
|
+
};
|
|
5571
|
+
return null;
|
|
5572
|
+
}
|
|
5573
|
+
/**
|
|
5574
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5575
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5576
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5577
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5578
|
+
*/
|
|
5579
|
+
function classifySecretWrite(incoming) {
|
|
5580
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5581
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5582
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5583
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5584
|
+
return {
|
|
5585
|
+
kind: "set",
|
|
5586
|
+
value: incoming
|
|
5587
|
+
};
|
|
5588
|
+
}
|
|
5491
5589
|
Object.fromEntries([
|
|
5492
5590
|
{
|
|
5493
5591
|
id: "overview",
|
|
@@ -5659,33 +5757,19 @@ Object.fromEntries([
|
|
|
5659
5757
|
function isValuelessField(field) {
|
|
5660
5758
|
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
|
|
5661
5759
|
}
|
|
5662
|
-
|
|
5663
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5664
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5665
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5666
|
-
*
|
|
5667
|
-
* For each leaf field:
|
|
5668
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5669
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5670
|
-
*
|
|
5671
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5672
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5673
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5674
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5675
|
-
*/
|
|
5676
|
-
function hydrateSchema(schema, values) {
|
|
5760
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5677
5761
|
return {
|
|
5678
5762
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5679
5763
|
sections: schema.sections.map((section) => ({
|
|
5680
5764
|
...section,
|
|
5681
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5765
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5682
5766
|
}))
|
|
5683
5767
|
};
|
|
5684
5768
|
}
|
|
5685
|
-
function hydrateField(field, values) {
|
|
5769
|
+
function hydrateField(field, values, options) {
|
|
5686
5770
|
if (isValuelessField(field)) return field;
|
|
5687
5771
|
if (field.type === "group") {
|
|
5688
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5772
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5689
5773
|
return {
|
|
5690
5774
|
...field,
|
|
5691
5775
|
fields: hydratedChildren
|
|
@@ -5694,7 +5778,7 @@ function hydrateField(field, values) {
|
|
|
5694
5778
|
if (field.type === "sub-tabs") {
|
|
5695
5779
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5696
5780
|
...tab,
|
|
5697
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5781
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5698
5782
|
}));
|
|
5699
5783
|
return {
|
|
5700
5784
|
...field,
|
|
@@ -5704,6 +5788,33 @@ function hydrateField(field, values) {
|
|
|
5704
5788
|
const key = field.key;
|
|
5705
5789
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5706
5790
|
const defaultValue = field.default;
|
|
5791
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5792
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5793
|
+
...field,
|
|
5794
|
+
value: toSecretFieldView(storedValue)
|
|
5795
|
+
};
|
|
5796
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5797
|
+
...field,
|
|
5798
|
+
value: null
|
|
5799
|
+
};
|
|
5800
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5801
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5802
|
+
if (secretItemKeys.length > 0) {
|
|
5803
|
+
const rows = storedValue.map((row) => {
|
|
5804
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5805
|
+
const out = { ...row };
|
|
5806
|
+
for (const k of secretItemKeys) {
|
|
5807
|
+
const v = Reflect.get(row, k);
|
|
5808
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5809
|
+
}
|
|
5810
|
+
return out;
|
|
5811
|
+
});
|
|
5812
|
+
return {
|
|
5813
|
+
...field,
|
|
5814
|
+
value: rows
|
|
5815
|
+
};
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5707
5818
|
if (field.multiple) {
|
|
5708
5819
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5709
5820
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5946,6 +6057,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5946
6057
|
}
|
|
5947
6058
|
return out;
|
|
5948
6059
|
}
|
|
6060
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6061
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6062
|
+
function globalSecretScope() {
|
|
6063
|
+
return GLOBAL_SCOPE;
|
|
6064
|
+
}
|
|
6065
|
+
function encodeSegment(value) {
|
|
6066
|
+
return encodeURIComponent(value);
|
|
6067
|
+
}
|
|
6068
|
+
function decodeSegment(value) {
|
|
6069
|
+
try {
|
|
6070
|
+
return decodeURIComponent(value);
|
|
6071
|
+
} catch {
|
|
6072
|
+
return null;
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
/**
|
|
6076
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6077
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6078
|
+
* `providers[authentik].clientSecret`.
|
|
6079
|
+
*/
|
|
6080
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6081
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6082
|
+
}
|
|
6083
|
+
function parseScope(segments) {
|
|
6084
|
+
switch (segments[0]) {
|
|
6085
|
+
case "global": return {
|
|
6086
|
+
scope: GLOBAL_SCOPE,
|
|
6087
|
+
used: 1
|
|
6088
|
+
};
|
|
6089
|
+
case "node": {
|
|
6090
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6091
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6092
|
+
scope: {
|
|
6093
|
+
kind: "node",
|
|
6094
|
+
nodeId
|
|
6095
|
+
},
|
|
6096
|
+
used: 2
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
case "device": {
|
|
6100
|
+
const raw = segments[1];
|
|
6101
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6102
|
+
return {
|
|
6103
|
+
scope: {
|
|
6104
|
+
kind: "device",
|
|
6105
|
+
deviceId: Number(raw)
|
|
6106
|
+
},
|
|
6107
|
+
used: 2
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6110
|
+
case "integration": {
|
|
6111
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6112
|
+
return id === null || id.length === 0 ? null : {
|
|
6113
|
+
scope: {
|
|
6114
|
+
kind: "integration",
|
|
6115
|
+
integrationId: id
|
|
6116
|
+
},
|
|
6117
|
+
used: 2
|
|
6118
|
+
};
|
|
6119
|
+
}
|
|
6120
|
+
case "row": {
|
|
6121
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6122
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6123
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6124
|
+
return {
|
|
6125
|
+
scope: {
|
|
6126
|
+
kind: "row",
|
|
6127
|
+
collection,
|
|
6128
|
+
rowId
|
|
6129
|
+
},
|
|
6130
|
+
used: 3
|
|
6131
|
+
};
|
|
6132
|
+
}
|
|
6133
|
+
default: return null;
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
6136
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6137
|
+
function parseSecretRef(ref) {
|
|
6138
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6139
|
+
const segments = ref.slice(9).split("/");
|
|
6140
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6141
|
+
if (owner === null || owner.length === 0) return null;
|
|
6142
|
+
const parsed = parseScope(segments.slice(1));
|
|
6143
|
+
if (parsed === null) return null;
|
|
6144
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6145
|
+
if (fieldPath.length === 0) return null;
|
|
6146
|
+
return {
|
|
6147
|
+
owner,
|
|
6148
|
+
scope: parsed.scope,
|
|
6149
|
+
fieldPath
|
|
6150
|
+
};
|
|
6151
|
+
}
|
|
6152
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6153
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6154
|
+
fieldPath;
|
|
6155
|
+
constructor(fieldPath, cause) {
|
|
6156
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6157
|
+
this.fieldPath = fieldPath;
|
|
6158
|
+
this.name = "KeychainWriteRefusedError";
|
|
6159
|
+
}
|
|
6160
|
+
};
|
|
6161
|
+
var KEEP = { kind: "keep" };
|
|
6162
|
+
function isRecord$1$1(value) {
|
|
6163
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6164
|
+
}
|
|
6165
|
+
function defaultMintId() {
|
|
6166
|
+
return globalThis.crypto.randomUUID();
|
|
6167
|
+
}
|
|
6168
|
+
/** Every marker ref anywhere under `value`. */
|
|
6169
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6170
|
+
if (isSecretMarker(value)) {
|
|
6171
|
+
out.push(value.$secret);
|
|
6172
|
+
return out;
|
|
6173
|
+
}
|
|
6174
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6175
|
+
else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6176
|
+
return out;
|
|
6177
|
+
}
|
|
6178
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6179
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6180
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6181
|
+
}
|
|
6182
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6183
|
+
const intent = classifySecretWrite(incoming);
|
|
6184
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6185
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6186
|
+
if (intent.kind === "keep") return KEEP;
|
|
6187
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6188
|
+
if (intent.kind === "clear") {
|
|
6189
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6190
|
+
return {
|
|
6191
|
+
kind: "value",
|
|
6192
|
+
value: null
|
|
6193
|
+
};
|
|
6194
|
+
}
|
|
6195
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6196
|
+
kind: "value",
|
|
6197
|
+
value: stored
|
|
6198
|
+
};
|
|
6199
|
+
try {
|
|
6200
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6201
|
+
} catch (err) {
|
|
6202
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6203
|
+
}
|
|
6204
|
+
return {
|
|
6205
|
+
kind: "value",
|
|
6206
|
+
value: makeSecretMarker(ref)
|
|
6207
|
+
};
|
|
6208
|
+
}
|
|
6209
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6210
|
+
function applyMember(out, key, result, storedParent) {
|
|
6211
|
+
if (result.kind === "value") {
|
|
6212
|
+
out[key] = result.value;
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6215
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6216
|
+
else delete out[key];
|
|
6217
|
+
}
|
|
6218
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6219
|
+
const out = { ...incoming };
|
|
6220
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6221
|
+
return out;
|
|
6222
|
+
}
|
|
6223
|
+
function rowId(row, idKey) {
|
|
6224
|
+
const raw = row[idKey];
|
|
6225
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6226
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6227
|
+
return null;
|
|
6228
|
+
}
|
|
6229
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6230
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
|
|
6231
|
+
if (!Array.isArray(incoming)) {
|
|
6232
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6233
|
+
return {
|
|
6234
|
+
kind: "value",
|
|
6235
|
+
value: incoming
|
|
6236
|
+
};
|
|
6237
|
+
}
|
|
6238
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6239
|
+
for (const row of storedRows) {
|
|
6240
|
+
const id = rowId(row, node.idKey);
|
|
6241
|
+
if (id !== null) storedById.set(id, row);
|
|
6242
|
+
}
|
|
6243
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6244
|
+
const rows = [];
|
|
6245
|
+
for (const row of incoming) {
|
|
6246
|
+
if (!isRecord$1$1(row)) {
|
|
6247
|
+
rows.push(row);
|
|
6248
|
+
continue;
|
|
6249
|
+
}
|
|
6250
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6251
|
+
kept.add(id);
|
|
6252
|
+
const withId = {
|
|
6253
|
+
...row,
|
|
6254
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6255
|
+
};
|
|
6256
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6257
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6258
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6259
|
+
}
|
|
6260
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6261
|
+
return {
|
|
6262
|
+
kind: "value",
|
|
6263
|
+
value: rows
|
|
6264
|
+
};
|
|
6265
|
+
}
|
|
6266
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6267
|
+
switch (node.kind) {
|
|
6268
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6269
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6270
|
+
case "object": {
|
|
6271
|
+
if (!isRecord$1$1(incoming)) {
|
|
6272
|
+
if (incoming === void 0) return KEEP;
|
|
6273
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6274
|
+
return {
|
|
6275
|
+
kind: "value",
|
|
6276
|
+
value: incoming
|
|
6277
|
+
};
|
|
6278
|
+
}
|
|
6279
|
+
const storedObj = isRecord$1$1(stored) ? stored : {};
|
|
6280
|
+
return {
|
|
6281
|
+
kind: "value",
|
|
6282
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6283
|
+
};
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
}
|
|
6287
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6288
|
+
function splitNodeKey(key) {
|
|
6289
|
+
const at = key.indexOf("@");
|
|
6290
|
+
return at <= 0 ? {
|
|
6291
|
+
base: key,
|
|
6292
|
+
nodeId: null
|
|
6293
|
+
} : {
|
|
6294
|
+
base: key.slice(0, at),
|
|
6295
|
+
nodeId: key.slice(at + 1)
|
|
6296
|
+
};
|
|
6297
|
+
}
|
|
6298
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6299
|
+
async function transformSecretWrite(input) {
|
|
6300
|
+
const deletes = [];
|
|
6301
|
+
const base = {
|
|
6302
|
+
secrets: input.secrets,
|
|
6303
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6304
|
+
deletes,
|
|
6305
|
+
operatorWrite: input.operatorWrite === true
|
|
6306
|
+
};
|
|
6307
|
+
const out = {};
|
|
6308
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6309
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6310
|
+
const node = input.tree.get(baseKey);
|
|
6311
|
+
if (node === void 0) {
|
|
6312
|
+
out[key] = incoming;
|
|
6313
|
+
continue;
|
|
6314
|
+
}
|
|
6315
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6316
|
+
kind: "node",
|
|
6317
|
+
nodeId
|
|
6318
|
+
} : input.scope ?? globalSecretScope();
|
|
6319
|
+
const result = await writeNode({
|
|
6320
|
+
...base,
|
|
6321
|
+
scope
|
|
6322
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6323
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6324
|
+
}
|
|
6325
|
+
return {
|
|
6326
|
+
patch: out,
|
|
6327
|
+
afterWrite: async () => {
|
|
6328
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6329
|
+
try {
|
|
6330
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6331
|
+
return { orphaned: [] };
|
|
6332
|
+
} catch {
|
|
6333
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6339
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6340
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6341
|
+
}
|
|
6342
|
+
/**
|
|
6343
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6344
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6345
|
+
*/
|
|
6346
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6347
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6348
|
+
const owner = options.ownedBy;
|
|
6349
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6350
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6351
|
+
if (refs.length === 0) return {
|
|
6352
|
+
value,
|
|
6353
|
+
unresolved: []
|
|
6354
|
+
};
|
|
6355
|
+
const answers = await secrets.resolve(refs);
|
|
6356
|
+
const unresolved = [];
|
|
6357
|
+
for (const ref of new Set(refs)) {
|
|
6358
|
+
const answer = answers[ref];
|
|
6359
|
+
if (answer === void 0) unresolved.push({
|
|
6360
|
+
ref,
|
|
6361
|
+
reason: "not-initialized"
|
|
6362
|
+
});
|
|
6363
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6364
|
+
ref,
|
|
6365
|
+
reason: answer.reason
|
|
6366
|
+
});
|
|
6367
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6368
|
+
ref,
|
|
6369
|
+
reason: answer.kind
|
|
6370
|
+
});
|
|
6371
|
+
}
|
|
6372
|
+
const substitute = (v) => {
|
|
6373
|
+
if (isSecretMarker(v)) {
|
|
6374
|
+
if (!inScope(v.$secret)) return {
|
|
6375
|
+
keep: true,
|
|
6376
|
+
value: v
|
|
6377
|
+
};
|
|
6378
|
+
const answer = answers[v.$secret];
|
|
6379
|
+
if (answer?.kind === "value") return {
|
|
6380
|
+
keep: true,
|
|
6381
|
+
value: answer.value
|
|
6382
|
+
};
|
|
6383
|
+
return keepMarker ? {
|
|
6384
|
+
keep: true,
|
|
6385
|
+
value: v
|
|
6386
|
+
} : {
|
|
6387
|
+
keep: false,
|
|
6388
|
+
value: void 0
|
|
6389
|
+
};
|
|
6390
|
+
}
|
|
6391
|
+
if (Array.isArray(v)) {
|
|
6392
|
+
const items = [];
|
|
6393
|
+
for (const item of v) {
|
|
6394
|
+
const s = substitute(item);
|
|
6395
|
+
if (s.keep) items.push(s.value);
|
|
6396
|
+
}
|
|
6397
|
+
return {
|
|
6398
|
+
keep: true,
|
|
6399
|
+
value: items
|
|
6400
|
+
};
|
|
6401
|
+
}
|
|
6402
|
+
if (isRecord$1$1(v)) {
|
|
6403
|
+
const out = {};
|
|
6404
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6405
|
+
const s = substitute(child);
|
|
6406
|
+
if (s.keep) out[k] = s.value;
|
|
6407
|
+
}
|
|
6408
|
+
return {
|
|
6409
|
+
keep: true,
|
|
6410
|
+
value: out
|
|
6411
|
+
};
|
|
6412
|
+
}
|
|
6413
|
+
return {
|
|
6414
|
+
keep: true,
|
|
6415
|
+
value: v
|
|
6416
|
+
};
|
|
6417
|
+
};
|
|
6418
|
+
return {
|
|
6419
|
+
value: substitute(value).value,
|
|
6420
|
+
unresolved
|
|
6421
|
+
};
|
|
6422
|
+
}
|
|
6423
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6424
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6425
|
+
ref;
|
|
6426
|
+
reason;
|
|
6427
|
+
constructor(ref, reason) {
|
|
6428
|
+
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.`);
|
|
6429
|
+
this.ref = ref;
|
|
6430
|
+
this.reason = reason;
|
|
6431
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6432
|
+
}
|
|
6433
|
+
};
|
|
6434
|
+
function isRecord$3(value) {
|
|
6435
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6436
|
+
}
|
|
6437
|
+
function resolvedValue(pass, marker) {
|
|
6438
|
+
const answer = pass.answers[marker.$secret];
|
|
6439
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6440
|
+
}
|
|
6441
|
+
async function atMarker(pass, incoming, stored) {
|
|
6442
|
+
if (incoming === null) return stored;
|
|
6443
|
+
if (typeof incoming !== "string") return incoming;
|
|
6444
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6445
|
+
const intent = classifySecretWrite(incoming);
|
|
6446
|
+
if (intent.kind !== "set") return stored;
|
|
6447
|
+
const ref = stored.$secret;
|
|
6448
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6449
|
+
const answer = pass.answers[ref];
|
|
6450
|
+
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);
|
|
6451
|
+
try {
|
|
6452
|
+
await pass.secrets.put(ref, intent.value);
|
|
6453
|
+
} catch (err) {
|
|
6454
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6455
|
+
}
|
|
6456
|
+
pass.changedRefs.push(ref);
|
|
6457
|
+
return stored;
|
|
6458
|
+
}
|
|
6459
|
+
function inArray(pass, incoming, stored) {
|
|
6460
|
+
return incoming.map((item, index) => {
|
|
6461
|
+
const twin = stored[index];
|
|
6462
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6463
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6464
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6465
|
+
return item;
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
6468
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6469
|
+
const out = { ...incoming };
|
|
6470
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6471
|
+
const twin = stored[key];
|
|
6472
|
+
if (isSecretMarker(twin)) {
|
|
6473
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6474
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6475
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6476
|
+
}
|
|
6477
|
+
return out;
|
|
6478
|
+
}
|
|
6479
|
+
async function walk(pass, incoming, stored) {
|
|
6480
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6481
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6482
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6483
|
+
const out = { ...incoming };
|
|
6484
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6485
|
+
return out;
|
|
6486
|
+
}
|
|
6487
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6488
|
+
async function restoreUnchangedSecrets(input) {
|
|
6489
|
+
const refs = [];
|
|
6490
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6491
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6492
|
+
if (owned.length === 0) return {
|
|
6493
|
+
patch: input.patch,
|
|
6494
|
+
changedRefs: []
|
|
6495
|
+
};
|
|
6496
|
+
const pass = {
|
|
6497
|
+
secrets: input.secrets,
|
|
6498
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6499
|
+
operatorWrite: input.operatorWrite,
|
|
6500
|
+
changedRefs: []
|
|
6501
|
+
};
|
|
6502
|
+
const out = {};
|
|
6503
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6504
|
+
return {
|
|
6505
|
+
patch: out,
|
|
6506
|
+
changedRefs: pass.changedRefs
|
|
6507
|
+
};
|
|
6508
|
+
}
|
|
6509
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6510
|
+
function isJsonEqual(a, b) {
|
|
6511
|
+
if (Object.is(a, b)) return true;
|
|
6512
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6513
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6514
|
+
const keys = Object.keys(a);
|
|
6515
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6516
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6517
|
+
}
|
|
6518
|
+
return false;
|
|
6519
|
+
}
|
|
6520
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6521
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6522
|
+
const out = {};
|
|
6523
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6524
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6525
|
+
out[key] = value;
|
|
6526
|
+
}
|
|
6527
|
+
return out;
|
|
6528
|
+
}
|
|
6529
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6530
|
+
function markerKeysOf(blob, owner) {
|
|
6531
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6532
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6533
|
+
return keys;
|
|
6534
|
+
}
|
|
6535
|
+
function nodeFromStored(value, owner) {
|
|
6536
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6537
|
+
if (!isRecord$3(value)) return null;
|
|
6538
|
+
const children = /* @__PURE__ */ new Map();
|
|
6539
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6540
|
+
const node = nodeFromStored(child, owner);
|
|
6541
|
+
if (node !== null) children.set(key, node);
|
|
6542
|
+
}
|
|
6543
|
+
return children.size > 0 ? {
|
|
6544
|
+
kind: "object",
|
|
6545
|
+
children
|
|
6546
|
+
} : null;
|
|
6547
|
+
}
|
|
6548
|
+
/**
|
|
6549
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6550
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6551
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6552
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6553
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6554
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6555
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6556
|
+
* over.
|
|
6557
|
+
*/
|
|
6558
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6559
|
+
const added = /* @__PURE__ */ new Map();
|
|
6560
|
+
for (const key of keys) {
|
|
6561
|
+
const at = key.indexOf("@");
|
|
6562
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6563
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6564
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6565
|
+
if (node !== null) added.set(base, node);
|
|
6566
|
+
}
|
|
6567
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6568
|
+
}
|
|
6569
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6570
|
+
async function readStoredAddonBlob(raw) {
|
|
6571
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6572
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6573
|
+
const result = await threeWay.call(raw);
|
|
6574
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6575
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6576
|
+
}
|
|
6577
|
+
function touchesTree(tree, patch) {
|
|
6578
|
+
if (tree.size === 0) return false;
|
|
6579
|
+
for (const key of Object.keys(patch)) {
|
|
6580
|
+
const at = key.indexOf("@");
|
|
6581
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6582
|
+
}
|
|
6583
|
+
return false;
|
|
6584
|
+
}
|
|
6585
|
+
/**
|
|
6586
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6587
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6588
|
+
*/
|
|
6589
|
+
var MarkerKeyIndex = class {
|
|
6590
|
+
owner;
|
|
6591
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6592
|
+
constructor(owner) {
|
|
6593
|
+
this.owner = owner;
|
|
6594
|
+
}
|
|
6595
|
+
seen(store, blob) {
|
|
6596
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6597
|
+
}
|
|
6598
|
+
wrote(store, patch) {
|
|
6599
|
+
const keys = this.byStore.get(store);
|
|
6600
|
+
if (keys === void 0) return;
|
|
6601
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6602
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6603
|
+
else keys.delete(key);
|
|
6604
|
+
}
|
|
6605
|
+
mayHoldMarkers(store, patch) {
|
|
6606
|
+
const keys = this.byStore.get(store);
|
|
6607
|
+
if (keys === void 0) return true;
|
|
6608
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6609
|
+
}
|
|
6610
|
+
};
|
|
6611
|
+
function createHandle(raw, opts) {
|
|
6612
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6613
|
+
const serialize = (key, fn) => {
|
|
6614
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6615
|
+
const tail = next.catch(() => void 0);
|
|
6616
|
+
chains.set(key, tail);
|
|
6617
|
+
tail.then(() => {
|
|
6618
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6619
|
+
});
|
|
6620
|
+
return next;
|
|
6621
|
+
};
|
|
6622
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6623
|
+
const resolveRead = async (store, blob) => {
|
|
6624
|
+
index.seen(store, blob);
|
|
6625
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6626
|
+
unresolved: "keep-marker",
|
|
6627
|
+
ownedBy: opts.secrets.owner
|
|
6628
|
+
});
|
|
6629
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6630
|
+
return value;
|
|
6631
|
+
};
|
|
6632
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6633
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6634
|
+
await rawWrite(patch);
|
|
6635
|
+
index.wrote(store, patch);
|
|
6636
|
+
return { changed: true };
|
|
6637
|
+
}
|
|
6638
|
+
return serialize(store, async () => {
|
|
6639
|
+
const stored = await readStored();
|
|
6640
|
+
index.seen(store, stored);
|
|
6641
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6642
|
+
const restored = await restoreUnchangedSecrets({
|
|
6643
|
+
patch,
|
|
6644
|
+
stored,
|
|
6645
|
+
secrets: opts.secrets,
|
|
6646
|
+
operatorWrite
|
|
6647
|
+
});
|
|
6648
|
+
const result = await transformSecretWrite({
|
|
6649
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6650
|
+
secrets: opts.secrets,
|
|
6651
|
+
patch: restored.patch,
|
|
6652
|
+
stored,
|
|
6653
|
+
...scope !== void 0 ? { scope } : {},
|
|
6654
|
+
operatorWrite
|
|
6655
|
+
});
|
|
6656
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6657
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6658
|
+
if (wroteBlob) {
|
|
6659
|
+
await rawWrite(effective);
|
|
6660
|
+
index.wrote(store, effective);
|
|
6661
|
+
}
|
|
6662
|
+
const { orphaned } = await result.afterWrite();
|
|
6663
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6664
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6665
|
+
});
|
|
6666
|
+
};
|
|
6667
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6668
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6669
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6670
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6671
|
+
const overrides = {
|
|
6672
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6673
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6674
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6675
|
+
return result.kind === "value" ? {
|
|
6676
|
+
kind: "value",
|
|
6677
|
+
value: await resolveRead("addon", result.value)
|
|
6678
|
+
} : result;
|
|
6679
|
+
} } : {},
|
|
6680
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6681
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6682
|
+
if (result.kind !== "present") return result;
|
|
6683
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6684
|
+
unresolved: "keep-marker",
|
|
6685
|
+
ownedBy: opts.secrets.owner
|
|
6686
|
+
});
|
|
6687
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6688
|
+
return {
|
|
6689
|
+
kind: "present",
|
|
6690
|
+
value: value[key]
|
|
6691
|
+
};
|
|
6692
|
+
} } : {},
|
|
6693
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6694
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6695
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6696
|
+
const out = /* @__PURE__ */ new Map();
|
|
6697
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6698
|
+
return out;
|
|
6699
|
+
} } : {},
|
|
6700
|
+
writeAddonStore: async (patch) => {
|
|
6701
|
+
await writeAddon(patch);
|
|
6702
|
+
},
|
|
6703
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6704
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6705
|
+
kind: "device",
|
|
6706
|
+
deviceId
|
|
6707
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6708
|
+
}
|
|
6709
|
+
};
|
|
6710
|
+
return {
|
|
6711
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6712
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6713
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6714
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6715
|
+
} }),
|
|
6716
|
+
raw: {
|
|
6717
|
+
readAddonStore: async () => {
|
|
6718
|
+
const blob = await raw.readAddonStore();
|
|
6719
|
+
index.seen("addon", blob);
|
|
6720
|
+
return blob;
|
|
6721
|
+
},
|
|
6722
|
+
readDeviceStore: async (deviceId) => {
|
|
6723
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6724
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6725
|
+
return blob;
|
|
6726
|
+
}
|
|
6727
|
+
},
|
|
6728
|
+
writeAddonStore: writeAddon
|
|
6729
|
+
};
|
|
6730
|
+
}
|
|
6731
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6732
|
+
function createSecretAwareContext(context, opts) {
|
|
6733
|
+
const raw = context.settings;
|
|
6734
|
+
if (raw === void 0) return {
|
|
6735
|
+
context,
|
|
6736
|
+
handle: null
|
|
6737
|
+
};
|
|
6738
|
+
const handle = createHandle(raw, opts);
|
|
6739
|
+
return {
|
|
6740
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6741
|
+
if (prop === "settings") return handle.settings;
|
|
6742
|
+
return Reflect.get(target, prop, receiver);
|
|
6743
|
+
} }),
|
|
6744
|
+
handle
|
|
6745
|
+
};
|
|
6746
|
+
}
|
|
6747
|
+
var LEAF = { kind: "leaf" };
|
|
6748
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6749
|
+
function collectFields(fields, out) {
|
|
6750
|
+
for (const field of fields) {
|
|
6751
|
+
if (field.type === "group") {
|
|
6752
|
+
collectFields(field.fields, out);
|
|
6753
|
+
continue;
|
|
6754
|
+
}
|
|
6755
|
+
if (field.type === "sub-tabs") {
|
|
6756
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6757
|
+
continue;
|
|
6758
|
+
}
|
|
6759
|
+
if (field.type === "editable-array") {
|
|
6760
|
+
const item = /* @__PURE__ */ new Map();
|
|
6761
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6762
|
+
if (item.size > 0) out.set(field.key, {
|
|
6763
|
+
kind: "array",
|
|
6764
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6765
|
+
item
|
|
6766
|
+
});
|
|
6767
|
+
continue;
|
|
6768
|
+
}
|
|
6769
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6770
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
/** The secret tree a settings schema declares. */
|
|
6774
|
+
function secretTreeFromSchema(schema) {
|
|
6775
|
+
const out = /* @__PURE__ */ new Map();
|
|
6776
|
+
if (schema === null) return out;
|
|
6777
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6778
|
+
return out;
|
|
6779
|
+
}
|
|
6780
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6781
|
+
function parseSecretStatePath(path) {
|
|
6782
|
+
const segments = [];
|
|
6783
|
+
for (const raw of path.split(".")) {
|
|
6784
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6785
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6786
|
+
segments.push(m[2] !== void 0 ? {
|
|
6787
|
+
key: m[1],
|
|
6788
|
+
idKey: m[2]
|
|
6789
|
+
} : { key: m[1] });
|
|
6790
|
+
}
|
|
6791
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6792
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6793
|
+
return segments;
|
|
6794
|
+
}
|
|
6795
|
+
function insert(into, segments) {
|
|
6796
|
+
const [head, ...rest] = segments;
|
|
6797
|
+
if (head === void 0) return;
|
|
6798
|
+
if (rest.length === 0) {
|
|
6799
|
+
into.set(head.key, LEAF);
|
|
6800
|
+
return;
|
|
6801
|
+
}
|
|
6802
|
+
const existing = into.get(head.key);
|
|
6803
|
+
if (head.idKey !== void 0) {
|
|
6804
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6805
|
+
insert(item, rest);
|
|
6806
|
+
into.set(head.key, {
|
|
6807
|
+
kind: "array",
|
|
6808
|
+
idKey: head.idKey,
|
|
6809
|
+
item
|
|
6810
|
+
});
|
|
6811
|
+
return;
|
|
6812
|
+
}
|
|
6813
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6814
|
+
insert(children, rest);
|
|
6815
|
+
into.set(head.key, {
|
|
6816
|
+
kind: "object",
|
|
6817
|
+
children
|
|
6818
|
+
});
|
|
6819
|
+
}
|
|
6820
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6821
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6822
|
+
if (paths.length === 0) return tree;
|
|
6823
|
+
const out = new Map(tree);
|
|
6824
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6825
|
+
return out;
|
|
6826
|
+
}
|
|
6827
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6828
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6829
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6830
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6831
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5949
6832
|
/**
|
|
5950
6833
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5951
6834
|
*
|
|
@@ -6015,6 +6898,33 @@ var BaseAddon = class {
|
|
|
6015
6898
|
settingsStoreReady = false;
|
|
6016
6899
|
/** Default config values. Provided via constructor. */
|
|
6017
6900
|
defaults;
|
|
6901
|
+
/**
|
|
6902
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6903
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6904
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6905
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6906
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6907
|
+
*/
|
|
6908
|
+
secretStatePaths = [];
|
|
6909
|
+
_addonSecretTree = null;
|
|
6910
|
+
_deviceSecretTree = null;
|
|
6911
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6912
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6913
|
+
_unresolvedSecrets = [];
|
|
6914
|
+
_secretRetryTimer = null;
|
|
6915
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6916
|
+
_secretChangeTimer = null;
|
|
6917
|
+
_secretChangeUnsub = null;
|
|
6918
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6919
|
+
_operatorWriteDepth = 0;
|
|
6920
|
+
/**
|
|
6921
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6922
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6923
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6924
|
+
*/
|
|
6925
|
+
_secretSettings = null;
|
|
6926
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6927
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6018
6928
|
constructor(defaults) {
|
|
6019
6929
|
this.defaults = defaults;
|
|
6020
6930
|
this._config = { ...defaults };
|
|
@@ -6050,8 +6960,26 @@ var BaseAddon = class {
|
|
|
6050
6960
|
return this._config;
|
|
6051
6961
|
}
|
|
6052
6962
|
async initialize(context) {
|
|
6053
|
-
|
|
6963
|
+
const secrets = context.secrets;
|
|
6964
|
+
if (secrets !== void 0) {
|
|
6965
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6966
|
+
secrets,
|
|
6967
|
+
addonTree: () => this.addonSecretTree(),
|
|
6968
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6969
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6970
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6971
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6972
|
+
});
|
|
6973
|
+
this._ctx = wrapped;
|
|
6974
|
+
this._secretSettings = handle;
|
|
6975
|
+
} else {
|
|
6976
|
+
this._ctx = context;
|
|
6977
|
+
this._secretSettings = null;
|
|
6978
|
+
}
|
|
6054
6979
|
await this.resolveConfig();
|
|
6980
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6981
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6982
|
+
});
|
|
6055
6983
|
const result = await this.onInitialize();
|
|
6056
6984
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6057
6985
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6084,6 +7012,12 @@ var BaseAddon = class {
|
|
|
6084
7012
|
*/
|
|
6085
7013
|
async onHubReachable() {}
|
|
6086
7014
|
async shutdown() {
|
|
7015
|
+
this._secretChangeUnsub?.();
|
|
7016
|
+
this._secretChangeUnsub = null;
|
|
7017
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7018
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7019
|
+
this._secretRetryTimer = null;
|
|
7020
|
+
this._secretChangeTimer = null;
|
|
6087
7021
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6088
7022
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6089
7023
|
await this.onShutdown();
|
|
@@ -6158,11 +7092,8 @@ var BaseAddon = class {
|
|
|
6158
7092
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6159
7093
|
const schema = this.globalSettingsSchema(cap);
|
|
6160
7094
|
if (!schema) return { sections: [] };
|
|
6161
|
-
const projected = await this.
|
|
6162
|
-
return hydrateSchema(schema, overlay ? {
|
|
6163
|
-
...projected,
|
|
6164
|
-
...overlay
|
|
6165
|
-
} : projected);
|
|
7095
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7096
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6166
7097
|
}
|
|
6167
7098
|
/**
|
|
6168
7099
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6207,11 +7138,11 @@ var BaseAddon = class {
|
|
|
6207
7138
|
});
|
|
6208
7139
|
}
|
|
6209
7140
|
if (sections.length === 0) return null;
|
|
6210
|
-
const projected = await this.
|
|
7141
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6211
7142
|
return hydrateSchema({
|
|
6212
7143
|
...schema,
|
|
6213
7144
|
sections
|
|
6214
|
-
}, projected);
|
|
7145
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6215
7146
|
}
|
|
6216
7147
|
/**
|
|
6217
7148
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6224,12 +7155,50 @@ var BaseAddon = class {
|
|
|
6224
7155
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6225
7156
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6226
7157
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7158
|
+
*
|
|
7159
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7160
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7161
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7162
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7163
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7164
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6227
7165
|
*/
|
|
6228
7166
|
async resolveGlobalStore(nodeId, cap) {
|
|
6229
7167
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7168
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7169
|
+
}
|
|
7170
|
+
projectForNode(store, nodeId, cap) {
|
|
6230
7171
|
const keys = this.perNodeKeys(cap);
|
|
6231
7172
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6232
|
-
return keys.size > 0 ? projectStore(
|
|
7173
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7174
|
+
}
|
|
7175
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7176
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7177
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7178
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7179
|
+
}
|
|
7180
|
+
/**
|
|
7181
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7182
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7183
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7184
|
+
* its value.
|
|
7185
|
+
*/
|
|
7186
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7187
|
+
const secrets = this._ctx?.secrets;
|
|
7188
|
+
const merged = {
|
|
7189
|
+
...stored,
|
|
7190
|
+
...overlay
|
|
7191
|
+
};
|
|
7192
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7193
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7194
|
+
unresolved: "keep-marker",
|
|
7195
|
+
ownedBy: secrets.owner
|
|
7196
|
+
});
|
|
7197
|
+
for (const key of Object.keys(overlay)) {
|
|
7198
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7199
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7200
|
+
}
|
|
7201
|
+
return merged;
|
|
6233
7202
|
}
|
|
6234
7203
|
/**
|
|
6235
7204
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6265,18 +7234,58 @@ var BaseAddon = class {
|
|
|
6265
7234
|
value: result.value[key]
|
|
6266
7235
|
};
|
|
6267
7236
|
}
|
|
7237
|
+
/**
|
|
7238
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7239
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7240
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7241
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7242
|
+
* writing back what it read is not (D787).
|
|
7243
|
+
*/
|
|
7244
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7245
|
+
this._operatorWriteDepth++;
|
|
7246
|
+
try {
|
|
7247
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7248
|
+
} finally {
|
|
7249
|
+
this._operatorWriteDepth--;
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
6268
7252
|
async updateGlobalSettings(patch, nodeId) {
|
|
7253
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7254
|
+
}
|
|
7255
|
+
/**
|
|
7256
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7257
|
+
*
|
|
7258
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7259
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7260
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7261
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7262
|
+
*/
|
|
7263
|
+
async clearSecrets(keys, nodeId) {
|
|
7264
|
+
const tree = this.addonSecretTree();
|
|
7265
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7266
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7267
|
+
const patch = {};
|
|
7268
|
+
for (const key of keys) {
|
|
7269
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7270
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7271
|
+
}
|
|
7272
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7273
|
+
}
|
|
7274
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6269
7275
|
const keys = this.perNodeKeys();
|
|
6270
7276
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6271
7277
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6272
|
-
const barePatch = patch;
|
|
6273
7278
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6274
|
-
|
|
7279
|
+
const handle = this._secretSettings;
|
|
7280
|
+
if (handle !== null) {
|
|
7281
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7282
|
+
if (!changed) return;
|
|
7283
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6275
7284
|
if (target !== localNode) return;
|
|
6276
7285
|
await this.resolveConfig();
|
|
6277
7286
|
await this.onConfigChanged();
|
|
6278
7287
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6279
|
-
this.maybeAutoRestart(
|
|
7288
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6280
7289
|
}
|
|
6281
7290
|
/**
|
|
6282
7291
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6301,7 +7310,7 @@ var BaseAddon = class {
|
|
|
6301
7310
|
* time to return its response before the addon is torn down and
|
|
6302
7311
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6303
7312
|
*/
|
|
6304
|
-
maybeAutoRestart(
|
|
7313
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6305
7314
|
if (!schema) return;
|
|
6306
7315
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6307
7316
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6309,13 +7318,13 @@ var BaseAddon = class {
|
|
|
6309
7318
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6310
7319
|
}
|
|
6311
7320
|
if (restartKeys.size === 0) return;
|
|
6312
|
-
if (!
|
|
7321
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6313
7322
|
const ctx = this._ctx;
|
|
6314
7323
|
if (!ctx) return;
|
|
6315
7324
|
const addonId = ctx.id;
|
|
6316
7325
|
setImmediate(() => {
|
|
6317
7326
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6318
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7327
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6319
7328
|
}).catch((err) => {
|
|
6320
7329
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6321
7330
|
});
|
|
@@ -6324,7 +7333,7 @@ var BaseAddon = class {
|
|
|
6324
7333
|
async getDeviceSettings(deviceId) {
|
|
6325
7334
|
const schema = this.deviceSettingsSchema();
|
|
6326
7335
|
if (!schema) return { sections: [] };
|
|
6327
|
-
return hydrateSchema(schema, await this.
|
|
7336
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6328
7337
|
}
|
|
6329
7338
|
async updateDeviceSettings(deviceId, patch) {
|
|
6330
7339
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6454,7 +7463,7 @@ var BaseAddon = class {
|
|
|
6454
7463
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6455
7464
|
*/
|
|
6456
7465
|
async resolveConfig() {
|
|
6457
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7466
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6458
7467
|
const perNode = this.perNodeKeys();
|
|
6459
7468
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6460
7469
|
const resolved = { ...this.defaults };
|
|
@@ -6479,7 +7488,7 @@ var BaseAddon = class {
|
|
|
6479
7488
|
key,
|
|
6480
7489
|
schema,
|
|
6481
7490
|
fallback,
|
|
6482
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7491
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6483
7492
|
write: async (patch) => {
|
|
6484
7493
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6485
7494
|
},
|
|
@@ -6496,7 +7505,7 @@ var BaseAddon = class {
|
|
|
6496
7505
|
key,
|
|
6497
7506
|
schema,
|
|
6498
7507
|
fallback,
|
|
6499
|
-
read: async () => await this.
|
|
7508
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6500
7509
|
write: async (patch) => {
|
|
6501
7510
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6502
7511
|
},
|
|
@@ -6508,6 +7517,87 @@ var BaseAddon = class {
|
|
|
6508
7517
|
} })
|
|
6509
7518
|
});
|
|
6510
7519
|
}
|
|
7520
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7521
|
+
addonSecretTree() {
|
|
7522
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7523
|
+
return this._addonSecretTree;
|
|
7524
|
+
}
|
|
7525
|
+
deviceSecretTree() {
|
|
7526
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7527
|
+
return this._deviceSecretTree;
|
|
7528
|
+
}
|
|
7529
|
+
/**
|
|
7530
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7531
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7532
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7533
|
+
* than start on an empty credential.
|
|
7534
|
+
*/
|
|
7535
|
+
get unresolvedSecrets() {
|
|
7536
|
+
return this._unresolvedSecrets;
|
|
7537
|
+
}
|
|
7538
|
+
/**
|
|
7539
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7540
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7541
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7542
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7543
|
+
* ever written back from here.
|
|
7544
|
+
*/
|
|
7545
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7546
|
+
const secrets = this._ctx?.secrets;
|
|
7547
|
+
if (secrets === void 0) return blob;
|
|
7548
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7549
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7550
|
+
if (refs.length === 0) {
|
|
7551
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7552
|
+
return blob;
|
|
7553
|
+
}
|
|
7554
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7555
|
+
if (trackForConfig) {
|
|
7556
|
+
this._unresolvedSecrets = unresolved;
|
|
7557
|
+
if (unresolved.length > 0) {
|
|
7558
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7559
|
+
ref: u.ref,
|
|
7560
|
+
reason: u.reason
|
|
7561
|
+
})) } });
|
|
7562
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7563
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7564
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7565
|
+
}
|
|
7566
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7567
|
+
}
|
|
7568
|
+
return value;
|
|
7569
|
+
}
|
|
7570
|
+
/**
|
|
7571
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7572
|
+
* keychain the context's own view is already raw.
|
|
7573
|
+
*/
|
|
7574
|
+
rawSettings() {
|
|
7575
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7576
|
+
}
|
|
7577
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7578
|
+
logUnresolvedRead(unresolved) {
|
|
7579
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7580
|
+
if (fresh.length === 0) return;
|
|
7581
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7582
|
+
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) => ({
|
|
7583
|
+
ref: u.ref,
|
|
7584
|
+
reason: u.reason
|
|
7585
|
+
})) } });
|
|
7586
|
+
}
|
|
7587
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7588
|
+
scheduleSecretReresolve(delayMs) {
|
|
7589
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7590
|
+
if (this[timerOf] !== null) return;
|
|
7591
|
+
const timer = setTimeout(() => {
|
|
7592
|
+
this[timerOf] = null;
|
|
7593
|
+
if (this._ctx === null) return;
|
|
7594
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7595
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7596
|
+
});
|
|
7597
|
+
}, delayMs);
|
|
7598
|
+
timer.unref?.();
|
|
7599
|
+
this[timerOf] = timer;
|
|
7600
|
+
}
|
|
6511
7601
|
/**
|
|
6512
7602
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6513
7603
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6520,7 +7610,7 @@ var BaseAddon = class {
|
|
|
6520
7610
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6521
7611
|
*/
|
|
6522
7612
|
async readAddonStoreWithRetry() {
|
|
6523
|
-
const settings = this.
|
|
7613
|
+
const settings = this.rawSettings();
|
|
6524
7614
|
if (!settings) return {};
|
|
6525
7615
|
const delaysMs = [
|
|
6526
7616
|
150,
|
|
@@ -7083,6 +8173,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7083
8173
|
kind: "mutation",
|
|
7084
8174
|
auth: "admin"
|
|
7085
8175
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8176
|
+
function defOf(schema) {
|
|
8177
|
+
return schema._zod?.def ?? {};
|
|
8178
|
+
}
|
|
8179
|
+
function declaredHere(schema) {
|
|
8180
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8181
|
+
}
|
|
8182
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8183
|
+
var WRAPPERS = new Set([
|
|
8184
|
+
"optional",
|
|
8185
|
+
"nullable",
|
|
8186
|
+
"default",
|
|
8187
|
+
"prefault",
|
|
8188
|
+
"catch",
|
|
8189
|
+
"readonly",
|
|
8190
|
+
"nonoptional"
|
|
8191
|
+
]);
|
|
8192
|
+
/**
|
|
8193
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8194
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8195
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8196
|
+
* `.transform` on `in`).
|
|
8197
|
+
*/
|
|
8198
|
+
function layersOf(schema) {
|
|
8199
|
+
const out = [];
|
|
8200
|
+
const queue = [schema];
|
|
8201
|
+
while (queue.length > 0) {
|
|
8202
|
+
const s = queue.shift();
|
|
8203
|
+
if (!s || out.includes(s)) continue;
|
|
8204
|
+
out.push(s);
|
|
8205
|
+
const def = defOf(s);
|
|
8206
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8207
|
+
if (def.type === "pipe") {
|
|
8208
|
+
if (def.in) queue.push(def.in);
|
|
8209
|
+
if (def.out) queue.push(def.out);
|
|
8210
|
+
}
|
|
8211
|
+
}
|
|
8212
|
+
return out;
|
|
8213
|
+
}
|
|
8214
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8215
|
+
function isZodSecret(schema) {
|
|
8216
|
+
return layersOf(schema).some(declaredHere);
|
|
8217
|
+
}
|
|
8218
|
+
/**
|
|
8219
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8220
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8221
|
+
* object or array is reported as one path and not descended into — everything
|
|
8222
|
+
* under it is secret.
|
|
8223
|
+
*/
|
|
8224
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8225
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8226
|
+
const paths = [];
|
|
8227
|
+
for (const layer of layersOf(schema)) {
|
|
8228
|
+
const def = defOf(layer);
|
|
8229
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8230
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8231
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8232
|
+
else if (def.type === "intersection") {
|
|
8233
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8234
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8235
|
+
}
|
|
8236
|
+
}
|
|
8237
|
+
return [...new Set(paths)];
|
|
8238
|
+
}
|
|
7086
8239
|
//#endregion
|
|
7087
8240
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7088
8241
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8877,6 +10030,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8877
10030
|
fetchedAt: number()
|
|
8878
10031
|
});
|
|
8879
10032
|
/**
|
|
10033
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10034
|
+
* gets back (cloud training, D805+).
|
|
10035
|
+
*
|
|
10036
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10037
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10038
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10039
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10040
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10041
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10042
|
+
* change there, in the same piece of work.
|
|
10043
|
+
*
|
|
10044
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10045
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10046
|
+
*/
|
|
10047
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10048
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10049
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10050
|
+
var TrainingExportSchema = _enum([
|
|
10051
|
+
"onnx",
|
|
10052
|
+
"openvino-fp16",
|
|
10053
|
+
"openvino-int8",
|
|
10054
|
+
"coreml-fp16"
|
|
10055
|
+
]);
|
|
10056
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10057
|
+
object({
|
|
10058
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10059
|
+
jobKey: string().uuid(),
|
|
10060
|
+
target: object({
|
|
10061
|
+
kind: literal("detector"),
|
|
10062
|
+
step: literal("object-detection")
|
|
10063
|
+
}),
|
|
10064
|
+
base: object({
|
|
10065
|
+
modelId: string().min(1),
|
|
10066
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10067
|
+
weights: string().min(1),
|
|
10068
|
+
imgsz: number().int().positive()
|
|
10069
|
+
}),
|
|
10070
|
+
baseline: object({
|
|
10071
|
+
modelId: string().min(1),
|
|
10072
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10073
|
+
onnxUrl: string().url(),
|
|
10074
|
+
imgsz: number().int().positive(),
|
|
10075
|
+
floors: FloorsSchema
|
|
10076
|
+
}),
|
|
10077
|
+
dataset: object({
|
|
10078
|
+
versionId: string().min(1),
|
|
10079
|
+
annotationHash: string(),
|
|
10080
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10081
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10082
|
+
}),
|
|
10083
|
+
split: object({
|
|
10084
|
+
holdoutCameras: array(number().int()),
|
|
10085
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10086
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10087
|
+
valFraction: number().min(0).max(.5),
|
|
10088
|
+
seed: number().int()
|
|
10089
|
+
}),
|
|
10090
|
+
hyper: object({
|
|
10091
|
+
epochs: number().int().positive(),
|
|
10092
|
+
batch: number().int().positive(),
|
|
10093
|
+
lr0: number().positive(),
|
|
10094
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10095
|
+
freeze: number().int().nonnegative(),
|
|
10096
|
+
patience: number().int().nonnegative(),
|
|
10097
|
+
seed: number().int()
|
|
10098
|
+
}),
|
|
10099
|
+
replay: object({
|
|
10100
|
+
source: literal("coco2017"),
|
|
10101
|
+
count: number().int().nonnegative()
|
|
10102
|
+
}),
|
|
10103
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10104
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10105
|
+
floors: object({
|
|
10106
|
+
minSupport: number().int().positive(),
|
|
10107
|
+
clamp: number().min(0).max(1)
|
|
10108
|
+
}),
|
|
10109
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10110
|
+
catalog: object({
|
|
10111
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10112
|
+
name: string().min(1).max(160)
|
|
10113
|
+
})
|
|
10114
|
+
});
|
|
10115
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10116
|
+
var TrainingResultFileSchema = object({
|
|
10117
|
+
path: string().min(1),
|
|
10118
|
+
bytes: number().int().nonnegative(),
|
|
10119
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10120
|
+
format: _enum([
|
|
10121
|
+
"onnx",
|
|
10122
|
+
"openvino",
|
|
10123
|
+
"coreml",
|
|
10124
|
+
"pt"
|
|
10125
|
+
]),
|
|
10126
|
+
variant: _enum(["base", "int8"])
|
|
10127
|
+
});
|
|
10128
|
+
var DraftFormatSchema = object({
|
|
10129
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10130
|
+
url: string().min(1),
|
|
10131
|
+
sizeMB: number().nonnegative(),
|
|
10132
|
+
isDirectory: boolean().optional(),
|
|
10133
|
+
files: array(string()).optional(),
|
|
10134
|
+
runtimes: array(literal("python")).optional(),
|
|
10135
|
+
revision: string().min(1)
|
|
10136
|
+
});
|
|
10137
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10138
|
+
var TrainingCatalogDraftSchema = object({
|
|
10139
|
+
id: string().min(1),
|
|
10140
|
+
name: string().min(1),
|
|
10141
|
+
description: string(),
|
|
10142
|
+
labels: array(unknown()),
|
|
10143
|
+
inputSize: object({
|
|
10144
|
+
width: number().int().positive(),
|
|
10145
|
+
height: number().int().positive()
|
|
10146
|
+
}),
|
|
10147
|
+
preprocessMode: literal("letterbox"),
|
|
10148
|
+
defaultClassFloors: FloorsSchema,
|
|
10149
|
+
formats: object({
|
|
10150
|
+
onnx: DraftFormatSchema.optional(),
|
|
10151
|
+
openvino: DraftFormatSchema.optional(),
|
|
10152
|
+
coreml: DraftFormatSchema.optional()
|
|
10153
|
+
})
|
|
10154
|
+
});
|
|
10155
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10156
|
+
var TrainingEvalClassSchema = object({
|
|
10157
|
+
positives: number().int(),
|
|
10158
|
+
floor: number().nullable(),
|
|
10159
|
+
tp: number().int(),
|
|
10160
|
+
fp: number().int(),
|
|
10161
|
+
fn: number().int(),
|
|
10162
|
+
precision: number().nullable(),
|
|
10163
|
+
recall: number().nullable(),
|
|
10164
|
+
ap50: number().nullable(),
|
|
10165
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10166
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10167
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10168
|
+
smallFound: number().int().optional(),
|
|
10169
|
+
smallTotal: number().int().optional()
|
|
10170
|
+
}).passthrough();
|
|
10171
|
+
var TrainingEvalReportSchema = object({
|
|
10172
|
+
frames: number().int(),
|
|
10173
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10174
|
+
}).passthrough();
|
|
10175
|
+
/**
|
|
10176
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10177
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10178
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10179
|
+
*/
|
|
10180
|
+
var TrainingResultSchema = object({
|
|
10181
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10182
|
+
jobKey: string(),
|
|
10183
|
+
status: _enum(["succeeded", "failed"]),
|
|
10184
|
+
error: object({
|
|
10185
|
+
stage: string(),
|
|
10186
|
+
code: string(),
|
|
10187
|
+
message: string()
|
|
10188
|
+
}).nullable(),
|
|
10189
|
+
trainer: object({
|
|
10190
|
+
version: string(),
|
|
10191
|
+
revision: string()
|
|
10192
|
+
}),
|
|
10193
|
+
toolchain: record(string(), string().nullable()),
|
|
10194
|
+
dataset: object({
|
|
10195
|
+
versionId: string(),
|
|
10196
|
+
annotationHash: string(),
|
|
10197
|
+
sha256: string(),
|
|
10198
|
+
frames: object({
|
|
10199
|
+
train: number().int(),
|
|
10200
|
+
val: number().int(),
|
|
10201
|
+
holdout: number().int()
|
|
10202
|
+
}),
|
|
10203
|
+
holdoutCameras: array(number().int()),
|
|
10204
|
+
replayImages: number().int()
|
|
10205
|
+
}).optional(),
|
|
10206
|
+
training: object({
|
|
10207
|
+
epochsRun: number().int(),
|
|
10208
|
+
bestEpoch: number().int(),
|
|
10209
|
+
bestMap50: number(),
|
|
10210
|
+
bestMap50_95: number(),
|
|
10211
|
+
seconds: number()
|
|
10212
|
+
}).optional(),
|
|
10213
|
+
evaluation: object({
|
|
10214
|
+
holdoutFrames: number().int(),
|
|
10215
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10216
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10217
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10218
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10219
|
+
map50: record(string(), number().nullable())
|
|
10220
|
+
}).optional(),
|
|
10221
|
+
floors: object({
|
|
10222
|
+
baseline: FloorsSchema,
|
|
10223
|
+
candidate: FloorsSchema,
|
|
10224
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10225
|
+
notes: array(string())
|
|
10226
|
+
}).optional(),
|
|
10227
|
+
int8: object({
|
|
10228
|
+
kept: boolean(),
|
|
10229
|
+
map50Fp16: number().nullable(),
|
|
10230
|
+
map50Int8: number().nullable(),
|
|
10231
|
+
reason: string().nullable()
|
|
10232
|
+
}).optional(),
|
|
10233
|
+
exportsDropped: array(object({
|
|
10234
|
+
export: string(),
|
|
10235
|
+
reason: string()
|
|
10236
|
+
})).optional(),
|
|
10237
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10238
|
+
bundle: object({
|
|
10239
|
+
path: literal("bundle.tar"),
|
|
10240
|
+
bytes: number().int().nonnegative(),
|
|
10241
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10242
|
+
}).nullable().optional(),
|
|
10243
|
+
catalogDraft: object({
|
|
10244
|
+
base: TrainingCatalogDraftSchema,
|
|
10245
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10246
|
+
}).nullable().optional(),
|
|
10247
|
+
licence: string()
|
|
10248
|
+
});
|
|
10249
|
+
var TrainingStageSchema = _enum([
|
|
10250
|
+
"prepare",
|
|
10251
|
+
"replay",
|
|
10252
|
+
"train",
|
|
10253
|
+
"eval",
|
|
10254
|
+
"export",
|
|
10255
|
+
"package"
|
|
10256
|
+
]);
|
|
10257
|
+
var EventBase = {
|
|
10258
|
+
v: literal(1),
|
|
10259
|
+
ts: number()
|
|
10260
|
+
};
|
|
10261
|
+
discriminatedUnion("type", [
|
|
10262
|
+
object({
|
|
10263
|
+
...EventBase,
|
|
10264
|
+
type: literal("stage"),
|
|
10265
|
+
stage: TrainingStageSchema
|
|
10266
|
+
}),
|
|
10267
|
+
object({
|
|
10268
|
+
...EventBase,
|
|
10269
|
+
type: literal("epoch"),
|
|
10270
|
+
epoch: number().int(),
|
|
10271
|
+
epochs: number().int(),
|
|
10272
|
+
boxLoss: number().nullable().optional(),
|
|
10273
|
+
map50: number().nullable().optional(),
|
|
10274
|
+
map50_95: number().nullable().optional(),
|
|
10275
|
+
etaSec: number().nullable().optional()
|
|
10276
|
+
}),
|
|
10277
|
+
object({
|
|
10278
|
+
...EventBase,
|
|
10279
|
+
type: literal("metric"),
|
|
10280
|
+
name: string(),
|
|
10281
|
+
value: number()
|
|
10282
|
+
}),
|
|
10283
|
+
object({
|
|
10284
|
+
...EventBase,
|
|
10285
|
+
type: literal("artifact"),
|
|
10286
|
+
path: string(),
|
|
10287
|
+
bytes: number(),
|
|
10288
|
+
sha256: string()
|
|
10289
|
+
}),
|
|
10290
|
+
object({
|
|
10291
|
+
...EventBase,
|
|
10292
|
+
type: literal("done"),
|
|
10293
|
+
status: _enum(["succeeded", "failed"]),
|
|
10294
|
+
resultSha256: string().nullable().optional()
|
|
10295
|
+
}),
|
|
10296
|
+
object({
|
|
10297
|
+
...EventBase,
|
|
10298
|
+
type: literal("error"),
|
|
10299
|
+
stage: string(),
|
|
10300
|
+
code: string(),
|
|
10301
|
+
message: string()
|
|
10302
|
+
})
|
|
10303
|
+
]);
|
|
10304
|
+
/**
|
|
8880
10305
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8881
10306
|
*
|
|
8882
10307
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11204,7 +12629,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11204
12629
|
"authenticated",
|
|
11205
12630
|
"admin"
|
|
11206
12631
|
]).optional(),
|
|
11207
|
-
description: string().optional()
|
|
12632
|
+
description: string().optional(),
|
|
12633
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12634
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11208
12635
|
});
|
|
11209
12636
|
/**
|
|
11210
12637
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11928,6 +13355,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11928
13355
|
lastError: string().optional()
|
|
11929
13356
|
});
|
|
11930
13357
|
/**
|
|
13358
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13359
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13360
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13361
|
+
* with it off — which restores without a key.
|
|
13362
|
+
*/
|
|
13363
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13364
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13365
|
+
scheme: string(),
|
|
13366
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13367
|
+
keyId: string()
|
|
13368
|
+
});
|
|
13369
|
+
/**
|
|
13370
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13371
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13372
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13373
|
+
*/
|
|
13374
|
+
var BackupEncryptionStatusSchema = object({
|
|
13375
|
+
enabled: boolean(),
|
|
13376
|
+
active: object({
|
|
13377
|
+
keyId: string(),
|
|
13378
|
+
publicKey: string(),
|
|
13379
|
+
createdAt: number()
|
|
13380
|
+
}).nullable(),
|
|
13381
|
+
/** Every key ever set up, newest first. */
|
|
13382
|
+
keys: array(object({
|
|
13383
|
+
keyId: string(),
|
|
13384
|
+
createdAt: number(),
|
|
13385
|
+
retiredAt: number().nullable()
|
|
13386
|
+
})).readonly()
|
|
13387
|
+
});
|
|
13388
|
+
/**
|
|
11931
13389
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11932
13390
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11933
13391
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11939,7 +13397,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11939
13397
|
sizeBytes: number(),
|
|
11940
13398
|
label: string().optional(),
|
|
11941
13399
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11942
|
-
locations: array(string()).readonly()
|
|
13400
|
+
locations: array(string()).readonly(),
|
|
13401
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13402
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11943
13403
|
});
|
|
11944
13404
|
var BackupEntrySchema = object({
|
|
11945
13405
|
id: string(),
|
|
@@ -11948,7 +13408,8 @@ var BackupEntrySchema = object({
|
|
|
11948
13408
|
label: string().optional(),
|
|
11949
13409
|
createdAt: number(),
|
|
11950
13410
|
sizeBytes: number(),
|
|
11951
|
-
locations: array(string()).optional()
|
|
13411
|
+
locations: array(string()).optional(),
|
|
13412
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11952
13413
|
});
|
|
11953
13414
|
var ArchiveEntrySchema = object({
|
|
11954
13415
|
path: string(),
|
|
@@ -12137,10 +13598,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12137
13598
|
* this list and skips entries whose path doesn't start with
|
|
12138
13599
|
* any of them.
|
|
12139
13600
|
*/
|
|
12140
|
-
locations: array(string()).optional()
|
|
13601
|
+
locations: array(string()).optional(),
|
|
13602
|
+
/**
|
|
13603
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13604
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13605
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13606
|
+
* is refused before the archive is downloaded.
|
|
13607
|
+
*/
|
|
13608
|
+
backupSecretKey: string().optional()
|
|
12141
13609
|
}), _void(), {
|
|
12142
13610
|
kind: "mutation",
|
|
12143
13611
|
auth: "admin"
|
|
13612
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13613
|
+
keyId: string(),
|
|
13614
|
+
secretKey: string(),
|
|
13615
|
+
publicKey: string(),
|
|
13616
|
+
createdAt: number(),
|
|
13617
|
+
replacedKeyId: string().nullable()
|
|
13618
|
+
}), {
|
|
13619
|
+
kind: "mutation",
|
|
13620
|
+
auth: "admin"
|
|
13621
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13622
|
+
kind: "mutation",
|
|
13623
|
+
auth: "admin"
|
|
13624
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13625
|
+
valid: boolean(),
|
|
13626
|
+
keyId: string().nullable(),
|
|
13627
|
+
/** The hub knows this key (active or retired). */
|
|
13628
|
+
known: boolean(),
|
|
13629
|
+
/** It is the key new archives are encrypted to. */
|
|
13630
|
+
active: boolean(),
|
|
13631
|
+
error: string().optional()
|
|
13632
|
+
}), {
|
|
13633
|
+
kind: "mutation",
|
|
13634
|
+
auth: "admin"
|
|
12144
13635
|
}), method(object({
|
|
12145
13636
|
destinationId: string(),
|
|
12146
13637
|
backupId: string()
|
|
@@ -13915,7 +15406,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13915
15406
|
stepId: string(),
|
|
13916
15407
|
entry: ModelCatalogEntrySchema
|
|
13917
15408
|
});
|
|
13918
|
-
|
|
15409
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15410
|
+
var ModelBundleFileSchema = object({
|
|
15411
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15412
|
+
path: string().min(1),
|
|
15413
|
+
bytes: number().int().nonnegative(),
|
|
15414
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15415
|
+
});
|
|
15416
|
+
var ImportModelBundleInputSchema = object({
|
|
15417
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15418
|
+
addonId: string(),
|
|
15419
|
+
stepId: string().min(1),
|
|
15420
|
+
/**
|
|
15421
|
+
* The catalog rows to register, complete, every format URL already
|
|
15422
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15423
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15424
|
+
*/
|
|
15425
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15426
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15427
|
+
bundle: object({
|
|
15428
|
+
ticket: PeerBytesTicketSchema,
|
|
15429
|
+
bytes: number().int().positive(),
|
|
15430
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15431
|
+
}),
|
|
15432
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15433
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15434
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15435
|
+
distribute: boolean()
|
|
15436
|
+
});
|
|
15437
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15438
|
+
kind: literal("imported"),
|
|
15439
|
+
modelIds: array(string()).readonly(),
|
|
15440
|
+
distributed: array(object({
|
|
15441
|
+
modelId: string(),
|
|
15442
|
+
nodeId: string(),
|
|
15443
|
+
format: _enum(MODEL_FORMATS),
|
|
15444
|
+
ok: boolean(),
|
|
15445
|
+
error: string().optional()
|
|
15446
|
+
})).readonly()
|
|
15447
|
+
}), object({
|
|
15448
|
+
kind: literal("refused"),
|
|
15449
|
+
reason: _enum([
|
|
15450
|
+
"transfer-failed",
|
|
15451
|
+
"checksum-mismatch",
|
|
15452
|
+
"bundle-mismatch",
|
|
15453
|
+
"invalid-entry",
|
|
15454
|
+
"id-taken"
|
|
15455
|
+
]),
|
|
15456
|
+
detail: string()
|
|
15457
|
+
})]);
|
|
15458
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15459
|
+
kind: "mutation",
|
|
15460
|
+
auth: "admin",
|
|
15461
|
+
timeoutMs: 30 * 6e4
|
|
15462
|
+
});
|
|
13919
15463
|
/**
|
|
13920
15464
|
* Query filter for settings-store collections.
|
|
13921
15465
|
*/
|
|
@@ -14298,6 +15842,253 @@ id: union([string(), number()]) }), {
|
|
|
14298
15842
|
kind: "mutation",
|
|
14299
15843
|
auth: "admin"
|
|
14300
15844
|
});
|
|
15845
|
+
/**
|
|
15846
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15847
|
+
*
|
|
15848
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15849
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15850
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15851
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15852
|
+
* against the CALLER, never against anything the caller claims.
|
|
15853
|
+
*
|
|
15854
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15855
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15856
|
+
* connection, the agent from its child's connection carried in
|
|
15857
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15858
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15859
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15860
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15861
|
+
* runner is the same OS user): see the threat model in
|
|
15862
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15863
|
+
*
|
|
15864
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15865
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15866
|
+
* floors every method to admin anyway (D240).
|
|
15867
|
+
*
|
|
15868
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15869
|
+
*/
|
|
15870
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15871
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15872
|
+
"key-missing",
|
|
15873
|
+
"wrong-key",
|
|
15874
|
+
"key-file-unreadable",
|
|
15875
|
+
"store-unavailable",
|
|
15876
|
+
"not-initialized",
|
|
15877
|
+
"decrypt-failed"
|
|
15878
|
+
]);
|
|
15879
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15880
|
+
state: literal("locked"),
|
|
15881
|
+
reason: KeychainUnavailableReasonSchema
|
|
15882
|
+
})]);
|
|
15883
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15884
|
+
object({
|
|
15885
|
+
kind: literal("value"),
|
|
15886
|
+
value: string(),
|
|
15887
|
+
version: number().int()
|
|
15888
|
+
}),
|
|
15889
|
+
object({ kind: literal("missing") }),
|
|
15890
|
+
object({
|
|
15891
|
+
kind: literal("unavailable"),
|
|
15892
|
+
reason: KeychainUnavailableReasonSchema
|
|
15893
|
+
}),
|
|
15894
|
+
object({ kind: literal("forbidden") })
|
|
15895
|
+
]);
|
|
15896
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15897
|
+
/** Metadata of one stored value — never the value. */
|
|
15898
|
+
var KeychainSecretMetaSchema = object({
|
|
15899
|
+
ref: string(),
|
|
15900
|
+
owner: string(),
|
|
15901
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15902
|
+
scope: string(),
|
|
15903
|
+
fieldPath: string(),
|
|
15904
|
+
version: number().int(),
|
|
15905
|
+
createdAt: number(),
|
|
15906
|
+
updatedAt: number(),
|
|
15907
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15908
|
+
updatedBy: string(),
|
|
15909
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15910
|
+
lastReadAt: number().nullable()
|
|
15911
|
+
});
|
|
15912
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15913
|
+
method(object({
|
|
15914
|
+
ref: string().min(1),
|
|
15915
|
+
value: string().min(1)
|
|
15916
|
+
}), object({
|
|
15917
|
+
ref: string(),
|
|
15918
|
+
version: number().int()
|
|
15919
|
+
}), {
|
|
15920
|
+
kind: "mutation",
|
|
15921
|
+
auth: "admin"
|
|
15922
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15923
|
+
kind: "mutation",
|
|
15924
|
+
auth: "admin"
|
|
15925
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15926
|
+
var KeychainKeySourceSchema = object({
|
|
15927
|
+
kind: _enum([
|
|
15928
|
+
"config-file",
|
|
15929
|
+
"previous-config-file",
|
|
15930
|
+
"platform",
|
|
15931
|
+
"default-file"
|
|
15932
|
+
]),
|
|
15933
|
+
/** File sources only — a path is not a secret. */
|
|
15934
|
+
path: string().optional(),
|
|
15935
|
+
/**
|
|
15936
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15937
|
+
* next to the database it protects (the default file). The page warns.
|
|
15938
|
+
*/
|
|
15939
|
+
sharesBackupWithDatabase: boolean()
|
|
15940
|
+
});
|
|
15941
|
+
/**
|
|
15942
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15943
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15944
|
+
*/
|
|
15945
|
+
var KeychainResetRecordSchema = object({
|
|
15946
|
+
id: string(),
|
|
15947
|
+
at: number(),
|
|
15948
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15949
|
+
actor: string(),
|
|
15950
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15951
|
+
lockedReason: string().nullable(),
|
|
15952
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15953
|
+
archived: number().int(),
|
|
15954
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15955
|
+
archivedCollection: string().nullable(),
|
|
15956
|
+
/**
|
|
15957
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15958
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15959
|
+
*/
|
|
15960
|
+
archivedKeysCollection: string().nullable(),
|
|
15961
|
+
/**
|
|
15962
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15963
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15964
|
+
* agent forever (D797).
|
|
15965
|
+
*/
|
|
15966
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15967
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15968
|
+
acknowledgedAt: number().nullable()
|
|
15969
|
+
});
|
|
15970
|
+
var KeychainStatusSchema = object({
|
|
15971
|
+
keychain: KeychainStateSchema,
|
|
15972
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15973
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15974
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15975
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15976
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15977
|
+
fingerprint: string().nullable(),
|
|
15978
|
+
activeKeyId: string().nullable(),
|
|
15979
|
+
/**
|
|
15980
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15981
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15982
|
+
*/
|
|
15983
|
+
rotationPending: boolean(),
|
|
15984
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15985
|
+
retiredWraps: number().int(),
|
|
15986
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15987
|
+
secretCount: number().int(),
|
|
15988
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15989
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15990
|
+
});
|
|
15991
|
+
/**
|
|
15992
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15993
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15994
|
+
* never reported as an orphan (and never deleted as one).
|
|
15995
|
+
*/
|
|
15996
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15997
|
+
"in-use",
|
|
15998
|
+
"orphan",
|
|
15999
|
+
"unknown"
|
|
16000
|
+
]);
|
|
16001
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
16002
|
+
var KeychainAuditActionSchema = _enum([
|
|
16003
|
+
"put",
|
|
16004
|
+
"delete",
|
|
16005
|
+
"reveal",
|
|
16006
|
+
"rotate-master-key",
|
|
16007
|
+
"purge-retired-keys",
|
|
16008
|
+
"download-recovery-key",
|
|
16009
|
+
"delete-orphans",
|
|
16010
|
+
"reset",
|
|
16011
|
+
"acknowledge-reset",
|
|
16012
|
+
"initialize"
|
|
16013
|
+
]);
|
|
16014
|
+
var KeychainAuditEntrySchema = object({
|
|
16015
|
+
id: string(),
|
|
16016
|
+
at: number(),
|
|
16017
|
+
action: KeychainAuditActionSchema,
|
|
16018
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
16019
|
+
actor: string(),
|
|
16020
|
+
ref: string().nullable(),
|
|
16021
|
+
detail: string().nullable()
|
|
16022
|
+
});
|
|
16023
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
16024
|
+
/**
|
|
16025
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
16026
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
16027
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
16028
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
16029
|
+
*/
|
|
16030
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
16031
|
+
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({
|
|
16032
|
+
value: string(),
|
|
16033
|
+
version: number().int()
|
|
16034
|
+
}), {
|
|
16035
|
+
kind: "mutation",
|
|
16036
|
+
auth: "admin",
|
|
16037
|
+
caller: "required"
|
|
16038
|
+
}), method(object({
|
|
16039
|
+
name: SystemHeldSecretNameSchema,
|
|
16040
|
+
value: string().min(16)
|
|
16041
|
+
}), object({
|
|
16042
|
+
ref: string(),
|
|
16043
|
+
version: number().int()
|
|
16044
|
+
}), {
|
|
16045
|
+
kind: "mutation",
|
|
16046
|
+
auth: "admin",
|
|
16047
|
+
caller: "required"
|
|
16048
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16049
|
+
deleted: array(string()).readonly(),
|
|
16050
|
+
kept: array(object({
|
|
16051
|
+
ref: string(),
|
|
16052
|
+
usage: KeychainSecretUsageSchema
|
|
16053
|
+
})).readonly()
|
|
16054
|
+
}), {
|
|
16055
|
+
kind: "mutation",
|
|
16056
|
+
auth: "admin",
|
|
16057
|
+
caller: "required"
|
|
16058
|
+
}), method(object({}), object({
|
|
16059
|
+
fingerprint: string(),
|
|
16060
|
+
keySource: KeychainKeySourceSchema
|
|
16061
|
+
}), {
|
|
16062
|
+
kind: "mutation",
|
|
16063
|
+
auth: "admin",
|
|
16064
|
+
caller: "required"
|
|
16065
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
16066
|
+
kind: "mutation",
|
|
16067
|
+
auth: "admin",
|
|
16068
|
+
caller: "required"
|
|
16069
|
+
}), method(object({}), object({
|
|
16070
|
+
key: string(),
|
|
16071
|
+
fingerprint: string(),
|
|
16072
|
+
keySource: KeychainKeySourceSchema
|
|
16073
|
+
}), {
|
|
16074
|
+
kind: "mutation",
|
|
16075
|
+
auth: "admin",
|
|
16076
|
+
caller: "required"
|
|
16077
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
16078
|
+
archivedCollection: string().nullable(),
|
|
16079
|
+
archived: number().int()
|
|
16080
|
+
}), {
|
|
16081
|
+
kind: "mutation",
|
|
16082
|
+
auth: "admin",
|
|
16083
|
+
caller: "required"
|
|
16084
|
+
}), method(object({}), object({
|
|
16085
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16086
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16087
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16088
|
+
kind: "mutation",
|
|
16089
|
+
auth: "admin",
|
|
16090
|
+
caller: "required"
|
|
16091
|
+
});
|
|
14301
16092
|
method(_void(), object({
|
|
14302
16093
|
id: string(),
|
|
14303
16094
|
name: string(),
|
|
@@ -15540,7 +17331,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15540
17331
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15541
17332
|
var DevicePersistConfigPayloadSchema = object({
|
|
15542
17333
|
deviceId: number(),
|
|
15543
|
-
data: record(string(), unknown())
|
|
17334
|
+
data: record(string(), unknown()),
|
|
17335
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17336
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17337
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17338
|
+
secretConfigPaths: array(string()).optional()
|
|
15544
17339
|
});
|
|
15545
17340
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15546
17341
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17143,7 +18938,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17143
18938
|
* `login-method` — collection cap through which auth addons contribute
|
|
17144
18939
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17145
18940
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17146
|
-
* every auth addon (OIDC,
|
|
18941
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17147
18942
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17148
18943
|
* procedure aggregates them for the unauthenticated login page.
|
|
17149
18944
|
*
|
|
@@ -17151,8 +18946,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17151
18946
|
*
|
|
17152
18947
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17153
18948
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17154
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17155
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18949
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17156
18950
|
* login page needs NO change.
|
|
17157
18951
|
*
|
|
17158
18952
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17171,8 +18965,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17171
18965
|
* decision.
|
|
17172
18966
|
*
|
|
17173
18967
|
* Every contribution carries a `stage`:
|
|
17174
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17175
|
-
*
|
|
18968
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18969
|
+
* buttons; a usernameless passkey).
|
|
17176
18970
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17177
18971
|
* returned `factors` (passkey-as-2FA today).
|
|
17178
18972
|
*
|
|
@@ -17199,7 +18993,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17199
18993
|
* The provider names an external identity a signed-in user can link to
|
|
17200
18994
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17201
18995
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17202
|
-
* whatever their id. Absent / false — a login button only
|
|
18996
|
+
* whatever their id. Absent / false — a login button only.
|
|
17203
18997
|
*/
|
|
17204
18998
|
linkable: boolean().optional()
|
|
17205
18999
|
}),
|
|
@@ -21054,8 +22848,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21054
22848
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21055
22849
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21056
22850
|
* distinction was only ever used to route role-specific procedures
|
|
21057
|
-
* which we no longer have.
|
|
21058
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22851
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21059
22852
|
* with `isAdmin: false` + an explicit scope list.
|
|
21060
22853
|
*/
|
|
21061
22854
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22557,8 +24350,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22557
24350
|
]);
|
|
22558
24351
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22559
24352
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22560
|
-
/**
|
|
22561
|
-
|
|
24353
|
+
/**
|
|
24354
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24355
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24356
|
+
*
|
|
24357
|
+
* - `operator` — drawn by hand.
|
|
24358
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24359
|
+
* model, or a larger teacher model).
|
|
24360
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24361
|
+
* back from the track store (never a re-run).
|
|
24362
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24363
|
+
*/
|
|
24364
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24365
|
+
"operator",
|
|
24366
|
+
"assist",
|
|
24367
|
+
"pipeline",
|
|
24368
|
+
"llm"
|
|
24369
|
+
]);
|
|
22562
24370
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22563
24371
|
var RetrainBboxSchema = object({
|
|
22564
24372
|
x: number(),
|
|
@@ -22576,7 +24384,8 @@ var RetrainBboxSchema = object({
|
|
|
22576
24384
|
*/
|
|
22577
24385
|
var RetrainAnnotationSchema = object({
|
|
22578
24386
|
id: string(),
|
|
22579
|
-
|
|
24387
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24388
|
+
trackId: string().optional(),
|
|
22580
24389
|
deviceId: number(),
|
|
22581
24390
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22582
24391
|
mediaKey: string(),
|
|
@@ -22625,13 +24434,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22625
24434
|
* fail, whatever became of the original. */
|
|
22626
24435
|
copied: boolean()
|
|
22627
24436
|
});
|
|
24437
|
+
/**
|
|
24438
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24439
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24440
|
+
* box recorded on the source media row when there is one, else the track
|
|
24441
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24442
|
+
* until the operator confirms it.
|
|
24443
|
+
*/
|
|
24444
|
+
var RetrainPipelineBoxSchema = object({
|
|
24445
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24446
|
+
bbox: RetrainBboxSchema,
|
|
24447
|
+
macroClass: RetrainMacroClassSchema,
|
|
24448
|
+
label: string().optional(),
|
|
24449
|
+
subLabel: string().optional(),
|
|
24450
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24451
|
+
score: number().optional(),
|
|
24452
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24453
|
+
modelId: string().optional(),
|
|
24454
|
+
trackId: string(),
|
|
24455
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24456
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24457
|
+
basis: _enum(["subject-box", "position"]),
|
|
24458
|
+
deltaMs: number()
|
|
24459
|
+
});
|
|
24460
|
+
/**
|
|
24461
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24462
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24463
|
+
* track at all.
|
|
24464
|
+
*/
|
|
24465
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22628
24466
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22629
24467
|
var RetrainFrameSchema = object({
|
|
22630
24468
|
frameId: string(),
|
|
22631
24469
|
deviceId: number(),
|
|
22632
|
-
|
|
22633
|
-
/**
|
|
22634
|
-
|
|
24470
|
+
origin: RetrainFrameOriginSchema,
|
|
24471
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24472
|
+
trackId: string().optional(),
|
|
24473
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24474
|
+
* Absent on a recording still. */
|
|
24475
|
+
sourceMediaId: number().int().optional(),
|
|
24476
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24477
|
+
epochMs: number().optional(),
|
|
22635
24478
|
sourceKind: MediaFileKindEnum,
|
|
22636
24479
|
sizeBytes: number().int(),
|
|
22637
24480
|
width: number().int(),
|
|
@@ -22642,7 +24485,12 @@ var RetrainFrameSchema = object({
|
|
|
22642
24485
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22643
24486
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22644
24487
|
* a false positive. */
|
|
22645
|
-
complete: boolean()
|
|
24488
|
+
complete: boolean(),
|
|
24489
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24490
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24491
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24492
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24493
|
+
collectionIds: array(string()).readonly().optional()
|
|
22646
24494
|
});
|
|
22647
24495
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22648
24496
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22673,6 +24521,11 @@ var RetrainFrameListSchema = object({
|
|
|
22673
24521
|
var RetrainExportFilterSchema = object({
|
|
22674
24522
|
deviceIds: array(number()).optional(),
|
|
22675
24523
|
frameIds: array(string()).max(2e4).optional(),
|
|
24524
|
+
/** Only frames in at least one of these named collections. */
|
|
24525
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24526
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24527
|
+
* unknown id selects nothing. */
|
|
24528
|
+
datasetVersionId: string().optional(),
|
|
22676
24529
|
batchId: string().optional(),
|
|
22677
24530
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22678
24531
|
completeOnly: boolean().optional()
|
|
@@ -22737,6 +24590,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22737
24590
|
reason: string(),
|
|
22738
24591
|
detail: string().optional()
|
|
22739
24592
|
})]);
|
|
24593
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24594
|
+
var RetrainCollectionSchema = object({
|
|
24595
|
+
id: string(),
|
|
24596
|
+
name: string(),
|
|
24597
|
+
createdAt: number(),
|
|
24598
|
+
frameCount: number().int()
|
|
24599
|
+
});
|
|
24600
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24601
|
+
kind: literal("created"),
|
|
24602
|
+
collection: RetrainCollectionSchema
|
|
24603
|
+
}), object({
|
|
24604
|
+
kind: literal("refused"),
|
|
24605
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24606
|
+
})]);
|
|
24607
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24608
|
+
kind: literal("renamed"),
|
|
24609
|
+
collection: RetrainCollectionSchema
|
|
24610
|
+
}), object({
|
|
24611
|
+
kind: literal("refused"),
|
|
24612
|
+
reason: _enum([
|
|
24613
|
+
"empty-name",
|
|
24614
|
+
"duplicate-name",
|
|
24615
|
+
"unknown-collection"
|
|
24616
|
+
])
|
|
24617
|
+
})]);
|
|
24618
|
+
/**
|
|
24619
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24620
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24621
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24622
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24623
|
+
*/
|
|
24624
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24625
|
+
kind: literal("added"),
|
|
24626
|
+
collectionId: string(),
|
|
24627
|
+
frame: RetrainFrameSchema,
|
|
24628
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24629
|
+
reused: boolean()
|
|
24630
|
+
}), object({
|
|
24631
|
+
kind: literal("refused"),
|
|
24632
|
+
reason: _enum([
|
|
24633
|
+
"unknown-collection",
|
|
24634
|
+
"still-unavailable",
|
|
24635
|
+
"still-busy",
|
|
24636
|
+
"unreadable-image",
|
|
24637
|
+
"write-failed"
|
|
24638
|
+
]),
|
|
24639
|
+
detail: string().optional()
|
|
24640
|
+
})]);
|
|
24641
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24642
|
+
var RetrainAssistProfileSchema = object({
|
|
24643
|
+
id: string(),
|
|
24644
|
+
name: string(),
|
|
24645
|
+
model: string(),
|
|
24646
|
+
kind: string(),
|
|
24647
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24648
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24649
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24650
|
+
leavesHouse: boolean()
|
|
24651
|
+
});
|
|
24652
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24653
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24654
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24655
|
+
var RetrainLlmReviewSchema = object({
|
|
24656
|
+
/** The `ref` the page sent the box under. */
|
|
24657
|
+
ref: string(),
|
|
24658
|
+
verdict: _enum([
|
|
24659
|
+
"confirmed",
|
|
24660
|
+
"wrong-class",
|
|
24661
|
+
"not-an-object",
|
|
24662
|
+
"uncertain"
|
|
24663
|
+
]),
|
|
24664
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24665
|
+
reason: string()
|
|
24666
|
+
});
|
|
24667
|
+
/**
|
|
24668
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24669
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24670
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24671
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24672
|
+
*/
|
|
24673
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24674
|
+
kind: literal("proposed"),
|
|
24675
|
+
profileId: string(),
|
|
24676
|
+
model: string(),
|
|
24677
|
+
/** The frame was sent outside the house for this answer. */
|
|
24678
|
+
leftHouse: boolean(),
|
|
24679
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24680
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24681
|
+
rejected: number().int()
|
|
24682
|
+
}), object({
|
|
24683
|
+
kind: literal("refused"),
|
|
24684
|
+
reason: _enum([
|
|
24685
|
+
"unknown-frame",
|
|
24686
|
+
"unreadable-frame",
|
|
24687
|
+
"unknown-profile",
|
|
24688
|
+
"profile-disabled",
|
|
24689
|
+
"no-vision",
|
|
24690
|
+
"cloud-not-confirmed",
|
|
24691
|
+
"llm-error",
|
|
24692
|
+
"malformed-answer"
|
|
24693
|
+
]),
|
|
24694
|
+
detail: string().optional()
|
|
24695
|
+
})]);
|
|
24696
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24697
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24698
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24699
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24700
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24701
|
+
});
|
|
24702
|
+
/** The counts a dataset is judged by. */
|
|
24703
|
+
var RetrainDatasetStatsSchema = object({
|
|
24704
|
+
frames: number().int(),
|
|
24705
|
+
completeFrames: number().int(),
|
|
24706
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24707
|
+
completeness: number(),
|
|
24708
|
+
/** Boxes to learn (model errors excluded). */
|
|
24709
|
+
subjects: number().int(),
|
|
24710
|
+
modelErrors: number().int(),
|
|
24711
|
+
/** Complete frames with no subject. */
|
|
24712
|
+
hardNegatives: number().int(),
|
|
24713
|
+
/** Subjects per class × camera × day/night. */
|
|
24714
|
+
cells: array(object({
|
|
24715
|
+
macroClass: string(),
|
|
24716
|
+
deviceId: number(),
|
|
24717
|
+
lighting: _enum([
|
|
24718
|
+
"day",
|
|
24719
|
+
"night",
|
|
24720
|
+
"unknown"
|
|
24721
|
+
]),
|
|
24722
|
+
subjects: number().int(),
|
|
24723
|
+
frames: number().int()
|
|
24724
|
+
})).readonly(),
|
|
24725
|
+
cameras: array(object({
|
|
24726
|
+
deviceId: number(),
|
|
24727
|
+
frames: number().int(),
|
|
24728
|
+
completeFrames: number().int()
|
|
24729
|
+
})).readonly()
|
|
24730
|
+
});
|
|
24731
|
+
/** An immutable dataset version, without its frame list. */
|
|
24732
|
+
var RetrainDatasetVersionSchema = object({
|
|
24733
|
+
id: string(),
|
|
24734
|
+
name: string(),
|
|
24735
|
+
createdAt: number(),
|
|
24736
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24737
|
+
layout: RetrainExportLayoutSchema,
|
|
24738
|
+
completeOnly: boolean(),
|
|
24739
|
+
frameCount: number().int(),
|
|
24740
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24741
|
+
annotationHash: string(),
|
|
24742
|
+
/** The export manifest schema the version was cut under. */
|
|
24743
|
+
manifestSchema: string(),
|
|
24744
|
+
stats: RetrainDatasetStatsSchema
|
|
24745
|
+
});
|
|
24746
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24747
|
+
kind: literal("created"),
|
|
24748
|
+
version: RetrainDatasetVersionSchema
|
|
24749
|
+
}), object({
|
|
24750
|
+
kind: literal("refused"),
|
|
24751
|
+
reason: _enum([
|
|
24752
|
+
"empty-name",
|
|
24753
|
+
"duplicate-name",
|
|
24754
|
+
"no-frames"
|
|
24755
|
+
])
|
|
24756
|
+
})]);
|
|
22740
24757
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22741
24758
|
var RetrainTransitionResultSchema = object({
|
|
22742
24759
|
trackId: string(),
|
|
@@ -23454,7 +25471,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23454
25471
|
auth: "admin"
|
|
23455
25472
|
}), method(object({
|
|
23456
25473
|
deviceId: number(),
|
|
23457
|
-
trackId: string(),
|
|
25474
|
+
trackId: string().optional(),
|
|
23458
25475
|
frameId: string()
|
|
23459
25476
|
}), object({
|
|
23460
25477
|
removed: boolean(),
|
|
@@ -23471,7 +25488,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23471
25488
|
auth: "admin"
|
|
23472
25489
|
}), method(object({
|
|
23473
25490
|
deviceId: number(),
|
|
23474
|
-
|
|
25491
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25492
|
+
trackId: string().optional(),
|
|
23475
25493
|
frameId: string(),
|
|
23476
25494
|
subject: RetrainAssistSubjectSchema,
|
|
23477
25495
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23479,12 +25497,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23479
25497
|
}), RetrainAssistResultSchema, {
|
|
23480
25498
|
kind: "mutation",
|
|
23481
25499
|
auth: "admin"
|
|
23482
|
-
}), method(object({
|
|
25500
|
+
}), method(object({
|
|
25501
|
+
trackId: string().optional(),
|
|
25502
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25503
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23483
25504
|
kind: "query",
|
|
23484
25505
|
auth: "admin"
|
|
23485
25506
|
}), method(object({
|
|
23486
25507
|
deviceId: number(),
|
|
23487
|
-
|
|
25508
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25509
|
+
trackId: string().optional(),
|
|
23488
25510
|
frameId: string(),
|
|
23489
25511
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23490
25512
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23507,7 +25529,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23507
25529
|
auth: "admin"
|
|
23508
25530
|
}), method(object({
|
|
23509
25531
|
deviceId: number(),
|
|
23510
|
-
trackId: string(),
|
|
25532
|
+
trackId: string().optional(),
|
|
23511
25533
|
frameId: string(),
|
|
23512
25534
|
complete: boolean()
|
|
23513
25535
|
}), RetrainFrameSchema, {
|
|
@@ -23521,6 +25543,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23521
25543
|
kind: "mutation",
|
|
23522
25544
|
auth: "admin",
|
|
23523
25545
|
timeoutMs: 60 * 6e4
|
|
25546
|
+
}), method(object({
|
|
25547
|
+
filter: RetrainExportFilterSchema,
|
|
25548
|
+
layout: RetrainExportLayoutSchema
|
|
25549
|
+
}), object({
|
|
25550
|
+
ticket: PeerBytesTicketSchema,
|
|
25551
|
+
frames: number().int(),
|
|
25552
|
+
annotations: number().int()
|
|
25553
|
+
}), {
|
|
25554
|
+
kind: "mutation",
|
|
25555
|
+
auth: "admin",
|
|
25556
|
+
timeoutMs: 12e4
|
|
25557
|
+
}), method(object({
|
|
25558
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25559
|
+
completeOnly: boolean().optional()
|
|
25560
|
+
}), RetrainDatasetStatsSchema, {
|
|
25561
|
+
kind: "query",
|
|
25562
|
+
auth: "admin"
|
|
25563
|
+
}), method(object({
|
|
25564
|
+
name: string().max(120),
|
|
25565
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25566
|
+
layout: RetrainExportLayoutSchema,
|
|
25567
|
+
completeOnly: boolean()
|
|
25568
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25569
|
+
kind: "mutation",
|
|
25570
|
+
auth: "admin",
|
|
25571
|
+
timeoutMs: 12e4
|
|
25572
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25573
|
+
kind: "query",
|
|
25574
|
+
auth: "admin"
|
|
25575
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25576
|
+
kind: "mutation",
|
|
25577
|
+
auth: "admin"
|
|
25578
|
+
}), method(object({ id: string() }), object({
|
|
25579
|
+
found: boolean(),
|
|
25580
|
+
annotationHash: string(),
|
|
25581
|
+
matches: boolean(),
|
|
25582
|
+
missingFrames: number().int()
|
|
25583
|
+
}), {
|
|
25584
|
+
kind: "query",
|
|
25585
|
+
auth: "admin",
|
|
25586
|
+
timeoutMs: 12e4
|
|
25587
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25588
|
+
kind: "query",
|
|
25589
|
+
auth: "admin"
|
|
25590
|
+
}), method(object({
|
|
25591
|
+
deviceId: number(),
|
|
25592
|
+
trackId: string().optional(),
|
|
25593
|
+
frameId: string(),
|
|
25594
|
+
profileId: string(),
|
|
25595
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25596
|
+
boxes: array(object({
|
|
25597
|
+
ref: string(),
|
|
25598
|
+
bbox: RetrainBboxSchema,
|
|
25599
|
+
macroClass: RetrainMacroClassSchema,
|
|
25600
|
+
label: string().optional()
|
|
25601
|
+
})).max(50),
|
|
25602
|
+
allowCloud: boolean()
|
|
25603
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25604
|
+
kind: "mutation",
|
|
25605
|
+
auth: "admin",
|
|
25606
|
+
timeoutMs: 18e4
|
|
25607
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25608
|
+
kind: "mutation",
|
|
25609
|
+
auth: "admin"
|
|
25610
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25611
|
+
kind: "query",
|
|
25612
|
+
auth: "admin"
|
|
25613
|
+
}), method(object({
|
|
25614
|
+
id: string(),
|
|
25615
|
+
name: string().max(120)
|
|
25616
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25617
|
+
kind: "mutation",
|
|
25618
|
+
auth: "admin"
|
|
25619
|
+
}), method(object({ id: string() }), object({
|
|
25620
|
+
deleted: boolean(),
|
|
25621
|
+
removedFrames: number().int()
|
|
25622
|
+
}), {
|
|
25623
|
+
kind: "mutation",
|
|
25624
|
+
auth: "admin"
|
|
25625
|
+
}), method(object({
|
|
25626
|
+
collectionId: string(),
|
|
25627
|
+
deviceId: number(),
|
|
25628
|
+
epochMs: number()
|
|
25629
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25630
|
+
kind: "mutation",
|
|
25631
|
+
auth: "admin",
|
|
25632
|
+
timeoutMs: 6e4
|
|
25633
|
+
}), method(object({
|
|
25634
|
+
collectionId: string(),
|
|
25635
|
+
frameIds: array(string()).min(1).max(500)
|
|
25636
|
+
}), object({
|
|
25637
|
+
added: number().int(),
|
|
25638
|
+
alreadyMember: number().int(),
|
|
25639
|
+
unknownFrameIds: array(string()).readonly()
|
|
25640
|
+
}), {
|
|
25641
|
+
kind: "mutation",
|
|
25642
|
+
auth: "admin"
|
|
25643
|
+
}), method(object({
|
|
25644
|
+
collectionId: string(),
|
|
25645
|
+
frameId: string()
|
|
25646
|
+
}), object({
|
|
25647
|
+
removed: boolean(),
|
|
25648
|
+
deletedFrame: boolean()
|
|
25649
|
+
}), {
|
|
25650
|
+
kind: "mutation",
|
|
25651
|
+
auth: "admin"
|
|
25652
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25653
|
+
kind: "query",
|
|
25654
|
+
auth: "admin"
|
|
23524
25655
|
}), method(object({
|
|
23525
25656
|
/** Which of the three event tables owns the row. */
|
|
23526
25657
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24144,13 +26275,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24144
26275
|
object({
|
|
24145
26276
|
kind: literal("no-family-build"),
|
|
24146
26277
|
format: ModelFormatSchema$1
|
|
26278
|
+
}),
|
|
26279
|
+
object({
|
|
26280
|
+
kind: literal("kept-custom-pin"),
|
|
26281
|
+
modelId: string(),
|
|
26282
|
+
deviceKey: string()
|
|
24147
26283
|
})
|
|
24148
26284
|
]);
|
|
26285
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26286
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26287
|
+
/**
|
|
26288
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26289
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26290
|
+
*/
|
|
26291
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26292
|
+
kind: literal("node-benchmark"),
|
|
26293
|
+
resultId: string(),
|
|
26294
|
+
measuredAtMs: number()
|
|
26295
|
+
})]);
|
|
24149
26296
|
var DeviceModelChoiceSchema = object({
|
|
24150
26297
|
modelId: string(),
|
|
24151
26298
|
p50Ms: number(),
|
|
24152
26299
|
fps: number(),
|
|
24153
26300
|
measured: boolean(),
|
|
26301
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26302
|
+
source: LatencySourceSchema.optional(),
|
|
24154
26303
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24155
26304
|
capacitySessions: number(),
|
|
24156
26305
|
personRecall: number()
|
|
@@ -24161,6 +26310,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24161
26310
|
enabled: boolean(),
|
|
24162
26311
|
available: boolean(),
|
|
24163
26312
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26313
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26314
|
+
kept: KeptReasonSchema.optional(),
|
|
24164
26315
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24165
26316
|
});
|
|
24166
26317
|
var NodeRecommendationSchema = object({
|
|
@@ -24214,6 +26365,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24214
26365
|
kind: literal("coral-enabled"),
|
|
24215
26366
|
nodeId: string(),
|
|
24216
26367
|
deviceKey: string()
|
|
26368
|
+
}),
|
|
26369
|
+
object({
|
|
26370
|
+
kind: literal("custom-pin-kept"),
|
|
26371
|
+
nodeId: string(),
|
|
26372
|
+
deviceKey: string().nullable(),
|
|
26373
|
+
deviceId: number().nullable(),
|
|
26374
|
+
modelId: string()
|
|
26375
|
+
}),
|
|
26376
|
+
object({
|
|
26377
|
+
kind: literal("custom-registry-unreadable"),
|
|
26378
|
+
error: string()
|
|
24217
26379
|
})
|
|
24218
26380
|
]);
|
|
24219
26381
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24392,13 +26554,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24392
26554
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24393
26555
|
});
|
|
24394
26556
|
/**
|
|
24395
|
-
* Where the node and device shares come from (D750, D755).
|
|
24396
|
-
* - `
|
|
24397
|
-
*
|
|
24398
|
-
*
|
|
24399
|
-
*
|
|
24400
|
-
*
|
|
24401
|
-
*
|
|
26557
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26558
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26559
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26560
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26561
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26562
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26563
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26564
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24402
26565
|
* - `manual` — the operator's stored sliders.
|
|
24403
26566
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24404
26567
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24447,6 +26610,362 @@ var EffectiveSharesSchema = object({
|
|
|
24447
26610
|
nodeWeights: record(string(), number()),
|
|
24448
26611
|
deviceWeights: record(string(), record(string(), number()))
|
|
24449
26612
|
});
|
|
26613
|
+
/**
|
|
26614
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26615
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26616
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26617
|
+
* shares read.
|
|
26618
|
+
*
|
|
26619
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26620
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26621
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26622
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26623
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26624
|
+
*
|
|
26625
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26626
|
+
* cross a process at frame rate, D9):
|
|
26627
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26628
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26629
|
+
* interval;
|
|
26630
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26631
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26632
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26633
|
+
* CPU, RAM or the event loop give out.
|
|
26634
|
+
*/
|
|
26635
|
+
/** Defaults and bounds, one place. */
|
|
26636
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26637
|
+
fpsPerStream: 10,
|
|
26638
|
+
budgetMinutes: 45,
|
|
26639
|
+
minBudgetMinutes: 10,
|
|
26640
|
+
maxBudgetMinutes: 120,
|
|
26641
|
+
/** A result older than this no longer beats the table. */
|
|
26642
|
+
staleAfterDays: 30,
|
|
26643
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26644
|
+
settleSec: 5,
|
|
26645
|
+
/** Accounted window per ramp step. */
|
|
26646
|
+
measureSec: 20,
|
|
26647
|
+
/** Longest the drain may take before the run is refused. */
|
|
26648
|
+
drainTimeoutSec: 120,
|
|
26649
|
+
/** Candidate models per device in one run. */
|
|
26650
|
+
maxModelsPerDevice: 6
|
|
26651
|
+
};
|
|
26652
|
+
/** The two measurements a run can make. */
|
|
26653
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26654
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26655
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26656
|
+
deviceKey: string().min(1),
|
|
26657
|
+
/**
|
|
26658
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26659
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26660
|
+
*/
|
|
26661
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26662
|
+
});
|
|
26663
|
+
/** What the operator confirmed. */
|
|
26664
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26665
|
+
nodeId: string().min(1),
|
|
26666
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26667
|
+
/** Which measurements run. At least one. */
|
|
26668
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26669
|
+
/**
|
|
26670
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26671
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26672
|
+
* detector always runs.
|
|
26673
|
+
*/
|
|
26674
|
+
steps: array(string().min(1)).default([]),
|
|
26675
|
+
/** Offered rate of one stream / session. */
|
|
26676
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26677
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26678
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26679
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26680
|
+
keepDownloadedModels: boolean().default(false),
|
|
26681
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26682
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26683
|
+
});
|
|
26684
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26685
|
+
kind: _enum([
|
|
26686
|
+
"benchmark-active",
|
|
26687
|
+
"node-offline",
|
|
26688
|
+
"unknown-device",
|
|
26689
|
+
"no-phase",
|
|
26690
|
+
"insufficient-headroom"
|
|
26691
|
+
]),
|
|
26692
|
+
detail: string(),
|
|
26693
|
+
overridable: boolean()
|
|
26694
|
+
});
|
|
26695
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26696
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26697
|
+
deviceId: number(),
|
|
26698
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26699
|
+
placedOnNode: boolean(),
|
|
26700
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26701
|
+
pinnedToNode: boolean()
|
|
26702
|
+
});
|
|
26703
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26704
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26705
|
+
deviceId: number(),
|
|
26706
|
+
reason: literal("only-frame-source")
|
|
26707
|
+
});
|
|
26708
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26709
|
+
nodeId: string(),
|
|
26710
|
+
online: boolean(),
|
|
26711
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26712
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26713
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26714
|
+
estimatedDurationMs: number(),
|
|
26715
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26716
|
+
budgetMs: number(),
|
|
26717
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26718
|
+
steps: array(string()).readonly(),
|
|
26719
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26720
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26721
|
+
headroom: object({
|
|
26722
|
+
sessionsNow: number(),
|
|
26723
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26724
|
+
}),
|
|
26725
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26726
|
+
canStart: boolean()
|
|
26727
|
+
});
|
|
26728
|
+
/** Where the measuring runner is. */
|
|
26729
|
+
var NodeBenchProgressSchema = object({
|
|
26730
|
+
phase: _enum([
|
|
26731
|
+
"preparing",
|
|
26732
|
+
"device",
|
|
26733
|
+
"pipeline",
|
|
26734
|
+
"cleanup"
|
|
26735
|
+
]),
|
|
26736
|
+
deviceKey: string().nullable(),
|
|
26737
|
+
modelId: string().nullable(),
|
|
26738
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26739
|
+
load: number().nullable(),
|
|
26740
|
+
cellsDone: number(),
|
|
26741
|
+
cellsTotal: number(),
|
|
26742
|
+
message: string()
|
|
26743
|
+
});
|
|
26744
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26745
|
+
var NodeBenchLimitSchema = _enum([
|
|
26746
|
+
"p95",
|
|
26747
|
+
"drops",
|
|
26748
|
+
"errors",
|
|
26749
|
+
"stall",
|
|
26750
|
+
"cpu",
|
|
26751
|
+
"ram",
|
|
26752
|
+
"none"
|
|
26753
|
+
]);
|
|
26754
|
+
var NodeBenchRampStepSchema = object({
|
|
26755
|
+
load: number(),
|
|
26756
|
+
pass: boolean(),
|
|
26757
|
+
p95Ms: number(),
|
|
26758
|
+
dropRatio: number(),
|
|
26759
|
+
/** Completed frames per second over the accounted window. */
|
|
26760
|
+
fps: number(),
|
|
26761
|
+
cpuPct: number().nullable(),
|
|
26762
|
+
ramFreePct: number().nullable(),
|
|
26763
|
+
failReasons: array(string()).readonly()
|
|
26764
|
+
});
|
|
26765
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26766
|
+
phase: literal("device"),
|
|
26767
|
+
deviceKey: string(),
|
|
26768
|
+
modelId: string(),
|
|
26769
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26770
|
+
p50Ms: number(),
|
|
26771
|
+
p95Ms: number(),
|
|
26772
|
+
p99Ms: number(),
|
|
26773
|
+
/** Frames per second sustained at the last passing step. */
|
|
26774
|
+
fps: number(),
|
|
26775
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26776
|
+
kMax: number(),
|
|
26777
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26778
|
+
/** First call (model load + warm-up). */
|
|
26779
|
+
warmupMs: number(),
|
|
26780
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26781
|
+
}), object({
|
|
26782
|
+
phase: literal("pipeline"),
|
|
26783
|
+
deviceKey: string(),
|
|
26784
|
+
modelId: string(),
|
|
26785
|
+
steps: array(string()).readonly(),
|
|
26786
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26787
|
+
maxSessions: number(),
|
|
26788
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26789
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26790
|
+
stepsFired: array(string()).readonly(),
|
|
26791
|
+
warmupMs: number(),
|
|
26792
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26793
|
+
})]);
|
|
26794
|
+
/**
|
|
26795
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26796
|
+
* the node no longer beats the table.
|
|
26797
|
+
*/
|
|
26798
|
+
var NodeBenchFingerprintSchema = object({
|
|
26799
|
+
pipelineVersion: string().nullable(),
|
|
26800
|
+
cpuModel: string().nullable(),
|
|
26801
|
+
ramGb: number().nullable(),
|
|
26802
|
+
os: string().nullable(),
|
|
26803
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26804
|
+
pools: record(string(), object({
|
|
26805
|
+
runtime: string(),
|
|
26806
|
+
numWorkers: number(),
|
|
26807
|
+
concurrency: number(),
|
|
26808
|
+
batchMode: string()
|
|
26809
|
+
})).default({})
|
|
26810
|
+
});
|
|
26811
|
+
/** The frames the run used. */
|
|
26812
|
+
var NodeBenchClipSchema = object({
|
|
26813
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26814
|
+
id: string(),
|
|
26815
|
+
revision: string().nullable(),
|
|
26816
|
+
frames: number(),
|
|
26817
|
+
width: number(),
|
|
26818
|
+
height: number()
|
|
26819
|
+
});
|
|
26820
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26821
|
+
runId: string().min(1),
|
|
26822
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26823
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26824
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26825
|
+
steps: array(string()).default([]),
|
|
26826
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26827
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26828
|
+
deadlineAtMs: number(),
|
|
26829
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26830
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26831
|
+
keepDownloadedModels: boolean().default(false)
|
|
26832
|
+
});
|
|
26833
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26834
|
+
"running",
|
|
26835
|
+
"done",
|
|
26836
|
+
"failed",
|
|
26837
|
+
"aborted"
|
|
26838
|
+
]);
|
|
26839
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26840
|
+
runId: string(),
|
|
26841
|
+
nodeId: string(),
|
|
26842
|
+
state: NodeBenchRunnerStateSchema,
|
|
26843
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26844
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26845
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26846
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26847
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26848
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26849
|
+
activeCameraIds: array(number()).readonly(),
|
|
26850
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26851
|
+
deletedModels: array(string()).readonly(),
|
|
26852
|
+
error: string().nullable(),
|
|
26853
|
+
startedAtMs: number(),
|
|
26854
|
+
finishedAtMs: number().nullable()
|
|
26855
|
+
});
|
|
26856
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26857
|
+
"draining",
|
|
26858
|
+
"measuring",
|
|
26859
|
+
"restoring",
|
|
26860
|
+
"done",
|
|
26861
|
+
"failed",
|
|
26862
|
+
"aborted"
|
|
26863
|
+
]);
|
|
26864
|
+
/** Why a run ended. */
|
|
26865
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26866
|
+
"completed",
|
|
26867
|
+
"operator-abort",
|
|
26868
|
+
"deadline",
|
|
26869
|
+
"node-lost",
|
|
26870
|
+
"runner-lost",
|
|
26871
|
+
"hub-restart",
|
|
26872
|
+
"drain-timeout",
|
|
26873
|
+
"failed"
|
|
26874
|
+
]);
|
|
26875
|
+
var NodeBenchmarkRunSchema = object({
|
|
26876
|
+
runId: string(),
|
|
26877
|
+
nodeId: string(),
|
|
26878
|
+
state: NodeBenchmarkStateSchema,
|
|
26879
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26880
|
+
startedAtMs: number(),
|
|
26881
|
+
deadlineAtMs: number(),
|
|
26882
|
+
finishedAtMs: number().nullable(),
|
|
26883
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26884
|
+
error: string().nullable(),
|
|
26885
|
+
/** Cameras moved off the node for the run. */
|
|
26886
|
+
moved: array(number()).readonly(),
|
|
26887
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26888
|
+
staying: array(number()).readonly(),
|
|
26889
|
+
/** Something else ran on the node's pools during the run. */
|
|
26890
|
+
contaminated: boolean(),
|
|
26891
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26892
|
+
resultIds: array(string()).readonly()
|
|
26893
|
+
});
|
|
26894
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26895
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26896
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26897
|
+
modeNodeId: string().nullable(),
|
|
26898
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26899
|
+
});
|
|
26900
|
+
/**
|
|
26901
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26902
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26903
|
+
* ends, never by anyone else.
|
|
26904
|
+
*/
|
|
26905
|
+
var NodeBenchmarkResultSchema = object({
|
|
26906
|
+
id: string(),
|
|
26907
|
+
runId: string(),
|
|
26908
|
+
nodeId: string(),
|
|
26909
|
+
cell: NodeBenchCellSchema,
|
|
26910
|
+
fpsPerStream: number(),
|
|
26911
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26912
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26913
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26914
|
+
contaminated: boolean(),
|
|
26915
|
+
stayingCameras: array(number()).readonly(),
|
|
26916
|
+
/** The run ended early; the cell itself completed. */
|
|
26917
|
+
partialRun: boolean(),
|
|
26918
|
+
measuredAtMs: number()
|
|
26919
|
+
});
|
|
26920
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26921
|
+
nodeId: string().optional(),
|
|
26922
|
+
deviceKey: string().optional()
|
|
26923
|
+
});
|
|
26924
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26925
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26926
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26927
|
+
standing: _enum([
|
|
26928
|
+
"fresh",
|
|
26929
|
+
"stale",
|
|
26930
|
+
"superseded"
|
|
26931
|
+
]),
|
|
26932
|
+
staleWhy: _enum([
|
|
26933
|
+
"age",
|
|
26934
|
+
"runtime",
|
|
26935
|
+
"pool-tuning"
|
|
26936
|
+
]).nullable()
|
|
26937
|
+
});
|
|
26938
|
+
object({
|
|
26939
|
+
runId: string(),
|
|
26940
|
+
nodeId: string(),
|
|
26941
|
+
startedAtMs: number(),
|
|
26942
|
+
deadlineAtMs: number(),
|
|
26943
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26944
|
+
moved: array(number()).readonly(),
|
|
26945
|
+
staying: array(number()).readonly()
|
|
26946
|
+
});
|
|
26947
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26948
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26949
|
+
nodeId: string(),
|
|
26950
|
+
reachable: boolean(),
|
|
26951
|
+
devices: array(object({
|
|
26952
|
+
deviceKey: string(),
|
|
26953
|
+
enabled: boolean(),
|
|
26954
|
+
available: boolean(),
|
|
26955
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26956
|
+
suggested: array(string()).readonly(),
|
|
26957
|
+
/** Every root detector the device has a build for. */
|
|
26958
|
+
all: array(string()).readonly(),
|
|
26959
|
+
/** The model the device runs now, when pinned. */
|
|
26960
|
+
currentModelId: string().nullable()
|
|
26961
|
+
})).readonly(),
|
|
26962
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26963
|
+
steps: array(object({
|
|
26964
|
+
id: string(),
|
|
26965
|
+
name: string(),
|
|
26966
|
+
slot: string()
|
|
26967
|
+
})).readonly()
|
|
26968
|
+
});
|
|
24450
26969
|
object({
|
|
24451
26970
|
activeCameras: number(),
|
|
24452
26971
|
throttledCameras: number(),
|
|
@@ -25575,7 +28094,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25575
28094
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25576
28095
|
deviceId: number(),
|
|
25577
28096
|
trackId: string()
|
|
25578
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28097
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28098
|
+
accepted: literal(true),
|
|
28099
|
+
runId: string()
|
|
28100
|
+
}), {
|
|
28101
|
+
kind: "mutation",
|
|
28102
|
+
auth: "admin"
|
|
28103
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28104
|
+
kind: "mutation",
|
|
28105
|
+
auth: "admin"
|
|
28106
|
+
});
|
|
25579
28107
|
var CameraPipelineConfigSchema = object({
|
|
25580
28108
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25581
28109
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26214,6 +28742,21 @@ method(object({
|
|
|
26214
28742
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26215
28743
|
kind: "mutation",
|
|
26216
28744
|
auth: "admin"
|
|
28745
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28746
|
+
kind: literal("started"),
|
|
28747
|
+
runId: string()
|
|
28748
|
+
}), object({
|
|
28749
|
+
kind: literal("refused"),
|
|
28750
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28751
|
+
})]), {
|
|
28752
|
+
kind: "mutation",
|
|
28753
|
+
auth: "admin"
|
|
28754
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28755
|
+
kind: "mutation",
|
|
28756
|
+
auth: "admin"
|
|
28757
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28758
|
+
kind: "mutation",
|
|
28759
|
+
auth: "admin"
|
|
26217
28760
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26218
28761
|
deviceId: number(),
|
|
26219
28762
|
addonId: string(),
|
|
@@ -26619,8 +29162,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26619
29162
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26620
29163
|
*
|
|
26621
29164
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26622
|
-
* one for transactional / one for notifications). Consumers (
|
|
26623
|
-
*
|
|
29165
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29166
|
+
* addons, …) walk the collection and pick the first
|
|
26624
29167
|
* ready provider OR target a specific addonId.
|
|
26625
29168
|
*
|
|
26626
29169
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26799,7 +29342,7 @@ targets: array(object({
|
|
|
26799
29342
|
})));
|
|
26800
29343
|
/**
|
|
26801
29344
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26802
|
-
* providers (OIDC, SAML,
|
|
29345
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26803
29346
|
* carrying the post-callback claims before redirecting back to
|
|
26804
29347
|
* `/api/auth/sso/finish`.
|
|
26805
29348
|
*
|
|
@@ -26862,7 +29405,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26862
29405
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26863
29406
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26864
29407
|
*/
|
|
26865
|
-
issuer: string().optional()
|
|
29408
|
+
issuer: string().optional(),
|
|
29409
|
+
/**
|
|
29410
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29411
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29412
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29413
|
+
* any other browser.
|
|
29414
|
+
*/
|
|
29415
|
+
browserBinding: string().optional()
|
|
26866
29416
|
});
|
|
26867
29417
|
method(object({
|
|
26868
29418
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32338,6 +34888,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32338
34888
|
enabled: boolean().optional(),
|
|
32339
34889
|
info: record(string(), unknown()).optional(),
|
|
32340
34890
|
settings: record(string(), unknown()).optional(),
|
|
34891
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34892
|
+
* the keychain, not the table (D787). */
|
|
34893
|
+
secretKeys: array(string()).optional(),
|
|
32341
34894
|
skipRestart: boolean().optional()
|
|
32342
34895
|
});
|
|
32343
34896
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32361,7 +34914,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32361
34914
|
auth: "admin"
|
|
32362
34915
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32363
34916
|
id: string(),
|
|
32364
|
-
settings: record(string(), unknown())
|
|
34917
|
+
settings: record(string(), unknown()),
|
|
34918
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34919
|
+
secretKeys: array(string()).optional()
|
|
32365
34920
|
}), object({ success: boolean() }), {
|
|
32366
34921
|
kind: "mutation",
|
|
32367
34922
|
auth: "admin"
|
|
@@ -39133,16 +41688,6 @@ var ApiKeySummarySchema = object({
|
|
|
39133
41688
|
createdAt: number(),
|
|
39134
41689
|
lastUsedAt: number().optional()
|
|
39135
41690
|
});
|
|
39136
|
-
var CreateApiKeyInputSchema = object({
|
|
39137
|
-
label: string(),
|
|
39138
|
-
isAdmin: boolean().default(false),
|
|
39139
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39140
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39141
|
-
});
|
|
39142
|
-
var CreateApiKeyResultSchema = object({
|
|
39143
|
-
token: string(),
|
|
39144
|
-
record: ApiKeySummarySchema
|
|
39145
|
-
});
|
|
39146
41691
|
var ScopedTokenSummarySchema = object({
|
|
39147
41692
|
id: string(),
|
|
39148
41693
|
userId: string(),
|
|
@@ -39241,17 +41786,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39241
41786
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39242
41787
|
kind: "mutation",
|
|
39243
41788
|
access: "view"
|
|
39244
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39245
|
-
kind: "mutation",
|
|
39246
|
-
auth: "admin",
|
|
39247
|
-
access: "create"
|
|
39248
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41789
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39249
41790
|
kind: "mutation",
|
|
39250
41791
|
auth: "admin",
|
|
39251
41792
|
access: "delete"
|
|
39252
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39253
|
-
kind: "mutation",
|
|
39254
|
-
access: "view"
|
|
39255
41793
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39256
41794
|
kind: "mutation",
|
|
39257
41795
|
auth: "admin",
|
|
@@ -39325,15 +41863,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39325
41863
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39326
41864
|
userId: string(),
|
|
39327
41865
|
issuer: string()
|
|
39328
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39329
|
-
userId: string(),
|
|
39330
|
-
issuer: string().min(1),
|
|
39331
|
-
label: string().optional()
|
|
39332
|
-
}), object({ success: literal(true) }), {
|
|
39333
|
-
kind: "mutation",
|
|
39334
|
-
auth: "admin",
|
|
39335
|
-
access: "create"
|
|
39336
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41866
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39337
41867
|
kind: "mutation",
|
|
39338
41868
|
auth: "admin",
|
|
39339
41869
|
access: "delete"
|
|
@@ -40038,6 +42568,451 @@ var zoneRulesCapability = {
|
|
|
40038
42568
|
*/
|
|
40039
42569
|
durability: "restored"
|
|
40040
42570
|
};
|
|
42571
|
+
/**
|
|
42572
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42573
|
+
*
|
|
42574
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42575
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42576
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42577
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42578
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42579
|
+
* manifest entry and nothing else.
|
|
42580
|
+
*
|
|
42581
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42582
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42583
|
+
* Every method is `admin`: these spend money.
|
|
42584
|
+
*
|
|
42585
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42586
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42587
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42588
|
+
*
|
|
42589
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42590
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42591
|
+
* ticket the provider mints (D613).
|
|
42592
|
+
*/
|
|
42593
|
+
var TrainingGpuOptionSchema = object({
|
|
42594
|
+
id: string(),
|
|
42595
|
+
label: string(),
|
|
42596
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42597
|
+
usdPerHour: number().nonnegative(),
|
|
42598
|
+
vramGb: number().nonnegative()
|
|
42599
|
+
});
|
|
42600
|
+
var TrainingRegionOptionSchema = object({
|
|
42601
|
+
/** `''` = any region (the provider's choice). */
|
|
42602
|
+
id: string(),
|
|
42603
|
+
label: string(),
|
|
42604
|
+
priceMultiplier: number().positive()
|
|
42605
|
+
});
|
|
42606
|
+
/**
|
|
42607
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42608
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42609
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42610
|
+
*/
|
|
42611
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42612
|
+
gpuType: string(),
|
|
42613
|
+
region: string(),
|
|
42614
|
+
costCapUsd: number().nonnegative(),
|
|
42615
|
+
maxRuntimeSec: number().int().positive(),
|
|
42616
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42617
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42618
|
+
});
|
|
42619
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42620
|
+
addonId: string(),
|
|
42621
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42622
|
+
kind: string(),
|
|
42623
|
+
label: string(),
|
|
42624
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42625
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42626
|
+
maxDatasetBytes: number().int().positive(),
|
|
42627
|
+
maxRuntimeSec: number().int().positive(),
|
|
42628
|
+
freeTierNote: string().optional(),
|
|
42629
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42630
|
+
dataResidencyNote: string(),
|
|
42631
|
+
/** Credentials are present — never the values. */
|
|
42632
|
+
configured: boolean(),
|
|
42633
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42634
|
+
});
|
|
42635
|
+
var TrainingCredentialCheckSchema = object({
|
|
42636
|
+
ok: boolean(),
|
|
42637
|
+
/** Workspace / account name, when the provider says. */
|
|
42638
|
+
account: string().optional(),
|
|
42639
|
+
reason: _enum([
|
|
42640
|
+
"missing",
|
|
42641
|
+
"invalid",
|
|
42642
|
+
"forbidden",
|
|
42643
|
+
"network",
|
|
42644
|
+
"quota"
|
|
42645
|
+
]).optional(),
|
|
42646
|
+
detail: string().optional()
|
|
42647
|
+
});
|
|
42648
|
+
var ProviderJobStateSchema = _enum([
|
|
42649
|
+
"pending",
|
|
42650
|
+
"starting",
|
|
42651
|
+
"running",
|
|
42652
|
+
"succeeded",
|
|
42653
|
+
"failed",
|
|
42654
|
+
"cancelled",
|
|
42655
|
+
"lost"
|
|
42656
|
+
]);
|
|
42657
|
+
var ProviderJobStatusSchema = object({
|
|
42658
|
+
jobKey: string(),
|
|
42659
|
+
providerJobId: string().optional(),
|
|
42660
|
+
state: ProviderJobStateSchema,
|
|
42661
|
+
startedAt: number().optional(),
|
|
42662
|
+
endedAt: number().optional(),
|
|
42663
|
+
exitCode: number().int().optional(),
|
|
42664
|
+
failureReason: string().optional(),
|
|
42665
|
+
gpuType: string(),
|
|
42666
|
+
region: string().optional(),
|
|
42667
|
+
billedSeconds: number().nonnegative(),
|
|
42668
|
+
costUsd: number().nonnegative(),
|
|
42669
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42670
|
+
costIsEstimate: boolean(),
|
|
42671
|
+
lastFetchedAt: number()
|
|
42672
|
+
});
|
|
42673
|
+
/**
|
|
42674
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42675
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42676
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42677
|
+
* in `result.json`.
|
|
42678
|
+
*/
|
|
42679
|
+
var TrainerSourceRefSchema = object({
|
|
42680
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42681
|
+
repo: string().min(1),
|
|
42682
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42683
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42684
|
+
});
|
|
42685
|
+
var JobRef = {
|
|
42686
|
+
addonId: string(),
|
|
42687
|
+
jobKey: string().uuid()
|
|
42688
|
+
};
|
|
42689
|
+
var TrainingLogLineSchema = object({
|
|
42690
|
+
ts: number(),
|
|
42691
|
+
text: string()
|
|
42692
|
+
});
|
|
42693
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42694
|
+
kind: "mutation",
|
|
42695
|
+
auth: "admin",
|
|
42696
|
+
timeoutMs: 3e4
|
|
42697
|
+
}), method(object({
|
|
42698
|
+
addonId: string(),
|
|
42699
|
+
gpuType: string(),
|
|
42700
|
+
region: string(),
|
|
42701
|
+
datasetBytes: number().int().nonnegative(),
|
|
42702
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42703
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42704
|
+
}), object({
|
|
42705
|
+
usdLow: number().nonnegative(),
|
|
42706
|
+
usdHigh: number().nonnegative(),
|
|
42707
|
+
notes: array(string()).readonly()
|
|
42708
|
+
}), { auth: "admin" }), method(object({
|
|
42709
|
+
...JobRef,
|
|
42710
|
+
ticket: PeerBytesTicketSchema
|
|
42711
|
+
}), object({
|
|
42712
|
+
bytes: number().int().nonnegative(),
|
|
42713
|
+
sha256: string()
|
|
42714
|
+
}), {
|
|
42715
|
+
kind: "mutation",
|
|
42716
|
+
auth: "admin",
|
|
42717
|
+
timeoutMs: 120 * 6e4
|
|
42718
|
+
}), method(object({
|
|
42719
|
+
...JobRef,
|
|
42720
|
+
trainer: TrainerSourceRefSchema,
|
|
42721
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42722
|
+
gpuType: string(),
|
|
42723
|
+
region: string(),
|
|
42724
|
+
maxRuntimeSec: number().int().positive()
|
|
42725
|
+
}), ProviderJobStatusSchema, {
|
|
42726
|
+
kind: "mutation",
|
|
42727
|
+
auth: "admin",
|
|
42728
|
+
timeoutMs: 30 * 6e4
|
|
42729
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42730
|
+
auth: "admin",
|
|
42731
|
+
timeoutMs: 6e4
|
|
42732
|
+
}), method(object({
|
|
42733
|
+
...JobRef,
|
|
42734
|
+
cursor: string().optional(),
|
|
42735
|
+
max: number().int().min(1).max(500)
|
|
42736
|
+
}), object({
|
|
42737
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42738
|
+
cursor: string()
|
|
42739
|
+
}), {
|
|
42740
|
+
auth: "admin",
|
|
42741
|
+
timeoutMs: 6e4
|
|
42742
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42743
|
+
kind: "mutation",
|
|
42744
|
+
auth: "admin",
|
|
42745
|
+
timeoutMs: 6e4
|
|
42746
|
+
}), method(object(JobRef), object({
|
|
42747
|
+
found: boolean(),
|
|
42748
|
+
text: string().optional()
|
|
42749
|
+
}), {
|
|
42750
|
+
kind: "mutation",
|
|
42751
|
+
auth: "admin",
|
|
42752
|
+
timeoutMs: 5 * 6e4
|
|
42753
|
+
}), method(object({
|
|
42754
|
+
...JobRef,
|
|
42755
|
+
path: _enum(["bundle.tar"])
|
|
42756
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42757
|
+
kind: "mutation",
|
|
42758
|
+
auth: "admin",
|
|
42759
|
+
timeoutMs: 5 * 6e4
|
|
42760
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42761
|
+
kind: "mutation",
|
|
42762
|
+
auth: "admin",
|
|
42763
|
+
timeoutMs: 5 * 6e4
|
|
42764
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42765
|
+
auth: "admin",
|
|
42766
|
+
timeoutMs: 2 * 6e4
|
|
42767
|
+
});
|
|
42768
|
+
/**
|
|
42769
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42770
|
+
* provided by `addon-training`.
|
|
42771
|
+
*
|
|
42772
|
+
* It owns what every provider must agree on, written once:
|
|
42773
|
+
*
|
|
42774
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42775
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42776
|
+
* the export plan) and reaches this store through the five row methods
|
|
42777
|
+
* below, so the Retrain page and the export did not change.
|
|
42778
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42779
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42780
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42781
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42782
|
+
* rollback. Nothing is ever registered automatically.
|
|
42783
|
+
*
|
|
42784
|
+
* Every method is `admin`.
|
|
42785
|
+
*/
|
|
42786
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42787
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42788
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42789
|
+
var TrainingBaseModelSchema = object({
|
|
42790
|
+
modelId: string(),
|
|
42791
|
+
label: string(),
|
|
42792
|
+
weights: string(),
|
|
42793
|
+
imgsz: number().int(),
|
|
42794
|
+
baselineOnnxUrl: string(),
|
|
42795
|
+
baselineFloors: record(string(), number()),
|
|
42796
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42797
|
+
recommended: boolean()
|
|
42798
|
+
});
|
|
42799
|
+
var TrainingPresetSchema = _enum([
|
|
42800
|
+
"quick",
|
|
42801
|
+
"standard",
|
|
42802
|
+
"thorough"
|
|
42803
|
+
]);
|
|
42804
|
+
var TrainingJobRequestSchema = object({
|
|
42805
|
+
datasetVersionId: string().min(1),
|
|
42806
|
+
/** The `training-provider` addon that runs it. */
|
|
42807
|
+
addonId: string().min(1),
|
|
42808
|
+
gpuType: string().min(1),
|
|
42809
|
+
region: string(),
|
|
42810
|
+
baseModelId: string().min(1),
|
|
42811
|
+
preset: TrainingPresetSchema,
|
|
42812
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42813
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42814
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42815
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42816
|
+
});
|
|
42817
|
+
var TrainingSplitPlanSchema = object({
|
|
42818
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42819
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42820
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42821
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42822
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42823
|
+
trainSubjects: number().int()
|
|
42824
|
+
});
|
|
42825
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42826
|
+
"unknown-dataset",
|
|
42827
|
+
"unknown-provider",
|
|
42828
|
+
"provider-not-configured",
|
|
42829
|
+
"unknown-base-model",
|
|
42830
|
+
"unknown-gpu",
|
|
42831
|
+
"dataset-too-large",
|
|
42832
|
+
"no-training-subjects",
|
|
42833
|
+
"job-already-running"
|
|
42834
|
+
]);
|
|
42835
|
+
var TrainingJobPlanSchema = object({
|
|
42836
|
+
refusal: object({
|
|
42837
|
+
reason: TrainingRefusalReasonSchema,
|
|
42838
|
+
detail: string()
|
|
42839
|
+
}).nullable(),
|
|
42840
|
+
warnings: array(string()).readonly(),
|
|
42841
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42842
|
+
estimate: object({
|
|
42843
|
+
datasetBytes: number().int(),
|
|
42844
|
+
uploadMinutesAt20Mbps: number(),
|
|
42845
|
+
gpuSecondsLow: number(),
|
|
42846
|
+
gpuSecondsHigh: number(),
|
|
42847
|
+
usdLow: number(),
|
|
42848
|
+
usdHigh: number(),
|
|
42849
|
+
notes: array(string()).readonly()
|
|
42850
|
+
}).nullable(),
|
|
42851
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42852
|
+
defaults: object({
|
|
42853
|
+
maxCostUsd: number(),
|
|
42854
|
+
maxRuntimeSec: number().int()
|
|
42855
|
+
}).nullable(),
|
|
42856
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42857
|
+
dataNotice: string()
|
|
42858
|
+
});
|
|
42859
|
+
/**
|
|
42860
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42861
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42862
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42863
|
+
* result lives after the operator acted on it.
|
|
42864
|
+
*/
|
|
42865
|
+
var TrainingJobStateSchema = _enum([
|
|
42866
|
+
"uploading",
|
|
42867
|
+
"submitted",
|
|
42868
|
+
"starting",
|
|
42869
|
+
"running",
|
|
42870
|
+
"collecting",
|
|
42871
|
+
"ready",
|
|
42872
|
+
"registered",
|
|
42873
|
+
"canary",
|
|
42874
|
+
"failed",
|
|
42875
|
+
"cancelling",
|
|
42876
|
+
"cancelled",
|
|
42877
|
+
"lost",
|
|
42878
|
+
"expired",
|
|
42879
|
+
"discarded"
|
|
42880
|
+
]);
|
|
42881
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42882
|
+
"cost-cap",
|
|
42883
|
+
"runtime-cap",
|
|
42884
|
+
"upload-failed",
|
|
42885
|
+
"submit-failed",
|
|
42886
|
+
"trainer-failed",
|
|
42887
|
+
"result-invalid",
|
|
42888
|
+
"checksum-mismatch",
|
|
42889
|
+
"fetch-failed",
|
|
42890
|
+
"provider-error",
|
|
42891
|
+
"hub-restart-during-upload"
|
|
42892
|
+
]);
|
|
42893
|
+
var TrainingProgressPointSchema = object({
|
|
42894
|
+
epoch: number().int(),
|
|
42895
|
+
map50: number().nullable(),
|
|
42896
|
+
map50_95: number().nullable()
|
|
42897
|
+
});
|
|
42898
|
+
var TrainingCanarySchema = object({
|
|
42899
|
+
deviceIds: array(number().int()).readonly(),
|
|
42900
|
+
since: number(),
|
|
42901
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42902
|
+
previous: array(object({
|
|
42903
|
+
deviceId: number().int(),
|
|
42904
|
+
nodeId: string(),
|
|
42905
|
+
deviceKey: string(),
|
|
42906
|
+
patch: object({
|
|
42907
|
+
modelId: string().optional(),
|
|
42908
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42909
|
+
}).nullable()
|
|
42910
|
+
})).readonly()
|
|
42911
|
+
});
|
|
42912
|
+
var TrainingJobSchema = object({
|
|
42913
|
+
id: string(),
|
|
42914
|
+
idempotencyKey: string(),
|
|
42915
|
+
name: string(),
|
|
42916
|
+
createdAt: number(),
|
|
42917
|
+
updatedAt: number(),
|
|
42918
|
+
state: TrainingJobStateSchema,
|
|
42919
|
+
stage: TrainingStageSchema.nullable(),
|
|
42920
|
+
failure: object({
|
|
42921
|
+
reason: TrainingFailureReasonSchema,
|
|
42922
|
+
stage: string().nullable(),
|
|
42923
|
+
detail: string()
|
|
42924
|
+
}).nullable(),
|
|
42925
|
+
request: TrainingJobRequestSchema,
|
|
42926
|
+
maxCostUsd: number().nonnegative(),
|
|
42927
|
+
maxRuntimeSec: number().int().positive(),
|
|
42928
|
+
trainer: TrainerSourceRefSchema,
|
|
42929
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42930
|
+
dataset: object({
|
|
42931
|
+
bytes: number().int(),
|
|
42932
|
+
sha256: string(),
|
|
42933
|
+
uploadedAt: number()
|
|
42934
|
+
}).nullable(),
|
|
42935
|
+
split: TrainingSplitPlanSchema,
|
|
42936
|
+
provider: object({
|
|
42937
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42938
|
+
providerJobId: string().nullable(),
|
|
42939
|
+
startedAt: number().nullable(),
|
|
42940
|
+
endedAt: number().nullable(),
|
|
42941
|
+
billedSeconds: number(),
|
|
42942
|
+
costUsd: number(),
|
|
42943
|
+
costIsEstimate: boolean(),
|
|
42944
|
+
lastPolledAt: number().nullable()
|
|
42945
|
+
}),
|
|
42946
|
+
progress: object({
|
|
42947
|
+
epoch: number().int().nullable(),
|
|
42948
|
+
epochs: number().int().nullable(),
|
|
42949
|
+
etaSec: number().nullable(),
|
|
42950
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42951
|
+
}),
|
|
42952
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42953
|
+
logTail: array(string()).readonly(),
|
|
42954
|
+
logCursor: string().nullable(),
|
|
42955
|
+
artifacts: object({
|
|
42956
|
+
bundleBytes: number().int(),
|
|
42957
|
+
bundleSha256: string(),
|
|
42958
|
+
fetchedAt: number(),
|
|
42959
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42960
|
+
expiresAt: number()
|
|
42961
|
+
}).nullable(),
|
|
42962
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42963
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42964
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42965
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42966
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42967
|
+
registeredModelIds: array(string()).readonly(),
|
|
42968
|
+
canary: TrainingCanarySchema.nullable()
|
|
42969
|
+
});
|
|
42970
|
+
var IdInput = object({ id: string().min(1) });
|
|
42971
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42972
|
+
kind: "mutation",
|
|
42973
|
+
auth: "admin"
|
|
42974
|
+
}), 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() }), {
|
|
42975
|
+
kind: "mutation",
|
|
42976
|
+
auth: "admin"
|
|
42977
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42978
|
+
auth: "admin",
|
|
42979
|
+
timeoutMs: 6e4
|
|
42980
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42981
|
+
name: string().min(1).max(120),
|
|
42982
|
+
maxCostUsd: number().positive(),
|
|
42983
|
+
maxRuntimeSec: number().int().positive(),
|
|
42984
|
+
idempotencyKey: string().min(8).max(80)
|
|
42985
|
+
}), discriminatedUnion("kind", [object({
|
|
42986
|
+
kind: literal("started"),
|
|
42987
|
+
job: TrainingJobSchema
|
|
42988
|
+
}), object({
|
|
42989
|
+
kind: literal("refused"),
|
|
42990
|
+
reason: TrainingRefusalReasonSchema,
|
|
42991
|
+
detail: string()
|
|
42992
|
+
})]), {
|
|
42993
|
+
kind: "mutation",
|
|
42994
|
+
auth: "admin",
|
|
42995
|
+
timeoutMs: 12e4
|
|
42996
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42997
|
+
kind: "mutation",
|
|
42998
|
+
auth: "admin",
|
|
42999
|
+
timeoutMs: 12e4
|
|
43000
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43001
|
+
kind: "mutation",
|
|
43002
|
+
auth: "admin",
|
|
43003
|
+
timeoutMs: 30 * 6e4
|
|
43004
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43005
|
+
kind: "mutation",
|
|
43006
|
+
auth: "admin",
|
|
43007
|
+
timeoutMs: 12e4
|
|
43008
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43009
|
+
kind: "mutation",
|
|
43010
|
+
auth: "admin",
|
|
43011
|
+
timeoutMs: 12e4
|
|
43012
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43013
|
+
kind: "mutation",
|
|
43014
|
+
auth: "admin"
|
|
43015
|
+
});
|
|
40041
43016
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40042
43017
|
Object.freeze({
|
|
40043
43018
|
person: .5,
|
|
@@ -40524,7 +43499,8 @@ var BaseDevice = class {
|
|
|
40524
43499
|
this.role = options.role;
|
|
40525
43500
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40526
43501
|
const seedData = ctx.persistedConfig ?? {};
|
|
40527
|
-
|
|
43502
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
43503
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40528
43504
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40529
43505
|
tags: {
|
|
40530
43506
|
deviceId: ctx.id,
|
|
@@ -42185,6 +45161,12 @@ Object.freeze({
|
|
|
42185
45161
|
addonId: null,
|
|
42186
45162
|
access: "create"
|
|
42187
45163
|
},
|
|
45164
|
+
"backup.checkBackupKey": {
|
|
45165
|
+
capName: "backup",
|
|
45166
|
+
capScope: "system",
|
|
45167
|
+
addonId: null,
|
|
45168
|
+
access: "create"
|
|
45169
|
+
},
|
|
42188
45170
|
"backup.delete": {
|
|
42189
45171
|
capName: "backup",
|
|
42190
45172
|
capScope: "system",
|
|
@@ -42197,6 +45179,18 @@ Object.freeze({
|
|
|
42197
45179
|
addonId: null,
|
|
42198
45180
|
access: "delete"
|
|
42199
45181
|
},
|
|
45182
|
+
"backup.disableEncryption": {
|
|
45183
|
+
capName: "backup",
|
|
45184
|
+
capScope: "system",
|
|
45185
|
+
addonId: null,
|
|
45186
|
+
access: "create"
|
|
45187
|
+
},
|
|
45188
|
+
"backup.getEncryption": {
|
|
45189
|
+
capName: "backup",
|
|
45190
|
+
capScope: "system",
|
|
45191
|
+
addonId: null,
|
|
45192
|
+
access: "view"
|
|
45193
|
+
},
|
|
42200
45194
|
"backup.getEntries": {
|
|
42201
45195
|
capName: "backup",
|
|
42202
45196
|
capScope: "system",
|
|
@@ -42251,6 +45245,12 @@ Object.freeze({
|
|
|
42251
45245
|
addonId: null,
|
|
42252
45246
|
access: "create"
|
|
42253
45247
|
},
|
|
45248
|
+
"backup.setupEncryption": {
|
|
45249
|
+
capName: "backup",
|
|
45250
|
+
capScope: "system",
|
|
45251
|
+
addonId: null,
|
|
45252
|
+
access: "create"
|
|
45253
|
+
},
|
|
42254
45254
|
"backup.trigger": {
|
|
42255
45255
|
capName: "backup",
|
|
42256
45256
|
capScope: "system",
|
|
@@ -42803,6 +45803,12 @@ Object.freeze({
|
|
|
42803
45803
|
addonId: null,
|
|
42804
45804
|
access: "create"
|
|
42805
45805
|
},
|
|
45806
|
+
"customModelRegistry.importModelBundle": {
|
|
45807
|
+
capName: "custom-model-registry",
|
|
45808
|
+
capScope: "system",
|
|
45809
|
+
addonId: null,
|
|
45810
|
+
access: "create"
|
|
45811
|
+
},
|
|
42806
45812
|
"customModelRegistry.listModels": {
|
|
42807
45813
|
capName: "custom-model-registry",
|
|
42808
45814
|
capScope: "system",
|
|
@@ -44213,6 +47219,108 @@ Object.freeze({
|
|
|
44213
47219
|
addonId: null,
|
|
44214
47220
|
access: "create"
|
|
44215
47221
|
},
|
|
47222
|
+
"keychain.delete": {
|
|
47223
|
+
capName: "keychain",
|
|
47224
|
+
capScope: "system",
|
|
47225
|
+
addonId: null,
|
|
47226
|
+
access: "delete"
|
|
47227
|
+
},
|
|
47228
|
+
"keychain.getState": {
|
|
47229
|
+
capName: "keychain",
|
|
47230
|
+
capScope: "system",
|
|
47231
|
+
addonId: null,
|
|
47232
|
+
access: "view"
|
|
47233
|
+
},
|
|
47234
|
+
"keychain.listMeta": {
|
|
47235
|
+
capName: "keychain",
|
|
47236
|
+
capScope: "system",
|
|
47237
|
+
addonId: null,
|
|
47238
|
+
access: "view"
|
|
47239
|
+
},
|
|
47240
|
+
"keychain.put": {
|
|
47241
|
+
capName: "keychain",
|
|
47242
|
+
capScope: "system",
|
|
47243
|
+
addonId: null,
|
|
47244
|
+
access: "create"
|
|
47245
|
+
},
|
|
47246
|
+
"keychain.resolve": {
|
|
47247
|
+
capName: "keychain",
|
|
47248
|
+
capScope: "system",
|
|
47249
|
+
addonId: null,
|
|
47250
|
+
access: "view"
|
|
47251
|
+
},
|
|
47252
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47253
|
+
capName: "keychain-admin",
|
|
47254
|
+
capScope: "system",
|
|
47255
|
+
addonId: null,
|
|
47256
|
+
access: "create"
|
|
47257
|
+
},
|
|
47258
|
+
"keychainAdmin.deleteOrphans": {
|
|
47259
|
+
capName: "keychain-admin",
|
|
47260
|
+
capScope: "system",
|
|
47261
|
+
addonId: null,
|
|
47262
|
+
access: "delete"
|
|
47263
|
+
},
|
|
47264
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47265
|
+
capName: "keychain-admin",
|
|
47266
|
+
capScope: "system",
|
|
47267
|
+
addonId: null,
|
|
47268
|
+
access: "create"
|
|
47269
|
+
},
|
|
47270
|
+
"keychainAdmin.listAudit": {
|
|
47271
|
+
capName: "keychain-admin",
|
|
47272
|
+
capScope: "system",
|
|
47273
|
+
addonId: null,
|
|
47274
|
+
access: "view"
|
|
47275
|
+
},
|
|
47276
|
+
"keychainAdmin.listSecrets": {
|
|
47277
|
+
capName: "keychain-admin",
|
|
47278
|
+
capScope: "system",
|
|
47279
|
+
addonId: null,
|
|
47280
|
+
access: "view"
|
|
47281
|
+
},
|
|
47282
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47283
|
+
capName: "keychain-admin",
|
|
47284
|
+
capScope: "system",
|
|
47285
|
+
addonId: null,
|
|
47286
|
+
access: "delete"
|
|
47287
|
+
},
|
|
47288
|
+
"keychainAdmin.resetKeychain": {
|
|
47289
|
+
capName: "keychain-admin",
|
|
47290
|
+
capScope: "system",
|
|
47291
|
+
addonId: null,
|
|
47292
|
+
access: "delete"
|
|
47293
|
+
},
|
|
47294
|
+
"keychainAdmin.resetReport": {
|
|
47295
|
+
capName: "keychain-admin",
|
|
47296
|
+
capScope: "system",
|
|
47297
|
+
addonId: null,
|
|
47298
|
+
access: "delete"
|
|
47299
|
+
},
|
|
47300
|
+
"keychainAdmin.reveal": {
|
|
47301
|
+
capName: "keychain-admin",
|
|
47302
|
+
capScope: "system",
|
|
47303
|
+
addonId: null,
|
|
47304
|
+
access: "create"
|
|
47305
|
+
},
|
|
47306
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47307
|
+
capName: "keychain-admin",
|
|
47308
|
+
capScope: "system",
|
|
47309
|
+
addonId: null,
|
|
47310
|
+
access: "create"
|
|
47311
|
+
},
|
|
47312
|
+
"keychainAdmin.setSystemSecret": {
|
|
47313
|
+
capName: "keychain-admin",
|
|
47314
|
+
capScope: "system",
|
|
47315
|
+
addonId: null,
|
|
47316
|
+
access: "create"
|
|
47317
|
+
},
|
|
47318
|
+
"keychainAdmin.status": {
|
|
47319
|
+
capName: "keychain-admin",
|
|
47320
|
+
capScope: "system",
|
|
47321
|
+
addonId: null,
|
|
47322
|
+
access: "view"
|
|
47323
|
+
},
|
|
44216
47324
|
"lawnMowerControl.dock": {
|
|
44217
47325
|
capName: "lawn-mower-control",
|
|
44218
47326
|
capScope: "device",
|
|
@@ -45587,6 +48695,18 @@ Object.freeze({
|
|
|
45587
48695
|
addonId: null,
|
|
45588
48696
|
access: "create"
|
|
45589
48697
|
},
|
|
48698
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48699
|
+
capName: "pipeline-analytics",
|
|
48700
|
+
capScope: "device",
|
|
48701
|
+
addonId: null,
|
|
48702
|
+
access: "create"
|
|
48703
|
+
},
|
|
48704
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48705
|
+
capName: "pipeline-analytics",
|
|
48706
|
+
capScope: "device",
|
|
48707
|
+
addonId: null,
|
|
48708
|
+
access: "create"
|
|
48709
|
+
},
|
|
45590
48710
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45591
48711
|
capName: "pipeline-analytics",
|
|
45592
48712
|
capScope: "device",
|
|
@@ -45635,12 +48755,36 @@ Object.freeze({
|
|
|
45635
48755
|
addonId: null,
|
|
45636
48756
|
access: "view"
|
|
45637
48757
|
},
|
|
48758
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48759
|
+
capName: "pipeline-analytics",
|
|
48760
|
+
capScope: "device",
|
|
48761
|
+
addonId: null,
|
|
48762
|
+
access: "create"
|
|
48763
|
+
},
|
|
48764
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48765
|
+
capName: "pipeline-analytics",
|
|
48766
|
+
capScope: "device",
|
|
48767
|
+
addonId: null,
|
|
48768
|
+
access: "create"
|
|
48769
|
+
},
|
|
45638
48770
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45639
48771
|
capName: "pipeline-analytics",
|
|
45640
48772
|
capScope: "device",
|
|
45641
48773
|
addonId: null,
|
|
45642
48774
|
access: "delete"
|
|
45643
48775
|
},
|
|
48776
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48777
|
+
capName: "pipeline-analytics",
|
|
48778
|
+
capScope: "device",
|
|
48779
|
+
addonId: null,
|
|
48780
|
+
access: "delete"
|
|
48781
|
+
},
|
|
48782
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48783
|
+
capName: "pipeline-analytics",
|
|
48784
|
+
capScope: "device",
|
|
48785
|
+
addonId: null,
|
|
48786
|
+
access: "delete"
|
|
48787
|
+
},
|
|
45644
48788
|
"pipelineAnalytics.deleteTracks": {
|
|
45645
48789
|
capName: "pipeline-analytics",
|
|
45646
48790
|
capScope: "device",
|
|
@@ -45845,6 +48989,30 @@ Object.freeze({
|
|
|
45845
48989
|
addonId: null,
|
|
45846
48990
|
access: "view"
|
|
45847
48991
|
},
|
|
48992
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48993
|
+
capName: "pipeline-analytics",
|
|
48994
|
+
capScope: "device",
|
|
48995
|
+
addonId: null,
|
|
48996
|
+
access: "view"
|
|
48997
|
+
},
|
|
48998
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48999
|
+
capName: "pipeline-analytics",
|
|
49000
|
+
capScope: "device",
|
|
49001
|
+
addonId: null,
|
|
49002
|
+
access: "view"
|
|
49003
|
+
},
|
|
49004
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49005
|
+
capName: "pipeline-analytics",
|
|
49006
|
+
capScope: "device",
|
|
49007
|
+
addonId: null,
|
|
49008
|
+
access: "view"
|
|
49009
|
+
},
|
|
49010
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49011
|
+
capName: "pipeline-analytics",
|
|
49012
|
+
capScope: "device",
|
|
49013
|
+
addonId: null,
|
|
49014
|
+
access: "view"
|
|
49015
|
+
},
|
|
45848
49016
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45849
49017
|
capName: "pipeline-analytics",
|
|
45850
49018
|
capScope: "device",
|
|
@@ -45875,6 +49043,12 @@ Object.freeze({
|
|
|
45875
49043
|
addonId: null,
|
|
45876
49044
|
access: "view"
|
|
45877
49045
|
},
|
|
49046
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49047
|
+
capName: "pipeline-analytics",
|
|
49048
|
+
capScope: "device",
|
|
49049
|
+
addonId: null,
|
|
49050
|
+
access: "create"
|
|
49051
|
+
},
|
|
45878
49052
|
"pipelineAnalytics.ownersWithMedia": {
|
|
45879
49053
|
capName: "pipeline-analytics",
|
|
45880
49054
|
capScope: "device",
|
|
@@ -45887,12 +49061,24 @@ Object.freeze({
|
|
|
45887
49061
|
addonId: null,
|
|
45888
49062
|
access: "create"
|
|
45889
49063
|
},
|
|
49064
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49065
|
+
capName: "pipeline-analytics",
|
|
49066
|
+
capScope: "device",
|
|
49067
|
+
addonId: null,
|
|
49068
|
+
access: "view"
|
|
49069
|
+
},
|
|
45890
49070
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
45891
49071
|
capName: "pipeline-analytics",
|
|
45892
49072
|
capScope: "device",
|
|
45893
49073
|
addonId: null,
|
|
45894
49074
|
access: "create"
|
|
45895
49075
|
},
|
|
49076
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49077
|
+
capName: "pipeline-analytics",
|
|
49078
|
+
capScope: "device",
|
|
49079
|
+
addonId: null,
|
|
49080
|
+
access: "create"
|
|
49081
|
+
},
|
|
45896
49082
|
"pipelineAnalytics.pruneEvents": {
|
|
45897
49083
|
capName: "pipeline-analytics",
|
|
45898
49084
|
capScope: "device",
|
|
@@ -45947,6 +49133,18 @@ Object.freeze({
|
|
|
45947
49133
|
addonId: null,
|
|
45948
49134
|
access: "create"
|
|
45949
49135
|
},
|
|
49136
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49137
|
+
capName: "pipeline-analytics",
|
|
49138
|
+
capScope: "device",
|
|
49139
|
+
addonId: null,
|
|
49140
|
+
access: "delete"
|
|
49141
|
+
},
|
|
49142
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49143
|
+
capName: "pipeline-analytics",
|
|
49144
|
+
capScope: "device",
|
|
49145
|
+
addonId: null,
|
|
49146
|
+
access: "create"
|
|
49147
|
+
},
|
|
45950
49148
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45951
49149
|
capName: "pipeline-analytics",
|
|
45952
49150
|
capScope: "device",
|
|
@@ -46007,6 +49205,12 @@ Object.freeze({
|
|
|
46007
49205
|
addonId: null,
|
|
46008
49206
|
access: "create"
|
|
46009
49207
|
},
|
|
49208
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49209
|
+
capName: "pipeline-analytics",
|
|
49210
|
+
capScope: "device",
|
|
49211
|
+
addonId: null,
|
|
49212
|
+
access: "view"
|
|
49213
|
+
},
|
|
46010
49214
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46011
49215
|
capName: "pipeline-analytics",
|
|
46012
49216
|
capScope: "device",
|
|
@@ -46235,6 +49439,12 @@ Object.freeze({
|
|
|
46235
49439
|
addonId: null,
|
|
46236
49440
|
access: "view"
|
|
46237
49441
|
},
|
|
49442
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
49443
|
+
capName: "pipeline-orchestrator",
|
|
49444
|
+
capScope: "system",
|
|
49445
|
+
addonId: null,
|
|
49446
|
+
access: "create"
|
|
49447
|
+
},
|
|
46238
49448
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46239
49449
|
capName: "pipeline-orchestrator",
|
|
46240
49450
|
capScope: "system",
|
|
@@ -46259,6 +49469,12 @@ Object.freeze({
|
|
|
46259
49469
|
addonId: null,
|
|
46260
49470
|
access: "create"
|
|
46261
49471
|
},
|
|
49472
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
49473
|
+
capName: "pipeline-orchestrator",
|
|
49474
|
+
capScope: "system",
|
|
49475
|
+
addonId: null,
|
|
49476
|
+
access: "delete"
|
|
49477
|
+
},
|
|
46262
49478
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46263
49479
|
capName: "pipeline-orchestrator",
|
|
46264
49480
|
capScope: "system",
|
|
@@ -46367,6 +49583,24 @@ Object.freeze({
|
|
|
46367
49583
|
addonId: null,
|
|
46368
49584
|
access: "view"
|
|
46369
49585
|
},
|
|
49586
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
49587
|
+
capName: "pipeline-orchestrator",
|
|
49588
|
+
capScope: "system",
|
|
49589
|
+
addonId: null,
|
|
49590
|
+
access: "view"
|
|
49591
|
+
},
|
|
49592
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
49593
|
+
capName: "pipeline-orchestrator",
|
|
49594
|
+
capScope: "system",
|
|
49595
|
+
addonId: null,
|
|
49596
|
+
access: "view"
|
|
49597
|
+
},
|
|
49598
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
49599
|
+
capName: "pipeline-orchestrator",
|
|
49600
|
+
capScope: "system",
|
|
49601
|
+
addonId: null,
|
|
49602
|
+
access: "view"
|
|
49603
|
+
},
|
|
46370
49604
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46371
49605
|
capName: "pipeline-orchestrator",
|
|
46372
49606
|
capScope: "system",
|
|
@@ -46409,6 +49643,12 @@ Object.freeze({
|
|
|
46409
49643
|
addonId: null,
|
|
46410
49644
|
access: "view"
|
|
46411
49645
|
},
|
|
49646
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49647
|
+
capName: "pipeline-orchestrator",
|
|
49648
|
+
capScope: "system",
|
|
49649
|
+
addonId: null,
|
|
49650
|
+
access: "view"
|
|
49651
|
+
},
|
|
46412
49652
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46413
49653
|
capName: "pipeline-orchestrator",
|
|
46414
49654
|
capScope: "system",
|
|
@@ -46553,6 +49793,12 @@ Object.freeze({
|
|
|
46553
49793
|
addonId: null,
|
|
46554
49794
|
access: "create"
|
|
46555
49795
|
},
|
|
49796
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49797
|
+
capName: "pipeline-orchestrator",
|
|
49798
|
+
capScope: "system",
|
|
49799
|
+
addonId: null,
|
|
49800
|
+
access: "create"
|
|
49801
|
+
},
|
|
46556
49802
|
"pipelineOrchestrator.suggestShares": {
|
|
46557
49803
|
capName: "pipeline-orchestrator",
|
|
46558
49804
|
capScope: "system",
|
|
@@ -46571,6 +49817,12 @@ Object.freeze({
|
|
|
46571
49817
|
addonId: null,
|
|
46572
49818
|
access: "create"
|
|
46573
49819
|
},
|
|
49820
|
+
"pipelineRunner.abortNodeBench": {
|
|
49821
|
+
capName: "pipeline-runner",
|
|
49822
|
+
capScope: "system",
|
|
49823
|
+
addonId: null,
|
|
49824
|
+
access: "create"
|
|
49825
|
+
},
|
|
46574
49826
|
"pipelineRunner.attachCamera": {
|
|
46575
49827
|
capName: "pipeline-runner",
|
|
46576
49828
|
capScope: "system",
|
|
@@ -46619,6 +49871,12 @@ Object.freeze({
|
|
|
46619
49871
|
addonId: null,
|
|
46620
49872
|
access: "view"
|
|
46621
49873
|
},
|
|
49874
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49875
|
+
capName: "pipeline-runner",
|
|
49876
|
+
capScope: "system",
|
|
49877
|
+
addonId: null,
|
|
49878
|
+
access: "view"
|
|
49879
|
+
},
|
|
46622
49880
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46623
49881
|
capName: "pipeline-runner",
|
|
46624
49882
|
capScope: "system",
|
|
@@ -46661,6 +49919,12 @@ Object.freeze({
|
|
|
46661
49919
|
addonId: null,
|
|
46662
49920
|
access: "create"
|
|
46663
49921
|
},
|
|
49922
|
+
"pipelineRunner.startNodeBench": {
|
|
49923
|
+
capName: "pipeline-runner",
|
|
49924
|
+
capScope: "system",
|
|
49925
|
+
addonId: null,
|
|
49926
|
+
access: "create"
|
|
49927
|
+
},
|
|
46664
49928
|
"plateGallery.assignPlate": {
|
|
46665
49929
|
capName: "plate-gallery",
|
|
46666
49930
|
capScope: "system",
|
|
@@ -48323,6 +51587,174 @@ Object.freeze({
|
|
|
48323
51587
|
addonId: null,
|
|
48324
51588
|
access: "view"
|
|
48325
51589
|
},
|
|
51590
|
+
"training.canaryResult": {
|
|
51591
|
+
capName: "training",
|
|
51592
|
+
capScope: "system",
|
|
51593
|
+
addonId: null,
|
|
51594
|
+
access: "create"
|
|
51595
|
+
},
|
|
51596
|
+
"training.cancelJob": {
|
|
51597
|
+
capName: "training",
|
|
51598
|
+
capScope: "system",
|
|
51599
|
+
addonId: null,
|
|
51600
|
+
access: "create"
|
|
51601
|
+
},
|
|
51602
|
+
"training.discardResult": {
|
|
51603
|
+
capName: "training",
|
|
51604
|
+
capScope: "system",
|
|
51605
|
+
addonId: null,
|
|
51606
|
+
access: "create"
|
|
51607
|
+
},
|
|
51608
|
+
"training.findDatasetVersionIdByName": {
|
|
51609
|
+
capName: "training",
|
|
51610
|
+
capScope: "system",
|
|
51611
|
+
addonId: null,
|
|
51612
|
+
access: "view"
|
|
51613
|
+
},
|
|
51614
|
+
"training.getDatasetVersion": {
|
|
51615
|
+
capName: "training",
|
|
51616
|
+
capScope: "system",
|
|
51617
|
+
addonId: null,
|
|
51618
|
+
access: "view"
|
|
51619
|
+
},
|
|
51620
|
+
"training.getJob": {
|
|
51621
|
+
capName: "training",
|
|
51622
|
+
capScope: "system",
|
|
51623
|
+
addonId: null,
|
|
51624
|
+
access: "view"
|
|
51625
|
+
},
|
|
51626
|
+
"training.getJobResult": {
|
|
51627
|
+
capName: "training",
|
|
51628
|
+
capScope: "system",
|
|
51629
|
+
addonId: null,
|
|
51630
|
+
access: "view"
|
|
51631
|
+
},
|
|
51632
|
+
"training.listBaseModels": {
|
|
51633
|
+
capName: "training",
|
|
51634
|
+
capScope: "system",
|
|
51635
|
+
addonId: null,
|
|
51636
|
+
access: "view"
|
|
51637
|
+
},
|
|
51638
|
+
"training.listDatasetVersions": {
|
|
51639
|
+
capName: "training",
|
|
51640
|
+
capScope: "system",
|
|
51641
|
+
addonId: null,
|
|
51642
|
+
access: "view"
|
|
51643
|
+
},
|
|
51644
|
+
"training.listJobs": {
|
|
51645
|
+
capName: "training",
|
|
51646
|
+
capScope: "system",
|
|
51647
|
+
addonId: null,
|
|
51648
|
+
access: "view"
|
|
51649
|
+
},
|
|
51650
|
+
"training.planJob": {
|
|
51651
|
+
capName: "training",
|
|
51652
|
+
capScope: "system",
|
|
51653
|
+
addonId: null,
|
|
51654
|
+
access: "view"
|
|
51655
|
+
},
|
|
51656
|
+
"training.putDatasetVersion": {
|
|
51657
|
+
capName: "training",
|
|
51658
|
+
capScope: "system",
|
|
51659
|
+
addonId: null,
|
|
51660
|
+
access: "create"
|
|
51661
|
+
},
|
|
51662
|
+
"training.registerResult": {
|
|
51663
|
+
capName: "training",
|
|
51664
|
+
capScope: "system",
|
|
51665
|
+
addonId: null,
|
|
51666
|
+
access: "create"
|
|
51667
|
+
},
|
|
51668
|
+
"training.removeDatasetVersion": {
|
|
51669
|
+
capName: "training",
|
|
51670
|
+
capScope: "system",
|
|
51671
|
+
addonId: null,
|
|
51672
|
+
access: "delete"
|
|
51673
|
+
},
|
|
51674
|
+
"training.rollbackCanary": {
|
|
51675
|
+
capName: "training",
|
|
51676
|
+
capScope: "system",
|
|
51677
|
+
addonId: null,
|
|
51678
|
+
access: "create"
|
|
51679
|
+
},
|
|
51680
|
+
"training.startJob": {
|
|
51681
|
+
capName: "training",
|
|
51682
|
+
capScope: "system",
|
|
51683
|
+
addonId: null,
|
|
51684
|
+
access: "create"
|
|
51685
|
+
},
|
|
51686
|
+
"trainingProvider.cancelJob": {
|
|
51687
|
+
capName: "training-provider",
|
|
51688
|
+
capScope: "system",
|
|
51689
|
+
addonId: null,
|
|
51690
|
+
access: "create"
|
|
51691
|
+
},
|
|
51692
|
+
"trainingProvider.cleanupJob": {
|
|
51693
|
+
capName: "training-provider",
|
|
51694
|
+
capScope: "system",
|
|
51695
|
+
addonId: null,
|
|
51696
|
+
access: "create"
|
|
51697
|
+
},
|
|
51698
|
+
"trainingProvider.describe": {
|
|
51699
|
+
capName: "training-provider",
|
|
51700
|
+
capScope: "system",
|
|
51701
|
+
addonId: null,
|
|
51702
|
+
access: "view"
|
|
51703
|
+
},
|
|
51704
|
+
"trainingProvider.estimateJob": {
|
|
51705
|
+
capName: "training-provider",
|
|
51706
|
+
capScope: "system",
|
|
51707
|
+
addonId: null,
|
|
51708
|
+
access: "view"
|
|
51709
|
+
},
|
|
51710
|
+
"trainingProvider.getJob": {
|
|
51711
|
+
capName: "training-provider",
|
|
51712
|
+
capScope: "system",
|
|
51713
|
+
addonId: null,
|
|
51714
|
+
access: "view"
|
|
51715
|
+
},
|
|
51716
|
+
"trainingProvider.listJobEvents": {
|
|
51717
|
+
capName: "training-provider",
|
|
51718
|
+
capScope: "system",
|
|
51719
|
+
addonId: null,
|
|
51720
|
+
access: "view"
|
|
51721
|
+
},
|
|
51722
|
+
"trainingProvider.listJobs": {
|
|
51723
|
+
capName: "training-provider",
|
|
51724
|
+
capScope: "system",
|
|
51725
|
+
addonId: null,
|
|
51726
|
+
access: "view"
|
|
51727
|
+
},
|
|
51728
|
+
"trainingProvider.offerArtifact": {
|
|
51729
|
+
capName: "training-provider",
|
|
51730
|
+
capScope: "system",
|
|
51731
|
+
addonId: null,
|
|
51732
|
+
access: "create"
|
|
51733
|
+
},
|
|
51734
|
+
"trainingProvider.readResult": {
|
|
51735
|
+
capName: "training-provider",
|
|
51736
|
+
capScope: "system",
|
|
51737
|
+
addonId: null,
|
|
51738
|
+
access: "create"
|
|
51739
|
+
},
|
|
51740
|
+
"trainingProvider.submitJob": {
|
|
51741
|
+
capName: "training-provider",
|
|
51742
|
+
capScope: "system",
|
|
51743
|
+
addonId: null,
|
|
51744
|
+
access: "create"
|
|
51745
|
+
},
|
|
51746
|
+
"trainingProvider.uploadDataset": {
|
|
51747
|
+
capName: "training-provider",
|
|
51748
|
+
capScope: "system",
|
|
51749
|
+
addonId: null,
|
|
51750
|
+
access: "create"
|
|
51751
|
+
},
|
|
51752
|
+
"trainingProvider.validateCredentials": {
|
|
51753
|
+
capName: "training-provider",
|
|
51754
|
+
capScope: "system",
|
|
51755
|
+
addonId: null,
|
|
51756
|
+
access: "create"
|
|
51757
|
+
},
|
|
48326
51758
|
"turnProvider.getTurnServers": {
|
|
48327
51759
|
capName: "turn-provider",
|
|
48328
51760
|
capScope: "system",
|
|
@@ -48347,12 +51779,6 @@ Object.freeze({
|
|
|
48347
51779
|
addonId: null,
|
|
48348
51780
|
access: "create"
|
|
48349
51781
|
},
|
|
48350
|
-
"userManagement.createApiKey": {
|
|
48351
|
-
capName: "user-management",
|
|
48352
|
-
capScope: "system",
|
|
48353
|
-
addonId: null,
|
|
48354
|
-
access: "create"
|
|
48355
|
-
},
|
|
48356
51782
|
"userManagement.createScopedToken": {
|
|
48357
51783
|
capName: "user-management",
|
|
48358
51784
|
capScope: "system",
|
|
@@ -48389,12 +51815,6 @@ Object.freeze({
|
|
|
48389
51815
|
addonId: null,
|
|
48390
51816
|
access: "view"
|
|
48391
51817
|
},
|
|
48392
|
-
"userManagement.linkExternalIdentity": {
|
|
48393
|
-
capName: "user-management",
|
|
48394
|
-
capScope: "system",
|
|
48395
|
-
addonId: null,
|
|
48396
|
-
access: "create"
|
|
48397
|
-
},
|
|
48398
51818
|
"userManagement.listApiKeys": {
|
|
48399
51819
|
capName: "user-management",
|
|
48400
51820
|
capScope: "system",
|
|
@@ -48497,12 +51917,6 @@ Object.freeze({
|
|
|
48497
51917
|
addonId: null,
|
|
48498
51918
|
access: "create"
|
|
48499
51919
|
},
|
|
48500
|
-
"userManagement.validateApiKey": {
|
|
48501
|
-
capName: "user-management",
|
|
48502
|
-
capScope: "system",
|
|
48503
|
-
addonId: null,
|
|
48504
|
-
access: "view"
|
|
48505
|
-
},
|
|
48506
51920
|
"userManagement.validateCredentials": {
|
|
48507
51921
|
capName: "user-management",
|
|
48508
51922
|
capScope: "system",
|
|
@@ -51590,6 +55004,11 @@ Object.freeze({
|
|
|
51590
55004
|
form: "single",
|
|
51591
55005
|
optional: false
|
|
51592
55006
|
}],
|
|
55007
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
55008
|
+
name: "deviceId",
|
|
55009
|
+
form: "single",
|
|
55010
|
+
optional: false
|
|
55011
|
+
}],
|
|
51593
55012
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51594
55013
|
name: "deviceId",
|
|
51595
55014
|
form: "single",
|
|
@@ -51780,6 +55199,11 @@ Object.freeze({
|
|
|
51780
55199
|
form: "single",
|
|
51781
55200
|
optional: false
|
|
51782
55201
|
}],
|
|
55202
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55203
|
+
name: "deviceId",
|
|
55204
|
+
form: "single",
|
|
55205
|
+
optional: false
|
|
55206
|
+
}],
|
|
51783
55207
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51784
55208
|
name: "deviceId",
|
|
51785
55209
|
form: "single",
|
|
@@ -52606,6 +56030,11 @@ Object.freeze({
|
|
|
52606
56030
|
form: "single",
|
|
52607
56031
|
optional: false
|
|
52608
56032
|
}],
|
|
56033
|
+
"training.canaryResult": [{
|
|
56034
|
+
name: "deviceIds",
|
|
56035
|
+
form: "array",
|
|
56036
|
+
optional: false
|
|
56037
|
+
}],
|
|
52609
56038
|
"update.getStatus": [{
|
|
52610
56039
|
name: "deviceId",
|
|
52611
56040
|
form: "single",
|