@camstack/addon-provider-amcrest 0.2.132 → 0.2.134
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.js
CHANGED
|
@@ -34,7 +34,7 @@ let node_stream = require("node:stream");
|
|
|
34
34
|
let node_stream_promises = require("node:stream/promises");
|
|
35
35
|
let node_child_process = require("node:child_process");
|
|
36
36
|
let node_os = require("node:os");
|
|
37
|
-
//#region ../types/dist/event-category-
|
|
37
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
38
38
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
39
39
|
EventCategory["SystemBoot"] = "system.boot";
|
|
40
40
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -113,6 +113,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
113
113
|
*/
|
|
114
114
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
115
115
|
/**
|
|
116
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
117
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
118
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
119
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
120
|
+
*/
|
|
121
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
122
|
+
/**
|
|
116
123
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
117
124
|
* transitions from `failed` back to `healthy` (typically via the
|
|
118
125
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5405,7 +5412,7 @@ var ZodIssueCode = {
|
|
|
5405
5412
|
var ZodFirstPartyTypeKind;
|
|
5406
5413
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5407
5414
|
//#endregion
|
|
5408
|
-
//#region ../types/dist/sleep-
|
|
5415
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5409
5416
|
/**
|
|
5410
5417
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5411
5418
|
* window to float samples (D455).
|
|
@@ -5484,6 +5491,97 @@ function buildAlawTable() {
|
|
|
5484
5491
|
}
|
|
5485
5492
|
buildUlawTable();
|
|
5486
5493
|
buildAlawTable();
|
|
5494
|
+
/** Is this field's stored value a credential? */
|
|
5495
|
+
function isSecretConfigField(field) {
|
|
5496
|
+
if (field.type === "password") return true;
|
|
5497
|
+
return "secret" in field && field.secret === true;
|
|
5498
|
+
}
|
|
5499
|
+
/**
|
|
5500
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5501
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5502
|
+
*/
|
|
5503
|
+
function isKeychainStoredField(field) {
|
|
5504
|
+
if (!isSecretConfigField(field)) return false;
|
|
5505
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5506
|
+
return !("storage" in field && field.storage === "inline");
|
|
5507
|
+
}
|
|
5508
|
+
/**
|
|
5509
|
+
* What a settings blob holds where a secret used to be.
|
|
5510
|
+
*
|
|
5511
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5512
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5513
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5514
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5515
|
+
*
|
|
5516
|
+
* The same shapes travel to and from the admin UI:
|
|
5517
|
+
*
|
|
5518
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5519
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5520
|
+
* value is set, never the value.
|
|
5521
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5522
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5523
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5524
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5525
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5526
|
+
*
|
|
5527
|
+
* Pure and browser-safe.
|
|
5528
|
+
*/
|
|
5529
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5530
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5531
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5532
|
+
function isRecord$2(value) {
|
|
5533
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5534
|
+
}
|
|
5535
|
+
function makeSecretMarker(ref) {
|
|
5536
|
+
return {
|
|
5537
|
+
$secret: ref,
|
|
5538
|
+
v: 1
|
|
5539
|
+
};
|
|
5540
|
+
}
|
|
5541
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5542
|
+
function isSecretMarker(value) {
|
|
5543
|
+
if (!isRecord$2(value)) return false;
|
|
5544
|
+
const ref = value["$secret"];
|
|
5545
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5546
|
+
}
|
|
5547
|
+
function isSecretClear(value) {
|
|
5548
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5549
|
+
}
|
|
5550
|
+
/**
|
|
5551
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5552
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5553
|
+
* survives this function.
|
|
5554
|
+
*/
|
|
5555
|
+
function toSecretFieldView(stored) {
|
|
5556
|
+
if (isSecretMarker(stored)) return {
|
|
5557
|
+
$secret: stored.$secret,
|
|
5558
|
+
v: 1,
|
|
5559
|
+
set: true
|
|
5560
|
+
};
|
|
5561
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5562
|
+
$secret: null,
|
|
5563
|
+
v: 1,
|
|
5564
|
+
set: true,
|
|
5565
|
+
inline: true
|
|
5566
|
+
};
|
|
5567
|
+
return null;
|
|
5568
|
+
}
|
|
5569
|
+
/**
|
|
5570
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5571
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5572
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5573
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5574
|
+
*/
|
|
5575
|
+
function classifySecretWrite(incoming) {
|
|
5576
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5577
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5578
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5579
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5580
|
+
return {
|
|
5581
|
+
kind: "set",
|
|
5582
|
+
value: incoming
|
|
5583
|
+
};
|
|
5584
|
+
}
|
|
5487
5585
|
Object.fromEntries([
|
|
5488
5586
|
{
|
|
5489
5587
|
id: "overview",
|
|
@@ -5655,33 +5753,19 @@ Object.fromEntries([
|
|
|
5655
5753
|
function isValuelessField(field) {
|
|
5656
5754
|
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";
|
|
5657
5755
|
}
|
|
5658
|
-
|
|
5659
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5660
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5661
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5662
|
-
*
|
|
5663
|
-
* For each leaf field:
|
|
5664
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5665
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5666
|
-
*
|
|
5667
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5668
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5669
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5670
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5671
|
-
*/
|
|
5672
|
-
function hydrateSchema(schema, values) {
|
|
5756
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5673
5757
|
return {
|
|
5674
5758
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5675
5759
|
sections: schema.sections.map((section) => ({
|
|
5676
5760
|
...section,
|
|
5677
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5761
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5678
5762
|
}))
|
|
5679
5763
|
};
|
|
5680
5764
|
}
|
|
5681
|
-
function hydrateField(field, values) {
|
|
5765
|
+
function hydrateField(field, values, options) {
|
|
5682
5766
|
if (isValuelessField(field)) return field;
|
|
5683
5767
|
if (field.type === "group") {
|
|
5684
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5768
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5685
5769
|
return {
|
|
5686
5770
|
...field,
|
|
5687
5771
|
fields: hydratedChildren
|
|
@@ -5690,7 +5774,7 @@ function hydrateField(field, values) {
|
|
|
5690
5774
|
if (field.type === "sub-tabs") {
|
|
5691
5775
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5692
5776
|
...tab,
|
|
5693
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5777
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5694
5778
|
}));
|
|
5695
5779
|
return {
|
|
5696
5780
|
...field,
|
|
@@ -5700,6 +5784,33 @@ function hydrateField(field, values) {
|
|
|
5700
5784
|
const key = field.key;
|
|
5701
5785
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5702
5786
|
const defaultValue = field.default;
|
|
5787
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5788
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5789
|
+
...field,
|
|
5790
|
+
value: toSecretFieldView(storedValue)
|
|
5791
|
+
};
|
|
5792
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5793
|
+
...field,
|
|
5794
|
+
value: null
|
|
5795
|
+
};
|
|
5796
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5797
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5798
|
+
if (secretItemKeys.length > 0) {
|
|
5799
|
+
const rows = storedValue.map((row) => {
|
|
5800
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5801
|
+
const out = { ...row };
|
|
5802
|
+
for (const k of secretItemKeys) {
|
|
5803
|
+
const v = Reflect.get(row, k);
|
|
5804
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5805
|
+
}
|
|
5806
|
+
return out;
|
|
5807
|
+
});
|
|
5808
|
+
return {
|
|
5809
|
+
...field,
|
|
5810
|
+
value: rows
|
|
5811
|
+
};
|
|
5812
|
+
}
|
|
5813
|
+
}
|
|
5703
5814
|
if (field.multiple) {
|
|
5704
5815
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5705
5816
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5942,6 +6053,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5942
6053
|
}
|
|
5943
6054
|
return out;
|
|
5944
6055
|
}
|
|
6056
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6057
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6058
|
+
function globalSecretScope() {
|
|
6059
|
+
return GLOBAL_SCOPE;
|
|
6060
|
+
}
|
|
6061
|
+
function encodeSegment(value) {
|
|
6062
|
+
return encodeURIComponent(value);
|
|
6063
|
+
}
|
|
6064
|
+
function decodeSegment(value) {
|
|
6065
|
+
try {
|
|
6066
|
+
return decodeURIComponent(value);
|
|
6067
|
+
} catch {
|
|
6068
|
+
return null;
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
6071
|
+
/**
|
|
6072
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6073
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6074
|
+
* `providers[authentik].clientSecret`.
|
|
6075
|
+
*/
|
|
6076
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6077
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6078
|
+
}
|
|
6079
|
+
function parseScope(segments) {
|
|
6080
|
+
switch (segments[0]) {
|
|
6081
|
+
case "global": return {
|
|
6082
|
+
scope: GLOBAL_SCOPE,
|
|
6083
|
+
used: 1
|
|
6084
|
+
};
|
|
6085
|
+
case "node": {
|
|
6086
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6087
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6088
|
+
scope: {
|
|
6089
|
+
kind: "node",
|
|
6090
|
+
nodeId
|
|
6091
|
+
},
|
|
6092
|
+
used: 2
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
case "device": {
|
|
6096
|
+
const raw = segments[1];
|
|
6097
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6098
|
+
return {
|
|
6099
|
+
scope: {
|
|
6100
|
+
kind: "device",
|
|
6101
|
+
deviceId: Number(raw)
|
|
6102
|
+
},
|
|
6103
|
+
used: 2
|
|
6104
|
+
};
|
|
6105
|
+
}
|
|
6106
|
+
case "integration": {
|
|
6107
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6108
|
+
return id === null || id.length === 0 ? null : {
|
|
6109
|
+
scope: {
|
|
6110
|
+
kind: "integration",
|
|
6111
|
+
integrationId: id
|
|
6112
|
+
},
|
|
6113
|
+
used: 2
|
|
6114
|
+
};
|
|
6115
|
+
}
|
|
6116
|
+
case "row": {
|
|
6117
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6118
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6119
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6120
|
+
return {
|
|
6121
|
+
scope: {
|
|
6122
|
+
kind: "row",
|
|
6123
|
+
collection,
|
|
6124
|
+
rowId
|
|
6125
|
+
},
|
|
6126
|
+
used: 3
|
|
6127
|
+
};
|
|
6128
|
+
}
|
|
6129
|
+
default: return null;
|
|
6130
|
+
}
|
|
6131
|
+
}
|
|
6132
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6133
|
+
function parseSecretRef(ref) {
|
|
6134
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6135
|
+
const segments = ref.slice(9).split("/");
|
|
6136
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6137
|
+
if (owner === null || owner.length === 0) return null;
|
|
6138
|
+
const parsed = parseScope(segments.slice(1));
|
|
6139
|
+
if (parsed === null) return null;
|
|
6140
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6141
|
+
if (fieldPath.length === 0) return null;
|
|
6142
|
+
return {
|
|
6143
|
+
owner,
|
|
6144
|
+
scope: parsed.scope,
|
|
6145
|
+
fieldPath
|
|
6146
|
+
};
|
|
6147
|
+
}
|
|
6148
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6149
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6150
|
+
fieldPath;
|
|
6151
|
+
constructor(fieldPath, cause) {
|
|
6152
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6153
|
+
this.fieldPath = fieldPath;
|
|
6154
|
+
this.name = "KeychainWriteRefusedError";
|
|
6155
|
+
}
|
|
6156
|
+
};
|
|
6157
|
+
var KEEP = { kind: "keep" };
|
|
6158
|
+
function isRecord$1$1(value) {
|
|
6159
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6160
|
+
}
|
|
6161
|
+
function defaultMintId() {
|
|
6162
|
+
return globalThis.crypto.randomUUID();
|
|
6163
|
+
}
|
|
6164
|
+
/** Every marker ref anywhere under `value`. */
|
|
6165
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6166
|
+
if (isSecretMarker(value)) {
|
|
6167
|
+
out.push(value.$secret);
|
|
6168
|
+
return out;
|
|
6169
|
+
}
|
|
6170
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6171
|
+
else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6172
|
+
return out;
|
|
6173
|
+
}
|
|
6174
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6175
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6176
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6177
|
+
}
|
|
6178
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6179
|
+
const intent = classifySecretWrite(incoming);
|
|
6180
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6181
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6182
|
+
if (intent.kind === "keep") return KEEP;
|
|
6183
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6184
|
+
if (intent.kind === "clear") {
|
|
6185
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6186
|
+
return {
|
|
6187
|
+
kind: "value",
|
|
6188
|
+
value: null
|
|
6189
|
+
};
|
|
6190
|
+
}
|
|
6191
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6192
|
+
kind: "value",
|
|
6193
|
+
value: stored
|
|
6194
|
+
};
|
|
6195
|
+
try {
|
|
6196
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6197
|
+
} catch (err) {
|
|
6198
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6199
|
+
}
|
|
6200
|
+
return {
|
|
6201
|
+
kind: "value",
|
|
6202
|
+
value: makeSecretMarker(ref)
|
|
6203
|
+
};
|
|
6204
|
+
}
|
|
6205
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6206
|
+
function applyMember(out, key, result, storedParent) {
|
|
6207
|
+
if (result.kind === "value") {
|
|
6208
|
+
out[key] = result.value;
|
|
6209
|
+
return;
|
|
6210
|
+
}
|
|
6211
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6212
|
+
else delete out[key];
|
|
6213
|
+
}
|
|
6214
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6215
|
+
const out = { ...incoming };
|
|
6216
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6217
|
+
return out;
|
|
6218
|
+
}
|
|
6219
|
+
function rowId(row, idKey) {
|
|
6220
|
+
const raw = row[idKey];
|
|
6221
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6222
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6223
|
+
return null;
|
|
6224
|
+
}
|
|
6225
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6226
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
|
|
6227
|
+
if (!Array.isArray(incoming)) {
|
|
6228
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6229
|
+
return {
|
|
6230
|
+
kind: "value",
|
|
6231
|
+
value: incoming
|
|
6232
|
+
};
|
|
6233
|
+
}
|
|
6234
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6235
|
+
for (const row of storedRows) {
|
|
6236
|
+
const id = rowId(row, node.idKey);
|
|
6237
|
+
if (id !== null) storedById.set(id, row);
|
|
6238
|
+
}
|
|
6239
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6240
|
+
const rows = [];
|
|
6241
|
+
for (const row of incoming) {
|
|
6242
|
+
if (!isRecord$1$1(row)) {
|
|
6243
|
+
rows.push(row);
|
|
6244
|
+
continue;
|
|
6245
|
+
}
|
|
6246
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6247
|
+
kept.add(id);
|
|
6248
|
+
const withId = {
|
|
6249
|
+
...row,
|
|
6250
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6251
|
+
};
|
|
6252
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6253
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6254
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6255
|
+
}
|
|
6256
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6257
|
+
return {
|
|
6258
|
+
kind: "value",
|
|
6259
|
+
value: rows
|
|
6260
|
+
};
|
|
6261
|
+
}
|
|
6262
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6263
|
+
switch (node.kind) {
|
|
6264
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6265
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6266
|
+
case "object": {
|
|
6267
|
+
if (!isRecord$1$1(incoming)) {
|
|
6268
|
+
if (incoming === void 0) return KEEP;
|
|
6269
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6270
|
+
return {
|
|
6271
|
+
kind: "value",
|
|
6272
|
+
value: incoming
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
const storedObj = isRecord$1$1(stored) ? stored : {};
|
|
6276
|
+
return {
|
|
6277
|
+
kind: "value",
|
|
6278
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6279
|
+
};
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
}
|
|
6283
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6284
|
+
function splitNodeKey(key) {
|
|
6285
|
+
const at = key.indexOf("@");
|
|
6286
|
+
return at <= 0 ? {
|
|
6287
|
+
base: key,
|
|
6288
|
+
nodeId: null
|
|
6289
|
+
} : {
|
|
6290
|
+
base: key.slice(0, at),
|
|
6291
|
+
nodeId: key.slice(at + 1)
|
|
6292
|
+
};
|
|
6293
|
+
}
|
|
6294
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6295
|
+
async function transformSecretWrite(input) {
|
|
6296
|
+
const deletes = [];
|
|
6297
|
+
const base = {
|
|
6298
|
+
secrets: input.secrets,
|
|
6299
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6300
|
+
deletes,
|
|
6301
|
+
operatorWrite: input.operatorWrite === true
|
|
6302
|
+
};
|
|
6303
|
+
const out = {};
|
|
6304
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6305
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6306
|
+
const node = input.tree.get(baseKey);
|
|
6307
|
+
if (node === void 0) {
|
|
6308
|
+
out[key] = incoming;
|
|
6309
|
+
continue;
|
|
6310
|
+
}
|
|
6311
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6312
|
+
kind: "node",
|
|
6313
|
+
nodeId
|
|
6314
|
+
} : input.scope ?? globalSecretScope();
|
|
6315
|
+
const result = await writeNode({
|
|
6316
|
+
...base,
|
|
6317
|
+
scope
|
|
6318
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6319
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6320
|
+
}
|
|
6321
|
+
return {
|
|
6322
|
+
patch: out,
|
|
6323
|
+
afterWrite: async () => {
|
|
6324
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6325
|
+
try {
|
|
6326
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6327
|
+
return { orphaned: [] };
|
|
6328
|
+
} catch {
|
|
6329
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
};
|
|
6333
|
+
}
|
|
6334
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6335
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6336
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6337
|
+
}
|
|
6338
|
+
/**
|
|
6339
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6340
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6341
|
+
*/
|
|
6342
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6343
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6344
|
+
const owner = options.ownedBy;
|
|
6345
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6346
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6347
|
+
if (refs.length === 0) return {
|
|
6348
|
+
value,
|
|
6349
|
+
unresolved: []
|
|
6350
|
+
};
|
|
6351
|
+
const answers = await secrets.resolve(refs);
|
|
6352
|
+
const unresolved = [];
|
|
6353
|
+
for (const ref of new Set(refs)) {
|
|
6354
|
+
const answer = answers[ref];
|
|
6355
|
+
if (answer === void 0) unresolved.push({
|
|
6356
|
+
ref,
|
|
6357
|
+
reason: "not-initialized"
|
|
6358
|
+
});
|
|
6359
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6360
|
+
ref,
|
|
6361
|
+
reason: answer.reason
|
|
6362
|
+
});
|
|
6363
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6364
|
+
ref,
|
|
6365
|
+
reason: answer.kind
|
|
6366
|
+
});
|
|
6367
|
+
}
|
|
6368
|
+
const substitute = (v) => {
|
|
6369
|
+
if (isSecretMarker(v)) {
|
|
6370
|
+
if (!inScope(v.$secret)) return {
|
|
6371
|
+
keep: true,
|
|
6372
|
+
value: v
|
|
6373
|
+
};
|
|
6374
|
+
const answer = answers[v.$secret];
|
|
6375
|
+
if (answer?.kind === "value") return {
|
|
6376
|
+
keep: true,
|
|
6377
|
+
value: answer.value
|
|
6378
|
+
};
|
|
6379
|
+
return keepMarker ? {
|
|
6380
|
+
keep: true,
|
|
6381
|
+
value: v
|
|
6382
|
+
} : {
|
|
6383
|
+
keep: false,
|
|
6384
|
+
value: void 0
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
if (Array.isArray(v)) {
|
|
6388
|
+
const items = [];
|
|
6389
|
+
for (const item of v) {
|
|
6390
|
+
const s = substitute(item);
|
|
6391
|
+
if (s.keep) items.push(s.value);
|
|
6392
|
+
}
|
|
6393
|
+
return {
|
|
6394
|
+
keep: true,
|
|
6395
|
+
value: items
|
|
6396
|
+
};
|
|
6397
|
+
}
|
|
6398
|
+
if (isRecord$1$1(v)) {
|
|
6399
|
+
const out = {};
|
|
6400
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6401
|
+
const s = substitute(child);
|
|
6402
|
+
if (s.keep) out[k] = s.value;
|
|
6403
|
+
}
|
|
6404
|
+
return {
|
|
6405
|
+
keep: true,
|
|
6406
|
+
value: out
|
|
6407
|
+
};
|
|
6408
|
+
}
|
|
6409
|
+
return {
|
|
6410
|
+
keep: true,
|
|
6411
|
+
value: v
|
|
6412
|
+
};
|
|
6413
|
+
};
|
|
6414
|
+
return {
|
|
6415
|
+
value: substitute(value).value,
|
|
6416
|
+
unresolved
|
|
6417
|
+
};
|
|
6418
|
+
}
|
|
6419
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6420
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6421
|
+
ref;
|
|
6422
|
+
reason;
|
|
6423
|
+
constructor(ref, reason) {
|
|
6424
|
+
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.`);
|
|
6425
|
+
this.ref = ref;
|
|
6426
|
+
this.reason = reason;
|
|
6427
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6428
|
+
}
|
|
6429
|
+
};
|
|
6430
|
+
function isRecord$3(value) {
|
|
6431
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6432
|
+
}
|
|
6433
|
+
function resolvedValue(pass, marker) {
|
|
6434
|
+
const answer = pass.answers[marker.$secret];
|
|
6435
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6436
|
+
}
|
|
6437
|
+
async function atMarker(pass, incoming, stored) {
|
|
6438
|
+
if (incoming === null) return stored;
|
|
6439
|
+
if (typeof incoming !== "string") return incoming;
|
|
6440
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6441
|
+
const intent = classifySecretWrite(incoming);
|
|
6442
|
+
if (intent.kind !== "set") return stored;
|
|
6443
|
+
const ref = stored.$secret;
|
|
6444
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6445
|
+
const answer = pass.answers[ref];
|
|
6446
|
+
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);
|
|
6447
|
+
try {
|
|
6448
|
+
await pass.secrets.put(ref, intent.value);
|
|
6449
|
+
} catch (err) {
|
|
6450
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6451
|
+
}
|
|
6452
|
+
pass.changedRefs.push(ref);
|
|
6453
|
+
return stored;
|
|
6454
|
+
}
|
|
6455
|
+
function inArray(pass, incoming, stored) {
|
|
6456
|
+
return incoming.map((item, index) => {
|
|
6457
|
+
const twin = stored[index];
|
|
6458
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6459
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6460
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6461
|
+
return item;
|
|
6462
|
+
});
|
|
6463
|
+
}
|
|
6464
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6465
|
+
const out = { ...incoming };
|
|
6466
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6467
|
+
const twin = stored[key];
|
|
6468
|
+
if (isSecretMarker(twin)) {
|
|
6469
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6470
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6471
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6472
|
+
}
|
|
6473
|
+
return out;
|
|
6474
|
+
}
|
|
6475
|
+
async function walk(pass, incoming, stored) {
|
|
6476
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6477
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6478
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6479
|
+
const out = { ...incoming };
|
|
6480
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6481
|
+
return out;
|
|
6482
|
+
}
|
|
6483
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6484
|
+
async function restoreUnchangedSecrets(input) {
|
|
6485
|
+
const refs = [];
|
|
6486
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6487
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6488
|
+
if (owned.length === 0) return {
|
|
6489
|
+
patch: input.patch,
|
|
6490
|
+
changedRefs: []
|
|
6491
|
+
};
|
|
6492
|
+
const pass = {
|
|
6493
|
+
secrets: input.secrets,
|
|
6494
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6495
|
+
operatorWrite: input.operatorWrite,
|
|
6496
|
+
changedRefs: []
|
|
6497
|
+
};
|
|
6498
|
+
const out = {};
|
|
6499
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6500
|
+
return {
|
|
6501
|
+
patch: out,
|
|
6502
|
+
changedRefs: pass.changedRefs
|
|
6503
|
+
};
|
|
6504
|
+
}
|
|
6505
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6506
|
+
function isJsonEqual(a, b) {
|
|
6507
|
+
if (Object.is(a, b)) return true;
|
|
6508
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6509
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6510
|
+
const keys = Object.keys(a);
|
|
6511
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6512
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6513
|
+
}
|
|
6514
|
+
return false;
|
|
6515
|
+
}
|
|
6516
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6517
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6518
|
+
const out = {};
|
|
6519
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6520
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6521
|
+
out[key] = value;
|
|
6522
|
+
}
|
|
6523
|
+
return out;
|
|
6524
|
+
}
|
|
6525
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6526
|
+
function markerKeysOf(blob, owner) {
|
|
6527
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6528
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6529
|
+
return keys;
|
|
6530
|
+
}
|
|
6531
|
+
function nodeFromStored(value, owner) {
|
|
6532
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6533
|
+
if (!isRecord$3(value)) return null;
|
|
6534
|
+
const children = /* @__PURE__ */ new Map();
|
|
6535
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6536
|
+
const node = nodeFromStored(child, owner);
|
|
6537
|
+
if (node !== null) children.set(key, node);
|
|
6538
|
+
}
|
|
6539
|
+
return children.size > 0 ? {
|
|
6540
|
+
kind: "object",
|
|
6541
|
+
children
|
|
6542
|
+
} : null;
|
|
6543
|
+
}
|
|
6544
|
+
/**
|
|
6545
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6546
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6547
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6548
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6549
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6550
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6551
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6552
|
+
* over.
|
|
6553
|
+
*/
|
|
6554
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6555
|
+
const added = /* @__PURE__ */ new Map();
|
|
6556
|
+
for (const key of keys) {
|
|
6557
|
+
const at = key.indexOf("@");
|
|
6558
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6559
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6560
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6561
|
+
if (node !== null) added.set(base, node);
|
|
6562
|
+
}
|
|
6563
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6564
|
+
}
|
|
6565
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6566
|
+
async function readStoredAddonBlob(raw) {
|
|
6567
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6568
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6569
|
+
const result = await threeWay.call(raw);
|
|
6570
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6571
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6572
|
+
}
|
|
6573
|
+
function touchesTree(tree, patch) {
|
|
6574
|
+
if (tree.size === 0) return false;
|
|
6575
|
+
for (const key of Object.keys(patch)) {
|
|
6576
|
+
const at = key.indexOf("@");
|
|
6577
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6578
|
+
}
|
|
6579
|
+
return false;
|
|
6580
|
+
}
|
|
6581
|
+
/**
|
|
6582
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6583
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6584
|
+
*/
|
|
6585
|
+
var MarkerKeyIndex = class {
|
|
6586
|
+
owner;
|
|
6587
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6588
|
+
constructor(owner) {
|
|
6589
|
+
this.owner = owner;
|
|
6590
|
+
}
|
|
6591
|
+
seen(store, blob) {
|
|
6592
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6593
|
+
}
|
|
6594
|
+
wrote(store, patch) {
|
|
6595
|
+
const keys = this.byStore.get(store);
|
|
6596
|
+
if (keys === void 0) return;
|
|
6597
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6598
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6599
|
+
else keys.delete(key);
|
|
6600
|
+
}
|
|
6601
|
+
mayHoldMarkers(store, patch) {
|
|
6602
|
+
const keys = this.byStore.get(store);
|
|
6603
|
+
if (keys === void 0) return true;
|
|
6604
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6605
|
+
}
|
|
6606
|
+
};
|
|
6607
|
+
function createHandle(raw, opts) {
|
|
6608
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6609
|
+
const serialize = (key, fn) => {
|
|
6610
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6611
|
+
const tail = next.catch(() => void 0);
|
|
6612
|
+
chains.set(key, tail);
|
|
6613
|
+
tail.then(() => {
|
|
6614
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6615
|
+
});
|
|
6616
|
+
return next;
|
|
6617
|
+
};
|
|
6618
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6619
|
+
const resolveRead = async (store, blob) => {
|
|
6620
|
+
index.seen(store, blob);
|
|
6621
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6622
|
+
unresolved: "keep-marker",
|
|
6623
|
+
ownedBy: opts.secrets.owner
|
|
6624
|
+
});
|
|
6625
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6626
|
+
return value;
|
|
6627
|
+
};
|
|
6628
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6629
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6630
|
+
await rawWrite(patch);
|
|
6631
|
+
index.wrote(store, patch);
|
|
6632
|
+
return { changed: true };
|
|
6633
|
+
}
|
|
6634
|
+
return serialize(store, async () => {
|
|
6635
|
+
const stored = await readStored();
|
|
6636
|
+
index.seen(store, stored);
|
|
6637
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6638
|
+
const restored = await restoreUnchangedSecrets({
|
|
6639
|
+
patch,
|
|
6640
|
+
stored,
|
|
6641
|
+
secrets: opts.secrets,
|
|
6642
|
+
operatorWrite
|
|
6643
|
+
});
|
|
6644
|
+
const result = await transformSecretWrite({
|
|
6645
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6646
|
+
secrets: opts.secrets,
|
|
6647
|
+
patch: restored.patch,
|
|
6648
|
+
stored,
|
|
6649
|
+
...scope !== void 0 ? { scope } : {},
|
|
6650
|
+
operatorWrite
|
|
6651
|
+
});
|
|
6652
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6653
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6654
|
+
if (wroteBlob) {
|
|
6655
|
+
await rawWrite(effective);
|
|
6656
|
+
index.wrote(store, effective);
|
|
6657
|
+
}
|
|
6658
|
+
const { orphaned } = await result.afterWrite();
|
|
6659
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6660
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6661
|
+
});
|
|
6662
|
+
};
|
|
6663
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6664
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6665
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6666
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6667
|
+
const overrides = {
|
|
6668
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6669
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6670
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6671
|
+
return result.kind === "value" ? {
|
|
6672
|
+
kind: "value",
|
|
6673
|
+
value: await resolveRead("addon", result.value)
|
|
6674
|
+
} : result;
|
|
6675
|
+
} } : {},
|
|
6676
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6677
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6678
|
+
if (result.kind !== "present") return result;
|
|
6679
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6680
|
+
unresolved: "keep-marker",
|
|
6681
|
+
ownedBy: opts.secrets.owner
|
|
6682
|
+
});
|
|
6683
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6684
|
+
return {
|
|
6685
|
+
kind: "present",
|
|
6686
|
+
value: value[key]
|
|
6687
|
+
};
|
|
6688
|
+
} } : {},
|
|
6689
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6690
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6691
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6692
|
+
const out = /* @__PURE__ */ new Map();
|
|
6693
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6694
|
+
return out;
|
|
6695
|
+
} } : {},
|
|
6696
|
+
writeAddonStore: async (patch) => {
|
|
6697
|
+
await writeAddon(patch);
|
|
6698
|
+
},
|
|
6699
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6700
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6701
|
+
kind: "device",
|
|
6702
|
+
deviceId
|
|
6703
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6704
|
+
}
|
|
6705
|
+
};
|
|
6706
|
+
return {
|
|
6707
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6708
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6709
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6710
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6711
|
+
} }),
|
|
6712
|
+
raw: {
|
|
6713
|
+
readAddonStore: async () => {
|
|
6714
|
+
const blob = await raw.readAddonStore();
|
|
6715
|
+
index.seen("addon", blob);
|
|
6716
|
+
return blob;
|
|
6717
|
+
},
|
|
6718
|
+
readDeviceStore: async (deviceId) => {
|
|
6719
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6720
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6721
|
+
return blob;
|
|
6722
|
+
}
|
|
6723
|
+
},
|
|
6724
|
+
writeAddonStore: writeAddon
|
|
6725
|
+
};
|
|
6726
|
+
}
|
|
6727
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6728
|
+
function createSecretAwareContext(context, opts) {
|
|
6729
|
+
const raw = context.settings;
|
|
6730
|
+
if (raw === void 0) return {
|
|
6731
|
+
context,
|
|
6732
|
+
handle: null
|
|
6733
|
+
};
|
|
6734
|
+
const handle = createHandle(raw, opts);
|
|
6735
|
+
return {
|
|
6736
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6737
|
+
if (prop === "settings") return handle.settings;
|
|
6738
|
+
return Reflect.get(target, prop, receiver);
|
|
6739
|
+
} }),
|
|
6740
|
+
handle
|
|
6741
|
+
};
|
|
6742
|
+
}
|
|
6743
|
+
var LEAF = { kind: "leaf" };
|
|
6744
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6745
|
+
function collectFields(fields, out) {
|
|
6746
|
+
for (const field of fields) {
|
|
6747
|
+
if (field.type === "group") {
|
|
6748
|
+
collectFields(field.fields, out);
|
|
6749
|
+
continue;
|
|
6750
|
+
}
|
|
6751
|
+
if (field.type === "sub-tabs") {
|
|
6752
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6753
|
+
continue;
|
|
6754
|
+
}
|
|
6755
|
+
if (field.type === "editable-array") {
|
|
6756
|
+
const item = /* @__PURE__ */ new Map();
|
|
6757
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6758
|
+
if (item.size > 0) out.set(field.key, {
|
|
6759
|
+
kind: "array",
|
|
6760
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6761
|
+
item
|
|
6762
|
+
});
|
|
6763
|
+
continue;
|
|
6764
|
+
}
|
|
6765
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6766
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6767
|
+
}
|
|
6768
|
+
}
|
|
6769
|
+
/** The secret tree a settings schema declares. */
|
|
6770
|
+
function secretTreeFromSchema(schema) {
|
|
6771
|
+
const out = /* @__PURE__ */ new Map();
|
|
6772
|
+
if (schema === null) return out;
|
|
6773
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6774
|
+
return out;
|
|
6775
|
+
}
|
|
6776
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6777
|
+
function parseSecretStatePath(path) {
|
|
6778
|
+
const segments = [];
|
|
6779
|
+
for (const raw of path.split(".")) {
|
|
6780
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6781
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6782
|
+
segments.push(m[2] !== void 0 ? {
|
|
6783
|
+
key: m[1],
|
|
6784
|
+
idKey: m[2]
|
|
6785
|
+
} : { key: m[1] });
|
|
6786
|
+
}
|
|
6787
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6788
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6789
|
+
return segments;
|
|
6790
|
+
}
|
|
6791
|
+
function insert(into, segments) {
|
|
6792
|
+
const [head, ...rest] = segments;
|
|
6793
|
+
if (head === void 0) return;
|
|
6794
|
+
if (rest.length === 0) {
|
|
6795
|
+
into.set(head.key, LEAF);
|
|
6796
|
+
return;
|
|
6797
|
+
}
|
|
6798
|
+
const existing = into.get(head.key);
|
|
6799
|
+
if (head.idKey !== void 0) {
|
|
6800
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6801
|
+
insert(item, rest);
|
|
6802
|
+
into.set(head.key, {
|
|
6803
|
+
kind: "array",
|
|
6804
|
+
idKey: head.idKey,
|
|
6805
|
+
item
|
|
6806
|
+
});
|
|
6807
|
+
return;
|
|
6808
|
+
}
|
|
6809
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6810
|
+
insert(children, rest);
|
|
6811
|
+
into.set(head.key, {
|
|
6812
|
+
kind: "object",
|
|
6813
|
+
children
|
|
6814
|
+
});
|
|
6815
|
+
}
|
|
6816
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6817
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6818
|
+
if (paths.length === 0) return tree;
|
|
6819
|
+
const out = new Map(tree);
|
|
6820
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6821
|
+
return out;
|
|
6822
|
+
}
|
|
6823
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6824
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6825
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6826
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6827
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5945
6828
|
/**
|
|
5946
6829
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5947
6830
|
*
|
|
@@ -6011,6 +6894,33 @@ var BaseAddon = class {
|
|
|
6011
6894
|
settingsStoreReady = false;
|
|
6012
6895
|
/** Default config values. Provided via constructor. */
|
|
6013
6896
|
defaults;
|
|
6897
|
+
/**
|
|
6898
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6899
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6900
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6901
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6902
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6903
|
+
*/
|
|
6904
|
+
secretStatePaths = [];
|
|
6905
|
+
_addonSecretTree = null;
|
|
6906
|
+
_deviceSecretTree = null;
|
|
6907
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6908
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6909
|
+
_unresolvedSecrets = [];
|
|
6910
|
+
_secretRetryTimer = null;
|
|
6911
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6912
|
+
_secretChangeTimer = null;
|
|
6913
|
+
_secretChangeUnsub = null;
|
|
6914
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6915
|
+
_operatorWriteDepth = 0;
|
|
6916
|
+
/**
|
|
6917
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6918
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6919
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6920
|
+
*/
|
|
6921
|
+
_secretSettings = null;
|
|
6922
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6923
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6014
6924
|
constructor(defaults) {
|
|
6015
6925
|
this.defaults = defaults;
|
|
6016
6926
|
this._config = { ...defaults };
|
|
@@ -6046,8 +6956,26 @@ var BaseAddon = class {
|
|
|
6046
6956
|
return this._config;
|
|
6047
6957
|
}
|
|
6048
6958
|
async initialize(context) {
|
|
6049
|
-
|
|
6959
|
+
const secrets = context.secrets;
|
|
6960
|
+
if (secrets !== void 0) {
|
|
6961
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6962
|
+
secrets,
|
|
6963
|
+
addonTree: () => this.addonSecretTree(),
|
|
6964
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6965
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6966
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6967
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6968
|
+
});
|
|
6969
|
+
this._ctx = wrapped;
|
|
6970
|
+
this._secretSettings = handle;
|
|
6971
|
+
} else {
|
|
6972
|
+
this._ctx = context;
|
|
6973
|
+
this._secretSettings = null;
|
|
6974
|
+
}
|
|
6050
6975
|
await this.resolveConfig();
|
|
6976
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6977
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6978
|
+
});
|
|
6051
6979
|
const result = await this.onInitialize();
|
|
6052
6980
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6053
6981
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6080,6 +7008,12 @@ var BaseAddon = class {
|
|
|
6080
7008
|
*/
|
|
6081
7009
|
async onHubReachable() {}
|
|
6082
7010
|
async shutdown() {
|
|
7011
|
+
this._secretChangeUnsub?.();
|
|
7012
|
+
this._secretChangeUnsub = null;
|
|
7013
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7014
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7015
|
+
this._secretRetryTimer = null;
|
|
7016
|
+
this._secretChangeTimer = null;
|
|
6083
7017
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6084
7018
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6085
7019
|
await this.onShutdown();
|
|
@@ -6154,11 +7088,8 @@ var BaseAddon = class {
|
|
|
6154
7088
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6155
7089
|
const schema = this.globalSettingsSchema(cap);
|
|
6156
7090
|
if (!schema) return { sections: [] };
|
|
6157
|
-
const projected = await this.
|
|
6158
|
-
return hydrateSchema(schema, overlay ? {
|
|
6159
|
-
...projected,
|
|
6160
|
-
...overlay
|
|
6161
|
-
} : projected);
|
|
7091
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7092
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6162
7093
|
}
|
|
6163
7094
|
/**
|
|
6164
7095
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6203,11 +7134,11 @@ var BaseAddon = class {
|
|
|
6203
7134
|
});
|
|
6204
7135
|
}
|
|
6205
7136
|
if (sections.length === 0) return null;
|
|
6206
|
-
const projected = await this.
|
|
7137
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6207
7138
|
return hydrateSchema({
|
|
6208
7139
|
...schema,
|
|
6209
7140
|
sections
|
|
6210
|
-
}, projected);
|
|
7141
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6211
7142
|
}
|
|
6212
7143
|
/**
|
|
6213
7144
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6220,12 +7151,50 @@ var BaseAddon = class {
|
|
|
6220
7151
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6221
7152
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6222
7153
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7154
|
+
*
|
|
7155
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7156
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7157
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7158
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7159
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7160
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6223
7161
|
*/
|
|
6224
7162
|
async resolveGlobalStore(nodeId, cap) {
|
|
6225
7163
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7164
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7165
|
+
}
|
|
7166
|
+
projectForNode(store, nodeId, cap) {
|
|
6226
7167
|
const keys = this.perNodeKeys(cap);
|
|
6227
7168
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6228
|
-
return keys.size > 0 ? projectStore(
|
|
7169
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7170
|
+
}
|
|
7171
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7172
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7173
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7174
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7175
|
+
}
|
|
7176
|
+
/**
|
|
7177
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7178
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7179
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7180
|
+
* its value.
|
|
7181
|
+
*/
|
|
7182
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7183
|
+
const secrets = this._ctx?.secrets;
|
|
7184
|
+
const merged = {
|
|
7185
|
+
...stored,
|
|
7186
|
+
...overlay
|
|
7187
|
+
};
|
|
7188
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7189
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7190
|
+
unresolved: "keep-marker",
|
|
7191
|
+
ownedBy: secrets.owner
|
|
7192
|
+
});
|
|
7193
|
+
for (const key of Object.keys(overlay)) {
|
|
7194
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7195
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7196
|
+
}
|
|
7197
|
+
return merged;
|
|
6229
7198
|
}
|
|
6230
7199
|
/**
|
|
6231
7200
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6261,18 +7230,58 @@ var BaseAddon = class {
|
|
|
6261
7230
|
value: result.value[key]
|
|
6262
7231
|
};
|
|
6263
7232
|
}
|
|
7233
|
+
/**
|
|
7234
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7235
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7236
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7237
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7238
|
+
* writing back what it read is not (D787).
|
|
7239
|
+
*/
|
|
7240
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7241
|
+
this._operatorWriteDepth++;
|
|
7242
|
+
try {
|
|
7243
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7244
|
+
} finally {
|
|
7245
|
+
this._operatorWriteDepth--;
|
|
7246
|
+
}
|
|
7247
|
+
}
|
|
6264
7248
|
async updateGlobalSettings(patch, nodeId) {
|
|
7249
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7250
|
+
}
|
|
7251
|
+
/**
|
|
7252
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7253
|
+
*
|
|
7254
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7255
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7256
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7257
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7258
|
+
*/
|
|
7259
|
+
async clearSecrets(keys, nodeId) {
|
|
7260
|
+
const tree = this.addonSecretTree();
|
|
7261
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7262
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7263
|
+
const patch = {};
|
|
7264
|
+
for (const key of keys) {
|
|
7265
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7266
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7267
|
+
}
|
|
7268
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7269
|
+
}
|
|
7270
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6265
7271
|
const keys = this.perNodeKeys();
|
|
6266
7272
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6267
7273
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6268
|
-
const barePatch = patch;
|
|
6269
7274
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6270
|
-
|
|
7275
|
+
const handle = this._secretSettings;
|
|
7276
|
+
if (handle !== null) {
|
|
7277
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7278
|
+
if (!changed) return;
|
|
7279
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6271
7280
|
if (target !== localNode) return;
|
|
6272
7281
|
await this.resolveConfig();
|
|
6273
7282
|
await this.onConfigChanged();
|
|
6274
7283
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6275
|
-
this.maybeAutoRestart(
|
|
7284
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6276
7285
|
}
|
|
6277
7286
|
/**
|
|
6278
7287
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6297,7 +7306,7 @@ var BaseAddon = class {
|
|
|
6297
7306
|
* time to return its response before the addon is torn down and
|
|
6298
7307
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6299
7308
|
*/
|
|
6300
|
-
maybeAutoRestart(
|
|
7309
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6301
7310
|
if (!schema) return;
|
|
6302
7311
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6303
7312
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6305,13 +7314,13 @@ var BaseAddon = class {
|
|
|
6305
7314
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6306
7315
|
}
|
|
6307
7316
|
if (restartKeys.size === 0) return;
|
|
6308
|
-
if (!
|
|
7317
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6309
7318
|
const ctx = this._ctx;
|
|
6310
7319
|
if (!ctx) return;
|
|
6311
7320
|
const addonId = ctx.id;
|
|
6312
7321
|
setImmediate(() => {
|
|
6313
7322
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6314
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7323
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6315
7324
|
}).catch((err) => {
|
|
6316
7325
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6317
7326
|
});
|
|
@@ -6320,7 +7329,7 @@ var BaseAddon = class {
|
|
|
6320
7329
|
async getDeviceSettings(deviceId) {
|
|
6321
7330
|
const schema = this.deviceSettingsSchema();
|
|
6322
7331
|
if (!schema) return { sections: [] };
|
|
6323
|
-
return hydrateSchema(schema, await this.
|
|
7332
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6324
7333
|
}
|
|
6325
7334
|
async updateDeviceSettings(deviceId, patch) {
|
|
6326
7335
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6450,7 +7459,7 @@ var BaseAddon = class {
|
|
|
6450
7459
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6451
7460
|
*/
|
|
6452
7461
|
async resolveConfig() {
|
|
6453
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7462
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6454
7463
|
const perNode = this.perNodeKeys();
|
|
6455
7464
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6456
7465
|
const resolved = { ...this.defaults };
|
|
@@ -6475,7 +7484,7 @@ var BaseAddon = class {
|
|
|
6475
7484
|
key,
|
|
6476
7485
|
schema,
|
|
6477
7486
|
fallback,
|
|
6478
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7487
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6479
7488
|
write: async (patch) => {
|
|
6480
7489
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6481
7490
|
},
|
|
@@ -6492,7 +7501,7 @@ var BaseAddon = class {
|
|
|
6492
7501
|
key,
|
|
6493
7502
|
schema,
|
|
6494
7503
|
fallback,
|
|
6495
|
-
read: async () => await this.
|
|
7504
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6496
7505
|
write: async (patch) => {
|
|
6497
7506
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6498
7507
|
},
|
|
@@ -6504,6 +7513,87 @@ var BaseAddon = class {
|
|
|
6504
7513
|
} })
|
|
6505
7514
|
});
|
|
6506
7515
|
}
|
|
7516
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7517
|
+
addonSecretTree() {
|
|
7518
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7519
|
+
return this._addonSecretTree;
|
|
7520
|
+
}
|
|
7521
|
+
deviceSecretTree() {
|
|
7522
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7523
|
+
return this._deviceSecretTree;
|
|
7524
|
+
}
|
|
7525
|
+
/**
|
|
7526
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7527
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7528
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7529
|
+
* than start on an empty credential.
|
|
7530
|
+
*/
|
|
7531
|
+
get unresolvedSecrets() {
|
|
7532
|
+
return this._unresolvedSecrets;
|
|
7533
|
+
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7536
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7537
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7538
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7539
|
+
* ever written back from here.
|
|
7540
|
+
*/
|
|
7541
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7542
|
+
const secrets = this._ctx?.secrets;
|
|
7543
|
+
if (secrets === void 0) return blob;
|
|
7544
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7545
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7546
|
+
if (refs.length === 0) {
|
|
7547
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7548
|
+
return blob;
|
|
7549
|
+
}
|
|
7550
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7551
|
+
if (trackForConfig) {
|
|
7552
|
+
this._unresolvedSecrets = unresolved;
|
|
7553
|
+
if (unresolved.length > 0) {
|
|
7554
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7555
|
+
ref: u.ref,
|
|
7556
|
+
reason: u.reason
|
|
7557
|
+
})) } });
|
|
7558
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7559
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7560
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7561
|
+
}
|
|
7562
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7563
|
+
}
|
|
7564
|
+
return value;
|
|
7565
|
+
}
|
|
7566
|
+
/**
|
|
7567
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7568
|
+
* keychain the context's own view is already raw.
|
|
7569
|
+
*/
|
|
7570
|
+
rawSettings() {
|
|
7571
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7572
|
+
}
|
|
7573
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7574
|
+
logUnresolvedRead(unresolved) {
|
|
7575
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7576
|
+
if (fresh.length === 0) return;
|
|
7577
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7578
|
+
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) => ({
|
|
7579
|
+
ref: u.ref,
|
|
7580
|
+
reason: u.reason
|
|
7581
|
+
})) } });
|
|
7582
|
+
}
|
|
7583
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7584
|
+
scheduleSecretReresolve(delayMs) {
|
|
7585
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7586
|
+
if (this[timerOf] !== null) return;
|
|
7587
|
+
const timer = setTimeout(() => {
|
|
7588
|
+
this[timerOf] = null;
|
|
7589
|
+
if (this._ctx === null) return;
|
|
7590
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7591
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7592
|
+
});
|
|
7593
|
+
}, delayMs);
|
|
7594
|
+
timer.unref?.();
|
|
7595
|
+
this[timerOf] = timer;
|
|
7596
|
+
}
|
|
6507
7597
|
/**
|
|
6508
7598
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6509
7599
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6516,7 +7606,7 @@ var BaseAddon = class {
|
|
|
6516
7606
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6517
7607
|
*/
|
|
6518
7608
|
async readAddonStoreWithRetry() {
|
|
6519
|
-
const settings = this.
|
|
7609
|
+
const settings = this.rawSettings();
|
|
6520
7610
|
if (!settings) return {};
|
|
6521
7611
|
const delaysMs = [
|
|
6522
7612
|
150,
|
|
@@ -7079,6 +8169,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7079
8169
|
kind: "mutation",
|
|
7080
8170
|
auth: "admin"
|
|
7081
8171
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8172
|
+
function defOf(schema) {
|
|
8173
|
+
return schema._zod?.def ?? {};
|
|
8174
|
+
}
|
|
8175
|
+
function declaredHere(schema) {
|
|
8176
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8177
|
+
}
|
|
8178
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8179
|
+
var WRAPPERS = new Set([
|
|
8180
|
+
"optional",
|
|
8181
|
+
"nullable",
|
|
8182
|
+
"default",
|
|
8183
|
+
"prefault",
|
|
8184
|
+
"catch",
|
|
8185
|
+
"readonly",
|
|
8186
|
+
"nonoptional"
|
|
8187
|
+
]);
|
|
8188
|
+
/**
|
|
8189
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8190
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8191
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8192
|
+
* `.transform` on `in`).
|
|
8193
|
+
*/
|
|
8194
|
+
function layersOf(schema) {
|
|
8195
|
+
const out = [];
|
|
8196
|
+
const queue = [schema];
|
|
8197
|
+
while (queue.length > 0) {
|
|
8198
|
+
const s = queue.shift();
|
|
8199
|
+
if (!s || out.includes(s)) continue;
|
|
8200
|
+
out.push(s);
|
|
8201
|
+
const def = defOf(s);
|
|
8202
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8203
|
+
if (def.type === "pipe") {
|
|
8204
|
+
if (def.in) queue.push(def.in);
|
|
8205
|
+
if (def.out) queue.push(def.out);
|
|
8206
|
+
}
|
|
8207
|
+
}
|
|
8208
|
+
return out;
|
|
8209
|
+
}
|
|
8210
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8211
|
+
function isZodSecret(schema) {
|
|
8212
|
+
return layersOf(schema).some(declaredHere);
|
|
8213
|
+
}
|
|
8214
|
+
/**
|
|
8215
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8216
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8217
|
+
* object or array is reported as one path and not descended into — everything
|
|
8218
|
+
* under it is secret.
|
|
8219
|
+
*/
|
|
8220
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8221
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8222
|
+
const paths = [];
|
|
8223
|
+
for (const layer of layersOf(schema)) {
|
|
8224
|
+
const def = defOf(layer);
|
|
8225
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8226
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8227
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8228
|
+
else if (def.type === "intersection") {
|
|
8229
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8230
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8231
|
+
}
|
|
8232
|
+
}
|
|
8233
|
+
return [...new Set(paths)];
|
|
8234
|
+
}
|
|
7082
8235
|
//#endregion
|
|
7083
8236
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7084
8237
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8766,6 +9919,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8766
9919
|
fetchedAt: number()
|
|
8767
9920
|
});
|
|
8768
9921
|
/**
|
|
9922
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9923
|
+
* gets back (cloud training, D805+).
|
|
9924
|
+
*
|
|
9925
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9926
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9927
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9928
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9929
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9930
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9931
|
+
* change there, in the same piece of work.
|
|
9932
|
+
*
|
|
9933
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9934
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9935
|
+
*/
|
|
9936
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9937
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9938
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9939
|
+
var TrainingExportSchema = _enum([
|
|
9940
|
+
"onnx",
|
|
9941
|
+
"openvino-fp16",
|
|
9942
|
+
"openvino-int8",
|
|
9943
|
+
"coreml-fp16"
|
|
9944
|
+
]);
|
|
9945
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9946
|
+
object({
|
|
9947
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9948
|
+
jobKey: string().uuid(),
|
|
9949
|
+
target: object({
|
|
9950
|
+
kind: literal("detector"),
|
|
9951
|
+
step: literal("object-detection")
|
|
9952
|
+
}),
|
|
9953
|
+
base: object({
|
|
9954
|
+
modelId: string().min(1),
|
|
9955
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9956
|
+
weights: string().min(1),
|
|
9957
|
+
imgsz: number().int().positive()
|
|
9958
|
+
}),
|
|
9959
|
+
baseline: object({
|
|
9960
|
+
modelId: string().min(1),
|
|
9961
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9962
|
+
onnxUrl: string().url(),
|
|
9963
|
+
imgsz: number().int().positive(),
|
|
9964
|
+
floors: FloorsSchema
|
|
9965
|
+
}),
|
|
9966
|
+
dataset: object({
|
|
9967
|
+
versionId: string().min(1),
|
|
9968
|
+
annotationHash: string(),
|
|
9969
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9970
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9971
|
+
}),
|
|
9972
|
+
split: object({
|
|
9973
|
+
holdoutCameras: array(number().int()),
|
|
9974
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9975
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9976
|
+
valFraction: number().min(0).max(.5),
|
|
9977
|
+
seed: number().int()
|
|
9978
|
+
}),
|
|
9979
|
+
hyper: object({
|
|
9980
|
+
epochs: number().int().positive(),
|
|
9981
|
+
batch: number().int().positive(),
|
|
9982
|
+
lr0: number().positive(),
|
|
9983
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9984
|
+
freeze: number().int().nonnegative(),
|
|
9985
|
+
patience: number().int().nonnegative(),
|
|
9986
|
+
seed: number().int()
|
|
9987
|
+
}),
|
|
9988
|
+
replay: object({
|
|
9989
|
+
source: literal("coco2017"),
|
|
9990
|
+
count: number().int().nonnegative()
|
|
9991
|
+
}),
|
|
9992
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9993
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9994
|
+
floors: object({
|
|
9995
|
+
minSupport: number().int().positive(),
|
|
9996
|
+
clamp: number().min(0).max(1)
|
|
9997
|
+
}),
|
|
9998
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9999
|
+
catalog: object({
|
|
10000
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10001
|
+
name: string().min(1).max(160)
|
|
10002
|
+
})
|
|
10003
|
+
});
|
|
10004
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10005
|
+
var TrainingResultFileSchema = object({
|
|
10006
|
+
path: string().min(1),
|
|
10007
|
+
bytes: number().int().nonnegative(),
|
|
10008
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10009
|
+
format: _enum([
|
|
10010
|
+
"onnx",
|
|
10011
|
+
"openvino",
|
|
10012
|
+
"coreml",
|
|
10013
|
+
"pt"
|
|
10014
|
+
]),
|
|
10015
|
+
variant: _enum(["base", "int8"])
|
|
10016
|
+
});
|
|
10017
|
+
var DraftFormatSchema = object({
|
|
10018
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10019
|
+
url: string().min(1),
|
|
10020
|
+
sizeMB: number().nonnegative(),
|
|
10021
|
+
isDirectory: boolean().optional(),
|
|
10022
|
+
files: array(string()).optional(),
|
|
10023
|
+
runtimes: array(literal("python")).optional(),
|
|
10024
|
+
revision: string().min(1)
|
|
10025
|
+
});
|
|
10026
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10027
|
+
var TrainingCatalogDraftSchema = object({
|
|
10028
|
+
id: string().min(1),
|
|
10029
|
+
name: string().min(1),
|
|
10030
|
+
description: string(),
|
|
10031
|
+
labels: array(unknown()),
|
|
10032
|
+
inputSize: object({
|
|
10033
|
+
width: number().int().positive(),
|
|
10034
|
+
height: number().int().positive()
|
|
10035
|
+
}),
|
|
10036
|
+
preprocessMode: literal("letterbox"),
|
|
10037
|
+
defaultClassFloors: FloorsSchema,
|
|
10038
|
+
formats: object({
|
|
10039
|
+
onnx: DraftFormatSchema.optional(),
|
|
10040
|
+
openvino: DraftFormatSchema.optional(),
|
|
10041
|
+
coreml: DraftFormatSchema.optional()
|
|
10042
|
+
})
|
|
10043
|
+
});
|
|
10044
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10045
|
+
var TrainingEvalClassSchema = object({
|
|
10046
|
+
positives: number().int(),
|
|
10047
|
+
floor: number().nullable(),
|
|
10048
|
+
tp: number().int(),
|
|
10049
|
+
fp: number().int(),
|
|
10050
|
+
fn: number().int(),
|
|
10051
|
+
precision: number().nullable(),
|
|
10052
|
+
recall: number().nullable(),
|
|
10053
|
+
ap50: number().nullable(),
|
|
10054
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10055
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10056
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10057
|
+
smallFound: number().int().optional(),
|
|
10058
|
+
smallTotal: number().int().optional()
|
|
10059
|
+
}).passthrough();
|
|
10060
|
+
var TrainingEvalReportSchema = object({
|
|
10061
|
+
frames: number().int(),
|
|
10062
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10063
|
+
}).passthrough();
|
|
10064
|
+
/**
|
|
10065
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10066
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10067
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10068
|
+
*/
|
|
10069
|
+
var TrainingResultSchema = object({
|
|
10070
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10071
|
+
jobKey: string(),
|
|
10072
|
+
status: _enum(["succeeded", "failed"]),
|
|
10073
|
+
error: object({
|
|
10074
|
+
stage: string(),
|
|
10075
|
+
code: string(),
|
|
10076
|
+
message: string()
|
|
10077
|
+
}).nullable(),
|
|
10078
|
+
trainer: object({
|
|
10079
|
+
version: string(),
|
|
10080
|
+
revision: string()
|
|
10081
|
+
}),
|
|
10082
|
+
toolchain: record(string(), string().nullable()),
|
|
10083
|
+
dataset: object({
|
|
10084
|
+
versionId: string(),
|
|
10085
|
+
annotationHash: string(),
|
|
10086
|
+
sha256: string(),
|
|
10087
|
+
frames: object({
|
|
10088
|
+
train: number().int(),
|
|
10089
|
+
val: number().int(),
|
|
10090
|
+
holdout: number().int()
|
|
10091
|
+
}),
|
|
10092
|
+
holdoutCameras: array(number().int()),
|
|
10093
|
+
replayImages: number().int()
|
|
10094
|
+
}).optional(),
|
|
10095
|
+
training: object({
|
|
10096
|
+
epochsRun: number().int(),
|
|
10097
|
+
bestEpoch: number().int(),
|
|
10098
|
+
bestMap50: number(),
|
|
10099
|
+
bestMap50_95: number(),
|
|
10100
|
+
seconds: number()
|
|
10101
|
+
}).optional(),
|
|
10102
|
+
evaluation: object({
|
|
10103
|
+
holdoutFrames: number().int(),
|
|
10104
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10105
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10106
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10107
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10108
|
+
map50: record(string(), number().nullable())
|
|
10109
|
+
}).optional(),
|
|
10110
|
+
floors: object({
|
|
10111
|
+
baseline: FloorsSchema,
|
|
10112
|
+
candidate: FloorsSchema,
|
|
10113
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10114
|
+
notes: array(string())
|
|
10115
|
+
}).optional(),
|
|
10116
|
+
int8: object({
|
|
10117
|
+
kept: boolean(),
|
|
10118
|
+
map50Fp16: number().nullable(),
|
|
10119
|
+
map50Int8: number().nullable(),
|
|
10120
|
+
reason: string().nullable()
|
|
10121
|
+
}).optional(),
|
|
10122
|
+
exportsDropped: array(object({
|
|
10123
|
+
export: string(),
|
|
10124
|
+
reason: string()
|
|
10125
|
+
})).optional(),
|
|
10126
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10127
|
+
bundle: object({
|
|
10128
|
+
path: literal("bundle.tar"),
|
|
10129
|
+
bytes: number().int().nonnegative(),
|
|
10130
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10131
|
+
}).nullable().optional(),
|
|
10132
|
+
catalogDraft: object({
|
|
10133
|
+
base: TrainingCatalogDraftSchema,
|
|
10134
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10135
|
+
}).nullable().optional(),
|
|
10136
|
+
licence: string()
|
|
10137
|
+
});
|
|
10138
|
+
var TrainingStageSchema = _enum([
|
|
10139
|
+
"prepare",
|
|
10140
|
+
"replay",
|
|
10141
|
+
"train",
|
|
10142
|
+
"eval",
|
|
10143
|
+
"export",
|
|
10144
|
+
"package"
|
|
10145
|
+
]);
|
|
10146
|
+
var EventBase = {
|
|
10147
|
+
v: literal(1),
|
|
10148
|
+
ts: number()
|
|
10149
|
+
};
|
|
10150
|
+
discriminatedUnion("type", [
|
|
10151
|
+
object({
|
|
10152
|
+
...EventBase,
|
|
10153
|
+
type: literal("stage"),
|
|
10154
|
+
stage: TrainingStageSchema
|
|
10155
|
+
}),
|
|
10156
|
+
object({
|
|
10157
|
+
...EventBase,
|
|
10158
|
+
type: literal("epoch"),
|
|
10159
|
+
epoch: number().int(),
|
|
10160
|
+
epochs: number().int(),
|
|
10161
|
+
boxLoss: number().nullable().optional(),
|
|
10162
|
+
map50: number().nullable().optional(),
|
|
10163
|
+
map50_95: number().nullable().optional(),
|
|
10164
|
+
etaSec: number().nullable().optional()
|
|
10165
|
+
}),
|
|
10166
|
+
object({
|
|
10167
|
+
...EventBase,
|
|
10168
|
+
type: literal("metric"),
|
|
10169
|
+
name: string(),
|
|
10170
|
+
value: number()
|
|
10171
|
+
}),
|
|
10172
|
+
object({
|
|
10173
|
+
...EventBase,
|
|
10174
|
+
type: literal("artifact"),
|
|
10175
|
+
path: string(),
|
|
10176
|
+
bytes: number(),
|
|
10177
|
+
sha256: string()
|
|
10178
|
+
}),
|
|
10179
|
+
object({
|
|
10180
|
+
...EventBase,
|
|
10181
|
+
type: literal("done"),
|
|
10182
|
+
status: _enum(["succeeded", "failed"]),
|
|
10183
|
+
resultSha256: string().nullable().optional()
|
|
10184
|
+
}),
|
|
10185
|
+
object({
|
|
10186
|
+
...EventBase,
|
|
10187
|
+
type: literal("error"),
|
|
10188
|
+
stage: string(),
|
|
10189
|
+
code: string(),
|
|
10190
|
+
message: string()
|
|
10191
|
+
})
|
|
10192
|
+
]);
|
|
10193
|
+
/**
|
|
8769
10194
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8770
10195
|
*
|
|
8771
10196
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11093,7 +12518,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11093
12518
|
"authenticated",
|
|
11094
12519
|
"admin"
|
|
11095
12520
|
]).optional(),
|
|
11096
|
-
description: string().optional()
|
|
12521
|
+
description: string().optional(),
|
|
12522
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12523
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11097
12524
|
});
|
|
11098
12525
|
/**
|
|
11099
12526
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11798,6 +13225,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11798
13225
|
lastError: string().optional()
|
|
11799
13226
|
});
|
|
11800
13227
|
/**
|
|
13228
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13229
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13230
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13231
|
+
* with it off — which restores without a key.
|
|
13232
|
+
*/
|
|
13233
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13234
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13235
|
+
scheme: string(),
|
|
13236
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13237
|
+
keyId: string()
|
|
13238
|
+
});
|
|
13239
|
+
/**
|
|
13240
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13241
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13242
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13243
|
+
*/
|
|
13244
|
+
var BackupEncryptionStatusSchema = object({
|
|
13245
|
+
enabled: boolean(),
|
|
13246
|
+
active: object({
|
|
13247
|
+
keyId: string(),
|
|
13248
|
+
publicKey: string(),
|
|
13249
|
+
createdAt: number()
|
|
13250
|
+
}).nullable(),
|
|
13251
|
+
/** Every key ever set up, newest first. */
|
|
13252
|
+
keys: array(object({
|
|
13253
|
+
keyId: string(),
|
|
13254
|
+
createdAt: number(),
|
|
13255
|
+
retiredAt: number().nullable()
|
|
13256
|
+
})).readonly()
|
|
13257
|
+
});
|
|
13258
|
+
/**
|
|
11801
13259
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11802
13260
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11803
13261
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11809,7 +13267,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11809
13267
|
sizeBytes: number(),
|
|
11810
13268
|
label: string().optional(),
|
|
11811
13269
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11812
|
-
locations: array(string()).readonly()
|
|
13270
|
+
locations: array(string()).readonly(),
|
|
13271
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13272
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11813
13273
|
});
|
|
11814
13274
|
var BackupEntrySchema = object({
|
|
11815
13275
|
id: string(),
|
|
@@ -11818,7 +13278,8 @@ var BackupEntrySchema = object({
|
|
|
11818
13278
|
label: string().optional(),
|
|
11819
13279
|
createdAt: number(),
|
|
11820
13280
|
sizeBytes: number(),
|
|
11821
|
-
locations: array(string()).optional()
|
|
13281
|
+
locations: array(string()).optional(),
|
|
13282
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11822
13283
|
});
|
|
11823
13284
|
var ArchiveEntrySchema = object({
|
|
11824
13285
|
path: string(),
|
|
@@ -12007,10 +13468,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12007
13468
|
* this list and skips entries whose path doesn't start with
|
|
12008
13469
|
* any of them.
|
|
12009
13470
|
*/
|
|
12010
|
-
locations: array(string()).optional()
|
|
13471
|
+
locations: array(string()).optional(),
|
|
13472
|
+
/**
|
|
13473
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13474
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13475
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13476
|
+
* is refused before the archive is downloaded.
|
|
13477
|
+
*/
|
|
13478
|
+
backupSecretKey: string().optional()
|
|
12011
13479
|
}), _void(), {
|
|
12012
13480
|
kind: "mutation",
|
|
12013
13481
|
auth: "admin"
|
|
13482
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13483
|
+
keyId: string(),
|
|
13484
|
+
secretKey: string(),
|
|
13485
|
+
publicKey: string(),
|
|
13486
|
+
createdAt: number(),
|
|
13487
|
+
replacedKeyId: string().nullable()
|
|
13488
|
+
}), {
|
|
13489
|
+
kind: "mutation",
|
|
13490
|
+
auth: "admin"
|
|
13491
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13492
|
+
kind: "mutation",
|
|
13493
|
+
auth: "admin"
|
|
13494
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13495
|
+
valid: boolean(),
|
|
13496
|
+
keyId: string().nullable(),
|
|
13497
|
+
/** The hub knows this key (active or retired). */
|
|
13498
|
+
known: boolean(),
|
|
13499
|
+
/** It is the key new archives are encrypted to. */
|
|
13500
|
+
active: boolean(),
|
|
13501
|
+
error: string().optional()
|
|
13502
|
+
}), {
|
|
13503
|
+
kind: "mutation",
|
|
13504
|
+
auth: "admin"
|
|
12014
13505
|
}), method(object({
|
|
12015
13506
|
destinationId: string(),
|
|
12016
13507
|
backupId: string()
|
|
@@ -13736,7 +15227,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13736
15227
|
stepId: string(),
|
|
13737
15228
|
entry: ModelCatalogEntrySchema
|
|
13738
15229
|
});
|
|
13739
|
-
|
|
15230
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15231
|
+
var ModelBundleFileSchema = object({
|
|
15232
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15233
|
+
path: string().min(1),
|
|
15234
|
+
bytes: number().int().nonnegative(),
|
|
15235
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15236
|
+
});
|
|
15237
|
+
var ImportModelBundleInputSchema = object({
|
|
15238
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15239
|
+
addonId: string(),
|
|
15240
|
+
stepId: string().min(1),
|
|
15241
|
+
/**
|
|
15242
|
+
* The catalog rows to register, complete, every format URL already
|
|
15243
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15244
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15245
|
+
*/
|
|
15246
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15247
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15248
|
+
bundle: object({
|
|
15249
|
+
ticket: PeerBytesTicketSchema,
|
|
15250
|
+
bytes: number().int().positive(),
|
|
15251
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15252
|
+
}),
|
|
15253
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15254
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15255
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15256
|
+
distribute: boolean()
|
|
15257
|
+
});
|
|
15258
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15259
|
+
kind: literal("imported"),
|
|
15260
|
+
modelIds: array(string()).readonly(),
|
|
15261
|
+
distributed: array(object({
|
|
15262
|
+
modelId: string(),
|
|
15263
|
+
nodeId: string(),
|
|
15264
|
+
format: _enum(MODEL_FORMATS),
|
|
15265
|
+
ok: boolean(),
|
|
15266
|
+
error: string().optional()
|
|
15267
|
+
})).readonly()
|
|
15268
|
+
}), object({
|
|
15269
|
+
kind: literal("refused"),
|
|
15270
|
+
reason: _enum([
|
|
15271
|
+
"transfer-failed",
|
|
15272
|
+
"checksum-mismatch",
|
|
15273
|
+
"bundle-mismatch",
|
|
15274
|
+
"invalid-entry",
|
|
15275
|
+
"id-taken"
|
|
15276
|
+
]),
|
|
15277
|
+
detail: string()
|
|
15278
|
+
})]);
|
|
15279
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15280
|
+
kind: "mutation",
|
|
15281
|
+
auth: "admin",
|
|
15282
|
+
timeoutMs: 30 * 6e4
|
|
15283
|
+
});
|
|
13740
15284
|
/**
|
|
13741
15285
|
* Query filter for settings-store collections.
|
|
13742
15286
|
*/
|
|
@@ -14119,6 +15663,253 @@ id: union([string(), number()]) }), {
|
|
|
14119
15663
|
kind: "mutation",
|
|
14120
15664
|
auth: "admin"
|
|
14121
15665
|
});
|
|
15666
|
+
/**
|
|
15667
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15668
|
+
*
|
|
15669
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15670
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15671
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15672
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15673
|
+
* against the CALLER, never against anything the caller claims.
|
|
15674
|
+
*
|
|
15675
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15676
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15677
|
+
* connection, the agent from its child's connection carried in
|
|
15678
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15679
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15680
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15681
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15682
|
+
* runner is the same OS user): see the threat model in
|
|
15683
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15684
|
+
*
|
|
15685
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15686
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15687
|
+
* floors every method to admin anyway (D240).
|
|
15688
|
+
*
|
|
15689
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15690
|
+
*/
|
|
15691
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15692
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15693
|
+
"key-missing",
|
|
15694
|
+
"wrong-key",
|
|
15695
|
+
"key-file-unreadable",
|
|
15696
|
+
"store-unavailable",
|
|
15697
|
+
"not-initialized",
|
|
15698
|
+
"decrypt-failed"
|
|
15699
|
+
]);
|
|
15700
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15701
|
+
state: literal("locked"),
|
|
15702
|
+
reason: KeychainUnavailableReasonSchema
|
|
15703
|
+
})]);
|
|
15704
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15705
|
+
object({
|
|
15706
|
+
kind: literal("value"),
|
|
15707
|
+
value: string(),
|
|
15708
|
+
version: number().int()
|
|
15709
|
+
}),
|
|
15710
|
+
object({ kind: literal("missing") }),
|
|
15711
|
+
object({
|
|
15712
|
+
kind: literal("unavailable"),
|
|
15713
|
+
reason: KeychainUnavailableReasonSchema
|
|
15714
|
+
}),
|
|
15715
|
+
object({ kind: literal("forbidden") })
|
|
15716
|
+
]);
|
|
15717
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15718
|
+
/** Metadata of one stored value — never the value. */
|
|
15719
|
+
var KeychainSecretMetaSchema = object({
|
|
15720
|
+
ref: string(),
|
|
15721
|
+
owner: string(),
|
|
15722
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15723
|
+
scope: string(),
|
|
15724
|
+
fieldPath: string(),
|
|
15725
|
+
version: number().int(),
|
|
15726
|
+
createdAt: number(),
|
|
15727
|
+
updatedAt: number(),
|
|
15728
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15729
|
+
updatedBy: string(),
|
|
15730
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15731
|
+
lastReadAt: number().nullable()
|
|
15732
|
+
});
|
|
15733
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15734
|
+
method(object({
|
|
15735
|
+
ref: string().min(1),
|
|
15736
|
+
value: string().min(1)
|
|
15737
|
+
}), object({
|
|
15738
|
+
ref: string(),
|
|
15739
|
+
version: number().int()
|
|
15740
|
+
}), {
|
|
15741
|
+
kind: "mutation",
|
|
15742
|
+
auth: "admin"
|
|
15743
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15744
|
+
kind: "mutation",
|
|
15745
|
+
auth: "admin"
|
|
15746
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15747
|
+
var KeychainKeySourceSchema = object({
|
|
15748
|
+
kind: _enum([
|
|
15749
|
+
"config-file",
|
|
15750
|
+
"previous-config-file",
|
|
15751
|
+
"platform",
|
|
15752
|
+
"default-file"
|
|
15753
|
+
]),
|
|
15754
|
+
/** File sources only — a path is not a secret. */
|
|
15755
|
+
path: string().optional(),
|
|
15756
|
+
/**
|
|
15757
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15758
|
+
* next to the database it protects (the default file). The page warns.
|
|
15759
|
+
*/
|
|
15760
|
+
sharesBackupWithDatabase: boolean()
|
|
15761
|
+
});
|
|
15762
|
+
/**
|
|
15763
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15764
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15765
|
+
*/
|
|
15766
|
+
var KeychainResetRecordSchema = object({
|
|
15767
|
+
id: string(),
|
|
15768
|
+
at: number(),
|
|
15769
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15770
|
+
actor: string(),
|
|
15771
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15772
|
+
lockedReason: string().nullable(),
|
|
15773
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15774
|
+
archived: number().int(),
|
|
15775
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15776
|
+
archivedCollection: string().nullable(),
|
|
15777
|
+
/**
|
|
15778
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15779
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15780
|
+
*/
|
|
15781
|
+
archivedKeysCollection: string().nullable(),
|
|
15782
|
+
/**
|
|
15783
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15784
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15785
|
+
* agent forever (D797).
|
|
15786
|
+
*/
|
|
15787
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15788
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15789
|
+
acknowledgedAt: number().nullable()
|
|
15790
|
+
});
|
|
15791
|
+
var KeychainStatusSchema = object({
|
|
15792
|
+
keychain: KeychainStateSchema,
|
|
15793
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15794
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15795
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15796
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15797
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15798
|
+
fingerprint: string().nullable(),
|
|
15799
|
+
activeKeyId: string().nullable(),
|
|
15800
|
+
/**
|
|
15801
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15802
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15803
|
+
*/
|
|
15804
|
+
rotationPending: boolean(),
|
|
15805
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15806
|
+
retiredWraps: number().int(),
|
|
15807
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15808
|
+
secretCount: number().int(),
|
|
15809
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15810
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15811
|
+
});
|
|
15812
|
+
/**
|
|
15813
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15814
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15815
|
+
* never reported as an orphan (and never deleted as one).
|
|
15816
|
+
*/
|
|
15817
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15818
|
+
"in-use",
|
|
15819
|
+
"orphan",
|
|
15820
|
+
"unknown"
|
|
15821
|
+
]);
|
|
15822
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15823
|
+
var KeychainAuditActionSchema = _enum([
|
|
15824
|
+
"put",
|
|
15825
|
+
"delete",
|
|
15826
|
+
"reveal",
|
|
15827
|
+
"rotate-master-key",
|
|
15828
|
+
"purge-retired-keys",
|
|
15829
|
+
"download-recovery-key",
|
|
15830
|
+
"delete-orphans",
|
|
15831
|
+
"reset",
|
|
15832
|
+
"acknowledge-reset",
|
|
15833
|
+
"initialize"
|
|
15834
|
+
]);
|
|
15835
|
+
var KeychainAuditEntrySchema = object({
|
|
15836
|
+
id: string(),
|
|
15837
|
+
at: number(),
|
|
15838
|
+
action: KeychainAuditActionSchema,
|
|
15839
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15840
|
+
actor: string(),
|
|
15841
|
+
ref: string().nullable(),
|
|
15842
|
+
detail: string().nullable()
|
|
15843
|
+
});
|
|
15844
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15845
|
+
/**
|
|
15846
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15847
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15848
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15849
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15850
|
+
*/
|
|
15851
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15852
|
+
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({
|
|
15853
|
+
value: string(),
|
|
15854
|
+
version: number().int()
|
|
15855
|
+
}), {
|
|
15856
|
+
kind: "mutation",
|
|
15857
|
+
auth: "admin",
|
|
15858
|
+
caller: "required"
|
|
15859
|
+
}), method(object({
|
|
15860
|
+
name: SystemHeldSecretNameSchema,
|
|
15861
|
+
value: string().min(16)
|
|
15862
|
+
}), object({
|
|
15863
|
+
ref: string(),
|
|
15864
|
+
version: number().int()
|
|
15865
|
+
}), {
|
|
15866
|
+
kind: "mutation",
|
|
15867
|
+
auth: "admin",
|
|
15868
|
+
caller: "required"
|
|
15869
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15870
|
+
deleted: array(string()).readonly(),
|
|
15871
|
+
kept: array(object({
|
|
15872
|
+
ref: string(),
|
|
15873
|
+
usage: KeychainSecretUsageSchema
|
|
15874
|
+
})).readonly()
|
|
15875
|
+
}), {
|
|
15876
|
+
kind: "mutation",
|
|
15877
|
+
auth: "admin",
|
|
15878
|
+
caller: "required"
|
|
15879
|
+
}), method(object({}), object({
|
|
15880
|
+
fingerprint: string(),
|
|
15881
|
+
keySource: KeychainKeySourceSchema
|
|
15882
|
+
}), {
|
|
15883
|
+
kind: "mutation",
|
|
15884
|
+
auth: "admin",
|
|
15885
|
+
caller: "required"
|
|
15886
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15887
|
+
kind: "mutation",
|
|
15888
|
+
auth: "admin",
|
|
15889
|
+
caller: "required"
|
|
15890
|
+
}), method(object({}), object({
|
|
15891
|
+
key: string(),
|
|
15892
|
+
fingerprint: string(),
|
|
15893
|
+
keySource: KeychainKeySourceSchema
|
|
15894
|
+
}), {
|
|
15895
|
+
kind: "mutation",
|
|
15896
|
+
auth: "admin",
|
|
15897
|
+
caller: "required"
|
|
15898
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15899
|
+
archivedCollection: string().nullable(),
|
|
15900
|
+
archived: number().int()
|
|
15901
|
+
}), {
|
|
15902
|
+
kind: "mutation",
|
|
15903
|
+
auth: "admin",
|
|
15904
|
+
caller: "required"
|
|
15905
|
+
}), method(object({}), object({
|
|
15906
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15907
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15908
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15909
|
+
kind: "mutation",
|
|
15910
|
+
auth: "admin",
|
|
15911
|
+
caller: "required"
|
|
15912
|
+
});
|
|
14122
15913
|
method(_void(), object({
|
|
14123
15914
|
id: string(),
|
|
14124
15915
|
name: string(),
|
|
@@ -15457,7 +17248,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15457
17248
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15458
17249
|
var DevicePersistConfigPayloadSchema = object({
|
|
15459
17250
|
deviceId: number(),
|
|
15460
|
-
data: record(string(), unknown())
|
|
17251
|
+
data: record(string(), unknown()),
|
|
17252
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17253
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17254
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17255
|
+
secretConfigPaths: array(string()).optional()
|
|
15461
17256
|
});
|
|
15462
17257
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15463
17258
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17060,7 +18855,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17060
18855
|
* `login-method` — collection cap through which auth addons contribute
|
|
17061
18856
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17062
18857
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17063
|
-
* every auth addon (OIDC,
|
|
18858
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17064
18859
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17065
18860
|
* procedure aggregates them for the unauthenticated login page.
|
|
17066
18861
|
*
|
|
@@ -17068,8 +18863,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17068
18863
|
*
|
|
17069
18864
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17070
18865
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17071
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17072
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18866
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17073
18867
|
* login page needs NO change.
|
|
17074
18868
|
*
|
|
17075
18869
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17088,8 +18882,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17088
18882
|
* decision.
|
|
17089
18883
|
*
|
|
17090
18884
|
* Every contribution carries a `stage`:
|
|
17091
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17092
|
-
*
|
|
18885
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18886
|
+
* buttons; a usernameless passkey).
|
|
17093
18887
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17094
18888
|
* returned `factors` (passkey-as-2FA today).
|
|
17095
18889
|
*
|
|
@@ -17116,7 +18910,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17116
18910
|
* The provider names an external identity a signed-in user can link to
|
|
17117
18911
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17118
18912
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17119
|
-
* whatever their id. Absent / false — a login button only
|
|
18913
|
+
* whatever their id. Absent / false — a login button only.
|
|
17120
18914
|
*/
|
|
17121
18915
|
linkable: boolean().optional()
|
|
17122
18916
|
}),
|
|
@@ -20971,8 +22765,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20971
22765
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20972
22766
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20973
22767
|
* distinction was only ever used to route role-specific procedures
|
|
20974
|
-
* which we no longer have.
|
|
20975
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22768
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20976
22769
|
* with `isAdmin: false` + an explicit scope list.
|
|
20977
22770
|
*/
|
|
20978
22771
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22474,8 +24267,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22474
24267
|
]);
|
|
22475
24268
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22476
24269
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22477
|
-
/**
|
|
22478
|
-
|
|
24270
|
+
/**
|
|
24271
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24272
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24273
|
+
*
|
|
24274
|
+
* - `operator` — drawn by hand.
|
|
24275
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24276
|
+
* model, or a larger teacher model).
|
|
24277
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24278
|
+
* back from the track store (never a re-run).
|
|
24279
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24280
|
+
*/
|
|
24281
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24282
|
+
"operator",
|
|
24283
|
+
"assist",
|
|
24284
|
+
"pipeline",
|
|
24285
|
+
"llm"
|
|
24286
|
+
]);
|
|
22479
24287
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22480
24288
|
var RetrainBboxSchema = object({
|
|
22481
24289
|
x: number(),
|
|
@@ -22493,7 +24301,8 @@ var RetrainBboxSchema = object({
|
|
|
22493
24301
|
*/
|
|
22494
24302
|
var RetrainAnnotationSchema = object({
|
|
22495
24303
|
id: string(),
|
|
22496
|
-
|
|
24304
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24305
|
+
trackId: string().optional(),
|
|
22497
24306
|
deviceId: number(),
|
|
22498
24307
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22499
24308
|
mediaKey: string(),
|
|
@@ -22542,13 +24351,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22542
24351
|
* fail, whatever became of the original. */
|
|
22543
24352
|
copied: boolean()
|
|
22544
24353
|
});
|
|
24354
|
+
/**
|
|
24355
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24356
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24357
|
+
* box recorded on the source media row when there is one, else the track
|
|
24358
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24359
|
+
* until the operator confirms it.
|
|
24360
|
+
*/
|
|
24361
|
+
var RetrainPipelineBoxSchema = object({
|
|
24362
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24363
|
+
bbox: RetrainBboxSchema,
|
|
24364
|
+
macroClass: RetrainMacroClassSchema,
|
|
24365
|
+
label: string().optional(),
|
|
24366
|
+
subLabel: string().optional(),
|
|
24367
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24368
|
+
score: number().optional(),
|
|
24369
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24370
|
+
modelId: string().optional(),
|
|
24371
|
+
trackId: string(),
|
|
24372
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24373
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24374
|
+
basis: _enum(["subject-box", "position"]),
|
|
24375
|
+
deltaMs: number()
|
|
24376
|
+
});
|
|
24377
|
+
/**
|
|
24378
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24379
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24380
|
+
* track at all.
|
|
24381
|
+
*/
|
|
24382
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22545
24383
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22546
24384
|
var RetrainFrameSchema = object({
|
|
22547
24385
|
frameId: string(),
|
|
22548
24386
|
deviceId: number(),
|
|
22549
|
-
|
|
22550
|
-
/**
|
|
22551
|
-
|
|
24387
|
+
origin: RetrainFrameOriginSchema,
|
|
24388
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24389
|
+
trackId: string().optional(),
|
|
24390
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24391
|
+
* Absent on a recording still. */
|
|
24392
|
+
sourceMediaId: number().int().optional(),
|
|
24393
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24394
|
+
epochMs: number().optional(),
|
|
22552
24395
|
sourceKind: MediaFileKindEnum,
|
|
22553
24396
|
sizeBytes: number().int(),
|
|
22554
24397
|
width: number().int(),
|
|
@@ -22559,7 +24402,12 @@ var RetrainFrameSchema = object({
|
|
|
22559
24402
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22560
24403
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22561
24404
|
* a false positive. */
|
|
22562
|
-
complete: boolean()
|
|
24405
|
+
complete: boolean(),
|
|
24406
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24407
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24408
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24409
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24410
|
+
collectionIds: array(string()).readonly().optional()
|
|
22563
24411
|
});
|
|
22564
24412
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22565
24413
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22590,6 +24438,11 @@ var RetrainFrameListSchema = object({
|
|
|
22590
24438
|
var RetrainExportFilterSchema = object({
|
|
22591
24439
|
deviceIds: array(number()).optional(),
|
|
22592
24440
|
frameIds: array(string()).max(2e4).optional(),
|
|
24441
|
+
/** Only frames in at least one of these named collections. */
|
|
24442
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24443
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24444
|
+
* unknown id selects nothing. */
|
|
24445
|
+
datasetVersionId: string().optional(),
|
|
22593
24446
|
batchId: string().optional(),
|
|
22594
24447
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22595
24448
|
completeOnly: boolean().optional()
|
|
@@ -22654,6 +24507,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22654
24507
|
reason: string(),
|
|
22655
24508
|
detail: string().optional()
|
|
22656
24509
|
})]);
|
|
24510
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24511
|
+
var RetrainCollectionSchema = object({
|
|
24512
|
+
id: string(),
|
|
24513
|
+
name: string(),
|
|
24514
|
+
createdAt: number(),
|
|
24515
|
+
frameCount: number().int()
|
|
24516
|
+
});
|
|
24517
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24518
|
+
kind: literal("created"),
|
|
24519
|
+
collection: RetrainCollectionSchema
|
|
24520
|
+
}), object({
|
|
24521
|
+
kind: literal("refused"),
|
|
24522
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24523
|
+
})]);
|
|
24524
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24525
|
+
kind: literal("renamed"),
|
|
24526
|
+
collection: RetrainCollectionSchema
|
|
24527
|
+
}), object({
|
|
24528
|
+
kind: literal("refused"),
|
|
24529
|
+
reason: _enum([
|
|
24530
|
+
"empty-name",
|
|
24531
|
+
"duplicate-name",
|
|
24532
|
+
"unknown-collection"
|
|
24533
|
+
])
|
|
24534
|
+
})]);
|
|
24535
|
+
/**
|
|
24536
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24537
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24538
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24539
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24540
|
+
*/
|
|
24541
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24542
|
+
kind: literal("added"),
|
|
24543
|
+
collectionId: string(),
|
|
24544
|
+
frame: RetrainFrameSchema,
|
|
24545
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24546
|
+
reused: boolean()
|
|
24547
|
+
}), object({
|
|
24548
|
+
kind: literal("refused"),
|
|
24549
|
+
reason: _enum([
|
|
24550
|
+
"unknown-collection",
|
|
24551
|
+
"still-unavailable",
|
|
24552
|
+
"still-busy",
|
|
24553
|
+
"unreadable-image",
|
|
24554
|
+
"write-failed"
|
|
24555
|
+
]),
|
|
24556
|
+
detail: string().optional()
|
|
24557
|
+
})]);
|
|
24558
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24559
|
+
var RetrainAssistProfileSchema = object({
|
|
24560
|
+
id: string(),
|
|
24561
|
+
name: string(),
|
|
24562
|
+
model: string(),
|
|
24563
|
+
kind: string(),
|
|
24564
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24565
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24566
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24567
|
+
leavesHouse: boolean()
|
|
24568
|
+
});
|
|
24569
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24570
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24571
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24572
|
+
var RetrainLlmReviewSchema = object({
|
|
24573
|
+
/** The `ref` the page sent the box under. */
|
|
24574
|
+
ref: string(),
|
|
24575
|
+
verdict: _enum([
|
|
24576
|
+
"confirmed",
|
|
24577
|
+
"wrong-class",
|
|
24578
|
+
"not-an-object",
|
|
24579
|
+
"uncertain"
|
|
24580
|
+
]),
|
|
24581
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24582
|
+
reason: string()
|
|
24583
|
+
});
|
|
24584
|
+
/**
|
|
24585
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24586
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24587
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24588
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24589
|
+
*/
|
|
24590
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24591
|
+
kind: literal("proposed"),
|
|
24592
|
+
profileId: string(),
|
|
24593
|
+
model: string(),
|
|
24594
|
+
/** The frame was sent outside the house for this answer. */
|
|
24595
|
+
leftHouse: boolean(),
|
|
24596
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24597
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24598
|
+
rejected: number().int()
|
|
24599
|
+
}), object({
|
|
24600
|
+
kind: literal("refused"),
|
|
24601
|
+
reason: _enum([
|
|
24602
|
+
"unknown-frame",
|
|
24603
|
+
"unreadable-frame",
|
|
24604
|
+
"unknown-profile",
|
|
24605
|
+
"profile-disabled",
|
|
24606
|
+
"no-vision",
|
|
24607
|
+
"cloud-not-confirmed",
|
|
24608
|
+
"llm-error",
|
|
24609
|
+
"malformed-answer"
|
|
24610
|
+
]),
|
|
24611
|
+
detail: string().optional()
|
|
24612
|
+
})]);
|
|
24613
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24614
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24615
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24616
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24617
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24618
|
+
});
|
|
24619
|
+
/** The counts a dataset is judged by. */
|
|
24620
|
+
var RetrainDatasetStatsSchema = object({
|
|
24621
|
+
frames: number().int(),
|
|
24622
|
+
completeFrames: number().int(),
|
|
24623
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24624
|
+
completeness: number(),
|
|
24625
|
+
/** Boxes to learn (model errors excluded). */
|
|
24626
|
+
subjects: number().int(),
|
|
24627
|
+
modelErrors: number().int(),
|
|
24628
|
+
/** Complete frames with no subject. */
|
|
24629
|
+
hardNegatives: number().int(),
|
|
24630
|
+
/** Subjects per class × camera × day/night. */
|
|
24631
|
+
cells: array(object({
|
|
24632
|
+
macroClass: string(),
|
|
24633
|
+
deviceId: number(),
|
|
24634
|
+
lighting: _enum([
|
|
24635
|
+
"day",
|
|
24636
|
+
"night",
|
|
24637
|
+
"unknown"
|
|
24638
|
+
]),
|
|
24639
|
+
subjects: number().int(),
|
|
24640
|
+
frames: number().int()
|
|
24641
|
+
})).readonly(),
|
|
24642
|
+
cameras: array(object({
|
|
24643
|
+
deviceId: number(),
|
|
24644
|
+
frames: number().int(),
|
|
24645
|
+
completeFrames: number().int()
|
|
24646
|
+
})).readonly()
|
|
24647
|
+
});
|
|
24648
|
+
/** An immutable dataset version, without its frame list. */
|
|
24649
|
+
var RetrainDatasetVersionSchema = object({
|
|
24650
|
+
id: string(),
|
|
24651
|
+
name: string(),
|
|
24652
|
+
createdAt: number(),
|
|
24653
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24654
|
+
layout: RetrainExportLayoutSchema,
|
|
24655
|
+
completeOnly: boolean(),
|
|
24656
|
+
frameCount: number().int(),
|
|
24657
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24658
|
+
annotationHash: string(),
|
|
24659
|
+
/** The export manifest schema the version was cut under. */
|
|
24660
|
+
manifestSchema: string(),
|
|
24661
|
+
stats: RetrainDatasetStatsSchema
|
|
24662
|
+
});
|
|
24663
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24664
|
+
kind: literal("created"),
|
|
24665
|
+
version: RetrainDatasetVersionSchema
|
|
24666
|
+
}), object({
|
|
24667
|
+
kind: literal("refused"),
|
|
24668
|
+
reason: _enum([
|
|
24669
|
+
"empty-name",
|
|
24670
|
+
"duplicate-name",
|
|
24671
|
+
"no-frames"
|
|
24672
|
+
])
|
|
24673
|
+
})]);
|
|
22657
24674
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22658
24675
|
var RetrainTransitionResultSchema = object({
|
|
22659
24676
|
trackId: string(),
|
|
@@ -23371,7 +25388,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23371
25388
|
auth: "admin"
|
|
23372
25389
|
}), method(object({
|
|
23373
25390
|
deviceId: number(),
|
|
23374
|
-
trackId: string(),
|
|
25391
|
+
trackId: string().optional(),
|
|
23375
25392
|
frameId: string()
|
|
23376
25393
|
}), object({
|
|
23377
25394
|
removed: boolean(),
|
|
@@ -23388,7 +25405,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23388
25405
|
auth: "admin"
|
|
23389
25406
|
}), method(object({
|
|
23390
25407
|
deviceId: number(),
|
|
23391
|
-
|
|
25408
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25409
|
+
trackId: string().optional(),
|
|
23392
25410
|
frameId: string(),
|
|
23393
25411
|
subject: RetrainAssistSubjectSchema,
|
|
23394
25412
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23396,12 +25414,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23396
25414
|
}), RetrainAssistResultSchema, {
|
|
23397
25415
|
kind: "mutation",
|
|
23398
25416
|
auth: "admin"
|
|
23399
|
-
}), method(object({
|
|
25417
|
+
}), method(object({
|
|
25418
|
+
trackId: string().optional(),
|
|
25419
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25420
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23400
25421
|
kind: "query",
|
|
23401
25422
|
auth: "admin"
|
|
23402
25423
|
}), method(object({
|
|
23403
25424
|
deviceId: number(),
|
|
23404
|
-
|
|
25425
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25426
|
+
trackId: string().optional(),
|
|
23405
25427
|
frameId: string(),
|
|
23406
25428
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23407
25429
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23424,7 +25446,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23424
25446
|
auth: "admin"
|
|
23425
25447
|
}), method(object({
|
|
23426
25448
|
deviceId: number(),
|
|
23427
|
-
trackId: string(),
|
|
25449
|
+
trackId: string().optional(),
|
|
23428
25450
|
frameId: string(),
|
|
23429
25451
|
complete: boolean()
|
|
23430
25452
|
}), RetrainFrameSchema, {
|
|
@@ -23438,6 +25460,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23438
25460
|
kind: "mutation",
|
|
23439
25461
|
auth: "admin",
|
|
23440
25462
|
timeoutMs: 60 * 6e4
|
|
25463
|
+
}), method(object({
|
|
25464
|
+
filter: RetrainExportFilterSchema,
|
|
25465
|
+
layout: RetrainExportLayoutSchema
|
|
25466
|
+
}), object({
|
|
25467
|
+
ticket: PeerBytesTicketSchema,
|
|
25468
|
+
frames: number().int(),
|
|
25469
|
+
annotations: number().int()
|
|
25470
|
+
}), {
|
|
25471
|
+
kind: "mutation",
|
|
25472
|
+
auth: "admin",
|
|
25473
|
+
timeoutMs: 12e4
|
|
25474
|
+
}), method(object({
|
|
25475
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25476
|
+
completeOnly: boolean().optional()
|
|
25477
|
+
}), RetrainDatasetStatsSchema, {
|
|
25478
|
+
kind: "query",
|
|
25479
|
+
auth: "admin"
|
|
25480
|
+
}), method(object({
|
|
25481
|
+
name: string().max(120),
|
|
25482
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25483
|
+
layout: RetrainExportLayoutSchema,
|
|
25484
|
+
completeOnly: boolean()
|
|
25485
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25486
|
+
kind: "mutation",
|
|
25487
|
+
auth: "admin",
|
|
25488
|
+
timeoutMs: 12e4
|
|
25489
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25490
|
+
kind: "query",
|
|
25491
|
+
auth: "admin"
|
|
25492
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25493
|
+
kind: "mutation",
|
|
25494
|
+
auth: "admin"
|
|
25495
|
+
}), method(object({ id: string() }), object({
|
|
25496
|
+
found: boolean(),
|
|
25497
|
+
annotationHash: string(),
|
|
25498
|
+
matches: boolean(),
|
|
25499
|
+
missingFrames: number().int()
|
|
25500
|
+
}), {
|
|
25501
|
+
kind: "query",
|
|
25502
|
+
auth: "admin",
|
|
25503
|
+
timeoutMs: 12e4
|
|
25504
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25505
|
+
kind: "query",
|
|
25506
|
+
auth: "admin"
|
|
25507
|
+
}), method(object({
|
|
25508
|
+
deviceId: number(),
|
|
25509
|
+
trackId: string().optional(),
|
|
25510
|
+
frameId: string(),
|
|
25511
|
+
profileId: string(),
|
|
25512
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25513
|
+
boxes: array(object({
|
|
25514
|
+
ref: string(),
|
|
25515
|
+
bbox: RetrainBboxSchema,
|
|
25516
|
+
macroClass: RetrainMacroClassSchema,
|
|
25517
|
+
label: string().optional()
|
|
25518
|
+
})).max(50),
|
|
25519
|
+
allowCloud: boolean()
|
|
25520
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25521
|
+
kind: "mutation",
|
|
25522
|
+
auth: "admin",
|
|
25523
|
+
timeoutMs: 18e4
|
|
25524
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25525
|
+
kind: "mutation",
|
|
25526
|
+
auth: "admin"
|
|
25527
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25528
|
+
kind: "query",
|
|
25529
|
+
auth: "admin"
|
|
25530
|
+
}), method(object({
|
|
25531
|
+
id: string(),
|
|
25532
|
+
name: string().max(120)
|
|
25533
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25534
|
+
kind: "mutation",
|
|
25535
|
+
auth: "admin"
|
|
25536
|
+
}), method(object({ id: string() }), object({
|
|
25537
|
+
deleted: boolean(),
|
|
25538
|
+
removedFrames: number().int()
|
|
25539
|
+
}), {
|
|
25540
|
+
kind: "mutation",
|
|
25541
|
+
auth: "admin"
|
|
25542
|
+
}), method(object({
|
|
25543
|
+
collectionId: string(),
|
|
25544
|
+
deviceId: number(),
|
|
25545
|
+
epochMs: number()
|
|
25546
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25547
|
+
kind: "mutation",
|
|
25548
|
+
auth: "admin",
|
|
25549
|
+
timeoutMs: 6e4
|
|
25550
|
+
}), method(object({
|
|
25551
|
+
collectionId: string(),
|
|
25552
|
+
frameIds: array(string()).min(1).max(500)
|
|
25553
|
+
}), object({
|
|
25554
|
+
added: number().int(),
|
|
25555
|
+
alreadyMember: number().int(),
|
|
25556
|
+
unknownFrameIds: array(string()).readonly()
|
|
25557
|
+
}), {
|
|
25558
|
+
kind: "mutation",
|
|
25559
|
+
auth: "admin"
|
|
25560
|
+
}), method(object({
|
|
25561
|
+
collectionId: string(),
|
|
25562
|
+
frameId: string()
|
|
25563
|
+
}), object({
|
|
25564
|
+
removed: boolean(),
|
|
25565
|
+
deletedFrame: boolean()
|
|
25566
|
+
}), {
|
|
25567
|
+
kind: "mutation",
|
|
25568
|
+
auth: "admin"
|
|
25569
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25570
|
+
kind: "query",
|
|
25571
|
+
auth: "admin"
|
|
23441
25572
|
}), method(object({
|
|
23442
25573
|
/** Which of the three event tables owns the row. */
|
|
23443
25574
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24061,13 +26192,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24061
26192
|
object({
|
|
24062
26193
|
kind: literal("no-family-build"),
|
|
24063
26194
|
format: ModelFormatSchema$1
|
|
26195
|
+
}),
|
|
26196
|
+
object({
|
|
26197
|
+
kind: literal("kept-custom-pin"),
|
|
26198
|
+
modelId: string(),
|
|
26199
|
+
deviceKey: string()
|
|
24064
26200
|
})
|
|
24065
26201
|
]);
|
|
26202
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26203
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26204
|
+
/**
|
|
26205
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26206
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26207
|
+
*/
|
|
26208
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26209
|
+
kind: literal("node-benchmark"),
|
|
26210
|
+
resultId: string(),
|
|
26211
|
+
measuredAtMs: number()
|
|
26212
|
+
})]);
|
|
24066
26213
|
var DeviceModelChoiceSchema = object({
|
|
24067
26214
|
modelId: string(),
|
|
24068
26215
|
p50Ms: number(),
|
|
24069
26216
|
fps: number(),
|
|
24070
26217
|
measured: boolean(),
|
|
26218
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26219
|
+
source: LatencySourceSchema.optional(),
|
|
24071
26220
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24072
26221
|
capacitySessions: number(),
|
|
24073
26222
|
personRecall: number()
|
|
@@ -24078,6 +26227,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24078
26227
|
enabled: boolean(),
|
|
24079
26228
|
available: boolean(),
|
|
24080
26229
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26230
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26231
|
+
kept: KeptReasonSchema.optional(),
|
|
24081
26232
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24082
26233
|
});
|
|
24083
26234
|
var NodeRecommendationSchema = object({
|
|
@@ -24131,6 +26282,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24131
26282
|
kind: literal("coral-enabled"),
|
|
24132
26283
|
nodeId: string(),
|
|
24133
26284
|
deviceKey: string()
|
|
26285
|
+
}),
|
|
26286
|
+
object({
|
|
26287
|
+
kind: literal("custom-pin-kept"),
|
|
26288
|
+
nodeId: string(),
|
|
26289
|
+
deviceKey: string().nullable(),
|
|
26290
|
+
deviceId: number().nullable(),
|
|
26291
|
+
modelId: string()
|
|
26292
|
+
}),
|
|
26293
|
+
object({
|
|
26294
|
+
kind: literal("custom-registry-unreadable"),
|
|
26295
|
+
error: string()
|
|
24134
26296
|
})
|
|
24135
26297
|
]);
|
|
24136
26298
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24309,13 +26471,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24309
26471
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24310
26472
|
});
|
|
24311
26473
|
/**
|
|
24312
|
-
* Where the node and device shares come from (D750, D755).
|
|
24313
|
-
* - `
|
|
24314
|
-
*
|
|
24315
|
-
*
|
|
24316
|
-
*
|
|
24317
|
-
*
|
|
24318
|
-
*
|
|
26474
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26475
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26476
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26477
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26478
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26479
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26480
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26481
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24319
26482
|
* - `manual` — the operator's stored sliders.
|
|
24320
26483
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24321
26484
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24364,6 +26527,362 @@ var EffectiveSharesSchema = object({
|
|
|
24364
26527
|
nodeWeights: record(string(), number()),
|
|
24365
26528
|
deviceWeights: record(string(), record(string(), number()))
|
|
24366
26529
|
});
|
|
26530
|
+
/**
|
|
26531
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26532
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26533
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26534
|
+
* shares read.
|
|
26535
|
+
*
|
|
26536
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26537
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26538
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26539
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26540
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26541
|
+
*
|
|
26542
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26543
|
+
* cross a process at frame rate, D9):
|
|
26544
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26545
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26546
|
+
* interval;
|
|
26547
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26548
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26549
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26550
|
+
* CPU, RAM or the event loop give out.
|
|
26551
|
+
*/
|
|
26552
|
+
/** Defaults and bounds, one place. */
|
|
26553
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26554
|
+
fpsPerStream: 10,
|
|
26555
|
+
budgetMinutes: 45,
|
|
26556
|
+
minBudgetMinutes: 10,
|
|
26557
|
+
maxBudgetMinutes: 120,
|
|
26558
|
+
/** A result older than this no longer beats the table. */
|
|
26559
|
+
staleAfterDays: 30,
|
|
26560
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26561
|
+
settleSec: 5,
|
|
26562
|
+
/** Accounted window per ramp step. */
|
|
26563
|
+
measureSec: 20,
|
|
26564
|
+
/** Longest the drain may take before the run is refused. */
|
|
26565
|
+
drainTimeoutSec: 120,
|
|
26566
|
+
/** Candidate models per device in one run. */
|
|
26567
|
+
maxModelsPerDevice: 6
|
|
26568
|
+
};
|
|
26569
|
+
/** The two measurements a run can make. */
|
|
26570
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26571
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26572
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26573
|
+
deviceKey: string().min(1),
|
|
26574
|
+
/**
|
|
26575
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26576
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26577
|
+
*/
|
|
26578
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26579
|
+
});
|
|
26580
|
+
/** What the operator confirmed. */
|
|
26581
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26582
|
+
nodeId: string().min(1),
|
|
26583
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26584
|
+
/** Which measurements run. At least one. */
|
|
26585
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26586
|
+
/**
|
|
26587
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26588
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26589
|
+
* detector always runs.
|
|
26590
|
+
*/
|
|
26591
|
+
steps: array(string().min(1)).default([]),
|
|
26592
|
+
/** Offered rate of one stream / session. */
|
|
26593
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26594
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26595
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26596
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26597
|
+
keepDownloadedModels: boolean().default(false),
|
|
26598
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26599
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26600
|
+
});
|
|
26601
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26602
|
+
kind: _enum([
|
|
26603
|
+
"benchmark-active",
|
|
26604
|
+
"node-offline",
|
|
26605
|
+
"unknown-device",
|
|
26606
|
+
"no-phase",
|
|
26607
|
+
"insufficient-headroom"
|
|
26608
|
+
]),
|
|
26609
|
+
detail: string(),
|
|
26610
|
+
overridable: boolean()
|
|
26611
|
+
});
|
|
26612
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26613
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26614
|
+
deviceId: number(),
|
|
26615
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26616
|
+
placedOnNode: boolean(),
|
|
26617
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26618
|
+
pinnedToNode: boolean()
|
|
26619
|
+
});
|
|
26620
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26621
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26622
|
+
deviceId: number(),
|
|
26623
|
+
reason: literal("only-frame-source")
|
|
26624
|
+
});
|
|
26625
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26626
|
+
nodeId: string(),
|
|
26627
|
+
online: boolean(),
|
|
26628
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26629
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26630
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26631
|
+
estimatedDurationMs: number(),
|
|
26632
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26633
|
+
budgetMs: number(),
|
|
26634
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26635
|
+
steps: array(string()).readonly(),
|
|
26636
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26637
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26638
|
+
headroom: object({
|
|
26639
|
+
sessionsNow: number(),
|
|
26640
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26641
|
+
}),
|
|
26642
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26643
|
+
canStart: boolean()
|
|
26644
|
+
});
|
|
26645
|
+
/** Where the measuring runner is. */
|
|
26646
|
+
var NodeBenchProgressSchema = object({
|
|
26647
|
+
phase: _enum([
|
|
26648
|
+
"preparing",
|
|
26649
|
+
"device",
|
|
26650
|
+
"pipeline",
|
|
26651
|
+
"cleanup"
|
|
26652
|
+
]),
|
|
26653
|
+
deviceKey: string().nullable(),
|
|
26654
|
+
modelId: string().nullable(),
|
|
26655
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26656
|
+
load: number().nullable(),
|
|
26657
|
+
cellsDone: number(),
|
|
26658
|
+
cellsTotal: number(),
|
|
26659
|
+
message: string()
|
|
26660
|
+
});
|
|
26661
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26662
|
+
var NodeBenchLimitSchema = _enum([
|
|
26663
|
+
"p95",
|
|
26664
|
+
"drops",
|
|
26665
|
+
"errors",
|
|
26666
|
+
"stall",
|
|
26667
|
+
"cpu",
|
|
26668
|
+
"ram",
|
|
26669
|
+
"none"
|
|
26670
|
+
]);
|
|
26671
|
+
var NodeBenchRampStepSchema = object({
|
|
26672
|
+
load: number(),
|
|
26673
|
+
pass: boolean(),
|
|
26674
|
+
p95Ms: number(),
|
|
26675
|
+
dropRatio: number(),
|
|
26676
|
+
/** Completed frames per second over the accounted window. */
|
|
26677
|
+
fps: number(),
|
|
26678
|
+
cpuPct: number().nullable(),
|
|
26679
|
+
ramFreePct: number().nullable(),
|
|
26680
|
+
failReasons: array(string()).readonly()
|
|
26681
|
+
});
|
|
26682
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26683
|
+
phase: literal("device"),
|
|
26684
|
+
deviceKey: string(),
|
|
26685
|
+
modelId: string(),
|
|
26686
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26687
|
+
p50Ms: number(),
|
|
26688
|
+
p95Ms: number(),
|
|
26689
|
+
p99Ms: number(),
|
|
26690
|
+
/** Frames per second sustained at the last passing step. */
|
|
26691
|
+
fps: number(),
|
|
26692
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26693
|
+
kMax: number(),
|
|
26694
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26695
|
+
/** First call (model load + warm-up). */
|
|
26696
|
+
warmupMs: number(),
|
|
26697
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26698
|
+
}), object({
|
|
26699
|
+
phase: literal("pipeline"),
|
|
26700
|
+
deviceKey: string(),
|
|
26701
|
+
modelId: string(),
|
|
26702
|
+
steps: array(string()).readonly(),
|
|
26703
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26704
|
+
maxSessions: number(),
|
|
26705
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26706
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26707
|
+
stepsFired: array(string()).readonly(),
|
|
26708
|
+
warmupMs: number(),
|
|
26709
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26710
|
+
})]);
|
|
26711
|
+
/**
|
|
26712
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26713
|
+
* the node no longer beats the table.
|
|
26714
|
+
*/
|
|
26715
|
+
var NodeBenchFingerprintSchema = object({
|
|
26716
|
+
pipelineVersion: string().nullable(),
|
|
26717
|
+
cpuModel: string().nullable(),
|
|
26718
|
+
ramGb: number().nullable(),
|
|
26719
|
+
os: string().nullable(),
|
|
26720
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26721
|
+
pools: record(string(), object({
|
|
26722
|
+
runtime: string(),
|
|
26723
|
+
numWorkers: number(),
|
|
26724
|
+
concurrency: number(),
|
|
26725
|
+
batchMode: string()
|
|
26726
|
+
})).default({})
|
|
26727
|
+
});
|
|
26728
|
+
/** The frames the run used. */
|
|
26729
|
+
var NodeBenchClipSchema = object({
|
|
26730
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26731
|
+
id: string(),
|
|
26732
|
+
revision: string().nullable(),
|
|
26733
|
+
frames: number(),
|
|
26734
|
+
width: number(),
|
|
26735
|
+
height: number()
|
|
26736
|
+
});
|
|
26737
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26738
|
+
runId: string().min(1),
|
|
26739
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26740
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26741
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26742
|
+
steps: array(string()).default([]),
|
|
26743
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26744
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26745
|
+
deadlineAtMs: number(),
|
|
26746
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26747
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26748
|
+
keepDownloadedModels: boolean().default(false)
|
|
26749
|
+
});
|
|
26750
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26751
|
+
"running",
|
|
26752
|
+
"done",
|
|
26753
|
+
"failed",
|
|
26754
|
+
"aborted"
|
|
26755
|
+
]);
|
|
26756
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26757
|
+
runId: string(),
|
|
26758
|
+
nodeId: string(),
|
|
26759
|
+
state: NodeBenchRunnerStateSchema,
|
|
26760
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26761
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26762
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26763
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26764
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26765
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26766
|
+
activeCameraIds: array(number()).readonly(),
|
|
26767
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26768
|
+
deletedModels: array(string()).readonly(),
|
|
26769
|
+
error: string().nullable(),
|
|
26770
|
+
startedAtMs: number(),
|
|
26771
|
+
finishedAtMs: number().nullable()
|
|
26772
|
+
});
|
|
26773
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26774
|
+
"draining",
|
|
26775
|
+
"measuring",
|
|
26776
|
+
"restoring",
|
|
26777
|
+
"done",
|
|
26778
|
+
"failed",
|
|
26779
|
+
"aborted"
|
|
26780
|
+
]);
|
|
26781
|
+
/** Why a run ended. */
|
|
26782
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26783
|
+
"completed",
|
|
26784
|
+
"operator-abort",
|
|
26785
|
+
"deadline",
|
|
26786
|
+
"node-lost",
|
|
26787
|
+
"runner-lost",
|
|
26788
|
+
"hub-restart",
|
|
26789
|
+
"drain-timeout",
|
|
26790
|
+
"failed"
|
|
26791
|
+
]);
|
|
26792
|
+
var NodeBenchmarkRunSchema = object({
|
|
26793
|
+
runId: string(),
|
|
26794
|
+
nodeId: string(),
|
|
26795
|
+
state: NodeBenchmarkStateSchema,
|
|
26796
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26797
|
+
startedAtMs: number(),
|
|
26798
|
+
deadlineAtMs: number(),
|
|
26799
|
+
finishedAtMs: number().nullable(),
|
|
26800
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26801
|
+
error: string().nullable(),
|
|
26802
|
+
/** Cameras moved off the node for the run. */
|
|
26803
|
+
moved: array(number()).readonly(),
|
|
26804
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26805
|
+
staying: array(number()).readonly(),
|
|
26806
|
+
/** Something else ran on the node's pools during the run. */
|
|
26807
|
+
contaminated: boolean(),
|
|
26808
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26809
|
+
resultIds: array(string()).readonly()
|
|
26810
|
+
});
|
|
26811
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26812
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26813
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26814
|
+
modeNodeId: string().nullable(),
|
|
26815
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26816
|
+
});
|
|
26817
|
+
/**
|
|
26818
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26819
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26820
|
+
* ends, never by anyone else.
|
|
26821
|
+
*/
|
|
26822
|
+
var NodeBenchmarkResultSchema = object({
|
|
26823
|
+
id: string(),
|
|
26824
|
+
runId: string(),
|
|
26825
|
+
nodeId: string(),
|
|
26826
|
+
cell: NodeBenchCellSchema,
|
|
26827
|
+
fpsPerStream: number(),
|
|
26828
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26829
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26830
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26831
|
+
contaminated: boolean(),
|
|
26832
|
+
stayingCameras: array(number()).readonly(),
|
|
26833
|
+
/** The run ended early; the cell itself completed. */
|
|
26834
|
+
partialRun: boolean(),
|
|
26835
|
+
measuredAtMs: number()
|
|
26836
|
+
});
|
|
26837
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26838
|
+
nodeId: string().optional(),
|
|
26839
|
+
deviceKey: string().optional()
|
|
26840
|
+
});
|
|
26841
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26842
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26843
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26844
|
+
standing: _enum([
|
|
26845
|
+
"fresh",
|
|
26846
|
+
"stale",
|
|
26847
|
+
"superseded"
|
|
26848
|
+
]),
|
|
26849
|
+
staleWhy: _enum([
|
|
26850
|
+
"age",
|
|
26851
|
+
"runtime",
|
|
26852
|
+
"pool-tuning"
|
|
26853
|
+
]).nullable()
|
|
26854
|
+
});
|
|
26855
|
+
object({
|
|
26856
|
+
runId: string(),
|
|
26857
|
+
nodeId: string(),
|
|
26858
|
+
startedAtMs: number(),
|
|
26859
|
+
deadlineAtMs: number(),
|
|
26860
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26861
|
+
moved: array(number()).readonly(),
|
|
26862
|
+
staying: array(number()).readonly()
|
|
26863
|
+
});
|
|
26864
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26865
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26866
|
+
nodeId: string(),
|
|
26867
|
+
reachable: boolean(),
|
|
26868
|
+
devices: array(object({
|
|
26869
|
+
deviceKey: string(),
|
|
26870
|
+
enabled: boolean(),
|
|
26871
|
+
available: boolean(),
|
|
26872
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26873
|
+
suggested: array(string()).readonly(),
|
|
26874
|
+
/** Every root detector the device has a build for. */
|
|
26875
|
+
all: array(string()).readonly(),
|
|
26876
|
+
/** The model the device runs now, when pinned. */
|
|
26877
|
+
currentModelId: string().nullable()
|
|
26878
|
+
})).readonly(),
|
|
26879
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26880
|
+
steps: array(object({
|
|
26881
|
+
id: string(),
|
|
26882
|
+
name: string(),
|
|
26883
|
+
slot: string()
|
|
26884
|
+
})).readonly()
|
|
26885
|
+
});
|
|
24367
26886
|
object({
|
|
24368
26887
|
activeCameras: number(),
|
|
24369
26888
|
throttledCameras: number(),
|
|
@@ -25492,7 +28011,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25492
28011
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25493
28012
|
deviceId: number(),
|
|
25494
28013
|
trackId: string()
|
|
25495
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28014
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28015
|
+
accepted: literal(true),
|
|
28016
|
+
runId: string()
|
|
28017
|
+
}), {
|
|
28018
|
+
kind: "mutation",
|
|
28019
|
+
auth: "admin"
|
|
28020
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28021
|
+
kind: "mutation",
|
|
28022
|
+
auth: "admin"
|
|
28023
|
+
});
|
|
25496
28024
|
var CameraPipelineConfigSchema = object({
|
|
25497
28025
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25498
28026
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26131,6 +28659,21 @@ method(object({
|
|
|
26131
28659
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26132
28660
|
kind: "mutation",
|
|
26133
28661
|
auth: "admin"
|
|
28662
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28663
|
+
kind: literal("started"),
|
|
28664
|
+
runId: string()
|
|
28665
|
+
}), object({
|
|
28666
|
+
kind: literal("refused"),
|
|
28667
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28668
|
+
})]), {
|
|
28669
|
+
kind: "mutation",
|
|
28670
|
+
auth: "admin"
|
|
28671
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28672
|
+
kind: "mutation",
|
|
28673
|
+
auth: "admin"
|
|
28674
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28675
|
+
kind: "mutation",
|
|
28676
|
+
auth: "admin"
|
|
26134
28677
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26135
28678
|
deviceId: number(),
|
|
26136
28679
|
addonId: string(),
|
|
@@ -26536,8 +29079,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26536
29079
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26537
29080
|
*
|
|
26538
29081
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26539
|
-
* one for transactional / one for notifications). Consumers (
|
|
26540
|
-
*
|
|
29082
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29083
|
+
* addons, …) walk the collection and pick the first
|
|
26541
29084
|
* ready provider OR target a specific addonId.
|
|
26542
29085
|
*
|
|
26543
29086
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26820,7 +29363,7 @@ targets: array(object({
|
|
|
26820
29363
|
};
|
|
26821
29364
|
/**
|
|
26822
29365
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26823
|
-
* providers (OIDC, SAML,
|
|
29366
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26824
29367
|
* carrying the post-callback claims before redirecting back to
|
|
26825
29368
|
* `/api/auth/sso/finish`.
|
|
26826
29369
|
*
|
|
@@ -26883,7 +29426,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26883
29426
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26884
29427
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26885
29428
|
*/
|
|
26886
|
-
issuer: string().optional()
|
|
29429
|
+
issuer: string().optional(),
|
|
29430
|
+
/**
|
|
29431
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29432
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29433
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29434
|
+
* any other browser.
|
|
29435
|
+
*/
|
|
29436
|
+
browserBinding: string().optional()
|
|
26887
29437
|
});
|
|
26888
29438
|
method(object({
|
|
26889
29439
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32751,6 +35301,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32751
35301
|
enabled: boolean().optional(),
|
|
32752
35302
|
info: record(string(), unknown()).optional(),
|
|
32753
35303
|
settings: record(string(), unknown()).optional(),
|
|
35304
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
35305
|
+
* the keychain, not the table (D787). */
|
|
35306
|
+
secretKeys: array(string()).optional(),
|
|
32754
35307
|
skipRestart: boolean().optional()
|
|
32755
35308
|
});
|
|
32756
35309
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32774,7 +35327,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32774
35327
|
auth: "admin"
|
|
32775
35328
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32776
35329
|
id: string(),
|
|
32777
|
-
settings: record(string(), unknown())
|
|
35330
|
+
settings: record(string(), unknown()),
|
|
35331
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
35332
|
+
secretKeys: array(string()).optional()
|
|
32778
35333
|
}), object({ success: boolean() }), {
|
|
32779
35334
|
kind: "mutation",
|
|
32780
35335
|
auth: "admin"
|
|
@@ -40008,16 +42563,6 @@ var ApiKeySummarySchema = object({
|
|
|
40008
42563
|
createdAt: number(),
|
|
40009
42564
|
lastUsedAt: number().optional()
|
|
40010
42565
|
});
|
|
40011
|
-
var CreateApiKeyInputSchema = object({
|
|
40012
|
-
label: string(),
|
|
40013
|
-
isAdmin: boolean().default(false),
|
|
40014
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
40015
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
40016
|
-
});
|
|
40017
|
-
var CreateApiKeyResultSchema = object({
|
|
40018
|
-
token: string(),
|
|
40019
|
-
record: ApiKeySummarySchema
|
|
40020
|
-
});
|
|
40021
42566
|
var ScopedTokenSummarySchema = object({
|
|
40022
42567
|
id: string(),
|
|
40023
42568
|
userId: string(),
|
|
@@ -40116,17 +42661,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40116
42661
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40117
42662
|
kind: "mutation",
|
|
40118
42663
|
access: "view"
|
|
40119
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40120
|
-
kind: "mutation",
|
|
40121
|
-
auth: "admin",
|
|
40122
|
-
access: "create"
|
|
40123
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42664
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40124
42665
|
kind: "mutation",
|
|
40125
42666
|
auth: "admin",
|
|
40126
42667
|
access: "delete"
|
|
40127
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40128
|
-
kind: "mutation",
|
|
40129
|
-
access: "view"
|
|
40130
42668
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40131
42669
|
kind: "mutation",
|
|
40132
42670
|
auth: "admin",
|
|
@@ -40200,15 +42738,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40200
42738
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40201
42739
|
userId: string(),
|
|
40202
42740
|
issuer: string()
|
|
40203
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40204
|
-
userId: string(),
|
|
40205
|
-
issuer: string().min(1),
|
|
40206
|
-
label: string().optional()
|
|
40207
|
-
}), object({ success: literal(true) }), {
|
|
40208
|
-
kind: "mutation",
|
|
40209
|
-
auth: "admin",
|
|
40210
|
-
access: "create"
|
|
40211
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42741
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40212
42742
|
kind: "mutation",
|
|
40213
42743
|
auth: "admin",
|
|
40214
42744
|
access: "delete"
|
|
@@ -40913,6 +43443,451 @@ var zoneRulesCapability = {
|
|
|
40913
43443
|
*/
|
|
40914
43444
|
durability: "restored"
|
|
40915
43445
|
};
|
|
43446
|
+
/**
|
|
43447
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43448
|
+
*
|
|
43449
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43450
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43451
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43452
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43453
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43454
|
+
* manifest entry and nothing else.
|
|
43455
|
+
*
|
|
43456
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43457
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43458
|
+
* Every method is `admin`: these spend money.
|
|
43459
|
+
*
|
|
43460
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43461
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43462
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43463
|
+
*
|
|
43464
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43465
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43466
|
+
* ticket the provider mints (D613).
|
|
43467
|
+
*/
|
|
43468
|
+
var TrainingGpuOptionSchema = object({
|
|
43469
|
+
id: string(),
|
|
43470
|
+
label: string(),
|
|
43471
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43472
|
+
usdPerHour: number().nonnegative(),
|
|
43473
|
+
vramGb: number().nonnegative()
|
|
43474
|
+
});
|
|
43475
|
+
var TrainingRegionOptionSchema = object({
|
|
43476
|
+
/** `''` = any region (the provider's choice). */
|
|
43477
|
+
id: string(),
|
|
43478
|
+
label: string(),
|
|
43479
|
+
priceMultiplier: number().positive()
|
|
43480
|
+
});
|
|
43481
|
+
/**
|
|
43482
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43483
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43484
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43485
|
+
*/
|
|
43486
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43487
|
+
gpuType: string(),
|
|
43488
|
+
region: string(),
|
|
43489
|
+
costCapUsd: number().nonnegative(),
|
|
43490
|
+
maxRuntimeSec: number().int().positive(),
|
|
43491
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43492
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43493
|
+
});
|
|
43494
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43495
|
+
addonId: string(),
|
|
43496
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43497
|
+
kind: string(),
|
|
43498
|
+
label: string(),
|
|
43499
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43500
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43501
|
+
maxDatasetBytes: number().int().positive(),
|
|
43502
|
+
maxRuntimeSec: number().int().positive(),
|
|
43503
|
+
freeTierNote: string().optional(),
|
|
43504
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43505
|
+
dataResidencyNote: string(),
|
|
43506
|
+
/** Credentials are present — never the values. */
|
|
43507
|
+
configured: boolean(),
|
|
43508
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43509
|
+
});
|
|
43510
|
+
var TrainingCredentialCheckSchema = object({
|
|
43511
|
+
ok: boolean(),
|
|
43512
|
+
/** Workspace / account name, when the provider says. */
|
|
43513
|
+
account: string().optional(),
|
|
43514
|
+
reason: _enum([
|
|
43515
|
+
"missing",
|
|
43516
|
+
"invalid",
|
|
43517
|
+
"forbidden",
|
|
43518
|
+
"network",
|
|
43519
|
+
"quota"
|
|
43520
|
+
]).optional(),
|
|
43521
|
+
detail: string().optional()
|
|
43522
|
+
});
|
|
43523
|
+
var ProviderJobStateSchema = _enum([
|
|
43524
|
+
"pending",
|
|
43525
|
+
"starting",
|
|
43526
|
+
"running",
|
|
43527
|
+
"succeeded",
|
|
43528
|
+
"failed",
|
|
43529
|
+
"cancelled",
|
|
43530
|
+
"lost"
|
|
43531
|
+
]);
|
|
43532
|
+
var ProviderJobStatusSchema = object({
|
|
43533
|
+
jobKey: string(),
|
|
43534
|
+
providerJobId: string().optional(),
|
|
43535
|
+
state: ProviderJobStateSchema,
|
|
43536
|
+
startedAt: number().optional(),
|
|
43537
|
+
endedAt: number().optional(),
|
|
43538
|
+
exitCode: number().int().optional(),
|
|
43539
|
+
failureReason: string().optional(),
|
|
43540
|
+
gpuType: string(),
|
|
43541
|
+
region: string().optional(),
|
|
43542
|
+
billedSeconds: number().nonnegative(),
|
|
43543
|
+
costUsd: number().nonnegative(),
|
|
43544
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43545
|
+
costIsEstimate: boolean(),
|
|
43546
|
+
lastFetchedAt: number()
|
|
43547
|
+
});
|
|
43548
|
+
/**
|
|
43549
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43550
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43551
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43552
|
+
* in `result.json`.
|
|
43553
|
+
*/
|
|
43554
|
+
var TrainerSourceRefSchema = object({
|
|
43555
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43556
|
+
repo: string().min(1),
|
|
43557
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43558
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43559
|
+
});
|
|
43560
|
+
var JobRef = {
|
|
43561
|
+
addonId: string(),
|
|
43562
|
+
jobKey: string().uuid()
|
|
43563
|
+
};
|
|
43564
|
+
var TrainingLogLineSchema = object({
|
|
43565
|
+
ts: number(),
|
|
43566
|
+
text: string()
|
|
43567
|
+
});
|
|
43568
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43569
|
+
kind: "mutation",
|
|
43570
|
+
auth: "admin",
|
|
43571
|
+
timeoutMs: 3e4
|
|
43572
|
+
}), method(object({
|
|
43573
|
+
addonId: string(),
|
|
43574
|
+
gpuType: string(),
|
|
43575
|
+
region: string(),
|
|
43576
|
+
datasetBytes: number().int().nonnegative(),
|
|
43577
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43578
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43579
|
+
}), object({
|
|
43580
|
+
usdLow: number().nonnegative(),
|
|
43581
|
+
usdHigh: number().nonnegative(),
|
|
43582
|
+
notes: array(string()).readonly()
|
|
43583
|
+
}), { auth: "admin" }), method(object({
|
|
43584
|
+
...JobRef,
|
|
43585
|
+
ticket: PeerBytesTicketSchema
|
|
43586
|
+
}), object({
|
|
43587
|
+
bytes: number().int().nonnegative(),
|
|
43588
|
+
sha256: string()
|
|
43589
|
+
}), {
|
|
43590
|
+
kind: "mutation",
|
|
43591
|
+
auth: "admin",
|
|
43592
|
+
timeoutMs: 120 * 6e4
|
|
43593
|
+
}), method(object({
|
|
43594
|
+
...JobRef,
|
|
43595
|
+
trainer: TrainerSourceRefSchema,
|
|
43596
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43597
|
+
gpuType: string(),
|
|
43598
|
+
region: string(),
|
|
43599
|
+
maxRuntimeSec: number().int().positive()
|
|
43600
|
+
}), ProviderJobStatusSchema, {
|
|
43601
|
+
kind: "mutation",
|
|
43602
|
+
auth: "admin",
|
|
43603
|
+
timeoutMs: 30 * 6e4
|
|
43604
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43605
|
+
auth: "admin",
|
|
43606
|
+
timeoutMs: 6e4
|
|
43607
|
+
}), method(object({
|
|
43608
|
+
...JobRef,
|
|
43609
|
+
cursor: string().optional(),
|
|
43610
|
+
max: number().int().min(1).max(500)
|
|
43611
|
+
}), object({
|
|
43612
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43613
|
+
cursor: string()
|
|
43614
|
+
}), {
|
|
43615
|
+
auth: "admin",
|
|
43616
|
+
timeoutMs: 6e4
|
|
43617
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43618
|
+
kind: "mutation",
|
|
43619
|
+
auth: "admin",
|
|
43620
|
+
timeoutMs: 6e4
|
|
43621
|
+
}), method(object(JobRef), object({
|
|
43622
|
+
found: boolean(),
|
|
43623
|
+
text: string().optional()
|
|
43624
|
+
}), {
|
|
43625
|
+
kind: "mutation",
|
|
43626
|
+
auth: "admin",
|
|
43627
|
+
timeoutMs: 5 * 6e4
|
|
43628
|
+
}), method(object({
|
|
43629
|
+
...JobRef,
|
|
43630
|
+
path: _enum(["bundle.tar"])
|
|
43631
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43632
|
+
kind: "mutation",
|
|
43633
|
+
auth: "admin",
|
|
43634
|
+
timeoutMs: 5 * 6e4
|
|
43635
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43636
|
+
kind: "mutation",
|
|
43637
|
+
auth: "admin",
|
|
43638
|
+
timeoutMs: 5 * 6e4
|
|
43639
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43640
|
+
auth: "admin",
|
|
43641
|
+
timeoutMs: 2 * 6e4
|
|
43642
|
+
});
|
|
43643
|
+
/**
|
|
43644
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43645
|
+
* provided by `addon-training`.
|
|
43646
|
+
*
|
|
43647
|
+
* It owns what every provider must agree on, written once:
|
|
43648
|
+
*
|
|
43649
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43650
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43651
|
+
* the export plan) and reaches this store through the five row methods
|
|
43652
|
+
* below, so the Retrain page and the export did not change.
|
|
43653
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43654
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43655
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43656
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43657
|
+
* rollback. Nothing is ever registered automatically.
|
|
43658
|
+
*
|
|
43659
|
+
* Every method is `admin`.
|
|
43660
|
+
*/
|
|
43661
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43662
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43663
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43664
|
+
var TrainingBaseModelSchema = object({
|
|
43665
|
+
modelId: string(),
|
|
43666
|
+
label: string(),
|
|
43667
|
+
weights: string(),
|
|
43668
|
+
imgsz: number().int(),
|
|
43669
|
+
baselineOnnxUrl: string(),
|
|
43670
|
+
baselineFloors: record(string(), number()),
|
|
43671
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43672
|
+
recommended: boolean()
|
|
43673
|
+
});
|
|
43674
|
+
var TrainingPresetSchema = _enum([
|
|
43675
|
+
"quick",
|
|
43676
|
+
"standard",
|
|
43677
|
+
"thorough"
|
|
43678
|
+
]);
|
|
43679
|
+
var TrainingJobRequestSchema = object({
|
|
43680
|
+
datasetVersionId: string().min(1),
|
|
43681
|
+
/** The `training-provider` addon that runs it. */
|
|
43682
|
+
addonId: string().min(1),
|
|
43683
|
+
gpuType: string().min(1),
|
|
43684
|
+
region: string(),
|
|
43685
|
+
baseModelId: string().min(1),
|
|
43686
|
+
preset: TrainingPresetSchema,
|
|
43687
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43688
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43689
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43690
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43691
|
+
});
|
|
43692
|
+
var TrainingSplitPlanSchema = object({
|
|
43693
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43694
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43695
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43696
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43697
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43698
|
+
trainSubjects: number().int()
|
|
43699
|
+
});
|
|
43700
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43701
|
+
"unknown-dataset",
|
|
43702
|
+
"unknown-provider",
|
|
43703
|
+
"provider-not-configured",
|
|
43704
|
+
"unknown-base-model",
|
|
43705
|
+
"unknown-gpu",
|
|
43706
|
+
"dataset-too-large",
|
|
43707
|
+
"no-training-subjects",
|
|
43708
|
+
"job-already-running"
|
|
43709
|
+
]);
|
|
43710
|
+
var TrainingJobPlanSchema = object({
|
|
43711
|
+
refusal: object({
|
|
43712
|
+
reason: TrainingRefusalReasonSchema,
|
|
43713
|
+
detail: string()
|
|
43714
|
+
}).nullable(),
|
|
43715
|
+
warnings: array(string()).readonly(),
|
|
43716
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43717
|
+
estimate: object({
|
|
43718
|
+
datasetBytes: number().int(),
|
|
43719
|
+
uploadMinutesAt20Mbps: number(),
|
|
43720
|
+
gpuSecondsLow: number(),
|
|
43721
|
+
gpuSecondsHigh: number(),
|
|
43722
|
+
usdLow: number(),
|
|
43723
|
+
usdHigh: number(),
|
|
43724
|
+
notes: array(string()).readonly()
|
|
43725
|
+
}).nullable(),
|
|
43726
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43727
|
+
defaults: object({
|
|
43728
|
+
maxCostUsd: number(),
|
|
43729
|
+
maxRuntimeSec: number().int()
|
|
43730
|
+
}).nullable(),
|
|
43731
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43732
|
+
dataNotice: string()
|
|
43733
|
+
});
|
|
43734
|
+
/**
|
|
43735
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43736
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43737
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43738
|
+
* result lives after the operator acted on it.
|
|
43739
|
+
*/
|
|
43740
|
+
var TrainingJobStateSchema = _enum([
|
|
43741
|
+
"uploading",
|
|
43742
|
+
"submitted",
|
|
43743
|
+
"starting",
|
|
43744
|
+
"running",
|
|
43745
|
+
"collecting",
|
|
43746
|
+
"ready",
|
|
43747
|
+
"registered",
|
|
43748
|
+
"canary",
|
|
43749
|
+
"failed",
|
|
43750
|
+
"cancelling",
|
|
43751
|
+
"cancelled",
|
|
43752
|
+
"lost",
|
|
43753
|
+
"expired",
|
|
43754
|
+
"discarded"
|
|
43755
|
+
]);
|
|
43756
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43757
|
+
"cost-cap",
|
|
43758
|
+
"runtime-cap",
|
|
43759
|
+
"upload-failed",
|
|
43760
|
+
"submit-failed",
|
|
43761
|
+
"trainer-failed",
|
|
43762
|
+
"result-invalid",
|
|
43763
|
+
"checksum-mismatch",
|
|
43764
|
+
"fetch-failed",
|
|
43765
|
+
"provider-error",
|
|
43766
|
+
"hub-restart-during-upload"
|
|
43767
|
+
]);
|
|
43768
|
+
var TrainingProgressPointSchema = object({
|
|
43769
|
+
epoch: number().int(),
|
|
43770
|
+
map50: number().nullable(),
|
|
43771
|
+
map50_95: number().nullable()
|
|
43772
|
+
});
|
|
43773
|
+
var TrainingCanarySchema = object({
|
|
43774
|
+
deviceIds: array(number().int()).readonly(),
|
|
43775
|
+
since: number(),
|
|
43776
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43777
|
+
previous: array(object({
|
|
43778
|
+
deviceId: number().int(),
|
|
43779
|
+
nodeId: string(),
|
|
43780
|
+
deviceKey: string(),
|
|
43781
|
+
patch: object({
|
|
43782
|
+
modelId: string().optional(),
|
|
43783
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43784
|
+
}).nullable()
|
|
43785
|
+
})).readonly()
|
|
43786
|
+
});
|
|
43787
|
+
var TrainingJobSchema = object({
|
|
43788
|
+
id: string(),
|
|
43789
|
+
idempotencyKey: string(),
|
|
43790
|
+
name: string(),
|
|
43791
|
+
createdAt: number(),
|
|
43792
|
+
updatedAt: number(),
|
|
43793
|
+
state: TrainingJobStateSchema,
|
|
43794
|
+
stage: TrainingStageSchema.nullable(),
|
|
43795
|
+
failure: object({
|
|
43796
|
+
reason: TrainingFailureReasonSchema,
|
|
43797
|
+
stage: string().nullable(),
|
|
43798
|
+
detail: string()
|
|
43799
|
+
}).nullable(),
|
|
43800
|
+
request: TrainingJobRequestSchema,
|
|
43801
|
+
maxCostUsd: number().nonnegative(),
|
|
43802
|
+
maxRuntimeSec: number().int().positive(),
|
|
43803
|
+
trainer: TrainerSourceRefSchema,
|
|
43804
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43805
|
+
dataset: object({
|
|
43806
|
+
bytes: number().int(),
|
|
43807
|
+
sha256: string(),
|
|
43808
|
+
uploadedAt: number()
|
|
43809
|
+
}).nullable(),
|
|
43810
|
+
split: TrainingSplitPlanSchema,
|
|
43811
|
+
provider: object({
|
|
43812
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43813
|
+
providerJobId: string().nullable(),
|
|
43814
|
+
startedAt: number().nullable(),
|
|
43815
|
+
endedAt: number().nullable(),
|
|
43816
|
+
billedSeconds: number(),
|
|
43817
|
+
costUsd: number(),
|
|
43818
|
+
costIsEstimate: boolean(),
|
|
43819
|
+
lastPolledAt: number().nullable()
|
|
43820
|
+
}),
|
|
43821
|
+
progress: object({
|
|
43822
|
+
epoch: number().int().nullable(),
|
|
43823
|
+
epochs: number().int().nullable(),
|
|
43824
|
+
etaSec: number().nullable(),
|
|
43825
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43826
|
+
}),
|
|
43827
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43828
|
+
logTail: array(string()).readonly(),
|
|
43829
|
+
logCursor: string().nullable(),
|
|
43830
|
+
artifacts: object({
|
|
43831
|
+
bundleBytes: number().int(),
|
|
43832
|
+
bundleSha256: string(),
|
|
43833
|
+
fetchedAt: number(),
|
|
43834
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43835
|
+
expiresAt: number()
|
|
43836
|
+
}).nullable(),
|
|
43837
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43838
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43839
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43840
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43841
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43842
|
+
registeredModelIds: array(string()).readonly(),
|
|
43843
|
+
canary: TrainingCanarySchema.nullable()
|
|
43844
|
+
});
|
|
43845
|
+
var IdInput = object({ id: string().min(1) });
|
|
43846
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43847
|
+
kind: "mutation",
|
|
43848
|
+
auth: "admin"
|
|
43849
|
+
}), 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() }), {
|
|
43850
|
+
kind: "mutation",
|
|
43851
|
+
auth: "admin"
|
|
43852
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43853
|
+
auth: "admin",
|
|
43854
|
+
timeoutMs: 6e4
|
|
43855
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43856
|
+
name: string().min(1).max(120),
|
|
43857
|
+
maxCostUsd: number().positive(),
|
|
43858
|
+
maxRuntimeSec: number().int().positive(),
|
|
43859
|
+
idempotencyKey: string().min(8).max(80)
|
|
43860
|
+
}), discriminatedUnion("kind", [object({
|
|
43861
|
+
kind: literal("started"),
|
|
43862
|
+
job: TrainingJobSchema
|
|
43863
|
+
}), object({
|
|
43864
|
+
kind: literal("refused"),
|
|
43865
|
+
reason: TrainingRefusalReasonSchema,
|
|
43866
|
+
detail: string()
|
|
43867
|
+
})]), {
|
|
43868
|
+
kind: "mutation",
|
|
43869
|
+
auth: "admin",
|
|
43870
|
+
timeoutMs: 12e4
|
|
43871
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43872
|
+
kind: "mutation",
|
|
43873
|
+
auth: "admin",
|
|
43874
|
+
timeoutMs: 12e4
|
|
43875
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43876
|
+
kind: "mutation",
|
|
43877
|
+
auth: "admin",
|
|
43878
|
+
timeoutMs: 30 * 6e4
|
|
43879
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43880
|
+
kind: "mutation",
|
|
43881
|
+
auth: "admin",
|
|
43882
|
+
timeoutMs: 12e4
|
|
43883
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43884
|
+
kind: "mutation",
|
|
43885
|
+
auth: "admin",
|
|
43886
|
+
timeoutMs: 12e4
|
|
43887
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43888
|
+
kind: "mutation",
|
|
43889
|
+
auth: "admin"
|
|
43890
|
+
});
|
|
40916
43891
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40917
43892
|
Object.freeze({
|
|
40918
43893
|
person: .5,
|
|
@@ -41399,7 +44374,8 @@ var BaseDevice = class {
|
|
|
41399
44374
|
this.role = options.role;
|
|
41400
44375
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41401
44376
|
const seedData = ctx.persistedConfig ?? {};
|
|
41402
|
-
|
|
44377
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
44378
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41403
44379
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41404
44380
|
tags: {
|
|
41405
44381
|
deviceId: ctx.id,
|
|
@@ -43060,6 +46036,12 @@ Object.freeze({
|
|
|
43060
46036
|
addonId: null,
|
|
43061
46037
|
access: "create"
|
|
43062
46038
|
},
|
|
46039
|
+
"backup.checkBackupKey": {
|
|
46040
|
+
capName: "backup",
|
|
46041
|
+
capScope: "system",
|
|
46042
|
+
addonId: null,
|
|
46043
|
+
access: "create"
|
|
46044
|
+
},
|
|
43063
46045
|
"backup.delete": {
|
|
43064
46046
|
capName: "backup",
|
|
43065
46047
|
capScope: "system",
|
|
@@ -43072,6 +46054,18 @@ Object.freeze({
|
|
|
43072
46054
|
addonId: null,
|
|
43073
46055
|
access: "delete"
|
|
43074
46056
|
},
|
|
46057
|
+
"backup.disableEncryption": {
|
|
46058
|
+
capName: "backup",
|
|
46059
|
+
capScope: "system",
|
|
46060
|
+
addonId: null,
|
|
46061
|
+
access: "create"
|
|
46062
|
+
},
|
|
46063
|
+
"backup.getEncryption": {
|
|
46064
|
+
capName: "backup",
|
|
46065
|
+
capScope: "system",
|
|
46066
|
+
addonId: null,
|
|
46067
|
+
access: "view"
|
|
46068
|
+
},
|
|
43075
46069
|
"backup.getEntries": {
|
|
43076
46070
|
capName: "backup",
|
|
43077
46071
|
capScope: "system",
|
|
@@ -43126,6 +46120,12 @@ Object.freeze({
|
|
|
43126
46120
|
addonId: null,
|
|
43127
46121
|
access: "create"
|
|
43128
46122
|
},
|
|
46123
|
+
"backup.setupEncryption": {
|
|
46124
|
+
capName: "backup",
|
|
46125
|
+
capScope: "system",
|
|
46126
|
+
addonId: null,
|
|
46127
|
+
access: "create"
|
|
46128
|
+
},
|
|
43129
46129
|
"backup.trigger": {
|
|
43130
46130
|
capName: "backup",
|
|
43131
46131
|
capScope: "system",
|
|
@@ -43678,6 +46678,12 @@ Object.freeze({
|
|
|
43678
46678
|
addonId: null,
|
|
43679
46679
|
access: "create"
|
|
43680
46680
|
},
|
|
46681
|
+
"customModelRegistry.importModelBundle": {
|
|
46682
|
+
capName: "custom-model-registry",
|
|
46683
|
+
capScope: "system",
|
|
46684
|
+
addonId: null,
|
|
46685
|
+
access: "create"
|
|
46686
|
+
},
|
|
43681
46687
|
"customModelRegistry.listModels": {
|
|
43682
46688
|
capName: "custom-model-registry",
|
|
43683
46689
|
capScope: "system",
|
|
@@ -45088,6 +48094,108 @@ Object.freeze({
|
|
|
45088
48094
|
addonId: null,
|
|
45089
48095
|
access: "create"
|
|
45090
48096
|
},
|
|
48097
|
+
"keychain.delete": {
|
|
48098
|
+
capName: "keychain",
|
|
48099
|
+
capScope: "system",
|
|
48100
|
+
addonId: null,
|
|
48101
|
+
access: "delete"
|
|
48102
|
+
},
|
|
48103
|
+
"keychain.getState": {
|
|
48104
|
+
capName: "keychain",
|
|
48105
|
+
capScope: "system",
|
|
48106
|
+
addonId: null,
|
|
48107
|
+
access: "view"
|
|
48108
|
+
},
|
|
48109
|
+
"keychain.listMeta": {
|
|
48110
|
+
capName: "keychain",
|
|
48111
|
+
capScope: "system",
|
|
48112
|
+
addonId: null,
|
|
48113
|
+
access: "view"
|
|
48114
|
+
},
|
|
48115
|
+
"keychain.put": {
|
|
48116
|
+
capName: "keychain",
|
|
48117
|
+
capScope: "system",
|
|
48118
|
+
addonId: null,
|
|
48119
|
+
access: "create"
|
|
48120
|
+
},
|
|
48121
|
+
"keychain.resolve": {
|
|
48122
|
+
capName: "keychain",
|
|
48123
|
+
capScope: "system",
|
|
48124
|
+
addonId: null,
|
|
48125
|
+
access: "view"
|
|
48126
|
+
},
|
|
48127
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48128
|
+
capName: "keychain-admin",
|
|
48129
|
+
capScope: "system",
|
|
48130
|
+
addonId: null,
|
|
48131
|
+
access: "create"
|
|
48132
|
+
},
|
|
48133
|
+
"keychainAdmin.deleteOrphans": {
|
|
48134
|
+
capName: "keychain-admin",
|
|
48135
|
+
capScope: "system",
|
|
48136
|
+
addonId: null,
|
|
48137
|
+
access: "delete"
|
|
48138
|
+
},
|
|
48139
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
48140
|
+
capName: "keychain-admin",
|
|
48141
|
+
capScope: "system",
|
|
48142
|
+
addonId: null,
|
|
48143
|
+
access: "create"
|
|
48144
|
+
},
|
|
48145
|
+
"keychainAdmin.listAudit": {
|
|
48146
|
+
capName: "keychain-admin",
|
|
48147
|
+
capScope: "system",
|
|
48148
|
+
addonId: null,
|
|
48149
|
+
access: "view"
|
|
48150
|
+
},
|
|
48151
|
+
"keychainAdmin.listSecrets": {
|
|
48152
|
+
capName: "keychain-admin",
|
|
48153
|
+
capScope: "system",
|
|
48154
|
+
addonId: null,
|
|
48155
|
+
access: "view"
|
|
48156
|
+
},
|
|
48157
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
48158
|
+
capName: "keychain-admin",
|
|
48159
|
+
capScope: "system",
|
|
48160
|
+
addonId: null,
|
|
48161
|
+
access: "delete"
|
|
48162
|
+
},
|
|
48163
|
+
"keychainAdmin.resetKeychain": {
|
|
48164
|
+
capName: "keychain-admin",
|
|
48165
|
+
capScope: "system",
|
|
48166
|
+
addonId: null,
|
|
48167
|
+
access: "delete"
|
|
48168
|
+
},
|
|
48169
|
+
"keychainAdmin.resetReport": {
|
|
48170
|
+
capName: "keychain-admin",
|
|
48171
|
+
capScope: "system",
|
|
48172
|
+
addonId: null,
|
|
48173
|
+
access: "delete"
|
|
48174
|
+
},
|
|
48175
|
+
"keychainAdmin.reveal": {
|
|
48176
|
+
capName: "keychain-admin",
|
|
48177
|
+
capScope: "system",
|
|
48178
|
+
addonId: null,
|
|
48179
|
+
access: "create"
|
|
48180
|
+
},
|
|
48181
|
+
"keychainAdmin.rotateMasterKey": {
|
|
48182
|
+
capName: "keychain-admin",
|
|
48183
|
+
capScope: "system",
|
|
48184
|
+
addonId: null,
|
|
48185
|
+
access: "create"
|
|
48186
|
+
},
|
|
48187
|
+
"keychainAdmin.setSystemSecret": {
|
|
48188
|
+
capName: "keychain-admin",
|
|
48189
|
+
capScope: "system",
|
|
48190
|
+
addonId: null,
|
|
48191
|
+
access: "create"
|
|
48192
|
+
},
|
|
48193
|
+
"keychainAdmin.status": {
|
|
48194
|
+
capName: "keychain-admin",
|
|
48195
|
+
capScope: "system",
|
|
48196
|
+
addonId: null,
|
|
48197
|
+
access: "view"
|
|
48198
|
+
},
|
|
45091
48199
|
"lawnMowerControl.dock": {
|
|
45092
48200
|
capName: "lawn-mower-control",
|
|
45093
48201
|
capScope: "device",
|
|
@@ -46462,6 +49570,18 @@ Object.freeze({
|
|
|
46462
49570
|
addonId: null,
|
|
46463
49571
|
access: "create"
|
|
46464
49572
|
},
|
|
49573
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
49574
|
+
capName: "pipeline-analytics",
|
|
49575
|
+
capScope: "device",
|
|
49576
|
+
addonId: null,
|
|
49577
|
+
access: "create"
|
|
49578
|
+
},
|
|
49579
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
49580
|
+
capName: "pipeline-analytics",
|
|
49581
|
+
capScope: "device",
|
|
49582
|
+
addonId: null,
|
|
49583
|
+
access: "create"
|
|
49584
|
+
},
|
|
46465
49585
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46466
49586
|
capName: "pipeline-analytics",
|
|
46467
49587
|
capScope: "device",
|
|
@@ -46510,12 +49630,36 @@ Object.freeze({
|
|
|
46510
49630
|
addonId: null,
|
|
46511
49631
|
access: "view"
|
|
46512
49632
|
},
|
|
49633
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
49634
|
+
capName: "pipeline-analytics",
|
|
49635
|
+
capScope: "device",
|
|
49636
|
+
addonId: null,
|
|
49637
|
+
access: "create"
|
|
49638
|
+
},
|
|
49639
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49640
|
+
capName: "pipeline-analytics",
|
|
49641
|
+
capScope: "device",
|
|
49642
|
+
addonId: null,
|
|
49643
|
+
access: "create"
|
|
49644
|
+
},
|
|
46513
49645
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46514
49646
|
capName: "pipeline-analytics",
|
|
46515
49647
|
capScope: "device",
|
|
46516
49648
|
addonId: null,
|
|
46517
49649
|
access: "delete"
|
|
46518
49650
|
},
|
|
49651
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
49652
|
+
capName: "pipeline-analytics",
|
|
49653
|
+
capScope: "device",
|
|
49654
|
+
addonId: null,
|
|
49655
|
+
access: "delete"
|
|
49656
|
+
},
|
|
49657
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49658
|
+
capName: "pipeline-analytics",
|
|
49659
|
+
capScope: "device",
|
|
49660
|
+
addonId: null,
|
|
49661
|
+
access: "delete"
|
|
49662
|
+
},
|
|
46519
49663
|
"pipelineAnalytics.deleteTracks": {
|
|
46520
49664
|
capName: "pipeline-analytics",
|
|
46521
49665
|
capScope: "device",
|
|
@@ -46720,6 +49864,30 @@ Object.freeze({
|
|
|
46720
49864
|
addonId: null,
|
|
46721
49865
|
access: "view"
|
|
46722
49866
|
},
|
|
49867
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
49868
|
+
capName: "pipeline-analytics",
|
|
49869
|
+
capScope: "device",
|
|
49870
|
+
addonId: null,
|
|
49871
|
+
access: "view"
|
|
49872
|
+
},
|
|
49873
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
49874
|
+
capName: "pipeline-analytics",
|
|
49875
|
+
capScope: "device",
|
|
49876
|
+
addonId: null,
|
|
49877
|
+
access: "view"
|
|
49878
|
+
},
|
|
49879
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49880
|
+
capName: "pipeline-analytics",
|
|
49881
|
+
capScope: "device",
|
|
49882
|
+
addonId: null,
|
|
49883
|
+
access: "view"
|
|
49884
|
+
},
|
|
49885
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49886
|
+
capName: "pipeline-analytics",
|
|
49887
|
+
capScope: "device",
|
|
49888
|
+
addonId: null,
|
|
49889
|
+
access: "view"
|
|
49890
|
+
},
|
|
46723
49891
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46724
49892
|
capName: "pipeline-analytics",
|
|
46725
49893
|
capScope: "device",
|
|
@@ -46750,6 +49918,12 @@ Object.freeze({
|
|
|
46750
49918
|
addonId: null,
|
|
46751
49919
|
access: "view"
|
|
46752
49920
|
},
|
|
49921
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49922
|
+
capName: "pipeline-analytics",
|
|
49923
|
+
capScope: "device",
|
|
49924
|
+
addonId: null,
|
|
49925
|
+
access: "create"
|
|
49926
|
+
},
|
|
46753
49927
|
"pipelineAnalytics.ownersWithMedia": {
|
|
46754
49928
|
capName: "pipeline-analytics",
|
|
46755
49929
|
capScope: "device",
|
|
@@ -46762,12 +49936,24 @@ Object.freeze({
|
|
|
46762
49936
|
addonId: null,
|
|
46763
49937
|
access: "create"
|
|
46764
49938
|
},
|
|
49939
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49940
|
+
capName: "pipeline-analytics",
|
|
49941
|
+
capScope: "device",
|
|
49942
|
+
addonId: null,
|
|
49943
|
+
access: "view"
|
|
49944
|
+
},
|
|
46765
49945
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
46766
49946
|
capName: "pipeline-analytics",
|
|
46767
49947
|
capScope: "device",
|
|
46768
49948
|
addonId: null,
|
|
46769
49949
|
access: "create"
|
|
46770
49950
|
},
|
|
49951
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49952
|
+
capName: "pipeline-analytics",
|
|
49953
|
+
capScope: "device",
|
|
49954
|
+
addonId: null,
|
|
49955
|
+
access: "create"
|
|
49956
|
+
},
|
|
46771
49957
|
"pipelineAnalytics.pruneEvents": {
|
|
46772
49958
|
capName: "pipeline-analytics",
|
|
46773
49959
|
capScope: "device",
|
|
@@ -46822,6 +50008,18 @@ Object.freeze({
|
|
|
46822
50008
|
addonId: null,
|
|
46823
50009
|
access: "create"
|
|
46824
50010
|
},
|
|
50011
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
50012
|
+
capName: "pipeline-analytics",
|
|
50013
|
+
capScope: "device",
|
|
50014
|
+
addonId: null,
|
|
50015
|
+
access: "delete"
|
|
50016
|
+
},
|
|
50017
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
50018
|
+
capName: "pipeline-analytics",
|
|
50019
|
+
capScope: "device",
|
|
50020
|
+
addonId: null,
|
|
50021
|
+
access: "create"
|
|
50022
|
+
},
|
|
46825
50023
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46826
50024
|
capName: "pipeline-analytics",
|
|
46827
50025
|
capScope: "device",
|
|
@@ -46882,6 +50080,12 @@ Object.freeze({
|
|
|
46882
50080
|
addonId: null,
|
|
46883
50081
|
access: "create"
|
|
46884
50082
|
},
|
|
50083
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50084
|
+
capName: "pipeline-analytics",
|
|
50085
|
+
capScope: "device",
|
|
50086
|
+
addonId: null,
|
|
50087
|
+
access: "view"
|
|
50088
|
+
},
|
|
46885
50089
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46886
50090
|
capName: "pipeline-analytics",
|
|
46887
50091
|
capScope: "device",
|
|
@@ -47110,6 +50314,12 @@ Object.freeze({
|
|
|
47110
50314
|
addonId: null,
|
|
47111
50315
|
access: "view"
|
|
47112
50316
|
},
|
|
50317
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
50318
|
+
capName: "pipeline-orchestrator",
|
|
50319
|
+
capScope: "system",
|
|
50320
|
+
addonId: null,
|
|
50321
|
+
access: "create"
|
|
50322
|
+
},
|
|
47113
50323
|
"pipelineOrchestrator.applyAutoTune": {
|
|
47114
50324
|
capName: "pipeline-orchestrator",
|
|
47115
50325
|
capScope: "system",
|
|
@@ -47134,6 +50344,12 @@ Object.freeze({
|
|
|
47134
50344
|
addonId: null,
|
|
47135
50345
|
access: "create"
|
|
47136
50346
|
},
|
|
50347
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
50348
|
+
capName: "pipeline-orchestrator",
|
|
50349
|
+
capScope: "system",
|
|
50350
|
+
addonId: null,
|
|
50351
|
+
access: "delete"
|
|
50352
|
+
},
|
|
47137
50353
|
"pipelineOrchestrator.getAgentLoad": {
|
|
47138
50354
|
capName: "pipeline-orchestrator",
|
|
47139
50355
|
capScope: "system",
|
|
@@ -47242,6 +50458,24 @@ Object.freeze({
|
|
|
47242
50458
|
addonId: null,
|
|
47243
50459
|
access: "view"
|
|
47244
50460
|
},
|
|
50461
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
50462
|
+
capName: "pipeline-orchestrator",
|
|
50463
|
+
capScope: "system",
|
|
50464
|
+
addonId: null,
|
|
50465
|
+
access: "view"
|
|
50466
|
+
},
|
|
50467
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
50468
|
+
capName: "pipeline-orchestrator",
|
|
50469
|
+
capScope: "system",
|
|
50470
|
+
addonId: null,
|
|
50471
|
+
access: "view"
|
|
50472
|
+
},
|
|
50473
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
50474
|
+
capName: "pipeline-orchestrator",
|
|
50475
|
+
capScope: "system",
|
|
50476
|
+
addonId: null,
|
|
50477
|
+
access: "view"
|
|
50478
|
+
},
|
|
47245
50479
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
47246
50480
|
capName: "pipeline-orchestrator",
|
|
47247
50481
|
capScope: "system",
|
|
@@ -47284,6 +50518,12 @@ Object.freeze({
|
|
|
47284
50518
|
addonId: null,
|
|
47285
50519
|
access: "view"
|
|
47286
50520
|
},
|
|
50521
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
50522
|
+
capName: "pipeline-orchestrator",
|
|
50523
|
+
capScope: "system",
|
|
50524
|
+
addonId: null,
|
|
50525
|
+
access: "view"
|
|
50526
|
+
},
|
|
47287
50527
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
47288
50528
|
capName: "pipeline-orchestrator",
|
|
47289
50529
|
capScope: "system",
|
|
@@ -47428,6 +50668,12 @@ Object.freeze({
|
|
|
47428
50668
|
addonId: null,
|
|
47429
50669
|
access: "create"
|
|
47430
50670
|
},
|
|
50671
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
50672
|
+
capName: "pipeline-orchestrator",
|
|
50673
|
+
capScope: "system",
|
|
50674
|
+
addonId: null,
|
|
50675
|
+
access: "create"
|
|
50676
|
+
},
|
|
47431
50677
|
"pipelineOrchestrator.suggestShares": {
|
|
47432
50678
|
capName: "pipeline-orchestrator",
|
|
47433
50679
|
capScope: "system",
|
|
@@ -47446,6 +50692,12 @@ Object.freeze({
|
|
|
47446
50692
|
addonId: null,
|
|
47447
50693
|
access: "create"
|
|
47448
50694
|
},
|
|
50695
|
+
"pipelineRunner.abortNodeBench": {
|
|
50696
|
+
capName: "pipeline-runner",
|
|
50697
|
+
capScope: "system",
|
|
50698
|
+
addonId: null,
|
|
50699
|
+
access: "create"
|
|
50700
|
+
},
|
|
47449
50701
|
"pipelineRunner.attachCamera": {
|
|
47450
50702
|
capName: "pipeline-runner",
|
|
47451
50703
|
capScope: "system",
|
|
@@ -47494,6 +50746,12 @@ Object.freeze({
|
|
|
47494
50746
|
addonId: null,
|
|
47495
50747
|
access: "view"
|
|
47496
50748
|
},
|
|
50749
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
50750
|
+
capName: "pipeline-runner",
|
|
50751
|
+
capScope: "system",
|
|
50752
|
+
addonId: null,
|
|
50753
|
+
access: "view"
|
|
50754
|
+
},
|
|
47497
50755
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47498
50756
|
capName: "pipeline-runner",
|
|
47499
50757
|
capScope: "system",
|
|
@@ -47536,6 +50794,12 @@ Object.freeze({
|
|
|
47536
50794
|
addonId: null,
|
|
47537
50795
|
access: "create"
|
|
47538
50796
|
},
|
|
50797
|
+
"pipelineRunner.startNodeBench": {
|
|
50798
|
+
capName: "pipeline-runner",
|
|
50799
|
+
capScope: "system",
|
|
50800
|
+
addonId: null,
|
|
50801
|
+
access: "create"
|
|
50802
|
+
},
|
|
47539
50803
|
"plateGallery.assignPlate": {
|
|
47540
50804
|
capName: "plate-gallery",
|
|
47541
50805
|
capScope: "system",
|
|
@@ -49198,6 +52462,174 @@ Object.freeze({
|
|
|
49198
52462
|
addonId: null,
|
|
49199
52463
|
access: "view"
|
|
49200
52464
|
},
|
|
52465
|
+
"training.canaryResult": {
|
|
52466
|
+
capName: "training",
|
|
52467
|
+
capScope: "system",
|
|
52468
|
+
addonId: null,
|
|
52469
|
+
access: "create"
|
|
52470
|
+
},
|
|
52471
|
+
"training.cancelJob": {
|
|
52472
|
+
capName: "training",
|
|
52473
|
+
capScope: "system",
|
|
52474
|
+
addonId: null,
|
|
52475
|
+
access: "create"
|
|
52476
|
+
},
|
|
52477
|
+
"training.discardResult": {
|
|
52478
|
+
capName: "training",
|
|
52479
|
+
capScope: "system",
|
|
52480
|
+
addonId: null,
|
|
52481
|
+
access: "create"
|
|
52482
|
+
},
|
|
52483
|
+
"training.findDatasetVersionIdByName": {
|
|
52484
|
+
capName: "training",
|
|
52485
|
+
capScope: "system",
|
|
52486
|
+
addonId: null,
|
|
52487
|
+
access: "view"
|
|
52488
|
+
},
|
|
52489
|
+
"training.getDatasetVersion": {
|
|
52490
|
+
capName: "training",
|
|
52491
|
+
capScope: "system",
|
|
52492
|
+
addonId: null,
|
|
52493
|
+
access: "view"
|
|
52494
|
+
},
|
|
52495
|
+
"training.getJob": {
|
|
52496
|
+
capName: "training",
|
|
52497
|
+
capScope: "system",
|
|
52498
|
+
addonId: null,
|
|
52499
|
+
access: "view"
|
|
52500
|
+
},
|
|
52501
|
+
"training.getJobResult": {
|
|
52502
|
+
capName: "training",
|
|
52503
|
+
capScope: "system",
|
|
52504
|
+
addonId: null,
|
|
52505
|
+
access: "view"
|
|
52506
|
+
},
|
|
52507
|
+
"training.listBaseModels": {
|
|
52508
|
+
capName: "training",
|
|
52509
|
+
capScope: "system",
|
|
52510
|
+
addonId: null,
|
|
52511
|
+
access: "view"
|
|
52512
|
+
},
|
|
52513
|
+
"training.listDatasetVersions": {
|
|
52514
|
+
capName: "training",
|
|
52515
|
+
capScope: "system",
|
|
52516
|
+
addonId: null,
|
|
52517
|
+
access: "view"
|
|
52518
|
+
},
|
|
52519
|
+
"training.listJobs": {
|
|
52520
|
+
capName: "training",
|
|
52521
|
+
capScope: "system",
|
|
52522
|
+
addonId: null,
|
|
52523
|
+
access: "view"
|
|
52524
|
+
},
|
|
52525
|
+
"training.planJob": {
|
|
52526
|
+
capName: "training",
|
|
52527
|
+
capScope: "system",
|
|
52528
|
+
addonId: null,
|
|
52529
|
+
access: "view"
|
|
52530
|
+
},
|
|
52531
|
+
"training.putDatasetVersion": {
|
|
52532
|
+
capName: "training",
|
|
52533
|
+
capScope: "system",
|
|
52534
|
+
addonId: null,
|
|
52535
|
+
access: "create"
|
|
52536
|
+
},
|
|
52537
|
+
"training.registerResult": {
|
|
52538
|
+
capName: "training",
|
|
52539
|
+
capScope: "system",
|
|
52540
|
+
addonId: null,
|
|
52541
|
+
access: "create"
|
|
52542
|
+
},
|
|
52543
|
+
"training.removeDatasetVersion": {
|
|
52544
|
+
capName: "training",
|
|
52545
|
+
capScope: "system",
|
|
52546
|
+
addonId: null,
|
|
52547
|
+
access: "delete"
|
|
52548
|
+
},
|
|
52549
|
+
"training.rollbackCanary": {
|
|
52550
|
+
capName: "training",
|
|
52551
|
+
capScope: "system",
|
|
52552
|
+
addonId: null,
|
|
52553
|
+
access: "create"
|
|
52554
|
+
},
|
|
52555
|
+
"training.startJob": {
|
|
52556
|
+
capName: "training",
|
|
52557
|
+
capScope: "system",
|
|
52558
|
+
addonId: null,
|
|
52559
|
+
access: "create"
|
|
52560
|
+
},
|
|
52561
|
+
"trainingProvider.cancelJob": {
|
|
52562
|
+
capName: "training-provider",
|
|
52563
|
+
capScope: "system",
|
|
52564
|
+
addonId: null,
|
|
52565
|
+
access: "create"
|
|
52566
|
+
},
|
|
52567
|
+
"trainingProvider.cleanupJob": {
|
|
52568
|
+
capName: "training-provider",
|
|
52569
|
+
capScope: "system",
|
|
52570
|
+
addonId: null,
|
|
52571
|
+
access: "create"
|
|
52572
|
+
},
|
|
52573
|
+
"trainingProvider.describe": {
|
|
52574
|
+
capName: "training-provider",
|
|
52575
|
+
capScope: "system",
|
|
52576
|
+
addonId: null,
|
|
52577
|
+
access: "view"
|
|
52578
|
+
},
|
|
52579
|
+
"trainingProvider.estimateJob": {
|
|
52580
|
+
capName: "training-provider",
|
|
52581
|
+
capScope: "system",
|
|
52582
|
+
addonId: null,
|
|
52583
|
+
access: "view"
|
|
52584
|
+
},
|
|
52585
|
+
"trainingProvider.getJob": {
|
|
52586
|
+
capName: "training-provider",
|
|
52587
|
+
capScope: "system",
|
|
52588
|
+
addonId: null,
|
|
52589
|
+
access: "view"
|
|
52590
|
+
},
|
|
52591
|
+
"trainingProvider.listJobEvents": {
|
|
52592
|
+
capName: "training-provider",
|
|
52593
|
+
capScope: "system",
|
|
52594
|
+
addonId: null,
|
|
52595
|
+
access: "view"
|
|
52596
|
+
},
|
|
52597
|
+
"trainingProvider.listJobs": {
|
|
52598
|
+
capName: "training-provider",
|
|
52599
|
+
capScope: "system",
|
|
52600
|
+
addonId: null,
|
|
52601
|
+
access: "view"
|
|
52602
|
+
},
|
|
52603
|
+
"trainingProvider.offerArtifact": {
|
|
52604
|
+
capName: "training-provider",
|
|
52605
|
+
capScope: "system",
|
|
52606
|
+
addonId: null,
|
|
52607
|
+
access: "create"
|
|
52608
|
+
},
|
|
52609
|
+
"trainingProvider.readResult": {
|
|
52610
|
+
capName: "training-provider",
|
|
52611
|
+
capScope: "system",
|
|
52612
|
+
addonId: null,
|
|
52613
|
+
access: "create"
|
|
52614
|
+
},
|
|
52615
|
+
"trainingProvider.submitJob": {
|
|
52616
|
+
capName: "training-provider",
|
|
52617
|
+
capScope: "system",
|
|
52618
|
+
addonId: null,
|
|
52619
|
+
access: "create"
|
|
52620
|
+
},
|
|
52621
|
+
"trainingProvider.uploadDataset": {
|
|
52622
|
+
capName: "training-provider",
|
|
52623
|
+
capScope: "system",
|
|
52624
|
+
addonId: null,
|
|
52625
|
+
access: "create"
|
|
52626
|
+
},
|
|
52627
|
+
"trainingProvider.validateCredentials": {
|
|
52628
|
+
capName: "training-provider",
|
|
52629
|
+
capScope: "system",
|
|
52630
|
+
addonId: null,
|
|
52631
|
+
access: "create"
|
|
52632
|
+
},
|
|
49201
52633
|
"turnProvider.getTurnServers": {
|
|
49202
52634
|
capName: "turn-provider",
|
|
49203
52635
|
capScope: "system",
|
|
@@ -49222,12 +52654,6 @@ Object.freeze({
|
|
|
49222
52654
|
addonId: null,
|
|
49223
52655
|
access: "create"
|
|
49224
52656
|
},
|
|
49225
|
-
"userManagement.createApiKey": {
|
|
49226
|
-
capName: "user-management",
|
|
49227
|
-
capScope: "system",
|
|
49228
|
-
addonId: null,
|
|
49229
|
-
access: "create"
|
|
49230
|
-
},
|
|
49231
52657
|
"userManagement.createScopedToken": {
|
|
49232
52658
|
capName: "user-management",
|
|
49233
52659
|
capScope: "system",
|
|
@@ -49264,12 +52690,6 @@ Object.freeze({
|
|
|
49264
52690
|
addonId: null,
|
|
49265
52691
|
access: "view"
|
|
49266
52692
|
},
|
|
49267
|
-
"userManagement.linkExternalIdentity": {
|
|
49268
|
-
capName: "user-management",
|
|
49269
|
-
capScope: "system",
|
|
49270
|
-
addonId: null,
|
|
49271
|
-
access: "create"
|
|
49272
|
-
},
|
|
49273
52693
|
"userManagement.listApiKeys": {
|
|
49274
52694
|
capName: "user-management",
|
|
49275
52695
|
capScope: "system",
|
|
@@ -49372,12 +52792,6 @@ Object.freeze({
|
|
|
49372
52792
|
addonId: null,
|
|
49373
52793
|
access: "create"
|
|
49374
52794
|
},
|
|
49375
|
-
"userManagement.validateApiKey": {
|
|
49376
|
-
capName: "user-management",
|
|
49377
|
-
capScope: "system",
|
|
49378
|
-
addonId: null,
|
|
49379
|
-
access: "view"
|
|
49380
|
-
},
|
|
49381
52795
|
"userManagement.validateCredentials": {
|
|
49382
52796
|
capName: "user-management",
|
|
49383
52797
|
capScope: "system",
|
|
@@ -52671,6 +56085,11 @@ Object.freeze({
|
|
|
52671
56085
|
form: "single",
|
|
52672
56086
|
optional: false
|
|
52673
56087
|
}],
|
|
56088
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
56089
|
+
name: "deviceId",
|
|
56090
|
+
form: "single",
|
|
56091
|
+
optional: false
|
|
56092
|
+
}],
|
|
52674
56093
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52675
56094
|
name: "deviceId",
|
|
52676
56095
|
form: "single",
|
|
@@ -52861,6 +56280,11 @@ Object.freeze({
|
|
|
52861
56280
|
form: "single",
|
|
52862
56281
|
optional: false
|
|
52863
56282
|
}],
|
|
56283
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
56284
|
+
name: "deviceId",
|
|
56285
|
+
form: "single",
|
|
56286
|
+
optional: false
|
|
56287
|
+
}],
|
|
52864
56288
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52865
56289
|
name: "deviceId",
|
|
52866
56290
|
form: "single",
|
|
@@ -53687,6 +57111,11 @@ Object.freeze({
|
|
|
53687
57111
|
form: "single",
|
|
53688
57112
|
optional: false
|
|
53689
57113
|
}],
|
|
57114
|
+
"training.canaryResult": [{
|
|
57115
|
+
name: "deviceIds",
|
|
57116
|
+
form: "array",
|
|
57117
|
+
optional: false
|
|
57118
|
+
}],
|
|
53690
57119
|
"update.getStatus": [{
|
|
53691
57120
|
name: "deviceId",
|
|
53692
57121
|
form: "single",
|