@camstack/addon-provider-unifi 0.2.123 → 0.2.125
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -78,6 +78,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
78
78
|
*/
|
|
79
79
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
80
80
|
/**
|
|
81
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
82
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
83
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
84
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
85
|
+
*/
|
|
86
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
87
|
+
/**
|
|
81
88
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
82
89
|
* transitions from `failed` back to `healthy` (typically via the
|
|
83
90
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5370,7 +5377,7 @@ var ZodIssueCode = {
|
|
|
5370
5377
|
var ZodFirstPartyTypeKind;
|
|
5371
5378
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5372
5379
|
//#endregion
|
|
5373
|
-
//#region ../types/dist/sleep-
|
|
5380
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5374
5381
|
/**
|
|
5375
5382
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5376
5383
|
* window to float samples (D455).
|
|
@@ -5449,6 +5456,97 @@ function buildAlawTable() {
|
|
|
5449
5456
|
}
|
|
5450
5457
|
buildUlawTable();
|
|
5451
5458
|
buildAlawTable();
|
|
5459
|
+
/** Is this field's stored value a credential? */
|
|
5460
|
+
function isSecretConfigField(field) {
|
|
5461
|
+
if (field.type === "password") return true;
|
|
5462
|
+
return "secret" in field && field.secret === true;
|
|
5463
|
+
}
|
|
5464
|
+
/**
|
|
5465
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5466
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5467
|
+
*/
|
|
5468
|
+
function isKeychainStoredField(field) {
|
|
5469
|
+
if (!isSecretConfigField(field)) return false;
|
|
5470
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5471
|
+
return !("storage" in field && field.storage === "inline");
|
|
5472
|
+
}
|
|
5473
|
+
/**
|
|
5474
|
+
* What a settings blob holds where a secret used to be.
|
|
5475
|
+
*
|
|
5476
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5477
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5478
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5479
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5480
|
+
*
|
|
5481
|
+
* The same shapes travel to and from the admin UI:
|
|
5482
|
+
*
|
|
5483
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5484
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5485
|
+
* value is set, never the value.
|
|
5486
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5487
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5488
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5489
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5490
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5491
|
+
*
|
|
5492
|
+
* Pure and browser-safe.
|
|
5493
|
+
*/
|
|
5494
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5495
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5496
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5497
|
+
function isRecord$2(value) {
|
|
5498
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5499
|
+
}
|
|
5500
|
+
function makeSecretMarker(ref) {
|
|
5501
|
+
return {
|
|
5502
|
+
$secret: ref,
|
|
5503
|
+
v: 1
|
|
5504
|
+
};
|
|
5505
|
+
}
|
|
5506
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5507
|
+
function isSecretMarker(value) {
|
|
5508
|
+
if (!isRecord$2(value)) return false;
|
|
5509
|
+
const ref = value["$secret"];
|
|
5510
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5511
|
+
}
|
|
5512
|
+
function isSecretClear(value) {
|
|
5513
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5514
|
+
}
|
|
5515
|
+
/**
|
|
5516
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5517
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5518
|
+
* survives this function.
|
|
5519
|
+
*/
|
|
5520
|
+
function toSecretFieldView(stored) {
|
|
5521
|
+
if (isSecretMarker(stored)) return {
|
|
5522
|
+
$secret: stored.$secret,
|
|
5523
|
+
v: 1,
|
|
5524
|
+
set: true
|
|
5525
|
+
};
|
|
5526
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5527
|
+
$secret: null,
|
|
5528
|
+
v: 1,
|
|
5529
|
+
set: true,
|
|
5530
|
+
inline: true
|
|
5531
|
+
};
|
|
5532
|
+
return null;
|
|
5533
|
+
}
|
|
5534
|
+
/**
|
|
5535
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5536
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5537
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5538
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5539
|
+
*/
|
|
5540
|
+
function classifySecretWrite(incoming) {
|
|
5541
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5542
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5543
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5544
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5545
|
+
return {
|
|
5546
|
+
kind: "set",
|
|
5547
|
+
value: incoming
|
|
5548
|
+
};
|
|
5549
|
+
}
|
|
5452
5550
|
Object.fromEntries([
|
|
5453
5551
|
{
|
|
5454
5552
|
id: "overview",
|
|
@@ -5620,33 +5718,19 @@ Object.fromEntries([
|
|
|
5620
5718
|
function isValuelessField(field) {
|
|
5621
5719
|
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";
|
|
5622
5720
|
}
|
|
5623
|
-
|
|
5624
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5625
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5626
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5627
|
-
*
|
|
5628
|
-
* For each leaf field:
|
|
5629
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5630
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5631
|
-
*
|
|
5632
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5633
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5634
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5635
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5636
|
-
*/
|
|
5637
|
-
function hydrateSchema(schema, values) {
|
|
5721
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5638
5722
|
return {
|
|
5639
5723
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5640
5724
|
sections: schema.sections.map((section) => ({
|
|
5641
5725
|
...section,
|
|
5642
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5726
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5643
5727
|
}))
|
|
5644
5728
|
};
|
|
5645
5729
|
}
|
|
5646
|
-
function hydrateField(field, values) {
|
|
5730
|
+
function hydrateField(field, values, options) {
|
|
5647
5731
|
if (isValuelessField(field)) return field;
|
|
5648
5732
|
if (field.type === "group") {
|
|
5649
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5733
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5650
5734
|
return {
|
|
5651
5735
|
...field,
|
|
5652
5736
|
fields: hydratedChildren
|
|
@@ -5655,7 +5739,7 @@ function hydrateField(field, values) {
|
|
|
5655
5739
|
if (field.type === "sub-tabs") {
|
|
5656
5740
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5657
5741
|
...tab,
|
|
5658
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5742
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5659
5743
|
}));
|
|
5660
5744
|
return {
|
|
5661
5745
|
...field,
|
|
@@ -5665,6 +5749,33 @@ function hydrateField(field, values) {
|
|
|
5665
5749
|
const key = field.key;
|
|
5666
5750
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5667
5751
|
const defaultValue = field.default;
|
|
5752
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5753
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5754
|
+
...field,
|
|
5755
|
+
value: toSecretFieldView(storedValue)
|
|
5756
|
+
};
|
|
5757
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5758
|
+
...field,
|
|
5759
|
+
value: null
|
|
5760
|
+
};
|
|
5761
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5762
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5763
|
+
if (secretItemKeys.length > 0) {
|
|
5764
|
+
const rows = storedValue.map((row) => {
|
|
5765
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5766
|
+
const out = { ...row };
|
|
5767
|
+
for (const k of secretItemKeys) {
|
|
5768
|
+
const v = Reflect.get(row, k);
|
|
5769
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5770
|
+
}
|
|
5771
|
+
return out;
|
|
5772
|
+
});
|
|
5773
|
+
return {
|
|
5774
|
+
...field,
|
|
5775
|
+
value: rows
|
|
5776
|
+
};
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5668
5779
|
if (field.multiple) {
|
|
5669
5780
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5670
5781
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5907,6 +6018,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5907
6018
|
}
|
|
5908
6019
|
return out;
|
|
5909
6020
|
}
|
|
6021
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6022
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6023
|
+
function globalSecretScope() {
|
|
6024
|
+
return GLOBAL_SCOPE;
|
|
6025
|
+
}
|
|
6026
|
+
function encodeSegment(value) {
|
|
6027
|
+
return encodeURIComponent(value);
|
|
6028
|
+
}
|
|
6029
|
+
function decodeSegment(value) {
|
|
6030
|
+
try {
|
|
6031
|
+
return decodeURIComponent(value);
|
|
6032
|
+
} catch {
|
|
6033
|
+
return null;
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
/**
|
|
6037
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6038
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6039
|
+
* `providers[authentik].clientSecret`.
|
|
6040
|
+
*/
|
|
6041
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6042
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6043
|
+
}
|
|
6044
|
+
function parseScope(segments) {
|
|
6045
|
+
switch (segments[0]) {
|
|
6046
|
+
case "global": return {
|
|
6047
|
+
scope: GLOBAL_SCOPE,
|
|
6048
|
+
used: 1
|
|
6049
|
+
};
|
|
6050
|
+
case "node": {
|
|
6051
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6052
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6053
|
+
scope: {
|
|
6054
|
+
kind: "node",
|
|
6055
|
+
nodeId
|
|
6056
|
+
},
|
|
6057
|
+
used: 2
|
|
6058
|
+
};
|
|
6059
|
+
}
|
|
6060
|
+
case "device": {
|
|
6061
|
+
const raw = segments[1];
|
|
6062
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6063
|
+
return {
|
|
6064
|
+
scope: {
|
|
6065
|
+
kind: "device",
|
|
6066
|
+
deviceId: Number(raw)
|
|
6067
|
+
},
|
|
6068
|
+
used: 2
|
|
6069
|
+
};
|
|
6070
|
+
}
|
|
6071
|
+
case "integration": {
|
|
6072
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6073
|
+
return id === null || id.length === 0 ? null : {
|
|
6074
|
+
scope: {
|
|
6075
|
+
kind: "integration",
|
|
6076
|
+
integrationId: id
|
|
6077
|
+
},
|
|
6078
|
+
used: 2
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
case "row": {
|
|
6082
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6083
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6084
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6085
|
+
return {
|
|
6086
|
+
scope: {
|
|
6087
|
+
kind: "row",
|
|
6088
|
+
collection,
|
|
6089
|
+
rowId
|
|
6090
|
+
},
|
|
6091
|
+
used: 3
|
|
6092
|
+
};
|
|
6093
|
+
}
|
|
6094
|
+
default: return null;
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6098
|
+
function parseSecretRef(ref) {
|
|
6099
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6100
|
+
const segments = ref.slice(9).split("/");
|
|
6101
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6102
|
+
if (owner === null || owner.length === 0) return null;
|
|
6103
|
+
const parsed = parseScope(segments.slice(1));
|
|
6104
|
+
if (parsed === null) return null;
|
|
6105
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6106
|
+
if (fieldPath.length === 0) return null;
|
|
6107
|
+
return {
|
|
6108
|
+
owner,
|
|
6109
|
+
scope: parsed.scope,
|
|
6110
|
+
fieldPath
|
|
6111
|
+
};
|
|
6112
|
+
}
|
|
6113
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6114
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6115
|
+
fieldPath;
|
|
6116
|
+
constructor(fieldPath, cause) {
|
|
6117
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6118
|
+
this.fieldPath = fieldPath;
|
|
6119
|
+
this.name = "KeychainWriteRefusedError";
|
|
6120
|
+
}
|
|
6121
|
+
};
|
|
6122
|
+
var KEEP = { kind: "keep" };
|
|
6123
|
+
function isRecord$1(value) {
|
|
6124
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6125
|
+
}
|
|
6126
|
+
function defaultMintId() {
|
|
6127
|
+
return globalThis.crypto.randomUUID();
|
|
6128
|
+
}
|
|
6129
|
+
/** Every marker ref anywhere under `value`. */
|
|
6130
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6131
|
+
if (isSecretMarker(value)) {
|
|
6132
|
+
out.push(value.$secret);
|
|
6133
|
+
return out;
|
|
6134
|
+
}
|
|
6135
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6136
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6137
|
+
return out;
|
|
6138
|
+
}
|
|
6139
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6140
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6141
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6142
|
+
}
|
|
6143
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6144
|
+
const intent = classifySecretWrite(incoming);
|
|
6145
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6146
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6147
|
+
if (intent.kind === "keep") return KEEP;
|
|
6148
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6149
|
+
if (intent.kind === "clear") {
|
|
6150
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6151
|
+
return {
|
|
6152
|
+
kind: "value",
|
|
6153
|
+
value: null
|
|
6154
|
+
};
|
|
6155
|
+
}
|
|
6156
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6157
|
+
kind: "value",
|
|
6158
|
+
value: stored
|
|
6159
|
+
};
|
|
6160
|
+
try {
|
|
6161
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6162
|
+
} catch (err) {
|
|
6163
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6164
|
+
}
|
|
6165
|
+
return {
|
|
6166
|
+
kind: "value",
|
|
6167
|
+
value: makeSecretMarker(ref)
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6171
|
+
function applyMember(out, key, result, storedParent) {
|
|
6172
|
+
if (result.kind === "value") {
|
|
6173
|
+
out[key] = result.value;
|
|
6174
|
+
return;
|
|
6175
|
+
}
|
|
6176
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6177
|
+
else delete out[key];
|
|
6178
|
+
}
|
|
6179
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6180
|
+
const out = { ...incoming };
|
|
6181
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6182
|
+
return out;
|
|
6183
|
+
}
|
|
6184
|
+
function rowId(row, idKey) {
|
|
6185
|
+
const raw = row[idKey];
|
|
6186
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6187
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6188
|
+
return null;
|
|
6189
|
+
}
|
|
6190
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6191
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6192
|
+
if (!Array.isArray(incoming)) {
|
|
6193
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6194
|
+
return {
|
|
6195
|
+
kind: "value",
|
|
6196
|
+
value: incoming
|
|
6197
|
+
};
|
|
6198
|
+
}
|
|
6199
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6200
|
+
for (const row of storedRows) {
|
|
6201
|
+
const id = rowId(row, node.idKey);
|
|
6202
|
+
if (id !== null) storedById.set(id, row);
|
|
6203
|
+
}
|
|
6204
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6205
|
+
const rows = [];
|
|
6206
|
+
for (const row of incoming) {
|
|
6207
|
+
if (!isRecord$1(row)) {
|
|
6208
|
+
rows.push(row);
|
|
6209
|
+
continue;
|
|
6210
|
+
}
|
|
6211
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6212
|
+
kept.add(id);
|
|
6213
|
+
const withId = {
|
|
6214
|
+
...row,
|
|
6215
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6216
|
+
};
|
|
6217
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6218
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6219
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6220
|
+
}
|
|
6221
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6222
|
+
return {
|
|
6223
|
+
kind: "value",
|
|
6224
|
+
value: rows
|
|
6225
|
+
};
|
|
6226
|
+
}
|
|
6227
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6228
|
+
switch (node.kind) {
|
|
6229
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6230
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6231
|
+
case "object": {
|
|
6232
|
+
if (!isRecord$1(incoming)) {
|
|
6233
|
+
if (incoming === void 0) return KEEP;
|
|
6234
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6235
|
+
return {
|
|
6236
|
+
kind: "value",
|
|
6237
|
+
value: incoming
|
|
6238
|
+
};
|
|
6239
|
+
}
|
|
6240
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6241
|
+
return {
|
|
6242
|
+
kind: "value",
|
|
6243
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6249
|
+
function splitNodeKey(key) {
|
|
6250
|
+
const at = key.indexOf("@");
|
|
6251
|
+
return at <= 0 ? {
|
|
6252
|
+
base: key,
|
|
6253
|
+
nodeId: null
|
|
6254
|
+
} : {
|
|
6255
|
+
base: key.slice(0, at),
|
|
6256
|
+
nodeId: key.slice(at + 1)
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6260
|
+
async function transformSecretWrite(input) {
|
|
6261
|
+
const deletes = [];
|
|
6262
|
+
const base = {
|
|
6263
|
+
secrets: input.secrets,
|
|
6264
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6265
|
+
deletes,
|
|
6266
|
+
operatorWrite: input.operatorWrite === true
|
|
6267
|
+
};
|
|
6268
|
+
const out = {};
|
|
6269
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6270
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6271
|
+
const node = input.tree.get(baseKey);
|
|
6272
|
+
if (node === void 0) {
|
|
6273
|
+
out[key] = incoming;
|
|
6274
|
+
continue;
|
|
6275
|
+
}
|
|
6276
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6277
|
+
kind: "node",
|
|
6278
|
+
nodeId
|
|
6279
|
+
} : input.scope ?? globalSecretScope();
|
|
6280
|
+
const result = await writeNode({
|
|
6281
|
+
...base,
|
|
6282
|
+
scope
|
|
6283
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6284
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6285
|
+
}
|
|
6286
|
+
return {
|
|
6287
|
+
patch: out,
|
|
6288
|
+
afterWrite: async () => {
|
|
6289
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6290
|
+
try {
|
|
6291
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6292
|
+
return { orphaned: [] };
|
|
6293
|
+
} catch {
|
|
6294
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
};
|
|
6298
|
+
}
|
|
6299
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6300
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6301
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6302
|
+
}
|
|
6303
|
+
/**
|
|
6304
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6305
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6306
|
+
*/
|
|
6307
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6308
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6309
|
+
const owner = options.ownedBy;
|
|
6310
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6311
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6312
|
+
if (refs.length === 0) return {
|
|
6313
|
+
value,
|
|
6314
|
+
unresolved: []
|
|
6315
|
+
};
|
|
6316
|
+
const answers = await secrets.resolve(refs);
|
|
6317
|
+
const unresolved = [];
|
|
6318
|
+
for (const ref of new Set(refs)) {
|
|
6319
|
+
const answer = answers[ref];
|
|
6320
|
+
if (answer === void 0) unresolved.push({
|
|
6321
|
+
ref,
|
|
6322
|
+
reason: "not-initialized"
|
|
6323
|
+
});
|
|
6324
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6325
|
+
ref,
|
|
6326
|
+
reason: answer.reason
|
|
6327
|
+
});
|
|
6328
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6329
|
+
ref,
|
|
6330
|
+
reason: answer.kind
|
|
6331
|
+
});
|
|
6332
|
+
}
|
|
6333
|
+
const substitute = (v) => {
|
|
6334
|
+
if (isSecretMarker(v)) {
|
|
6335
|
+
if (!inScope(v.$secret)) return {
|
|
6336
|
+
keep: true,
|
|
6337
|
+
value: v
|
|
6338
|
+
};
|
|
6339
|
+
const answer = answers[v.$secret];
|
|
6340
|
+
if (answer?.kind === "value") return {
|
|
6341
|
+
keep: true,
|
|
6342
|
+
value: answer.value
|
|
6343
|
+
};
|
|
6344
|
+
return keepMarker ? {
|
|
6345
|
+
keep: true,
|
|
6346
|
+
value: v
|
|
6347
|
+
} : {
|
|
6348
|
+
keep: false,
|
|
6349
|
+
value: void 0
|
|
6350
|
+
};
|
|
6351
|
+
}
|
|
6352
|
+
if (Array.isArray(v)) {
|
|
6353
|
+
const items = [];
|
|
6354
|
+
for (const item of v) {
|
|
6355
|
+
const s = substitute(item);
|
|
6356
|
+
if (s.keep) items.push(s.value);
|
|
6357
|
+
}
|
|
6358
|
+
return {
|
|
6359
|
+
keep: true,
|
|
6360
|
+
value: items
|
|
6361
|
+
};
|
|
6362
|
+
}
|
|
6363
|
+
if (isRecord$1(v)) {
|
|
6364
|
+
const out = {};
|
|
6365
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6366
|
+
const s = substitute(child);
|
|
6367
|
+
if (s.keep) out[k] = s.value;
|
|
6368
|
+
}
|
|
6369
|
+
return {
|
|
6370
|
+
keep: true,
|
|
6371
|
+
value: out
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
return {
|
|
6375
|
+
keep: true,
|
|
6376
|
+
value: v
|
|
6377
|
+
};
|
|
6378
|
+
};
|
|
6379
|
+
return {
|
|
6380
|
+
value: substitute(value).value,
|
|
6381
|
+
unresolved
|
|
6382
|
+
};
|
|
6383
|
+
}
|
|
6384
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6385
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6386
|
+
ref;
|
|
6387
|
+
reason;
|
|
6388
|
+
constructor(ref, reason) {
|
|
6389
|
+
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.`);
|
|
6390
|
+
this.ref = ref;
|
|
6391
|
+
this.reason = reason;
|
|
6392
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6393
|
+
}
|
|
6394
|
+
};
|
|
6395
|
+
function isRecord(value) {
|
|
6396
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6397
|
+
}
|
|
6398
|
+
function resolvedValue(pass, marker) {
|
|
6399
|
+
const answer = pass.answers[marker.$secret];
|
|
6400
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6401
|
+
}
|
|
6402
|
+
async function atMarker(pass, incoming, stored) {
|
|
6403
|
+
if (incoming === null) return stored;
|
|
6404
|
+
if (typeof incoming !== "string") return incoming;
|
|
6405
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6406
|
+
const intent = classifySecretWrite(incoming);
|
|
6407
|
+
if (intent.kind !== "set") return stored;
|
|
6408
|
+
const ref = stored.$secret;
|
|
6409
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6410
|
+
const answer = pass.answers[ref];
|
|
6411
|
+
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);
|
|
6412
|
+
try {
|
|
6413
|
+
await pass.secrets.put(ref, intent.value);
|
|
6414
|
+
} catch (err) {
|
|
6415
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6416
|
+
}
|
|
6417
|
+
pass.changedRefs.push(ref);
|
|
6418
|
+
return stored;
|
|
6419
|
+
}
|
|
6420
|
+
function inArray(pass, incoming, stored) {
|
|
6421
|
+
return incoming.map((item, index) => {
|
|
6422
|
+
const twin = stored[index];
|
|
6423
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6424
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6425
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6426
|
+
return item;
|
|
6427
|
+
});
|
|
6428
|
+
}
|
|
6429
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6430
|
+
const out = { ...incoming };
|
|
6431
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6432
|
+
const twin = stored[key];
|
|
6433
|
+
if (isSecretMarker(twin)) {
|
|
6434
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6435
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6436
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6437
|
+
}
|
|
6438
|
+
return out;
|
|
6439
|
+
}
|
|
6440
|
+
async function walk(pass, incoming, stored) {
|
|
6441
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6442
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6443
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6444
|
+
const out = { ...incoming };
|
|
6445
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6446
|
+
return out;
|
|
6447
|
+
}
|
|
6448
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6449
|
+
async function restoreUnchangedSecrets(input) {
|
|
6450
|
+
const refs = [];
|
|
6451
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6452
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6453
|
+
if (owned.length === 0) return {
|
|
6454
|
+
patch: input.patch,
|
|
6455
|
+
changedRefs: []
|
|
6456
|
+
};
|
|
6457
|
+
const pass = {
|
|
6458
|
+
secrets: input.secrets,
|
|
6459
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6460
|
+
operatorWrite: input.operatorWrite,
|
|
6461
|
+
changedRefs: []
|
|
6462
|
+
};
|
|
6463
|
+
const out = {};
|
|
6464
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6465
|
+
return {
|
|
6466
|
+
patch: out,
|
|
6467
|
+
changedRefs: pass.changedRefs
|
|
6468
|
+
};
|
|
6469
|
+
}
|
|
6470
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6471
|
+
function isJsonEqual(a, b) {
|
|
6472
|
+
if (Object.is(a, b)) return true;
|
|
6473
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6474
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6475
|
+
const keys = Object.keys(a);
|
|
6476
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6477
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6478
|
+
}
|
|
6479
|
+
return false;
|
|
6480
|
+
}
|
|
6481
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6482
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6483
|
+
const out = {};
|
|
6484
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6485
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6486
|
+
out[key] = value;
|
|
6487
|
+
}
|
|
6488
|
+
return out;
|
|
6489
|
+
}
|
|
6490
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6491
|
+
function markerKeysOf(blob, owner) {
|
|
6492
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6493
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6494
|
+
return keys;
|
|
6495
|
+
}
|
|
6496
|
+
function nodeFromStored(value, owner) {
|
|
6497
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6498
|
+
if (!isRecord(value)) return null;
|
|
6499
|
+
const children = /* @__PURE__ */ new Map();
|
|
6500
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6501
|
+
const node = nodeFromStored(child, owner);
|
|
6502
|
+
if (node !== null) children.set(key, node);
|
|
6503
|
+
}
|
|
6504
|
+
return children.size > 0 ? {
|
|
6505
|
+
kind: "object",
|
|
6506
|
+
children
|
|
6507
|
+
} : null;
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6511
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6512
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6513
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6514
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6515
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6516
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6517
|
+
* over.
|
|
6518
|
+
*/
|
|
6519
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6520
|
+
const added = /* @__PURE__ */ new Map();
|
|
6521
|
+
for (const key of keys) {
|
|
6522
|
+
const at = key.indexOf("@");
|
|
6523
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6524
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6525
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6526
|
+
if (node !== null) added.set(base, node);
|
|
6527
|
+
}
|
|
6528
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6529
|
+
}
|
|
6530
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6531
|
+
async function readStoredAddonBlob(raw) {
|
|
6532
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6533
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6534
|
+
const result = await threeWay.call(raw);
|
|
6535
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6536
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6537
|
+
}
|
|
6538
|
+
function touchesTree(tree, patch) {
|
|
6539
|
+
if (tree.size === 0) return false;
|
|
6540
|
+
for (const key of Object.keys(patch)) {
|
|
6541
|
+
const at = key.indexOf("@");
|
|
6542
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6543
|
+
}
|
|
6544
|
+
return false;
|
|
6545
|
+
}
|
|
6546
|
+
/**
|
|
6547
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6548
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6549
|
+
*/
|
|
6550
|
+
var MarkerKeyIndex = class {
|
|
6551
|
+
owner;
|
|
6552
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6553
|
+
constructor(owner) {
|
|
6554
|
+
this.owner = owner;
|
|
6555
|
+
}
|
|
6556
|
+
seen(store, blob) {
|
|
6557
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6558
|
+
}
|
|
6559
|
+
wrote(store, patch) {
|
|
6560
|
+
const keys = this.byStore.get(store);
|
|
6561
|
+
if (keys === void 0) return;
|
|
6562
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6563
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6564
|
+
else keys.delete(key);
|
|
6565
|
+
}
|
|
6566
|
+
mayHoldMarkers(store, patch) {
|
|
6567
|
+
const keys = this.byStore.get(store);
|
|
6568
|
+
if (keys === void 0) return true;
|
|
6569
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6570
|
+
}
|
|
6571
|
+
};
|
|
6572
|
+
function createHandle(raw, opts) {
|
|
6573
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6574
|
+
const serialize = (key, fn) => {
|
|
6575
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6576
|
+
const tail = next.catch(() => void 0);
|
|
6577
|
+
chains.set(key, tail);
|
|
6578
|
+
tail.then(() => {
|
|
6579
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6580
|
+
});
|
|
6581
|
+
return next;
|
|
6582
|
+
};
|
|
6583
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6584
|
+
const resolveRead = async (store, blob) => {
|
|
6585
|
+
index.seen(store, blob);
|
|
6586
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6587
|
+
unresolved: "keep-marker",
|
|
6588
|
+
ownedBy: opts.secrets.owner
|
|
6589
|
+
});
|
|
6590
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6591
|
+
return value;
|
|
6592
|
+
};
|
|
6593
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6594
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6595
|
+
await rawWrite(patch);
|
|
6596
|
+
index.wrote(store, patch);
|
|
6597
|
+
return { changed: true };
|
|
6598
|
+
}
|
|
6599
|
+
return serialize(store, async () => {
|
|
6600
|
+
const stored = await readStored();
|
|
6601
|
+
index.seen(store, stored);
|
|
6602
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6603
|
+
const restored = await restoreUnchangedSecrets({
|
|
6604
|
+
patch,
|
|
6605
|
+
stored,
|
|
6606
|
+
secrets: opts.secrets,
|
|
6607
|
+
operatorWrite
|
|
6608
|
+
});
|
|
6609
|
+
const result = await transformSecretWrite({
|
|
6610
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6611
|
+
secrets: opts.secrets,
|
|
6612
|
+
patch: restored.patch,
|
|
6613
|
+
stored,
|
|
6614
|
+
...scope !== void 0 ? { scope } : {},
|
|
6615
|
+
operatorWrite
|
|
6616
|
+
});
|
|
6617
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6618
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6619
|
+
if (wroteBlob) {
|
|
6620
|
+
await rawWrite(effective);
|
|
6621
|
+
index.wrote(store, effective);
|
|
6622
|
+
}
|
|
6623
|
+
const { orphaned } = await result.afterWrite();
|
|
6624
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6625
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6626
|
+
});
|
|
6627
|
+
};
|
|
6628
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6629
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6630
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6631
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6632
|
+
const overrides = {
|
|
6633
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6634
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6635
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6636
|
+
return result.kind === "value" ? {
|
|
6637
|
+
kind: "value",
|
|
6638
|
+
value: await resolveRead("addon", result.value)
|
|
6639
|
+
} : result;
|
|
6640
|
+
} } : {},
|
|
6641
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6642
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6643
|
+
if (result.kind !== "present") return result;
|
|
6644
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6645
|
+
unresolved: "keep-marker",
|
|
6646
|
+
ownedBy: opts.secrets.owner
|
|
6647
|
+
});
|
|
6648
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6649
|
+
return {
|
|
6650
|
+
kind: "present",
|
|
6651
|
+
value: value[key]
|
|
6652
|
+
};
|
|
6653
|
+
} } : {},
|
|
6654
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6655
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6656
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6657
|
+
const out = /* @__PURE__ */ new Map();
|
|
6658
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6659
|
+
return out;
|
|
6660
|
+
} } : {},
|
|
6661
|
+
writeAddonStore: async (patch) => {
|
|
6662
|
+
await writeAddon(patch);
|
|
6663
|
+
},
|
|
6664
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6665
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6666
|
+
kind: "device",
|
|
6667
|
+
deviceId
|
|
6668
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6669
|
+
}
|
|
6670
|
+
};
|
|
6671
|
+
return {
|
|
6672
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6673
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6674
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6675
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6676
|
+
} }),
|
|
6677
|
+
raw: {
|
|
6678
|
+
readAddonStore: async () => {
|
|
6679
|
+
const blob = await raw.readAddonStore();
|
|
6680
|
+
index.seen("addon", blob);
|
|
6681
|
+
return blob;
|
|
6682
|
+
},
|
|
6683
|
+
readDeviceStore: async (deviceId) => {
|
|
6684
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6685
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6686
|
+
return blob;
|
|
6687
|
+
}
|
|
6688
|
+
},
|
|
6689
|
+
writeAddonStore: writeAddon
|
|
6690
|
+
};
|
|
6691
|
+
}
|
|
6692
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6693
|
+
function createSecretAwareContext(context, opts) {
|
|
6694
|
+
const raw = context.settings;
|
|
6695
|
+
if (raw === void 0) return {
|
|
6696
|
+
context,
|
|
6697
|
+
handle: null
|
|
6698
|
+
};
|
|
6699
|
+
const handle = createHandle(raw, opts);
|
|
6700
|
+
return {
|
|
6701
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6702
|
+
if (prop === "settings") return handle.settings;
|
|
6703
|
+
return Reflect.get(target, prop, receiver);
|
|
6704
|
+
} }),
|
|
6705
|
+
handle
|
|
6706
|
+
};
|
|
6707
|
+
}
|
|
6708
|
+
var LEAF = { kind: "leaf" };
|
|
6709
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6710
|
+
function collectFields(fields, out) {
|
|
6711
|
+
for (const field of fields) {
|
|
6712
|
+
if (field.type === "group") {
|
|
6713
|
+
collectFields(field.fields, out);
|
|
6714
|
+
continue;
|
|
6715
|
+
}
|
|
6716
|
+
if (field.type === "sub-tabs") {
|
|
6717
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6718
|
+
continue;
|
|
6719
|
+
}
|
|
6720
|
+
if (field.type === "editable-array") {
|
|
6721
|
+
const item = /* @__PURE__ */ new Map();
|
|
6722
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6723
|
+
if (item.size > 0) out.set(field.key, {
|
|
6724
|
+
kind: "array",
|
|
6725
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6726
|
+
item
|
|
6727
|
+
});
|
|
6728
|
+
continue;
|
|
6729
|
+
}
|
|
6730
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6731
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6732
|
+
}
|
|
6733
|
+
}
|
|
6734
|
+
/** The secret tree a settings schema declares. */
|
|
6735
|
+
function secretTreeFromSchema(schema) {
|
|
6736
|
+
const out = /* @__PURE__ */ new Map();
|
|
6737
|
+
if (schema === null) return out;
|
|
6738
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6739
|
+
return out;
|
|
6740
|
+
}
|
|
6741
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6742
|
+
function parseSecretStatePath(path) {
|
|
6743
|
+
const segments = [];
|
|
6744
|
+
for (const raw of path.split(".")) {
|
|
6745
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6746
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6747
|
+
segments.push(m[2] !== void 0 ? {
|
|
6748
|
+
key: m[1],
|
|
6749
|
+
idKey: m[2]
|
|
6750
|
+
} : { key: m[1] });
|
|
6751
|
+
}
|
|
6752
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6753
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6754
|
+
return segments;
|
|
6755
|
+
}
|
|
6756
|
+
function insert(into, segments) {
|
|
6757
|
+
const [head, ...rest] = segments;
|
|
6758
|
+
if (head === void 0) return;
|
|
6759
|
+
if (rest.length === 0) {
|
|
6760
|
+
into.set(head.key, LEAF);
|
|
6761
|
+
return;
|
|
6762
|
+
}
|
|
6763
|
+
const existing = into.get(head.key);
|
|
6764
|
+
if (head.idKey !== void 0) {
|
|
6765
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6766
|
+
insert(item, rest);
|
|
6767
|
+
into.set(head.key, {
|
|
6768
|
+
kind: "array",
|
|
6769
|
+
idKey: head.idKey,
|
|
6770
|
+
item
|
|
6771
|
+
});
|
|
6772
|
+
return;
|
|
6773
|
+
}
|
|
6774
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6775
|
+
insert(children, rest);
|
|
6776
|
+
into.set(head.key, {
|
|
6777
|
+
kind: "object",
|
|
6778
|
+
children
|
|
6779
|
+
});
|
|
6780
|
+
}
|
|
6781
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6782
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6783
|
+
if (paths.length === 0) return tree;
|
|
6784
|
+
const out = new Map(tree);
|
|
6785
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6786
|
+
return out;
|
|
6787
|
+
}
|
|
6788
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6789
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6790
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6791
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6792
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5910
6793
|
/**
|
|
5911
6794
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5912
6795
|
*
|
|
@@ -5976,6 +6859,33 @@ var BaseAddon = class {
|
|
|
5976
6859
|
settingsStoreReady = false;
|
|
5977
6860
|
/** Default config values. Provided via constructor. */
|
|
5978
6861
|
defaults;
|
|
6862
|
+
/**
|
|
6863
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6864
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6865
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6866
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6867
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6868
|
+
*/
|
|
6869
|
+
secretStatePaths = [];
|
|
6870
|
+
_addonSecretTree = null;
|
|
6871
|
+
_deviceSecretTree = null;
|
|
6872
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6873
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6874
|
+
_unresolvedSecrets = [];
|
|
6875
|
+
_secretRetryTimer = null;
|
|
6876
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6877
|
+
_secretChangeTimer = null;
|
|
6878
|
+
_secretChangeUnsub = null;
|
|
6879
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6880
|
+
_operatorWriteDepth = 0;
|
|
6881
|
+
/**
|
|
6882
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6883
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6884
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6885
|
+
*/
|
|
6886
|
+
_secretSettings = null;
|
|
6887
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6888
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
5979
6889
|
constructor(defaults) {
|
|
5980
6890
|
this.defaults = defaults;
|
|
5981
6891
|
this._config = { ...defaults };
|
|
@@ -6011,8 +6921,26 @@ var BaseAddon = class {
|
|
|
6011
6921
|
return this._config;
|
|
6012
6922
|
}
|
|
6013
6923
|
async initialize(context) {
|
|
6014
|
-
|
|
6924
|
+
const secrets = context.secrets;
|
|
6925
|
+
if (secrets !== void 0) {
|
|
6926
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6927
|
+
secrets,
|
|
6928
|
+
addonTree: () => this.addonSecretTree(),
|
|
6929
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6930
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6931
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6932
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6933
|
+
});
|
|
6934
|
+
this._ctx = wrapped;
|
|
6935
|
+
this._secretSettings = handle;
|
|
6936
|
+
} else {
|
|
6937
|
+
this._ctx = context;
|
|
6938
|
+
this._secretSettings = null;
|
|
6939
|
+
}
|
|
6015
6940
|
await this.resolveConfig();
|
|
6941
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6942
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6943
|
+
});
|
|
6016
6944
|
const result = await this.onInitialize();
|
|
6017
6945
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6018
6946
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6045,6 +6973,12 @@ var BaseAddon = class {
|
|
|
6045
6973
|
*/
|
|
6046
6974
|
async onHubReachable() {}
|
|
6047
6975
|
async shutdown() {
|
|
6976
|
+
this._secretChangeUnsub?.();
|
|
6977
|
+
this._secretChangeUnsub = null;
|
|
6978
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6979
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6980
|
+
this._secretRetryTimer = null;
|
|
6981
|
+
this._secretChangeTimer = null;
|
|
6048
6982
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6049
6983
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6050
6984
|
await this.onShutdown();
|
|
@@ -6119,11 +7053,8 @@ var BaseAddon = class {
|
|
|
6119
7053
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6120
7054
|
const schema = this.globalSettingsSchema(cap);
|
|
6121
7055
|
if (!schema) return { sections: [] };
|
|
6122
|
-
const projected = await this.
|
|
6123
|
-
return hydrateSchema(schema, overlay ? {
|
|
6124
|
-
...projected,
|
|
6125
|
-
...overlay
|
|
6126
|
-
} : projected);
|
|
7056
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7057
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6127
7058
|
}
|
|
6128
7059
|
/**
|
|
6129
7060
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6168,11 +7099,11 @@ var BaseAddon = class {
|
|
|
6168
7099
|
});
|
|
6169
7100
|
}
|
|
6170
7101
|
if (sections.length === 0) return null;
|
|
6171
|
-
const projected = await this.
|
|
7102
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6172
7103
|
return hydrateSchema({
|
|
6173
7104
|
...schema,
|
|
6174
7105
|
sections
|
|
6175
|
-
}, projected);
|
|
7106
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6176
7107
|
}
|
|
6177
7108
|
/**
|
|
6178
7109
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6185,12 +7116,50 @@ var BaseAddon = class {
|
|
|
6185
7116
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6186
7117
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6187
7118
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7119
|
+
*
|
|
7120
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7121
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7122
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7123
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7124
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7125
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6188
7126
|
*/
|
|
6189
7127
|
async resolveGlobalStore(nodeId, cap) {
|
|
6190
7128
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7129
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7130
|
+
}
|
|
7131
|
+
projectForNode(store, nodeId, cap) {
|
|
6191
7132
|
const keys = this.perNodeKeys(cap);
|
|
6192
7133
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6193
|
-
return keys.size > 0 ? projectStore(
|
|
7134
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7135
|
+
}
|
|
7136
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7137
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7138
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7139
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7140
|
+
}
|
|
7141
|
+
/**
|
|
7142
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7143
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7144
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7145
|
+
* its value.
|
|
7146
|
+
*/
|
|
7147
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7148
|
+
const secrets = this._ctx?.secrets;
|
|
7149
|
+
const merged = {
|
|
7150
|
+
...stored,
|
|
7151
|
+
...overlay
|
|
7152
|
+
};
|
|
7153
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7154
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7155
|
+
unresolved: "keep-marker",
|
|
7156
|
+
ownedBy: secrets.owner
|
|
7157
|
+
});
|
|
7158
|
+
for (const key of Object.keys(overlay)) {
|
|
7159
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7160
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7161
|
+
}
|
|
7162
|
+
return merged;
|
|
6194
7163
|
}
|
|
6195
7164
|
/**
|
|
6196
7165
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6226,18 +7195,58 @@ var BaseAddon = class {
|
|
|
6226
7195
|
value: result.value[key]
|
|
6227
7196
|
};
|
|
6228
7197
|
}
|
|
7198
|
+
/**
|
|
7199
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7200
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7201
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7202
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7203
|
+
* writing back what it read is not (D787).
|
|
7204
|
+
*/
|
|
7205
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7206
|
+
this._operatorWriteDepth++;
|
|
7207
|
+
try {
|
|
7208
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7209
|
+
} finally {
|
|
7210
|
+
this._operatorWriteDepth--;
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
6229
7213
|
async updateGlobalSettings(patch, nodeId) {
|
|
7214
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7215
|
+
}
|
|
7216
|
+
/**
|
|
7217
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7218
|
+
*
|
|
7219
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7220
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7221
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7222
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7223
|
+
*/
|
|
7224
|
+
async clearSecrets(keys, nodeId) {
|
|
7225
|
+
const tree = this.addonSecretTree();
|
|
7226
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7227
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7228
|
+
const patch = {};
|
|
7229
|
+
for (const key of keys) {
|
|
7230
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7231
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7232
|
+
}
|
|
7233
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7234
|
+
}
|
|
7235
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6230
7236
|
const keys = this.perNodeKeys();
|
|
6231
7237
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6232
7238
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6233
|
-
const barePatch = patch;
|
|
6234
7239
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6235
|
-
|
|
7240
|
+
const handle = this._secretSettings;
|
|
7241
|
+
if (handle !== null) {
|
|
7242
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7243
|
+
if (!changed) return;
|
|
7244
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6236
7245
|
if (target !== localNode) return;
|
|
6237
7246
|
await this.resolveConfig();
|
|
6238
7247
|
await this.onConfigChanged();
|
|
6239
7248
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6240
|
-
this.maybeAutoRestart(
|
|
7249
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6241
7250
|
}
|
|
6242
7251
|
/**
|
|
6243
7252
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6262,7 +7271,7 @@ var BaseAddon = class {
|
|
|
6262
7271
|
* time to return its response before the addon is torn down and
|
|
6263
7272
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6264
7273
|
*/
|
|
6265
|
-
maybeAutoRestart(
|
|
7274
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6266
7275
|
if (!schema) return;
|
|
6267
7276
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6268
7277
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6270,13 +7279,13 @@ var BaseAddon = class {
|
|
|
6270
7279
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6271
7280
|
}
|
|
6272
7281
|
if (restartKeys.size === 0) return;
|
|
6273
|
-
if (!
|
|
7282
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6274
7283
|
const ctx = this._ctx;
|
|
6275
7284
|
if (!ctx) return;
|
|
6276
7285
|
const addonId = ctx.id;
|
|
6277
7286
|
setImmediate(() => {
|
|
6278
7287
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6279
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7288
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6280
7289
|
}).catch((err) => {
|
|
6281
7290
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6282
7291
|
});
|
|
@@ -6285,7 +7294,7 @@ var BaseAddon = class {
|
|
|
6285
7294
|
async getDeviceSettings(deviceId) {
|
|
6286
7295
|
const schema = this.deviceSettingsSchema();
|
|
6287
7296
|
if (!schema) return { sections: [] };
|
|
6288
|
-
return hydrateSchema(schema, await this.
|
|
7297
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6289
7298
|
}
|
|
6290
7299
|
async updateDeviceSettings(deviceId, patch) {
|
|
6291
7300
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6415,7 +7424,7 @@ var BaseAddon = class {
|
|
|
6415
7424
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6416
7425
|
*/
|
|
6417
7426
|
async resolveConfig() {
|
|
6418
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7427
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6419
7428
|
const perNode = this.perNodeKeys();
|
|
6420
7429
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6421
7430
|
const resolved = { ...this.defaults };
|
|
@@ -6440,7 +7449,7 @@ var BaseAddon = class {
|
|
|
6440
7449
|
key,
|
|
6441
7450
|
schema,
|
|
6442
7451
|
fallback,
|
|
6443
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7452
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6444
7453
|
write: async (patch) => {
|
|
6445
7454
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6446
7455
|
},
|
|
@@ -6457,7 +7466,7 @@ var BaseAddon = class {
|
|
|
6457
7466
|
key,
|
|
6458
7467
|
schema,
|
|
6459
7468
|
fallback,
|
|
6460
|
-
read: async () => await this.
|
|
7469
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6461
7470
|
write: async (patch) => {
|
|
6462
7471
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6463
7472
|
},
|
|
@@ -6469,6 +7478,87 @@ var BaseAddon = class {
|
|
|
6469
7478
|
} })
|
|
6470
7479
|
});
|
|
6471
7480
|
}
|
|
7481
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7482
|
+
addonSecretTree() {
|
|
7483
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7484
|
+
return this._addonSecretTree;
|
|
7485
|
+
}
|
|
7486
|
+
deviceSecretTree() {
|
|
7487
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7488
|
+
return this._deviceSecretTree;
|
|
7489
|
+
}
|
|
7490
|
+
/**
|
|
7491
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7492
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7493
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7494
|
+
* than start on an empty credential.
|
|
7495
|
+
*/
|
|
7496
|
+
get unresolvedSecrets() {
|
|
7497
|
+
return this._unresolvedSecrets;
|
|
7498
|
+
}
|
|
7499
|
+
/**
|
|
7500
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7501
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7502
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7503
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7504
|
+
* ever written back from here.
|
|
7505
|
+
*/
|
|
7506
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7507
|
+
const secrets = this._ctx?.secrets;
|
|
7508
|
+
if (secrets === void 0) return blob;
|
|
7509
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7510
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7511
|
+
if (refs.length === 0) {
|
|
7512
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7513
|
+
return blob;
|
|
7514
|
+
}
|
|
7515
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7516
|
+
if (trackForConfig) {
|
|
7517
|
+
this._unresolvedSecrets = unresolved;
|
|
7518
|
+
if (unresolved.length > 0) {
|
|
7519
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7520
|
+
ref: u.ref,
|
|
7521
|
+
reason: u.reason
|
|
7522
|
+
})) } });
|
|
7523
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7524
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7525
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7526
|
+
}
|
|
7527
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7528
|
+
}
|
|
7529
|
+
return value;
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7533
|
+
* keychain the context's own view is already raw.
|
|
7534
|
+
*/
|
|
7535
|
+
rawSettings() {
|
|
7536
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7537
|
+
}
|
|
7538
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7539
|
+
logUnresolvedRead(unresolved) {
|
|
7540
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7541
|
+
if (fresh.length === 0) return;
|
|
7542
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7543
|
+
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) => ({
|
|
7544
|
+
ref: u.ref,
|
|
7545
|
+
reason: u.reason
|
|
7546
|
+
})) } });
|
|
7547
|
+
}
|
|
7548
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7549
|
+
scheduleSecretReresolve(delayMs) {
|
|
7550
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7551
|
+
if (this[timerOf] !== null) return;
|
|
7552
|
+
const timer = setTimeout(() => {
|
|
7553
|
+
this[timerOf] = null;
|
|
7554
|
+
if (this._ctx === null) return;
|
|
7555
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7556
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7557
|
+
});
|
|
7558
|
+
}, delayMs);
|
|
7559
|
+
timer.unref?.();
|
|
7560
|
+
this[timerOf] = timer;
|
|
7561
|
+
}
|
|
6472
7562
|
/**
|
|
6473
7563
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6474
7564
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6481,7 +7571,7 @@ var BaseAddon = class {
|
|
|
6481
7571
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6482
7572
|
*/
|
|
6483
7573
|
async readAddonStoreWithRetry() {
|
|
6484
|
-
const settings = this.
|
|
7574
|
+
const settings = this.rawSettings();
|
|
6485
7575
|
if (!settings) return {};
|
|
6486
7576
|
const delaysMs = [
|
|
6487
7577
|
150,
|
|
@@ -7044,6 +8134,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7044
8134
|
kind: "mutation",
|
|
7045
8135
|
auth: "admin"
|
|
7046
8136
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8137
|
+
function defOf(schema) {
|
|
8138
|
+
return schema._zod?.def ?? {};
|
|
8139
|
+
}
|
|
8140
|
+
function declaredHere(schema) {
|
|
8141
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8142
|
+
}
|
|
8143
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8144
|
+
var WRAPPERS = new Set([
|
|
8145
|
+
"optional",
|
|
8146
|
+
"nullable",
|
|
8147
|
+
"default",
|
|
8148
|
+
"prefault",
|
|
8149
|
+
"catch",
|
|
8150
|
+
"readonly",
|
|
8151
|
+
"nonoptional"
|
|
8152
|
+
]);
|
|
8153
|
+
/**
|
|
8154
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8155
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8156
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8157
|
+
* `.transform` on `in`).
|
|
8158
|
+
*/
|
|
8159
|
+
function layersOf(schema) {
|
|
8160
|
+
const out = [];
|
|
8161
|
+
const queue = [schema];
|
|
8162
|
+
while (queue.length > 0) {
|
|
8163
|
+
const s = queue.shift();
|
|
8164
|
+
if (!s || out.includes(s)) continue;
|
|
8165
|
+
out.push(s);
|
|
8166
|
+
const def = defOf(s);
|
|
8167
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8168
|
+
if (def.type === "pipe") {
|
|
8169
|
+
if (def.in) queue.push(def.in);
|
|
8170
|
+
if (def.out) queue.push(def.out);
|
|
8171
|
+
}
|
|
8172
|
+
}
|
|
8173
|
+
return out;
|
|
8174
|
+
}
|
|
8175
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8176
|
+
function isZodSecret(schema) {
|
|
8177
|
+
return layersOf(schema).some(declaredHere);
|
|
8178
|
+
}
|
|
8179
|
+
/**
|
|
8180
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8181
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8182
|
+
* object or array is reported as one path and not descended into — everything
|
|
8183
|
+
* under it is secret.
|
|
8184
|
+
*/
|
|
8185
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8186
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8187
|
+
const paths = [];
|
|
8188
|
+
for (const layer of layersOf(schema)) {
|
|
8189
|
+
const def = defOf(layer);
|
|
8190
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8191
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8192
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8193
|
+
else if (def.type === "intersection") {
|
|
8194
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8195
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
return [...new Set(paths)];
|
|
8199
|
+
}
|
|
7047
8200
|
//#endregion
|
|
7048
8201
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7049
8202
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8721,6 +9874,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8721
9874
|
fetchedAt: number()
|
|
8722
9875
|
});
|
|
8723
9876
|
/**
|
|
9877
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9878
|
+
* gets back (cloud training, D805+).
|
|
9879
|
+
*
|
|
9880
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9881
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9882
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9883
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9884
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9885
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9886
|
+
* change there, in the same piece of work.
|
|
9887
|
+
*
|
|
9888
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9889
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9890
|
+
*/
|
|
9891
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9892
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9893
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9894
|
+
var TrainingExportSchema = _enum([
|
|
9895
|
+
"onnx",
|
|
9896
|
+
"openvino-fp16",
|
|
9897
|
+
"openvino-int8",
|
|
9898
|
+
"coreml-fp16"
|
|
9899
|
+
]);
|
|
9900
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9901
|
+
object({
|
|
9902
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9903
|
+
jobKey: string().uuid(),
|
|
9904
|
+
target: object({
|
|
9905
|
+
kind: literal("detector"),
|
|
9906
|
+
step: literal("object-detection")
|
|
9907
|
+
}),
|
|
9908
|
+
base: object({
|
|
9909
|
+
modelId: string().min(1),
|
|
9910
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9911
|
+
weights: string().min(1),
|
|
9912
|
+
imgsz: number().int().positive()
|
|
9913
|
+
}),
|
|
9914
|
+
baseline: object({
|
|
9915
|
+
modelId: string().min(1),
|
|
9916
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9917
|
+
onnxUrl: string().url(),
|
|
9918
|
+
imgsz: number().int().positive(),
|
|
9919
|
+
floors: FloorsSchema
|
|
9920
|
+
}),
|
|
9921
|
+
dataset: object({
|
|
9922
|
+
versionId: string().min(1),
|
|
9923
|
+
annotationHash: string(),
|
|
9924
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9925
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9926
|
+
}),
|
|
9927
|
+
split: object({
|
|
9928
|
+
holdoutCameras: array(number().int()),
|
|
9929
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9930
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9931
|
+
valFraction: number().min(0).max(.5),
|
|
9932
|
+
seed: number().int()
|
|
9933
|
+
}),
|
|
9934
|
+
hyper: object({
|
|
9935
|
+
epochs: number().int().positive(),
|
|
9936
|
+
batch: number().int().positive(),
|
|
9937
|
+
lr0: number().positive(),
|
|
9938
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9939
|
+
freeze: number().int().nonnegative(),
|
|
9940
|
+
patience: number().int().nonnegative(),
|
|
9941
|
+
seed: number().int()
|
|
9942
|
+
}),
|
|
9943
|
+
replay: object({
|
|
9944
|
+
source: literal("coco2017"),
|
|
9945
|
+
count: number().int().nonnegative()
|
|
9946
|
+
}),
|
|
9947
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9948
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9949
|
+
floors: object({
|
|
9950
|
+
minSupport: number().int().positive(),
|
|
9951
|
+
clamp: number().min(0).max(1)
|
|
9952
|
+
}),
|
|
9953
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9954
|
+
catalog: object({
|
|
9955
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9956
|
+
name: string().min(1).max(160)
|
|
9957
|
+
})
|
|
9958
|
+
});
|
|
9959
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9960
|
+
var TrainingResultFileSchema = object({
|
|
9961
|
+
path: string().min(1),
|
|
9962
|
+
bytes: number().int().nonnegative(),
|
|
9963
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9964
|
+
format: _enum([
|
|
9965
|
+
"onnx",
|
|
9966
|
+
"openvino",
|
|
9967
|
+
"coreml",
|
|
9968
|
+
"pt"
|
|
9969
|
+
]),
|
|
9970
|
+
variant: _enum(["base", "int8"])
|
|
9971
|
+
});
|
|
9972
|
+
var DraftFormatSchema = object({
|
|
9973
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9974
|
+
url: string().min(1),
|
|
9975
|
+
sizeMB: number().nonnegative(),
|
|
9976
|
+
isDirectory: boolean().optional(),
|
|
9977
|
+
files: array(string()).optional(),
|
|
9978
|
+
runtimes: array(literal("python")).optional(),
|
|
9979
|
+
revision: string().min(1)
|
|
9980
|
+
});
|
|
9981
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9982
|
+
var TrainingCatalogDraftSchema = object({
|
|
9983
|
+
id: string().min(1),
|
|
9984
|
+
name: string().min(1),
|
|
9985
|
+
description: string(),
|
|
9986
|
+
labels: array(unknown()),
|
|
9987
|
+
inputSize: object({
|
|
9988
|
+
width: number().int().positive(),
|
|
9989
|
+
height: number().int().positive()
|
|
9990
|
+
}),
|
|
9991
|
+
preprocessMode: literal("letterbox"),
|
|
9992
|
+
defaultClassFloors: FloorsSchema,
|
|
9993
|
+
formats: object({
|
|
9994
|
+
onnx: DraftFormatSchema.optional(),
|
|
9995
|
+
openvino: DraftFormatSchema.optional(),
|
|
9996
|
+
coreml: DraftFormatSchema.optional()
|
|
9997
|
+
})
|
|
9998
|
+
});
|
|
9999
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10000
|
+
var TrainingEvalClassSchema = object({
|
|
10001
|
+
positives: number().int(),
|
|
10002
|
+
floor: number().nullable(),
|
|
10003
|
+
tp: number().int(),
|
|
10004
|
+
fp: number().int(),
|
|
10005
|
+
fn: number().int(),
|
|
10006
|
+
precision: number().nullable(),
|
|
10007
|
+
recall: number().nullable(),
|
|
10008
|
+
ap50: number().nullable(),
|
|
10009
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10010
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10011
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10012
|
+
smallFound: number().int().optional(),
|
|
10013
|
+
smallTotal: number().int().optional()
|
|
10014
|
+
}).passthrough();
|
|
10015
|
+
var TrainingEvalReportSchema = object({
|
|
10016
|
+
frames: number().int(),
|
|
10017
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10018
|
+
}).passthrough();
|
|
10019
|
+
/**
|
|
10020
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10021
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10022
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10023
|
+
*/
|
|
10024
|
+
var TrainingResultSchema = object({
|
|
10025
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10026
|
+
jobKey: string(),
|
|
10027
|
+
status: _enum(["succeeded", "failed"]),
|
|
10028
|
+
error: object({
|
|
10029
|
+
stage: string(),
|
|
10030
|
+
code: string(),
|
|
10031
|
+
message: string()
|
|
10032
|
+
}).nullable(),
|
|
10033
|
+
trainer: object({
|
|
10034
|
+
version: string(),
|
|
10035
|
+
revision: string()
|
|
10036
|
+
}),
|
|
10037
|
+
toolchain: record(string(), string().nullable()),
|
|
10038
|
+
dataset: object({
|
|
10039
|
+
versionId: string(),
|
|
10040
|
+
annotationHash: string(),
|
|
10041
|
+
sha256: string(),
|
|
10042
|
+
frames: object({
|
|
10043
|
+
train: number().int(),
|
|
10044
|
+
val: number().int(),
|
|
10045
|
+
holdout: number().int()
|
|
10046
|
+
}),
|
|
10047
|
+
holdoutCameras: array(number().int()),
|
|
10048
|
+
replayImages: number().int()
|
|
10049
|
+
}).optional(),
|
|
10050
|
+
training: object({
|
|
10051
|
+
epochsRun: number().int(),
|
|
10052
|
+
bestEpoch: number().int(),
|
|
10053
|
+
bestMap50: number(),
|
|
10054
|
+
bestMap50_95: number(),
|
|
10055
|
+
seconds: number()
|
|
10056
|
+
}).optional(),
|
|
10057
|
+
evaluation: object({
|
|
10058
|
+
holdoutFrames: number().int(),
|
|
10059
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10060
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10061
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10062
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10063
|
+
map50: record(string(), number().nullable())
|
|
10064
|
+
}).optional(),
|
|
10065
|
+
floors: object({
|
|
10066
|
+
baseline: FloorsSchema,
|
|
10067
|
+
candidate: FloorsSchema,
|
|
10068
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10069
|
+
notes: array(string())
|
|
10070
|
+
}).optional(),
|
|
10071
|
+
int8: object({
|
|
10072
|
+
kept: boolean(),
|
|
10073
|
+
map50Fp16: number().nullable(),
|
|
10074
|
+
map50Int8: number().nullable(),
|
|
10075
|
+
reason: string().nullable()
|
|
10076
|
+
}).optional(),
|
|
10077
|
+
exportsDropped: array(object({
|
|
10078
|
+
export: string(),
|
|
10079
|
+
reason: string()
|
|
10080
|
+
})).optional(),
|
|
10081
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10082
|
+
bundle: object({
|
|
10083
|
+
path: literal("bundle.tar"),
|
|
10084
|
+
bytes: number().int().nonnegative(),
|
|
10085
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10086
|
+
}).nullable().optional(),
|
|
10087
|
+
catalogDraft: object({
|
|
10088
|
+
base: TrainingCatalogDraftSchema,
|
|
10089
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10090
|
+
}).nullable().optional(),
|
|
10091
|
+
licence: string()
|
|
10092
|
+
});
|
|
10093
|
+
var TrainingStageSchema = _enum([
|
|
10094
|
+
"prepare",
|
|
10095
|
+
"replay",
|
|
10096
|
+
"train",
|
|
10097
|
+
"eval",
|
|
10098
|
+
"export",
|
|
10099
|
+
"package"
|
|
10100
|
+
]);
|
|
10101
|
+
var EventBase = {
|
|
10102
|
+
v: literal(1),
|
|
10103
|
+
ts: number()
|
|
10104
|
+
};
|
|
10105
|
+
discriminatedUnion("type", [
|
|
10106
|
+
object({
|
|
10107
|
+
...EventBase,
|
|
10108
|
+
type: literal("stage"),
|
|
10109
|
+
stage: TrainingStageSchema
|
|
10110
|
+
}),
|
|
10111
|
+
object({
|
|
10112
|
+
...EventBase,
|
|
10113
|
+
type: literal("epoch"),
|
|
10114
|
+
epoch: number().int(),
|
|
10115
|
+
epochs: number().int(),
|
|
10116
|
+
boxLoss: number().nullable().optional(),
|
|
10117
|
+
map50: number().nullable().optional(),
|
|
10118
|
+
map50_95: number().nullable().optional(),
|
|
10119
|
+
etaSec: number().nullable().optional()
|
|
10120
|
+
}),
|
|
10121
|
+
object({
|
|
10122
|
+
...EventBase,
|
|
10123
|
+
type: literal("metric"),
|
|
10124
|
+
name: string(),
|
|
10125
|
+
value: number()
|
|
10126
|
+
}),
|
|
10127
|
+
object({
|
|
10128
|
+
...EventBase,
|
|
10129
|
+
type: literal("artifact"),
|
|
10130
|
+
path: string(),
|
|
10131
|
+
bytes: number(),
|
|
10132
|
+
sha256: string()
|
|
10133
|
+
}),
|
|
10134
|
+
object({
|
|
10135
|
+
...EventBase,
|
|
10136
|
+
type: literal("done"),
|
|
10137
|
+
status: _enum(["succeeded", "failed"]),
|
|
10138
|
+
resultSha256: string().nullable().optional()
|
|
10139
|
+
}),
|
|
10140
|
+
object({
|
|
10141
|
+
...EventBase,
|
|
10142
|
+
type: literal("error"),
|
|
10143
|
+
stage: string(),
|
|
10144
|
+
code: string(),
|
|
10145
|
+
message: string()
|
|
10146
|
+
})
|
|
10147
|
+
]);
|
|
10148
|
+
/**
|
|
8724
10149
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8725
10150
|
*
|
|
8726
10151
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11048,7 +12473,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11048
12473
|
"authenticated",
|
|
11049
12474
|
"admin"
|
|
11050
12475
|
]).optional(),
|
|
11051
|
-
description: string().optional()
|
|
12476
|
+
description: string().optional(),
|
|
12477
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12478
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11052
12479
|
});
|
|
11053
12480
|
/**
|
|
11054
12481
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11753,6 +13180,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11753
13180
|
lastError: string().optional()
|
|
11754
13181
|
});
|
|
11755
13182
|
/**
|
|
13183
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13184
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13185
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13186
|
+
* with it off — which restores without a key.
|
|
13187
|
+
*/
|
|
13188
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13189
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13190
|
+
scheme: string(),
|
|
13191
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13192
|
+
keyId: string()
|
|
13193
|
+
});
|
|
13194
|
+
/**
|
|
13195
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13196
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13197
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13198
|
+
*/
|
|
13199
|
+
var BackupEncryptionStatusSchema = object({
|
|
13200
|
+
enabled: boolean(),
|
|
13201
|
+
active: object({
|
|
13202
|
+
keyId: string(),
|
|
13203
|
+
publicKey: string(),
|
|
13204
|
+
createdAt: number()
|
|
13205
|
+
}).nullable(),
|
|
13206
|
+
/** Every key ever set up, newest first. */
|
|
13207
|
+
keys: array(object({
|
|
13208
|
+
keyId: string(),
|
|
13209
|
+
createdAt: number(),
|
|
13210
|
+
retiredAt: number().nullable()
|
|
13211
|
+
})).readonly()
|
|
13212
|
+
});
|
|
13213
|
+
/**
|
|
11756
13214
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11757
13215
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11758
13216
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11764,7 +13222,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11764
13222
|
sizeBytes: number(),
|
|
11765
13223
|
label: string().optional(),
|
|
11766
13224
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11767
|
-
locations: array(string()).readonly()
|
|
13225
|
+
locations: array(string()).readonly(),
|
|
13226
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13227
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11768
13228
|
});
|
|
11769
13229
|
var BackupEntrySchema = object({
|
|
11770
13230
|
id: string(),
|
|
@@ -11773,7 +13233,8 @@ var BackupEntrySchema = object({
|
|
|
11773
13233
|
label: string().optional(),
|
|
11774
13234
|
createdAt: number(),
|
|
11775
13235
|
sizeBytes: number(),
|
|
11776
|
-
locations: array(string()).optional()
|
|
13236
|
+
locations: array(string()).optional(),
|
|
13237
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11777
13238
|
});
|
|
11778
13239
|
var ArchiveEntrySchema = object({
|
|
11779
13240
|
path: string(),
|
|
@@ -11962,10 +13423,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
11962
13423
|
* this list and skips entries whose path doesn't start with
|
|
11963
13424
|
* any of them.
|
|
11964
13425
|
*/
|
|
11965
|
-
locations: array(string()).optional()
|
|
13426
|
+
locations: array(string()).optional(),
|
|
13427
|
+
/**
|
|
13428
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13429
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13430
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13431
|
+
* is refused before the archive is downloaded.
|
|
13432
|
+
*/
|
|
13433
|
+
backupSecretKey: string().optional()
|
|
11966
13434
|
}), _void(), {
|
|
11967
13435
|
kind: "mutation",
|
|
11968
13436
|
auth: "admin"
|
|
13437
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13438
|
+
keyId: string(),
|
|
13439
|
+
secretKey: string(),
|
|
13440
|
+
publicKey: string(),
|
|
13441
|
+
createdAt: number(),
|
|
13442
|
+
replacedKeyId: string().nullable()
|
|
13443
|
+
}), {
|
|
13444
|
+
kind: "mutation",
|
|
13445
|
+
auth: "admin"
|
|
13446
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13447
|
+
kind: "mutation",
|
|
13448
|
+
auth: "admin"
|
|
13449
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13450
|
+
valid: boolean(),
|
|
13451
|
+
keyId: string().nullable(),
|
|
13452
|
+
/** The hub knows this key (active or retired). */
|
|
13453
|
+
known: boolean(),
|
|
13454
|
+
/** It is the key new archives are encrypted to. */
|
|
13455
|
+
active: boolean(),
|
|
13456
|
+
error: string().optional()
|
|
13457
|
+
}), {
|
|
13458
|
+
kind: "mutation",
|
|
13459
|
+
auth: "admin"
|
|
11969
13460
|
}), method(object({
|
|
11970
13461
|
destinationId: string(),
|
|
11971
13462
|
backupId: string()
|
|
@@ -13691,7 +15182,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13691
15182
|
stepId: string(),
|
|
13692
15183
|
entry: ModelCatalogEntrySchema
|
|
13693
15184
|
});
|
|
13694
|
-
|
|
15185
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15186
|
+
var ModelBundleFileSchema = object({
|
|
15187
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15188
|
+
path: string().min(1),
|
|
15189
|
+
bytes: number().int().nonnegative(),
|
|
15190
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15191
|
+
});
|
|
15192
|
+
var ImportModelBundleInputSchema = object({
|
|
15193
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15194
|
+
addonId: string(),
|
|
15195
|
+
stepId: string().min(1),
|
|
15196
|
+
/**
|
|
15197
|
+
* The catalog rows to register, complete, every format URL already
|
|
15198
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15199
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15200
|
+
*/
|
|
15201
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15202
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15203
|
+
bundle: object({
|
|
15204
|
+
ticket: PeerBytesTicketSchema,
|
|
15205
|
+
bytes: number().int().positive(),
|
|
15206
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15207
|
+
}),
|
|
15208
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15209
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15210
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15211
|
+
distribute: boolean()
|
|
15212
|
+
});
|
|
15213
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15214
|
+
kind: literal("imported"),
|
|
15215
|
+
modelIds: array(string()).readonly(),
|
|
15216
|
+
distributed: array(object({
|
|
15217
|
+
modelId: string(),
|
|
15218
|
+
nodeId: string(),
|
|
15219
|
+
format: _enum(MODEL_FORMATS),
|
|
15220
|
+
ok: boolean(),
|
|
15221
|
+
error: string().optional()
|
|
15222
|
+
})).readonly()
|
|
15223
|
+
}), object({
|
|
15224
|
+
kind: literal("refused"),
|
|
15225
|
+
reason: _enum([
|
|
15226
|
+
"transfer-failed",
|
|
15227
|
+
"checksum-mismatch",
|
|
15228
|
+
"bundle-mismatch",
|
|
15229
|
+
"invalid-entry",
|
|
15230
|
+
"id-taken"
|
|
15231
|
+
]),
|
|
15232
|
+
detail: string()
|
|
15233
|
+
})]);
|
|
15234
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15235
|
+
kind: "mutation",
|
|
15236
|
+
auth: "admin",
|
|
15237
|
+
timeoutMs: 30 * 6e4
|
|
15238
|
+
});
|
|
13695
15239
|
/**
|
|
13696
15240
|
* Query filter for settings-store collections.
|
|
13697
15241
|
*/
|
|
@@ -14074,6 +15618,253 @@ id: union([string(), number()]) }), {
|
|
|
14074
15618
|
kind: "mutation",
|
|
14075
15619
|
auth: "admin"
|
|
14076
15620
|
});
|
|
15621
|
+
/**
|
|
15622
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15623
|
+
*
|
|
15624
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15625
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15626
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15627
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15628
|
+
* against the CALLER, never against anything the caller claims.
|
|
15629
|
+
*
|
|
15630
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15631
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15632
|
+
* connection, the agent from its child's connection carried in
|
|
15633
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15634
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15635
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15636
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15637
|
+
* runner is the same OS user): see the threat model in
|
|
15638
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15639
|
+
*
|
|
15640
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15641
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15642
|
+
* floors every method to admin anyway (D240).
|
|
15643
|
+
*
|
|
15644
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15645
|
+
*/
|
|
15646
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15647
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15648
|
+
"key-missing",
|
|
15649
|
+
"wrong-key",
|
|
15650
|
+
"key-file-unreadable",
|
|
15651
|
+
"store-unavailable",
|
|
15652
|
+
"not-initialized",
|
|
15653
|
+
"decrypt-failed"
|
|
15654
|
+
]);
|
|
15655
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15656
|
+
state: literal("locked"),
|
|
15657
|
+
reason: KeychainUnavailableReasonSchema
|
|
15658
|
+
})]);
|
|
15659
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15660
|
+
object({
|
|
15661
|
+
kind: literal("value"),
|
|
15662
|
+
value: string(),
|
|
15663
|
+
version: number().int()
|
|
15664
|
+
}),
|
|
15665
|
+
object({ kind: literal("missing") }),
|
|
15666
|
+
object({
|
|
15667
|
+
kind: literal("unavailable"),
|
|
15668
|
+
reason: KeychainUnavailableReasonSchema
|
|
15669
|
+
}),
|
|
15670
|
+
object({ kind: literal("forbidden") })
|
|
15671
|
+
]);
|
|
15672
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15673
|
+
/** Metadata of one stored value — never the value. */
|
|
15674
|
+
var KeychainSecretMetaSchema = object({
|
|
15675
|
+
ref: string(),
|
|
15676
|
+
owner: string(),
|
|
15677
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15678
|
+
scope: string(),
|
|
15679
|
+
fieldPath: string(),
|
|
15680
|
+
version: number().int(),
|
|
15681
|
+
createdAt: number(),
|
|
15682
|
+
updatedAt: number(),
|
|
15683
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15684
|
+
updatedBy: string(),
|
|
15685
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15686
|
+
lastReadAt: number().nullable()
|
|
15687
|
+
});
|
|
15688
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15689
|
+
method(object({
|
|
15690
|
+
ref: string().min(1),
|
|
15691
|
+
value: string().min(1)
|
|
15692
|
+
}), object({
|
|
15693
|
+
ref: string(),
|
|
15694
|
+
version: number().int()
|
|
15695
|
+
}), {
|
|
15696
|
+
kind: "mutation",
|
|
15697
|
+
auth: "admin"
|
|
15698
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15699
|
+
kind: "mutation",
|
|
15700
|
+
auth: "admin"
|
|
15701
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15702
|
+
var KeychainKeySourceSchema = object({
|
|
15703
|
+
kind: _enum([
|
|
15704
|
+
"config-file",
|
|
15705
|
+
"previous-config-file",
|
|
15706
|
+
"platform",
|
|
15707
|
+
"default-file"
|
|
15708
|
+
]),
|
|
15709
|
+
/** File sources only — a path is not a secret. */
|
|
15710
|
+
path: string().optional(),
|
|
15711
|
+
/**
|
|
15712
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15713
|
+
* next to the database it protects (the default file). The page warns.
|
|
15714
|
+
*/
|
|
15715
|
+
sharesBackupWithDatabase: boolean()
|
|
15716
|
+
});
|
|
15717
|
+
/**
|
|
15718
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15719
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15720
|
+
*/
|
|
15721
|
+
var KeychainResetRecordSchema = object({
|
|
15722
|
+
id: string(),
|
|
15723
|
+
at: number(),
|
|
15724
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15725
|
+
actor: string(),
|
|
15726
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15727
|
+
lockedReason: string().nullable(),
|
|
15728
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15729
|
+
archived: number().int(),
|
|
15730
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15731
|
+
archivedCollection: string().nullable(),
|
|
15732
|
+
/**
|
|
15733
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15734
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15735
|
+
*/
|
|
15736
|
+
archivedKeysCollection: string().nullable(),
|
|
15737
|
+
/**
|
|
15738
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15739
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15740
|
+
* agent forever (D797).
|
|
15741
|
+
*/
|
|
15742
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15743
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15744
|
+
acknowledgedAt: number().nullable()
|
|
15745
|
+
});
|
|
15746
|
+
var KeychainStatusSchema = object({
|
|
15747
|
+
keychain: KeychainStateSchema,
|
|
15748
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15749
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15750
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15751
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15752
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15753
|
+
fingerprint: string().nullable(),
|
|
15754
|
+
activeKeyId: string().nullable(),
|
|
15755
|
+
/**
|
|
15756
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15757
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15758
|
+
*/
|
|
15759
|
+
rotationPending: boolean(),
|
|
15760
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15761
|
+
retiredWraps: number().int(),
|
|
15762
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15763
|
+
secretCount: number().int(),
|
|
15764
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15765
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15766
|
+
});
|
|
15767
|
+
/**
|
|
15768
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15769
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15770
|
+
* never reported as an orphan (and never deleted as one).
|
|
15771
|
+
*/
|
|
15772
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15773
|
+
"in-use",
|
|
15774
|
+
"orphan",
|
|
15775
|
+
"unknown"
|
|
15776
|
+
]);
|
|
15777
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15778
|
+
var KeychainAuditActionSchema = _enum([
|
|
15779
|
+
"put",
|
|
15780
|
+
"delete",
|
|
15781
|
+
"reveal",
|
|
15782
|
+
"rotate-master-key",
|
|
15783
|
+
"purge-retired-keys",
|
|
15784
|
+
"download-recovery-key",
|
|
15785
|
+
"delete-orphans",
|
|
15786
|
+
"reset",
|
|
15787
|
+
"acknowledge-reset",
|
|
15788
|
+
"initialize"
|
|
15789
|
+
]);
|
|
15790
|
+
var KeychainAuditEntrySchema = object({
|
|
15791
|
+
id: string(),
|
|
15792
|
+
at: number(),
|
|
15793
|
+
action: KeychainAuditActionSchema,
|
|
15794
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15795
|
+
actor: string(),
|
|
15796
|
+
ref: string().nullable(),
|
|
15797
|
+
detail: string().nullable()
|
|
15798
|
+
});
|
|
15799
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15800
|
+
/**
|
|
15801
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15802
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15803
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15804
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15805
|
+
*/
|
|
15806
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15807
|
+
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({
|
|
15808
|
+
value: string(),
|
|
15809
|
+
version: number().int()
|
|
15810
|
+
}), {
|
|
15811
|
+
kind: "mutation",
|
|
15812
|
+
auth: "admin",
|
|
15813
|
+
caller: "required"
|
|
15814
|
+
}), method(object({
|
|
15815
|
+
name: SystemHeldSecretNameSchema,
|
|
15816
|
+
value: string().min(16)
|
|
15817
|
+
}), object({
|
|
15818
|
+
ref: string(),
|
|
15819
|
+
version: number().int()
|
|
15820
|
+
}), {
|
|
15821
|
+
kind: "mutation",
|
|
15822
|
+
auth: "admin",
|
|
15823
|
+
caller: "required"
|
|
15824
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15825
|
+
deleted: array(string()).readonly(),
|
|
15826
|
+
kept: array(object({
|
|
15827
|
+
ref: string(),
|
|
15828
|
+
usage: KeychainSecretUsageSchema
|
|
15829
|
+
})).readonly()
|
|
15830
|
+
}), {
|
|
15831
|
+
kind: "mutation",
|
|
15832
|
+
auth: "admin",
|
|
15833
|
+
caller: "required"
|
|
15834
|
+
}), method(object({}), object({
|
|
15835
|
+
fingerprint: string(),
|
|
15836
|
+
keySource: KeychainKeySourceSchema
|
|
15837
|
+
}), {
|
|
15838
|
+
kind: "mutation",
|
|
15839
|
+
auth: "admin",
|
|
15840
|
+
caller: "required"
|
|
15841
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15842
|
+
kind: "mutation",
|
|
15843
|
+
auth: "admin",
|
|
15844
|
+
caller: "required"
|
|
15845
|
+
}), method(object({}), object({
|
|
15846
|
+
key: string(),
|
|
15847
|
+
fingerprint: string(),
|
|
15848
|
+
keySource: KeychainKeySourceSchema
|
|
15849
|
+
}), {
|
|
15850
|
+
kind: "mutation",
|
|
15851
|
+
auth: "admin",
|
|
15852
|
+
caller: "required"
|
|
15853
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15854
|
+
archivedCollection: string().nullable(),
|
|
15855
|
+
archived: number().int()
|
|
15856
|
+
}), {
|
|
15857
|
+
kind: "mutation",
|
|
15858
|
+
auth: "admin",
|
|
15859
|
+
caller: "required"
|
|
15860
|
+
}), method(object({}), object({
|
|
15861
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15862
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15863
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15864
|
+
kind: "mutation",
|
|
15865
|
+
auth: "admin",
|
|
15866
|
+
caller: "required"
|
|
15867
|
+
});
|
|
14077
15868
|
method(_void(), object({
|
|
14078
15869
|
id: string(),
|
|
14079
15870
|
name: string(),
|
|
@@ -15412,7 +17203,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15412
17203
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15413
17204
|
var DevicePersistConfigPayloadSchema = object({
|
|
15414
17205
|
deviceId: number(),
|
|
15415
|
-
data: record(string(), unknown())
|
|
17206
|
+
data: record(string(), unknown()),
|
|
17207
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17208
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17209
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17210
|
+
secretConfigPaths: array(string()).optional()
|
|
15416
17211
|
});
|
|
15417
17212
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15418
17213
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17015,7 +18810,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17015
18810
|
* `login-method` — collection cap through which auth addons contribute
|
|
17016
18811
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17017
18812
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17018
|
-
* every auth addon (OIDC,
|
|
18813
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17019
18814
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17020
18815
|
* procedure aggregates them for the unauthenticated login page.
|
|
17021
18816
|
*
|
|
@@ -17023,8 +18818,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17023
18818
|
*
|
|
17024
18819
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17025
18820
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17026
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17027
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18821
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17028
18822
|
* login page needs NO change.
|
|
17029
18823
|
*
|
|
17030
18824
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17043,8 +18837,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17043
18837
|
* decision.
|
|
17044
18838
|
*
|
|
17045
18839
|
* Every contribution carries a `stage`:
|
|
17046
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17047
|
-
*
|
|
18840
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18841
|
+
* buttons; a usernameless passkey).
|
|
17048
18842
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17049
18843
|
* returned `factors` (passkey-as-2FA today).
|
|
17050
18844
|
*
|
|
@@ -17071,7 +18865,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17071
18865
|
* The provider names an external identity a signed-in user can link to
|
|
17072
18866
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17073
18867
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17074
|
-
* whatever their id. Absent / false — a login button only
|
|
18868
|
+
* whatever their id. Absent / false — a login button only.
|
|
17075
18869
|
*/
|
|
17076
18870
|
linkable: boolean().optional()
|
|
17077
18871
|
}),
|
|
@@ -20926,8 +22720,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20926
22720
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20927
22721
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20928
22722
|
* distinction was only ever used to route role-specific procedures
|
|
20929
|
-
* which we no longer have.
|
|
20930
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22723
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20931
22724
|
* with `isAdmin: false` + an explicit scope list.
|
|
20932
22725
|
*/
|
|
20933
22726
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22429,8 +24222,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22429
24222
|
]);
|
|
22430
24223
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22431
24224
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22432
|
-
/**
|
|
22433
|
-
|
|
24225
|
+
/**
|
|
24226
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24227
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24228
|
+
*
|
|
24229
|
+
* - `operator` — drawn by hand.
|
|
24230
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24231
|
+
* model, or a larger teacher model).
|
|
24232
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24233
|
+
* back from the track store (never a re-run).
|
|
24234
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24235
|
+
*/
|
|
24236
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24237
|
+
"operator",
|
|
24238
|
+
"assist",
|
|
24239
|
+
"pipeline",
|
|
24240
|
+
"llm"
|
|
24241
|
+
]);
|
|
22434
24242
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22435
24243
|
var RetrainBboxSchema = object({
|
|
22436
24244
|
x: number(),
|
|
@@ -22448,7 +24256,8 @@ var RetrainBboxSchema = object({
|
|
|
22448
24256
|
*/
|
|
22449
24257
|
var RetrainAnnotationSchema = object({
|
|
22450
24258
|
id: string(),
|
|
22451
|
-
|
|
24259
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24260
|
+
trackId: string().optional(),
|
|
22452
24261
|
deviceId: number(),
|
|
22453
24262
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22454
24263
|
mediaKey: string(),
|
|
@@ -22497,13 +24306,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22497
24306
|
* fail, whatever became of the original. */
|
|
22498
24307
|
copied: boolean()
|
|
22499
24308
|
});
|
|
24309
|
+
/**
|
|
24310
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24311
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24312
|
+
* box recorded on the source media row when there is one, else the track
|
|
24313
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24314
|
+
* until the operator confirms it.
|
|
24315
|
+
*/
|
|
24316
|
+
var RetrainPipelineBoxSchema = object({
|
|
24317
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24318
|
+
bbox: RetrainBboxSchema,
|
|
24319
|
+
macroClass: RetrainMacroClassSchema,
|
|
24320
|
+
label: string().optional(),
|
|
24321
|
+
subLabel: string().optional(),
|
|
24322
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24323
|
+
score: number().optional(),
|
|
24324
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24325
|
+
modelId: string().optional(),
|
|
24326
|
+
trackId: string(),
|
|
24327
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24328
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24329
|
+
basis: _enum(["subject-box", "position"]),
|
|
24330
|
+
deltaMs: number()
|
|
24331
|
+
});
|
|
24332
|
+
/**
|
|
24333
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24334
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24335
|
+
* track at all.
|
|
24336
|
+
*/
|
|
24337
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22500
24338
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22501
24339
|
var RetrainFrameSchema = object({
|
|
22502
24340
|
frameId: string(),
|
|
22503
24341
|
deviceId: number(),
|
|
22504
|
-
|
|
22505
|
-
/**
|
|
22506
|
-
|
|
24342
|
+
origin: RetrainFrameOriginSchema,
|
|
24343
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24344
|
+
trackId: string().optional(),
|
|
24345
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24346
|
+
* Absent on a recording still. */
|
|
24347
|
+
sourceMediaId: number().int().optional(),
|
|
24348
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24349
|
+
epochMs: number().optional(),
|
|
22507
24350
|
sourceKind: MediaFileKindEnum,
|
|
22508
24351
|
sizeBytes: number().int(),
|
|
22509
24352
|
width: number().int(),
|
|
@@ -22514,7 +24357,12 @@ var RetrainFrameSchema = object({
|
|
|
22514
24357
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22515
24358
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22516
24359
|
* a false positive. */
|
|
22517
|
-
complete: boolean()
|
|
24360
|
+
complete: boolean(),
|
|
24361
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24362
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24363
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24364
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24365
|
+
collectionIds: array(string()).readonly().optional()
|
|
22518
24366
|
});
|
|
22519
24367
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22520
24368
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22545,6 +24393,11 @@ var RetrainFrameListSchema = object({
|
|
|
22545
24393
|
var RetrainExportFilterSchema = object({
|
|
22546
24394
|
deviceIds: array(number()).optional(),
|
|
22547
24395
|
frameIds: array(string()).max(2e4).optional(),
|
|
24396
|
+
/** Only frames in at least one of these named collections. */
|
|
24397
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24398
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24399
|
+
* unknown id selects nothing. */
|
|
24400
|
+
datasetVersionId: string().optional(),
|
|
22548
24401
|
batchId: string().optional(),
|
|
22549
24402
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22550
24403
|
completeOnly: boolean().optional()
|
|
@@ -22609,6 +24462,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22609
24462
|
reason: string(),
|
|
22610
24463
|
detail: string().optional()
|
|
22611
24464
|
})]);
|
|
24465
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24466
|
+
var RetrainCollectionSchema = object({
|
|
24467
|
+
id: string(),
|
|
24468
|
+
name: string(),
|
|
24469
|
+
createdAt: number(),
|
|
24470
|
+
frameCount: number().int()
|
|
24471
|
+
});
|
|
24472
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24473
|
+
kind: literal("created"),
|
|
24474
|
+
collection: RetrainCollectionSchema
|
|
24475
|
+
}), object({
|
|
24476
|
+
kind: literal("refused"),
|
|
24477
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24478
|
+
})]);
|
|
24479
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24480
|
+
kind: literal("renamed"),
|
|
24481
|
+
collection: RetrainCollectionSchema
|
|
24482
|
+
}), object({
|
|
24483
|
+
kind: literal("refused"),
|
|
24484
|
+
reason: _enum([
|
|
24485
|
+
"empty-name",
|
|
24486
|
+
"duplicate-name",
|
|
24487
|
+
"unknown-collection"
|
|
24488
|
+
])
|
|
24489
|
+
})]);
|
|
24490
|
+
/**
|
|
24491
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24492
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24493
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24494
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24495
|
+
*/
|
|
24496
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24497
|
+
kind: literal("added"),
|
|
24498
|
+
collectionId: string(),
|
|
24499
|
+
frame: RetrainFrameSchema,
|
|
24500
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24501
|
+
reused: boolean()
|
|
24502
|
+
}), object({
|
|
24503
|
+
kind: literal("refused"),
|
|
24504
|
+
reason: _enum([
|
|
24505
|
+
"unknown-collection",
|
|
24506
|
+
"still-unavailable",
|
|
24507
|
+
"still-busy",
|
|
24508
|
+
"unreadable-image",
|
|
24509
|
+
"write-failed"
|
|
24510
|
+
]),
|
|
24511
|
+
detail: string().optional()
|
|
24512
|
+
})]);
|
|
24513
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24514
|
+
var RetrainAssistProfileSchema = object({
|
|
24515
|
+
id: string(),
|
|
24516
|
+
name: string(),
|
|
24517
|
+
model: string(),
|
|
24518
|
+
kind: string(),
|
|
24519
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24520
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24521
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24522
|
+
leavesHouse: boolean()
|
|
24523
|
+
});
|
|
24524
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24525
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24526
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24527
|
+
var RetrainLlmReviewSchema = object({
|
|
24528
|
+
/** The `ref` the page sent the box under. */
|
|
24529
|
+
ref: string(),
|
|
24530
|
+
verdict: _enum([
|
|
24531
|
+
"confirmed",
|
|
24532
|
+
"wrong-class",
|
|
24533
|
+
"not-an-object",
|
|
24534
|
+
"uncertain"
|
|
24535
|
+
]),
|
|
24536
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24537
|
+
reason: string()
|
|
24538
|
+
});
|
|
24539
|
+
/**
|
|
24540
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24541
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24542
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24543
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24544
|
+
*/
|
|
24545
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24546
|
+
kind: literal("proposed"),
|
|
24547
|
+
profileId: string(),
|
|
24548
|
+
model: string(),
|
|
24549
|
+
/** The frame was sent outside the house for this answer. */
|
|
24550
|
+
leftHouse: boolean(),
|
|
24551
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24552
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24553
|
+
rejected: number().int()
|
|
24554
|
+
}), object({
|
|
24555
|
+
kind: literal("refused"),
|
|
24556
|
+
reason: _enum([
|
|
24557
|
+
"unknown-frame",
|
|
24558
|
+
"unreadable-frame",
|
|
24559
|
+
"unknown-profile",
|
|
24560
|
+
"profile-disabled",
|
|
24561
|
+
"no-vision",
|
|
24562
|
+
"cloud-not-confirmed",
|
|
24563
|
+
"llm-error",
|
|
24564
|
+
"malformed-answer"
|
|
24565
|
+
]),
|
|
24566
|
+
detail: string().optional()
|
|
24567
|
+
})]);
|
|
24568
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24569
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24570
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24571
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24572
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24573
|
+
});
|
|
24574
|
+
/** The counts a dataset is judged by. */
|
|
24575
|
+
var RetrainDatasetStatsSchema = object({
|
|
24576
|
+
frames: number().int(),
|
|
24577
|
+
completeFrames: number().int(),
|
|
24578
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24579
|
+
completeness: number(),
|
|
24580
|
+
/** Boxes to learn (model errors excluded). */
|
|
24581
|
+
subjects: number().int(),
|
|
24582
|
+
modelErrors: number().int(),
|
|
24583
|
+
/** Complete frames with no subject. */
|
|
24584
|
+
hardNegatives: number().int(),
|
|
24585
|
+
/** Subjects per class × camera × day/night. */
|
|
24586
|
+
cells: array(object({
|
|
24587
|
+
macroClass: string(),
|
|
24588
|
+
deviceId: number(),
|
|
24589
|
+
lighting: _enum([
|
|
24590
|
+
"day",
|
|
24591
|
+
"night",
|
|
24592
|
+
"unknown"
|
|
24593
|
+
]),
|
|
24594
|
+
subjects: number().int(),
|
|
24595
|
+
frames: number().int()
|
|
24596
|
+
})).readonly(),
|
|
24597
|
+
cameras: array(object({
|
|
24598
|
+
deviceId: number(),
|
|
24599
|
+
frames: number().int(),
|
|
24600
|
+
completeFrames: number().int()
|
|
24601
|
+
})).readonly()
|
|
24602
|
+
});
|
|
24603
|
+
/** An immutable dataset version, without its frame list. */
|
|
24604
|
+
var RetrainDatasetVersionSchema = object({
|
|
24605
|
+
id: string(),
|
|
24606
|
+
name: string(),
|
|
24607
|
+
createdAt: number(),
|
|
24608
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24609
|
+
layout: RetrainExportLayoutSchema,
|
|
24610
|
+
completeOnly: boolean(),
|
|
24611
|
+
frameCount: number().int(),
|
|
24612
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24613
|
+
annotationHash: string(),
|
|
24614
|
+
/** The export manifest schema the version was cut under. */
|
|
24615
|
+
manifestSchema: string(),
|
|
24616
|
+
stats: RetrainDatasetStatsSchema
|
|
24617
|
+
});
|
|
24618
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24619
|
+
kind: literal("created"),
|
|
24620
|
+
version: RetrainDatasetVersionSchema
|
|
24621
|
+
}), object({
|
|
24622
|
+
kind: literal("refused"),
|
|
24623
|
+
reason: _enum([
|
|
24624
|
+
"empty-name",
|
|
24625
|
+
"duplicate-name",
|
|
24626
|
+
"no-frames"
|
|
24627
|
+
])
|
|
24628
|
+
})]);
|
|
22612
24629
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22613
24630
|
var RetrainTransitionResultSchema = object({
|
|
22614
24631
|
trackId: string(),
|
|
@@ -23326,7 +25343,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23326
25343
|
auth: "admin"
|
|
23327
25344
|
}), method(object({
|
|
23328
25345
|
deviceId: number(),
|
|
23329
|
-
trackId: string(),
|
|
25346
|
+
trackId: string().optional(),
|
|
23330
25347
|
frameId: string()
|
|
23331
25348
|
}), object({
|
|
23332
25349
|
removed: boolean(),
|
|
@@ -23343,7 +25360,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23343
25360
|
auth: "admin"
|
|
23344
25361
|
}), method(object({
|
|
23345
25362
|
deviceId: number(),
|
|
23346
|
-
|
|
25363
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25364
|
+
trackId: string().optional(),
|
|
23347
25365
|
frameId: string(),
|
|
23348
25366
|
subject: RetrainAssistSubjectSchema,
|
|
23349
25367
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23351,12 +25369,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23351
25369
|
}), RetrainAssistResultSchema, {
|
|
23352
25370
|
kind: "mutation",
|
|
23353
25371
|
auth: "admin"
|
|
23354
|
-
}), method(object({
|
|
25372
|
+
}), method(object({
|
|
25373
|
+
trackId: string().optional(),
|
|
25374
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25375
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23355
25376
|
kind: "query",
|
|
23356
25377
|
auth: "admin"
|
|
23357
25378
|
}), method(object({
|
|
23358
25379
|
deviceId: number(),
|
|
23359
|
-
|
|
25380
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25381
|
+
trackId: string().optional(),
|
|
23360
25382
|
frameId: string(),
|
|
23361
25383
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23362
25384
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23379,7 +25401,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23379
25401
|
auth: "admin"
|
|
23380
25402
|
}), method(object({
|
|
23381
25403
|
deviceId: number(),
|
|
23382
|
-
trackId: string(),
|
|
25404
|
+
trackId: string().optional(),
|
|
23383
25405
|
frameId: string(),
|
|
23384
25406
|
complete: boolean()
|
|
23385
25407
|
}), RetrainFrameSchema, {
|
|
@@ -23393,6 +25415,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23393
25415
|
kind: "mutation",
|
|
23394
25416
|
auth: "admin",
|
|
23395
25417
|
timeoutMs: 60 * 6e4
|
|
25418
|
+
}), method(object({
|
|
25419
|
+
filter: RetrainExportFilterSchema,
|
|
25420
|
+
layout: RetrainExportLayoutSchema
|
|
25421
|
+
}), object({
|
|
25422
|
+
ticket: PeerBytesTicketSchema,
|
|
25423
|
+
frames: number().int(),
|
|
25424
|
+
annotations: number().int()
|
|
25425
|
+
}), {
|
|
25426
|
+
kind: "mutation",
|
|
25427
|
+
auth: "admin",
|
|
25428
|
+
timeoutMs: 12e4
|
|
25429
|
+
}), method(object({
|
|
25430
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25431
|
+
completeOnly: boolean().optional()
|
|
25432
|
+
}), RetrainDatasetStatsSchema, {
|
|
25433
|
+
kind: "query",
|
|
25434
|
+
auth: "admin"
|
|
25435
|
+
}), method(object({
|
|
25436
|
+
name: string().max(120),
|
|
25437
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25438
|
+
layout: RetrainExportLayoutSchema,
|
|
25439
|
+
completeOnly: boolean()
|
|
25440
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25441
|
+
kind: "mutation",
|
|
25442
|
+
auth: "admin",
|
|
25443
|
+
timeoutMs: 12e4
|
|
25444
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25445
|
+
kind: "query",
|
|
25446
|
+
auth: "admin"
|
|
25447
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25448
|
+
kind: "mutation",
|
|
25449
|
+
auth: "admin"
|
|
25450
|
+
}), method(object({ id: string() }), object({
|
|
25451
|
+
found: boolean(),
|
|
25452
|
+
annotationHash: string(),
|
|
25453
|
+
matches: boolean(),
|
|
25454
|
+
missingFrames: number().int()
|
|
25455
|
+
}), {
|
|
25456
|
+
kind: "query",
|
|
25457
|
+
auth: "admin",
|
|
25458
|
+
timeoutMs: 12e4
|
|
25459
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25460
|
+
kind: "query",
|
|
25461
|
+
auth: "admin"
|
|
25462
|
+
}), method(object({
|
|
25463
|
+
deviceId: number(),
|
|
25464
|
+
trackId: string().optional(),
|
|
25465
|
+
frameId: string(),
|
|
25466
|
+
profileId: string(),
|
|
25467
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25468
|
+
boxes: array(object({
|
|
25469
|
+
ref: string(),
|
|
25470
|
+
bbox: RetrainBboxSchema,
|
|
25471
|
+
macroClass: RetrainMacroClassSchema,
|
|
25472
|
+
label: string().optional()
|
|
25473
|
+
})).max(50),
|
|
25474
|
+
allowCloud: boolean()
|
|
25475
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25476
|
+
kind: "mutation",
|
|
25477
|
+
auth: "admin",
|
|
25478
|
+
timeoutMs: 18e4
|
|
25479
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25480
|
+
kind: "mutation",
|
|
25481
|
+
auth: "admin"
|
|
25482
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25483
|
+
kind: "query",
|
|
25484
|
+
auth: "admin"
|
|
25485
|
+
}), method(object({
|
|
25486
|
+
id: string(),
|
|
25487
|
+
name: string().max(120)
|
|
25488
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25489
|
+
kind: "mutation",
|
|
25490
|
+
auth: "admin"
|
|
25491
|
+
}), method(object({ id: string() }), object({
|
|
25492
|
+
deleted: boolean(),
|
|
25493
|
+
removedFrames: number().int()
|
|
25494
|
+
}), {
|
|
25495
|
+
kind: "mutation",
|
|
25496
|
+
auth: "admin"
|
|
25497
|
+
}), method(object({
|
|
25498
|
+
collectionId: string(),
|
|
25499
|
+
deviceId: number(),
|
|
25500
|
+
epochMs: number()
|
|
25501
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25502
|
+
kind: "mutation",
|
|
25503
|
+
auth: "admin",
|
|
25504
|
+
timeoutMs: 6e4
|
|
25505
|
+
}), method(object({
|
|
25506
|
+
collectionId: string(),
|
|
25507
|
+
frameIds: array(string()).min(1).max(500)
|
|
25508
|
+
}), object({
|
|
25509
|
+
added: number().int(),
|
|
25510
|
+
alreadyMember: number().int(),
|
|
25511
|
+
unknownFrameIds: array(string()).readonly()
|
|
25512
|
+
}), {
|
|
25513
|
+
kind: "mutation",
|
|
25514
|
+
auth: "admin"
|
|
25515
|
+
}), method(object({
|
|
25516
|
+
collectionId: string(),
|
|
25517
|
+
frameId: string()
|
|
25518
|
+
}), object({
|
|
25519
|
+
removed: boolean(),
|
|
25520
|
+
deletedFrame: boolean()
|
|
25521
|
+
}), {
|
|
25522
|
+
kind: "mutation",
|
|
25523
|
+
auth: "admin"
|
|
25524
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25525
|
+
kind: "query",
|
|
25526
|
+
auth: "admin"
|
|
23396
25527
|
}), method(object({
|
|
23397
25528
|
/** Which of the three event tables owns the row. */
|
|
23398
25529
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24016,13 +26147,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24016
26147
|
object({
|
|
24017
26148
|
kind: literal("no-family-build"),
|
|
24018
26149
|
format: ModelFormatSchema$1
|
|
26150
|
+
}),
|
|
26151
|
+
object({
|
|
26152
|
+
kind: literal("kept-custom-pin"),
|
|
26153
|
+
modelId: string(),
|
|
26154
|
+
deviceKey: string()
|
|
24019
26155
|
})
|
|
24020
26156
|
]);
|
|
26157
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26158
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26159
|
+
/**
|
|
26160
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26161
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26162
|
+
*/
|
|
26163
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26164
|
+
kind: literal("node-benchmark"),
|
|
26165
|
+
resultId: string(),
|
|
26166
|
+
measuredAtMs: number()
|
|
26167
|
+
})]);
|
|
24021
26168
|
var DeviceModelChoiceSchema = object({
|
|
24022
26169
|
modelId: string(),
|
|
24023
26170
|
p50Ms: number(),
|
|
24024
26171
|
fps: number(),
|
|
24025
26172
|
measured: boolean(),
|
|
26173
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26174
|
+
source: LatencySourceSchema.optional(),
|
|
24026
26175
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24027
26176
|
capacitySessions: number(),
|
|
24028
26177
|
personRecall: number()
|
|
@@ -24033,6 +26182,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24033
26182
|
enabled: boolean(),
|
|
24034
26183
|
available: boolean(),
|
|
24035
26184
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26185
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26186
|
+
kept: KeptReasonSchema.optional(),
|
|
24036
26187
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24037
26188
|
});
|
|
24038
26189
|
var NodeRecommendationSchema = object({
|
|
@@ -24086,6 +26237,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24086
26237
|
kind: literal("coral-enabled"),
|
|
24087
26238
|
nodeId: string(),
|
|
24088
26239
|
deviceKey: string()
|
|
26240
|
+
}),
|
|
26241
|
+
object({
|
|
26242
|
+
kind: literal("custom-pin-kept"),
|
|
26243
|
+
nodeId: string(),
|
|
26244
|
+
deviceKey: string().nullable(),
|
|
26245
|
+
deviceId: number().nullable(),
|
|
26246
|
+
modelId: string()
|
|
26247
|
+
}),
|
|
26248
|
+
object({
|
|
26249
|
+
kind: literal("custom-registry-unreadable"),
|
|
26250
|
+
error: string()
|
|
24089
26251
|
})
|
|
24090
26252
|
]);
|
|
24091
26253
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24264,13 +26426,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24264
26426
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24265
26427
|
});
|
|
24266
26428
|
/**
|
|
24267
|
-
* Where the node and device shares come from (D750, D755).
|
|
24268
|
-
* - `
|
|
24269
|
-
*
|
|
24270
|
-
*
|
|
24271
|
-
*
|
|
24272
|
-
*
|
|
24273
|
-
*
|
|
26429
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26430
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26431
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26432
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26433
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26434
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26435
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26436
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24274
26437
|
* - `manual` — the operator's stored sliders.
|
|
24275
26438
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24276
26439
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24319,6 +26482,362 @@ var EffectiveSharesSchema = object({
|
|
|
24319
26482
|
nodeWeights: record(string(), number()),
|
|
24320
26483
|
deviceWeights: record(string(), record(string(), number()))
|
|
24321
26484
|
});
|
|
26485
|
+
/**
|
|
26486
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26487
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26488
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26489
|
+
* shares read.
|
|
26490
|
+
*
|
|
26491
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26492
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26493
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26494
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26495
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26496
|
+
*
|
|
26497
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26498
|
+
* cross a process at frame rate, D9):
|
|
26499
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26500
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26501
|
+
* interval;
|
|
26502
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26503
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26504
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26505
|
+
* CPU, RAM or the event loop give out.
|
|
26506
|
+
*/
|
|
26507
|
+
/** Defaults and bounds, one place. */
|
|
26508
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26509
|
+
fpsPerStream: 10,
|
|
26510
|
+
budgetMinutes: 45,
|
|
26511
|
+
minBudgetMinutes: 10,
|
|
26512
|
+
maxBudgetMinutes: 120,
|
|
26513
|
+
/** A result older than this no longer beats the table. */
|
|
26514
|
+
staleAfterDays: 30,
|
|
26515
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26516
|
+
settleSec: 5,
|
|
26517
|
+
/** Accounted window per ramp step. */
|
|
26518
|
+
measureSec: 20,
|
|
26519
|
+
/** Longest the drain may take before the run is refused. */
|
|
26520
|
+
drainTimeoutSec: 120,
|
|
26521
|
+
/** Candidate models per device in one run. */
|
|
26522
|
+
maxModelsPerDevice: 6
|
|
26523
|
+
};
|
|
26524
|
+
/** The two measurements a run can make. */
|
|
26525
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26526
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26527
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26528
|
+
deviceKey: string().min(1),
|
|
26529
|
+
/**
|
|
26530
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26531
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26532
|
+
*/
|
|
26533
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26534
|
+
});
|
|
26535
|
+
/** What the operator confirmed. */
|
|
26536
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26537
|
+
nodeId: string().min(1),
|
|
26538
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26539
|
+
/** Which measurements run. At least one. */
|
|
26540
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26541
|
+
/**
|
|
26542
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26543
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26544
|
+
* detector always runs.
|
|
26545
|
+
*/
|
|
26546
|
+
steps: array(string().min(1)).default([]),
|
|
26547
|
+
/** Offered rate of one stream / session. */
|
|
26548
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26549
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26550
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26551
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26552
|
+
keepDownloadedModels: boolean().default(false),
|
|
26553
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26554
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26555
|
+
});
|
|
26556
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26557
|
+
kind: _enum([
|
|
26558
|
+
"benchmark-active",
|
|
26559
|
+
"node-offline",
|
|
26560
|
+
"unknown-device",
|
|
26561
|
+
"no-phase",
|
|
26562
|
+
"insufficient-headroom"
|
|
26563
|
+
]),
|
|
26564
|
+
detail: string(),
|
|
26565
|
+
overridable: boolean()
|
|
26566
|
+
});
|
|
26567
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26568
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26569
|
+
deviceId: number(),
|
|
26570
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26571
|
+
placedOnNode: boolean(),
|
|
26572
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26573
|
+
pinnedToNode: boolean()
|
|
26574
|
+
});
|
|
26575
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26576
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26577
|
+
deviceId: number(),
|
|
26578
|
+
reason: literal("only-frame-source")
|
|
26579
|
+
});
|
|
26580
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26581
|
+
nodeId: string(),
|
|
26582
|
+
online: boolean(),
|
|
26583
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26584
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26585
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26586
|
+
estimatedDurationMs: number(),
|
|
26587
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26588
|
+
budgetMs: number(),
|
|
26589
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26590
|
+
steps: array(string()).readonly(),
|
|
26591
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26592
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26593
|
+
headroom: object({
|
|
26594
|
+
sessionsNow: number(),
|
|
26595
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26596
|
+
}),
|
|
26597
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26598
|
+
canStart: boolean()
|
|
26599
|
+
});
|
|
26600
|
+
/** Where the measuring runner is. */
|
|
26601
|
+
var NodeBenchProgressSchema = object({
|
|
26602
|
+
phase: _enum([
|
|
26603
|
+
"preparing",
|
|
26604
|
+
"device",
|
|
26605
|
+
"pipeline",
|
|
26606
|
+
"cleanup"
|
|
26607
|
+
]),
|
|
26608
|
+
deviceKey: string().nullable(),
|
|
26609
|
+
modelId: string().nullable(),
|
|
26610
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26611
|
+
load: number().nullable(),
|
|
26612
|
+
cellsDone: number(),
|
|
26613
|
+
cellsTotal: number(),
|
|
26614
|
+
message: string()
|
|
26615
|
+
});
|
|
26616
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26617
|
+
var NodeBenchLimitSchema = _enum([
|
|
26618
|
+
"p95",
|
|
26619
|
+
"drops",
|
|
26620
|
+
"errors",
|
|
26621
|
+
"stall",
|
|
26622
|
+
"cpu",
|
|
26623
|
+
"ram",
|
|
26624
|
+
"none"
|
|
26625
|
+
]);
|
|
26626
|
+
var NodeBenchRampStepSchema = object({
|
|
26627
|
+
load: number(),
|
|
26628
|
+
pass: boolean(),
|
|
26629
|
+
p95Ms: number(),
|
|
26630
|
+
dropRatio: number(),
|
|
26631
|
+
/** Completed frames per second over the accounted window. */
|
|
26632
|
+
fps: number(),
|
|
26633
|
+
cpuPct: number().nullable(),
|
|
26634
|
+
ramFreePct: number().nullable(),
|
|
26635
|
+
failReasons: array(string()).readonly()
|
|
26636
|
+
});
|
|
26637
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26638
|
+
phase: literal("device"),
|
|
26639
|
+
deviceKey: string(),
|
|
26640
|
+
modelId: string(),
|
|
26641
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26642
|
+
p50Ms: number(),
|
|
26643
|
+
p95Ms: number(),
|
|
26644
|
+
p99Ms: number(),
|
|
26645
|
+
/** Frames per second sustained at the last passing step. */
|
|
26646
|
+
fps: number(),
|
|
26647
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26648
|
+
kMax: number(),
|
|
26649
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26650
|
+
/** First call (model load + warm-up). */
|
|
26651
|
+
warmupMs: number(),
|
|
26652
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26653
|
+
}), object({
|
|
26654
|
+
phase: literal("pipeline"),
|
|
26655
|
+
deviceKey: string(),
|
|
26656
|
+
modelId: string(),
|
|
26657
|
+
steps: array(string()).readonly(),
|
|
26658
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26659
|
+
maxSessions: number(),
|
|
26660
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26661
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26662
|
+
stepsFired: array(string()).readonly(),
|
|
26663
|
+
warmupMs: number(),
|
|
26664
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26665
|
+
})]);
|
|
26666
|
+
/**
|
|
26667
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26668
|
+
* the node no longer beats the table.
|
|
26669
|
+
*/
|
|
26670
|
+
var NodeBenchFingerprintSchema = object({
|
|
26671
|
+
pipelineVersion: string().nullable(),
|
|
26672
|
+
cpuModel: string().nullable(),
|
|
26673
|
+
ramGb: number().nullable(),
|
|
26674
|
+
os: string().nullable(),
|
|
26675
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26676
|
+
pools: record(string(), object({
|
|
26677
|
+
runtime: string(),
|
|
26678
|
+
numWorkers: number(),
|
|
26679
|
+
concurrency: number(),
|
|
26680
|
+
batchMode: string()
|
|
26681
|
+
})).default({})
|
|
26682
|
+
});
|
|
26683
|
+
/** The frames the run used. */
|
|
26684
|
+
var NodeBenchClipSchema = object({
|
|
26685
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26686
|
+
id: string(),
|
|
26687
|
+
revision: string().nullable(),
|
|
26688
|
+
frames: number(),
|
|
26689
|
+
width: number(),
|
|
26690
|
+
height: number()
|
|
26691
|
+
});
|
|
26692
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26693
|
+
runId: string().min(1),
|
|
26694
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26695
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26696
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26697
|
+
steps: array(string()).default([]),
|
|
26698
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26699
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26700
|
+
deadlineAtMs: number(),
|
|
26701
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26702
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26703
|
+
keepDownloadedModels: boolean().default(false)
|
|
26704
|
+
});
|
|
26705
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26706
|
+
"running",
|
|
26707
|
+
"done",
|
|
26708
|
+
"failed",
|
|
26709
|
+
"aborted"
|
|
26710
|
+
]);
|
|
26711
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26712
|
+
runId: string(),
|
|
26713
|
+
nodeId: string(),
|
|
26714
|
+
state: NodeBenchRunnerStateSchema,
|
|
26715
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26716
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26717
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26718
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26719
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26720
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26721
|
+
activeCameraIds: array(number()).readonly(),
|
|
26722
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26723
|
+
deletedModels: array(string()).readonly(),
|
|
26724
|
+
error: string().nullable(),
|
|
26725
|
+
startedAtMs: number(),
|
|
26726
|
+
finishedAtMs: number().nullable()
|
|
26727
|
+
});
|
|
26728
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26729
|
+
"draining",
|
|
26730
|
+
"measuring",
|
|
26731
|
+
"restoring",
|
|
26732
|
+
"done",
|
|
26733
|
+
"failed",
|
|
26734
|
+
"aborted"
|
|
26735
|
+
]);
|
|
26736
|
+
/** Why a run ended. */
|
|
26737
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26738
|
+
"completed",
|
|
26739
|
+
"operator-abort",
|
|
26740
|
+
"deadline",
|
|
26741
|
+
"node-lost",
|
|
26742
|
+
"runner-lost",
|
|
26743
|
+
"hub-restart",
|
|
26744
|
+
"drain-timeout",
|
|
26745
|
+
"failed"
|
|
26746
|
+
]);
|
|
26747
|
+
var NodeBenchmarkRunSchema = object({
|
|
26748
|
+
runId: string(),
|
|
26749
|
+
nodeId: string(),
|
|
26750
|
+
state: NodeBenchmarkStateSchema,
|
|
26751
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26752
|
+
startedAtMs: number(),
|
|
26753
|
+
deadlineAtMs: number(),
|
|
26754
|
+
finishedAtMs: number().nullable(),
|
|
26755
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26756
|
+
error: string().nullable(),
|
|
26757
|
+
/** Cameras moved off the node for the run. */
|
|
26758
|
+
moved: array(number()).readonly(),
|
|
26759
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26760
|
+
staying: array(number()).readonly(),
|
|
26761
|
+
/** Something else ran on the node's pools during the run. */
|
|
26762
|
+
contaminated: boolean(),
|
|
26763
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26764
|
+
resultIds: array(string()).readonly()
|
|
26765
|
+
});
|
|
26766
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26767
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26768
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26769
|
+
modeNodeId: string().nullable(),
|
|
26770
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26771
|
+
});
|
|
26772
|
+
/**
|
|
26773
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26774
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26775
|
+
* ends, never by anyone else.
|
|
26776
|
+
*/
|
|
26777
|
+
var NodeBenchmarkResultSchema = object({
|
|
26778
|
+
id: string(),
|
|
26779
|
+
runId: string(),
|
|
26780
|
+
nodeId: string(),
|
|
26781
|
+
cell: NodeBenchCellSchema,
|
|
26782
|
+
fpsPerStream: number(),
|
|
26783
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26784
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26785
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26786
|
+
contaminated: boolean(),
|
|
26787
|
+
stayingCameras: array(number()).readonly(),
|
|
26788
|
+
/** The run ended early; the cell itself completed. */
|
|
26789
|
+
partialRun: boolean(),
|
|
26790
|
+
measuredAtMs: number()
|
|
26791
|
+
});
|
|
26792
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26793
|
+
nodeId: string().optional(),
|
|
26794
|
+
deviceKey: string().optional()
|
|
26795
|
+
});
|
|
26796
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26797
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26798
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26799
|
+
standing: _enum([
|
|
26800
|
+
"fresh",
|
|
26801
|
+
"stale",
|
|
26802
|
+
"superseded"
|
|
26803
|
+
]),
|
|
26804
|
+
staleWhy: _enum([
|
|
26805
|
+
"age",
|
|
26806
|
+
"runtime",
|
|
26807
|
+
"pool-tuning"
|
|
26808
|
+
]).nullable()
|
|
26809
|
+
});
|
|
26810
|
+
object({
|
|
26811
|
+
runId: string(),
|
|
26812
|
+
nodeId: string(),
|
|
26813
|
+
startedAtMs: number(),
|
|
26814
|
+
deadlineAtMs: number(),
|
|
26815
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26816
|
+
moved: array(number()).readonly(),
|
|
26817
|
+
staying: array(number()).readonly()
|
|
26818
|
+
});
|
|
26819
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26820
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26821
|
+
nodeId: string(),
|
|
26822
|
+
reachable: boolean(),
|
|
26823
|
+
devices: array(object({
|
|
26824
|
+
deviceKey: string(),
|
|
26825
|
+
enabled: boolean(),
|
|
26826
|
+
available: boolean(),
|
|
26827
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26828
|
+
suggested: array(string()).readonly(),
|
|
26829
|
+
/** Every root detector the device has a build for. */
|
|
26830
|
+
all: array(string()).readonly(),
|
|
26831
|
+
/** The model the device runs now, when pinned. */
|
|
26832
|
+
currentModelId: string().nullable()
|
|
26833
|
+
})).readonly(),
|
|
26834
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26835
|
+
steps: array(object({
|
|
26836
|
+
id: string(),
|
|
26837
|
+
name: string(),
|
|
26838
|
+
slot: string()
|
|
26839
|
+
})).readonly()
|
|
26840
|
+
});
|
|
24322
26841
|
object({
|
|
24323
26842
|
activeCameras: number(),
|
|
24324
26843
|
throttledCameras: number(),
|
|
@@ -25447,7 +27966,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25447
27966
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25448
27967
|
deviceId: number(),
|
|
25449
27968
|
trackId: string()
|
|
25450
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27969
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27970
|
+
accepted: literal(true),
|
|
27971
|
+
runId: string()
|
|
27972
|
+
}), {
|
|
27973
|
+
kind: "mutation",
|
|
27974
|
+
auth: "admin"
|
|
27975
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27976
|
+
kind: "mutation",
|
|
27977
|
+
auth: "admin"
|
|
27978
|
+
});
|
|
25451
27979
|
var CameraPipelineConfigSchema = object({
|
|
25452
27980
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25453
27981
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26086,6 +28614,21 @@ method(object({
|
|
|
26086
28614
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26087
28615
|
kind: "mutation",
|
|
26088
28616
|
auth: "admin"
|
|
28617
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28618
|
+
kind: literal("started"),
|
|
28619
|
+
runId: string()
|
|
28620
|
+
}), object({
|
|
28621
|
+
kind: literal("refused"),
|
|
28622
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28623
|
+
})]), {
|
|
28624
|
+
kind: "mutation",
|
|
28625
|
+
auth: "admin"
|
|
28626
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28627
|
+
kind: "mutation",
|
|
28628
|
+
auth: "admin"
|
|
28629
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28630
|
+
kind: "mutation",
|
|
28631
|
+
auth: "admin"
|
|
26089
28632
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26090
28633
|
deviceId: number(),
|
|
26091
28634
|
addonId: string(),
|
|
@@ -26491,8 +29034,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26491
29034
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26492
29035
|
*
|
|
26493
29036
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26494
|
-
* one for transactional / one for notifications). Consumers (
|
|
26495
|
-
*
|
|
29037
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29038
|
+
* addons, …) walk the collection and pick the first
|
|
26496
29039
|
* ready provider OR target a specific addonId.
|
|
26497
29040
|
*
|
|
26498
29041
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26671,7 +29214,7 @@ targets: array(object({
|
|
|
26671
29214
|
})));
|
|
26672
29215
|
/**
|
|
26673
29216
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26674
|
-
* providers (OIDC, SAML,
|
|
29217
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26675
29218
|
* carrying the post-callback claims before redirecting back to
|
|
26676
29219
|
* `/api/auth/sso/finish`.
|
|
26677
29220
|
*
|
|
@@ -26734,7 +29277,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26734
29277
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26735
29278
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26736
29279
|
*/
|
|
26737
|
-
issuer: string().optional()
|
|
29280
|
+
issuer: string().optional(),
|
|
29281
|
+
/**
|
|
29282
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29283
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29284
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29285
|
+
* any other browser.
|
|
29286
|
+
*/
|
|
29287
|
+
browserBinding: string().optional()
|
|
26738
29288
|
});
|
|
26739
29289
|
method(object({
|
|
26740
29290
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32210,6 +34760,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32210
34760
|
enabled: boolean().optional(),
|
|
32211
34761
|
info: record(string(), unknown()).optional(),
|
|
32212
34762
|
settings: record(string(), unknown()).optional(),
|
|
34763
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34764
|
+
* the keychain, not the table (D787). */
|
|
34765
|
+
secretKeys: array(string()).optional(),
|
|
32213
34766
|
skipRestart: boolean().optional()
|
|
32214
34767
|
});
|
|
32215
34768
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32233,7 +34786,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32233
34786
|
auth: "admin"
|
|
32234
34787
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32235
34788
|
id: string(),
|
|
32236
|
-
settings: record(string(), unknown())
|
|
34789
|
+
settings: record(string(), unknown()),
|
|
34790
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34791
|
+
secretKeys: array(string()).optional()
|
|
32237
34792
|
}), object({ success: boolean() }), {
|
|
32238
34793
|
kind: "mutation",
|
|
32239
34794
|
auth: "admin"
|
|
@@ -39005,16 +41560,6 @@ var ApiKeySummarySchema = object({
|
|
|
39005
41560
|
createdAt: number(),
|
|
39006
41561
|
lastUsedAt: number().optional()
|
|
39007
41562
|
});
|
|
39008
|
-
var CreateApiKeyInputSchema = object({
|
|
39009
|
-
label: string(),
|
|
39010
|
-
isAdmin: boolean().default(false),
|
|
39011
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39012
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39013
|
-
});
|
|
39014
|
-
var CreateApiKeyResultSchema = object({
|
|
39015
|
-
token: string(),
|
|
39016
|
-
record: ApiKeySummarySchema
|
|
39017
|
-
});
|
|
39018
41563
|
var ScopedTokenSummarySchema = object({
|
|
39019
41564
|
id: string(),
|
|
39020
41565
|
userId: string(),
|
|
@@ -39113,17 +41658,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39113
41658
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39114
41659
|
kind: "mutation",
|
|
39115
41660
|
access: "view"
|
|
39116
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39117
|
-
kind: "mutation",
|
|
39118
|
-
auth: "admin",
|
|
39119
|
-
access: "create"
|
|
39120
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41661
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39121
41662
|
kind: "mutation",
|
|
39122
41663
|
auth: "admin",
|
|
39123
41664
|
access: "delete"
|
|
39124
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39125
|
-
kind: "mutation",
|
|
39126
|
-
access: "view"
|
|
39127
41665
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39128
41666
|
kind: "mutation",
|
|
39129
41667
|
auth: "admin",
|
|
@@ -39197,15 +41735,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39197
41735
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39198
41736
|
userId: string(),
|
|
39199
41737
|
issuer: string()
|
|
39200
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39201
|
-
userId: string(),
|
|
39202
|
-
issuer: string().min(1),
|
|
39203
|
-
label: string().optional()
|
|
39204
|
-
}), object({ success: literal(true) }), {
|
|
39205
|
-
kind: "mutation",
|
|
39206
|
-
auth: "admin",
|
|
39207
|
-
access: "create"
|
|
39208
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41738
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39209
41739
|
kind: "mutation",
|
|
39210
41740
|
auth: "admin",
|
|
39211
41741
|
access: "delete"
|
|
@@ -39910,6 +42440,451 @@ var zoneRulesCapability = {
|
|
|
39910
42440
|
*/
|
|
39911
42441
|
durability: "restored"
|
|
39912
42442
|
};
|
|
42443
|
+
/**
|
|
42444
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42445
|
+
*
|
|
42446
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42447
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42448
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42449
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42450
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42451
|
+
* manifest entry and nothing else.
|
|
42452
|
+
*
|
|
42453
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42454
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42455
|
+
* Every method is `admin`: these spend money.
|
|
42456
|
+
*
|
|
42457
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42458
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42459
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42460
|
+
*
|
|
42461
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42462
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42463
|
+
* ticket the provider mints (D613).
|
|
42464
|
+
*/
|
|
42465
|
+
var TrainingGpuOptionSchema = object({
|
|
42466
|
+
id: string(),
|
|
42467
|
+
label: string(),
|
|
42468
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42469
|
+
usdPerHour: number().nonnegative(),
|
|
42470
|
+
vramGb: number().nonnegative()
|
|
42471
|
+
});
|
|
42472
|
+
var TrainingRegionOptionSchema = object({
|
|
42473
|
+
/** `''` = any region (the provider's choice). */
|
|
42474
|
+
id: string(),
|
|
42475
|
+
label: string(),
|
|
42476
|
+
priceMultiplier: number().positive()
|
|
42477
|
+
});
|
|
42478
|
+
/**
|
|
42479
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42480
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42481
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42482
|
+
*/
|
|
42483
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42484
|
+
gpuType: string(),
|
|
42485
|
+
region: string(),
|
|
42486
|
+
costCapUsd: number().nonnegative(),
|
|
42487
|
+
maxRuntimeSec: number().int().positive(),
|
|
42488
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42489
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42490
|
+
});
|
|
42491
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42492
|
+
addonId: string(),
|
|
42493
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42494
|
+
kind: string(),
|
|
42495
|
+
label: string(),
|
|
42496
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42497
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42498
|
+
maxDatasetBytes: number().int().positive(),
|
|
42499
|
+
maxRuntimeSec: number().int().positive(),
|
|
42500
|
+
freeTierNote: string().optional(),
|
|
42501
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42502
|
+
dataResidencyNote: string(),
|
|
42503
|
+
/** Credentials are present — never the values. */
|
|
42504
|
+
configured: boolean(),
|
|
42505
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42506
|
+
});
|
|
42507
|
+
var TrainingCredentialCheckSchema = object({
|
|
42508
|
+
ok: boolean(),
|
|
42509
|
+
/** Workspace / account name, when the provider says. */
|
|
42510
|
+
account: string().optional(),
|
|
42511
|
+
reason: _enum([
|
|
42512
|
+
"missing",
|
|
42513
|
+
"invalid",
|
|
42514
|
+
"forbidden",
|
|
42515
|
+
"network",
|
|
42516
|
+
"quota"
|
|
42517
|
+
]).optional(),
|
|
42518
|
+
detail: string().optional()
|
|
42519
|
+
});
|
|
42520
|
+
var ProviderJobStateSchema = _enum([
|
|
42521
|
+
"pending",
|
|
42522
|
+
"starting",
|
|
42523
|
+
"running",
|
|
42524
|
+
"succeeded",
|
|
42525
|
+
"failed",
|
|
42526
|
+
"cancelled",
|
|
42527
|
+
"lost"
|
|
42528
|
+
]);
|
|
42529
|
+
var ProviderJobStatusSchema = object({
|
|
42530
|
+
jobKey: string(),
|
|
42531
|
+
providerJobId: string().optional(),
|
|
42532
|
+
state: ProviderJobStateSchema,
|
|
42533
|
+
startedAt: number().optional(),
|
|
42534
|
+
endedAt: number().optional(),
|
|
42535
|
+
exitCode: number().int().optional(),
|
|
42536
|
+
failureReason: string().optional(),
|
|
42537
|
+
gpuType: string(),
|
|
42538
|
+
region: string().optional(),
|
|
42539
|
+
billedSeconds: number().nonnegative(),
|
|
42540
|
+
costUsd: number().nonnegative(),
|
|
42541
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42542
|
+
costIsEstimate: boolean(),
|
|
42543
|
+
lastFetchedAt: number()
|
|
42544
|
+
});
|
|
42545
|
+
/**
|
|
42546
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42547
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42548
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42549
|
+
* in `result.json`.
|
|
42550
|
+
*/
|
|
42551
|
+
var TrainerSourceRefSchema = object({
|
|
42552
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42553
|
+
repo: string().min(1),
|
|
42554
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42555
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42556
|
+
});
|
|
42557
|
+
var JobRef = {
|
|
42558
|
+
addonId: string(),
|
|
42559
|
+
jobKey: string().uuid()
|
|
42560
|
+
};
|
|
42561
|
+
var TrainingLogLineSchema = object({
|
|
42562
|
+
ts: number(),
|
|
42563
|
+
text: string()
|
|
42564
|
+
});
|
|
42565
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42566
|
+
kind: "mutation",
|
|
42567
|
+
auth: "admin",
|
|
42568
|
+
timeoutMs: 3e4
|
|
42569
|
+
}), method(object({
|
|
42570
|
+
addonId: string(),
|
|
42571
|
+
gpuType: string(),
|
|
42572
|
+
region: string(),
|
|
42573
|
+
datasetBytes: number().int().nonnegative(),
|
|
42574
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42575
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42576
|
+
}), object({
|
|
42577
|
+
usdLow: number().nonnegative(),
|
|
42578
|
+
usdHigh: number().nonnegative(),
|
|
42579
|
+
notes: array(string()).readonly()
|
|
42580
|
+
}), { auth: "admin" }), method(object({
|
|
42581
|
+
...JobRef,
|
|
42582
|
+
ticket: PeerBytesTicketSchema
|
|
42583
|
+
}), object({
|
|
42584
|
+
bytes: number().int().nonnegative(),
|
|
42585
|
+
sha256: string()
|
|
42586
|
+
}), {
|
|
42587
|
+
kind: "mutation",
|
|
42588
|
+
auth: "admin",
|
|
42589
|
+
timeoutMs: 120 * 6e4
|
|
42590
|
+
}), method(object({
|
|
42591
|
+
...JobRef,
|
|
42592
|
+
trainer: TrainerSourceRefSchema,
|
|
42593
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42594
|
+
gpuType: string(),
|
|
42595
|
+
region: string(),
|
|
42596
|
+
maxRuntimeSec: number().int().positive()
|
|
42597
|
+
}), ProviderJobStatusSchema, {
|
|
42598
|
+
kind: "mutation",
|
|
42599
|
+
auth: "admin",
|
|
42600
|
+
timeoutMs: 30 * 6e4
|
|
42601
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42602
|
+
auth: "admin",
|
|
42603
|
+
timeoutMs: 6e4
|
|
42604
|
+
}), method(object({
|
|
42605
|
+
...JobRef,
|
|
42606
|
+
cursor: string().optional(),
|
|
42607
|
+
max: number().int().min(1).max(500)
|
|
42608
|
+
}), object({
|
|
42609
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42610
|
+
cursor: string()
|
|
42611
|
+
}), {
|
|
42612
|
+
auth: "admin",
|
|
42613
|
+
timeoutMs: 6e4
|
|
42614
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42615
|
+
kind: "mutation",
|
|
42616
|
+
auth: "admin",
|
|
42617
|
+
timeoutMs: 6e4
|
|
42618
|
+
}), method(object(JobRef), object({
|
|
42619
|
+
found: boolean(),
|
|
42620
|
+
text: string().optional()
|
|
42621
|
+
}), {
|
|
42622
|
+
kind: "mutation",
|
|
42623
|
+
auth: "admin",
|
|
42624
|
+
timeoutMs: 5 * 6e4
|
|
42625
|
+
}), method(object({
|
|
42626
|
+
...JobRef,
|
|
42627
|
+
path: _enum(["bundle.tar"])
|
|
42628
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42629
|
+
kind: "mutation",
|
|
42630
|
+
auth: "admin",
|
|
42631
|
+
timeoutMs: 5 * 6e4
|
|
42632
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42633
|
+
kind: "mutation",
|
|
42634
|
+
auth: "admin",
|
|
42635
|
+
timeoutMs: 5 * 6e4
|
|
42636
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42637
|
+
auth: "admin",
|
|
42638
|
+
timeoutMs: 2 * 6e4
|
|
42639
|
+
});
|
|
42640
|
+
/**
|
|
42641
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42642
|
+
* provided by `addon-training`.
|
|
42643
|
+
*
|
|
42644
|
+
* It owns what every provider must agree on, written once:
|
|
42645
|
+
*
|
|
42646
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42647
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42648
|
+
* the export plan) and reaches this store through the five row methods
|
|
42649
|
+
* below, so the Retrain page and the export did not change.
|
|
42650
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42651
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42652
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42653
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42654
|
+
* rollback. Nothing is ever registered automatically.
|
|
42655
|
+
*
|
|
42656
|
+
* Every method is `admin`.
|
|
42657
|
+
*/
|
|
42658
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42659
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42660
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42661
|
+
var TrainingBaseModelSchema = object({
|
|
42662
|
+
modelId: string(),
|
|
42663
|
+
label: string(),
|
|
42664
|
+
weights: string(),
|
|
42665
|
+
imgsz: number().int(),
|
|
42666
|
+
baselineOnnxUrl: string(),
|
|
42667
|
+
baselineFloors: record(string(), number()),
|
|
42668
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42669
|
+
recommended: boolean()
|
|
42670
|
+
});
|
|
42671
|
+
var TrainingPresetSchema = _enum([
|
|
42672
|
+
"quick",
|
|
42673
|
+
"standard",
|
|
42674
|
+
"thorough"
|
|
42675
|
+
]);
|
|
42676
|
+
var TrainingJobRequestSchema = object({
|
|
42677
|
+
datasetVersionId: string().min(1),
|
|
42678
|
+
/** The `training-provider` addon that runs it. */
|
|
42679
|
+
addonId: string().min(1),
|
|
42680
|
+
gpuType: string().min(1),
|
|
42681
|
+
region: string(),
|
|
42682
|
+
baseModelId: string().min(1),
|
|
42683
|
+
preset: TrainingPresetSchema,
|
|
42684
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42685
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42686
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42687
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42688
|
+
});
|
|
42689
|
+
var TrainingSplitPlanSchema = object({
|
|
42690
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42691
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42692
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42693
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42694
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42695
|
+
trainSubjects: number().int()
|
|
42696
|
+
});
|
|
42697
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42698
|
+
"unknown-dataset",
|
|
42699
|
+
"unknown-provider",
|
|
42700
|
+
"provider-not-configured",
|
|
42701
|
+
"unknown-base-model",
|
|
42702
|
+
"unknown-gpu",
|
|
42703
|
+
"dataset-too-large",
|
|
42704
|
+
"no-training-subjects",
|
|
42705
|
+
"job-already-running"
|
|
42706
|
+
]);
|
|
42707
|
+
var TrainingJobPlanSchema = object({
|
|
42708
|
+
refusal: object({
|
|
42709
|
+
reason: TrainingRefusalReasonSchema,
|
|
42710
|
+
detail: string()
|
|
42711
|
+
}).nullable(),
|
|
42712
|
+
warnings: array(string()).readonly(),
|
|
42713
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42714
|
+
estimate: object({
|
|
42715
|
+
datasetBytes: number().int(),
|
|
42716
|
+
uploadMinutesAt20Mbps: number(),
|
|
42717
|
+
gpuSecondsLow: number(),
|
|
42718
|
+
gpuSecondsHigh: number(),
|
|
42719
|
+
usdLow: number(),
|
|
42720
|
+
usdHigh: number(),
|
|
42721
|
+
notes: array(string()).readonly()
|
|
42722
|
+
}).nullable(),
|
|
42723
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42724
|
+
defaults: object({
|
|
42725
|
+
maxCostUsd: number(),
|
|
42726
|
+
maxRuntimeSec: number().int()
|
|
42727
|
+
}).nullable(),
|
|
42728
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42729
|
+
dataNotice: string()
|
|
42730
|
+
});
|
|
42731
|
+
/**
|
|
42732
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42733
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42734
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42735
|
+
* result lives after the operator acted on it.
|
|
42736
|
+
*/
|
|
42737
|
+
var TrainingJobStateSchema = _enum([
|
|
42738
|
+
"uploading",
|
|
42739
|
+
"submitted",
|
|
42740
|
+
"starting",
|
|
42741
|
+
"running",
|
|
42742
|
+
"collecting",
|
|
42743
|
+
"ready",
|
|
42744
|
+
"registered",
|
|
42745
|
+
"canary",
|
|
42746
|
+
"failed",
|
|
42747
|
+
"cancelling",
|
|
42748
|
+
"cancelled",
|
|
42749
|
+
"lost",
|
|
42750
|
+
"expired",
|
|
42751
|
+
"discarded"
|
|
42752
|
+
]);
|
|
42753
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42754
|
+
"cost-cap",
|
|
42755
|
+
"runtime-cap",
|
|
42756
|
+
"upload-failed",
|
|
42757
|
+
"submit-failed",
|
|
42758
|
+
"trainer-failed",
|
|
42759
|
+
"result-invalid",
|
|
42760
|
+
"checksum-mismatch",
|
|
42761
|
+
"fetch-failed",
|
|
42762
|
+
"provider-error",
|
|
42763
|
+
"hub-restart-during-upload"
|
|
42764
|
+
]);
|
|
42765
|
+
var TrainingProgressPointSchema = object({
|
|
42766
|
+
epoch: number().int(),
|
|
42767
|
+
map50: number().nullable(),
|
|
42768
|
+
map50_95: number().nullable()
|
|
42769
|
+
});
|
|
42770
|
+
var TrainingCanarySchema = object({
|
|
42771
|
+
deviceIds: array(number().int()).readonly(),
|
|
42772
|
+
since: number(),
|
|
42773
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42774
|
+
previous: array(object({
|
|
42775
|
+
deviceId: number().int(),
|
|
42776
|
+
nodeId: string(),
|
|
42777
|
+
deviceKey: string(),
|
|
42778
|
+
patch: object({
|
|
42779
|
+
modelId: string().optional(),
|
|
42780
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42781
|
+
}).nullable()
|
|
42782
|
+
})).readonly()
|
|
42783
|
+
});
|
|
42784
|
+
var TrainingJobSchema = object({
|
|
42785
|
+
id: string(),
|
|
42786
|
+
idempotencyKey: string(),
|
|
42787
|
+
name: string(),
|
|
42788
|
+
createdAt: number(),
|
|
42789
|
+
updatedAt: number(),
|
|
42790
|
+
state: TrainingJobStateSchema,
|
|
42791
|
+
stage: TrainingStageSchema.nullable(),
|
|
42792
|
+
failure: object({
|
|
42793
|
+
reason: TrainingFailureReasonSchema,
|
|
42794
|
+
stage: string().nullable(),
|
|
42795
|
+
detail: string()
|
|
42796
|
+
}).nullable(),
|
|
42797
|
+
request: TrainingJobRequestSchema,
|
|
42798
|
+
maxCostUsd: number().nonnegative(),
|
|
42799
|
+
maxRuntimeSec: number().int().positive(),
|
|
42800
|
+
trainer: TrainerSourceRefSchema,
|
|
42801
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42802
|
+
dataset: object({
|
|
42803
|
+
bytes: number().int(),
|
|
42804
|
+
sha256: string(),
|
|
42805
|
+
uploadedAt: number()
|
|
42806
|
+
}).nullable(),
|
|
42807
|
+
split: TrainingSplitPlanSchema,
|
|
42808
|
+
provider: object({
|
|
42809
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42810
|
+
providerJobId: string().nullable(),
|
|
42811
|
+
startedAt: number().nullable(),
|
|
42812
|
+
endedAt: number().nullable(),
|
|
42813
|
+
billedSeconds: number(),
|
|
42814
|
+
costUsd: number(),
|
|
42815
|
+
costIsEstimate: boolean(),
|
|
42816
|
+
lastPolledAt: number().nullable()
|
|
42817
|
+
}),
|
|
42818
|
+
progress: object({
|
|
42819
|
+
epoch: number().int().nullable(),
|
|
42820
|
+
epochs: number().int().nullable(),
|
|
42821
|
+
etaSec: number().nullable(),
|
|
42822
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42823
|
+
}),
|
|
42824
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42825
|
+
logTail: array(string()).readonly(),
|
|
42826
|
+
logCursor: string().nullable(),
|
|
42827
|
+
artifacts: object({
|
|
42828
|
+
bundleBytes: number().int(),
|
|
42829
|
+
bundleSha256: string(),
|
|
42830
|
+
fetchedAt: number(),
|
|
42831
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42832
|
+
expiresAt: number()
|
|
42833
|
+
}).nullable(),
|
|
42834
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42835
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42836
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42837
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42838
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42839
|
+
registeredModelIds: array(string()).readonly(),
|
|
42840
|
+
canary: TrainingCanarySchema.nullable()
|
|
42841
|
+
});
|
|
42842
|
+
var IdInput = object({ id: string().min(1) });
|
|
42843
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42844
|
+
kind: "mutation",
|
|
42845
|
+
auth: "admin"
|
|
42846
|
+
}), 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() }), {
|
|
42847
|
+
kind: "mutation",
|
|
42848
|
+
auth: "admin"
|
|
42849
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42850
|
+
auth: "admin",
|
|
42851
|
+
timeoutMs: 6e4
|
|
42852
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42853
|
+
name: string().min(1).max(120),
|
|
42854
|
+
maxCostUsd: number().positive(),
|
|
42855
|
+
maxRuntimeSec: number().int().positive(),
|
|
42856
|
+
idempotencyKey: string().min(8).max(80)
|
|
42857
|
+
}), discriminatedUnion("kind", [object({
|
|
42858
|
+
kind: literal("started"),
|
|
42859
|
+
job: TrainingJobSchema
|
|
42860
|
+
}), object({
|
|
42861
|
+
kind: literal("refused"),
|
|
42862
|
+
reason: TrainingRefusalReasonSchema,
|
|
42863
|
+
detail: string()
|
|
42864
|
+
})]), {
|
|
42865
|
+
kind: "mutation",
|
|
42866
|
+
auth: "admin",
|
|
42867
|
+
timeoutMs: 12e4
|
|
42868
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42869
|
+
kind: "mutation",
|
|
42870
|
+
auth: "admin",
|
|
42871
|
+
timeoutMs: 12e4
|
|
42872
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42873
|
+
kind: "mutation",
|
|
42874
|
+
auth: "admin",
|
|
42875
|
+
timeoutMs: 30 * 6e4
|
|
42876
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42877
|
+
kind: "mutation",
|
|
42878
|
+
auth: "admin",
|
|
42879
|
+
timeoutMs: 12e4
|
|
42880
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42881
|
+
kind: "mutation",
|
|
42882
|
+
auth: "admin",
|
|
42883
|
+
timeoutMs: 12e4
|
|
42884
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42885
|
+
kind: "mutation",
|
|
42886
|
+
auth: "admin"
|
|
42887
|
+
});
|
|
39913
42888
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39914
42889
|
Object.freeze({
|
|
39915
42890
|
person: .5,
|
|
@@ -40396,7 +43371,8 @@ var BaseDevice = class {
|
|
|
40396
43371
|
this.role = options.role;
|
|
40397
43372
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40398
43373
|
const seedData = ctx.persistedConfig ?? {};
|
|
40399
|
-
|
|
43374
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
43375
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40400
43376
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40401
43377
|
tags: {
|
|
40402
43378
|
deviceId: ctx.id,
|
|
@@ -42057,6 +45033,12 @@ Object.freeze({
|
|
|
42057
45033
|
addonId: null,
|
|
42058
45034
|
access: "create"
|
|
42059
45035
|
},
|
|
45036
|
+
"backup.checkBackupKey": {
|
|
45037
|
+
capName: "backup",
|
|
45038
|
+
capScope: "system",
|
|
45039
|
+
addonId: null,
|
|
45040
|
+
access: "create"
|
|
45041
|
+
},
|
|
42060
45042
|
"backup.delete": {
|
|
42061
45043
|
capName: "backup",
|
|
42062
45044
|
capScope: "system",
|
|
@@ -42069,6 +45051,18 @@ Object.freeze({
|
|
|
42069
45051
|
addonId: null,
|
|
42070
45052
|
access: "delete"
|
|
42071
45053
|
},
|
|
45054
|
+
"backup.disableEncryption": {
|
|
45055
|
+
capName: "backup",
|
|
45056
|
+
capScope: "system",
|
|
45057
|
+
addonId: null,
|
|
45058
|
+
access: "create"
|
|
45059
|
+
},
|
|
45060
|
+
"backup.getEncryption": {
|
|
45061
|
+
capName: "backup",
|
|
45062
|
+
capScope: "system",
|
|
45063
|
+
addonId: null,
|
|
45064
|
+
access: "view"
|
|
45065
|
+
},
|
|
42072
45066
|
"backup.getEntries": {
|
|
42073
45067
|
capName: "backup",
|
|
42074
45068
|
capScope: "system",
|
|
@@ -42123,6 +45117,12 @@ Object.freeze({
|
|
|
42123
45117
|
addonId: null,
|
|
42124
45118
|
access: "create"
|
|
42125
45119
|
},
|
|
45120
|
+
"backup.setupEncryption": {
|
|
45121
|
+
capName: "backup",
|
|
45122
|
+
capScope: "system",
|
|
45123
|
+
addonId: null,
|
|
45124
|
+
access: "create"
|
|
45125
|
+
},
|
|
42126
45126
|
"backup.trigger": {
|
|
42127
45127
|
capName: "backup",
|
|
42128
45128
|
capScope: "system",
|
|
@@ -42675,6 +45675,12 @@ Object.freeze({
|
|
|
42675
45675
|
addonId: null,
|
|
42676
45676
|
access: "create"
|
|
42677
45677
|
},
|
|
45678
|
+
"customModelRegistry.importModelBundle": {
|
|
45679
|
+
capName: "custom-model-registry",
|
|
45680
|
+
capScope: "system",
|
|
45681
|
+
addonId: null,
|
|
45682
|
+
access: "create"
|
|
45683
|
+
},
|
|
42678
45684
|
"customModelRegistry.listModels": {
|
|
42679
45685
|
capName: "custom-model-registry",
|
|
42680
45686
|
capScope: "system",
|
|
@@ -44085,6 +47091,108 @@ Object.freeze({
|
|
|
44085
47091
|
addonId: null,
|
|
44086
47092
|
access: "create"
|
|
44087
47093
|
},
|
|
47094
|
+
"keychain.delete": {
|
|
47095
|
+
capName: "keychain",
|
|
47096
|
+
capScope: "system",
|
|
47097
|
+
addonId: null,
|
|
47098
|
+
access: "delete"
|
|
47099
|
+
},
|
|
47100
|
+
"keychain.getState": {
|
|
47101
|
+
capName: "keychain",
|
|
47102
|
+
capScope: "system",
|
|
47103
|
+
addonId: null,
|
|
47104
|
+
access: "view"
|
|
47105
|
+
},
|
|
47106
|
+
"keychain.listMeta": {
|
|
47107
|
+
capName: "keychain",
|
|
47108
|
+
capScope: "system",
|
|
47109
|
+
addonId: null,
|
|
47110
|
+
access: "view"
|
|
47111
|
+
},
|
|
47112
|
+
"keychain.put": {
|
|
47113
|
+
capName: "keychain",
|
|
47114
|
+
capScope: "system",
|
|
47115
|
+
addonId: null,
|
|
47116
|
+
access: "create"
|
|
47117
|
+
},
|
|
47118
|
+
"keychain.resolve": {
|
|
47119
|
+
capName: "keychain",
|
|
47120
|
+
capScope: "system",
|
|
47121
|
+
addonId: null,
|
|
47122
|
+
access: "view"
|
|
47123
|
+
},
|
|
47124
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47125
|
+
capName: "keychain-admin",
|
|
47126
|
+
capScope: "system",
|
|
47127
|
+
addonId: null,
|
|
47128
|
+
access: "create"
|
|
47129
|
+
},
|
|
47130
|
+
"keychainAdmin.deleteOrphans": {
|
|
47131
|
+
capName: "keychain-admin",
|
|
47132
|
+
capScope: "system",
|
|
47133
|
+
addonId: null,
|
|
47134
|
+
access: "delete"
|
|
47135
|
+
},
|
|
47136
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47137
|
+
capName: "keychain-admin",
|
|
47138
|
+
capScope: "system",
|
|
47139
|
+
addonId: null,
|
|
47140
|
+
access: "create"
|
|
47141
|
+
},
|
|
47142
|
+
"keychainAdmin.listAudit": {
|
|
47143
|
+
capName: "keychain-admin",
|
|
47144
|
+
capScope: "system",
|
|
47145
|
+
addonId: null,
|
|
47146
|
+
access: "view"
|
|
47147
|
+
},
|
|
47148
|
+
"keychainAdmin.listSecrets": {
|
|
47149
|
+
capName: "keychain-admin",
|
|
47150
|
+
capScope: "system",
|
|
47151
|
+
addonId: null,
|
|
47152
|
+
access: "view"
|
|
47153
|
+
},
|
|
47154
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47155
|
+
capName: "keychain-admin",
|
|
47156
|
+
capScope: "system",
|
|
47157
|
+
addonId: null,
|
|
47158
|
+
access: "delete"
|
|
47159
|
+
},
|
|
47160
|
+
"keychainAdmin.resetKeychain": {
|
|
47161
|
+
capName: "keychain-admin",
|
|
47162
|
+
capScope: "system",
|
|
47163
|
+
addonId: null,
|
|
47164
|
+
access: "delete"
|
|
47165
|
+
},
|
|
47166
|
+
"keychainAdmin.resetReport": {
|
|
47167
|
+
capName: "keychain-admin",
|
|
47168
|
+
capScope: "system",
|
|
47169
|
+
addonId: null,
|
|
47170
|
+
access: "delete"
|
|
47171
|
+
},
|
|
47172
|
+
"keychainAdmin.reveal": {
|
|
47173
|
+
capName: "keychain-admin",
|
|
47174
|
+
capScope: "system",
|
|
47175
|
+
addonId: null,
|
|
47176
|
+
access: "create"
|
|
47177
|
+
},
|
|
47178
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47179
|
+
capName: "keychain-admin",
|
|
47180
|
+
capScope: "system",
|
|
47181
|
+
addonId: null,
|
|
47182
|
+
access: "create"
|
|
47183
|
+
},
|
|
47184
|
+
"keychainAdmin.setSystemSecret": {
|
|
47185
|
+
capName: "keychain-admin",
|
|
47186
|
+
capScope: "system",
|
|
47187
|
+
addonId: null,
|
|
47188
|
+
access: "create"
|
|
47189
|
+
},
|
|
47190
|
+
"keychainAdmin.status": {
|
|
47191
|
+
capName: "keychain-admin",
|
|
47192
|
+
capScope: "system",
|
|
47193
|
+
addonId: null,
|
|
47194
|
+
access: "view"
|
|
47195
|
+
},
|
|
44088
47196
|
"lawnMowerControl.dock": {
|
|
44089
47197
|
capName: "lawn-mower-control",
|
|
44090
47198
|
capScope: "device",
|
|
@@ -45459,6 +48567,18 @@ Object.freeze({
|
|
|
45459
48567
|
addonId: null,
|
|
45460
48568
|
access: "create"
|
|
45461
48569
|
},
|
|
48570
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48571
|
+
capName: "pipeline-analytics",
|
|
48572
|
+
capScope: "device",
|
|
48573
|
+
addonId: null,
|
|
48574
|
+
access: "create"
|
|
48575
|
+
},
|
|
48576
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48577
|
+
capName: "pipeline-analytics",
|
|
48578
|
+
capScope: "device",
|
|
48579
|
+
addonId: null,
|
|
48580
|
+
access: "create"
|
|
48581
|
+
},
|
|
45462
48582
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45463
48583
|
capName: "pipeline-analytics",
|
|
45464
48584
|
capScope: "device",
|
|
@@ -45507,12 +48627,36 @@ Object.freeze({
|
|
|
45507
48627
|
addonId: null,
|
|
45508
48628
|
access: "view"
|
|
45509
48629
|
},
|
|
48630
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48631
|
+
capName: "pipeline-analytics",
|
|
48632
|
+
capScope: "device",
|
|
48633
|
+
addonId: null,
|
|
48634
|
+
access: "create"
|
|
48635
|
+
},
|
|
48636
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48637
|
+
capName: "pipeline-analytics",
|
|
48638
|
+
capScope: "device",
|
|
48639
|
+
addonId: null,
|
|
48640
|
+
access: "create"
|
|
48641
|
+
},
|
|
45510
48642
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45511
48643
|
capName: "pipeline-analytics",
|
|
45512
48644
|
capScope: "device",
|
|
45513
48645
|
addonId: null,
|
|
45514
48646
|
access: "delete"
|
|
45515
48647
|
},
|
|
48648
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48649
|
+
capName: "pipeline-analytics",
|
|
48650
|
+
capScope: "device",
|
|
48651
|
+
addonId: null,
|
|
48652
|
+
access: "delete"
|
|
48653
|
+
},
|
|
48654
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48655
|
+
capName: "pipeline-analytics",
|
|
48656
|
+
capScope: "device",
|
|
48657
|
+
addonId: null,
|
|
48658
|
+
access: "delete"
|
|
48659
|
+
},
|
|
45516
48660
|
"pipelineAnalytics.deleteTracks": {
|
|
45517
48661
|
capName: "pipeline-analytics",
|
|
45518
48662
|
capScope: "device",
|
|
@@ -45717,6 +48861,30 @@ Object.freeze({
|
|
|
45717
48861
|
addonId: null,
|
|
45718
48862
|
access: "view"
|
|
45719
48863
|
},
|
|
48864
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48865
|
+
capName: "pipeline-analytics",
|
|
48866
|
+
capScope: "device",
|
|
48867
|
+
addonId: null,
|
|
48868
|
+
access: "view"
|
|
48869
|
+
},
|
|
48870
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48871
|
+
capName: "pipeline-analytics",
|
|
48872
|
+
capScope: "device",
|
|
48873
|
+
addonId: null,
|
|
48874
|
+
access: "view"
|
|
48875
|
+
},
|
|
48876
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
48877
|
+
capName: "pipeline-analytics",
|
|
48878
|
+
capScope: "device",
|
|
48879
|
+
addonId: null,
|
|
48880
|
+
access: "view"
|
|
48881
|
+
},
|
|
48882
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48883
|
+
capName: "pipeline-analytics",
|
|
48884
|
+
capScope: "device",
|
|
48885
|
+
addonId: null,
|
|
48886
|
+
access: "view"
|
|
48887
|
+
},
|
|
45720
48888
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45721
48889
|
capName: "pipeline-analytics",
|
|
45722
48890
|
capScope: "device",
|
|
@@ -45747,6 +48915,12 @@ Object.freeze({
|
|
|
45747
48915
|
addonId: null,
|
|
45748
48916
|
access: "view"
|
|
45749
48917
|
},
|
|
48918
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48919
|
+
capName: "pipeline-analytics",
|
|
48920
|
+
capScope: "device",
|
|
48921
|
+
addonId: null,
|
|
48922
|
+
access: "create"
|
|
48923
|
+
},
|
|
45750
48924
|
"pipelineAnalytics.ownersWithMedia": {
|
|
45751
48925
|
capName: "pipeline-analytics",
|
|
45752
48926
|
capScope: "device",
|
|
@@ -45759,12 +48933,24 @@ Object.freeze({
|
|
|
45759
48933
|
addonId: null,
|
|
45760
48934
|
access: "create"
|
|
45761
48935
|
},
|
|
48936
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48937
|
+
capName: "pipeline-analytics",
|
|
48938
|
+
capScope: "device",
|
|
48939
|
+
addonId: null,
|
|
48940
|
+
access: "view"
|
|
48941
|
+
},
|
|
45762
48942
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
45763
48943
|
capName: "pipeline-analytics",
|
|
45764
48944
|
capScope: "device",
|
|
45765
48945
|
addonId: null,
|
|
45766
48946
|
access: "create"
|
|
45767
48947
|
},
|
|
48948
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
48949
|
+
capName: "pipeline-analytics",
|
|
48950
|
+
capScope: "device",
|
|
48951
|
+
addonId: null,
|
|
48952
|
+
access: "create"
|
|
48953
|
+
},
|
|
45768
48954
|
"pipelineAnalytics.pruneEvents": {
|
|
45769
48955
|
capName: "pipeline-analytics",
|
|
45770
48956
|
capScope: "device",
|
|
@@ -45819,6 +49005,18 @@ Object.freeze({
|
|
|
45819
49005
|
addonId: null,
|
|
45820
49006
|
access: "create"
|
|
45821
49007
|
},
|
|
49008
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49009
|
+
capName: "pipeline-analytics",
|
|
49010
|
+
capScope: "device",
|
|
49011
|
+
addonId: null,
|
|
49012
|
+
access: "delete"
|
|
49013
|
+
},
|
|
49014
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49015
|
+
capName: "pipeline-analytics",
|
|
49016
|
+
capScope: "device",
|
|
49017
|
+
addonId: null,
|
|
49018
|
+
access: "create"
|
|
49019
|
+
},
|
|
45822
49020
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45823
49021
|
capName: "pipeline-analytics",
|
|
45824
49022
|
capScope: "device",
|
|
@@ -45879,6 +49077,12 @@ Object.freeze({
|
|
|
45879
49077
|
addonId: null,
|
|
45880
49078
|
access: "create"
|
|
45881
49079
|
},
|
|
49080
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49081
|
+
capName: "pipeline-analytics",
|
|
49082
|
+
capScope: "device",
|
|
49083
|
+
addonId: null,
|
|
49084
|
+
access: "view"
|
|
49085
|
+
},
|
|
45882
49086
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
45883
49087
|
capName: "pipeline-analytics",
|
|
45884
49088
|
capScope: "device",
|
|
@@ -46107,6 +49311,12 @@ Object.freeze({
|
|
|
46107
49311
|
addonId: null,
|
|
46108
49312
|
access: "view"
|
|
46109
49313
|
},
|
|
49314
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
49315
|
+
capName: "pipeline-orchestrator",
|
|
49316
|
+
capScope: "system",
|
|
49317
|
+
addonId: null,
|
|
49318
|
+
access: "create"
|
|
49319
|
+
},
|
|
46110
49320
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46111
49321
|
capName: "pipeline-orchestrator",
|
|
46112
49322
|
capScope: "system",
|
|
@@ -46131,6 +49341,12 @@ Object.freeze({
|
|
|
46131
49341
|
addonId: null,
|
|
46132
49342
|
access: "create"
|
|
46133
49343
|
},
|
|
49344
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
49345
|
+
capName: "pipeline-orchestrator",
|
|
49346
|
+
capScope: "system",
|
|
49347
|
+
addonId: null,
|
|
49348
|
+
access: "delete"
|
|
49349
|
+
},
|
|
46134
49350
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46135
49351
|
capName: "pipeline-orchestrator",
|
|
46136
49352
|
capScope: "system",
|
|
@@ -46239,6 +49455,24 @@ Object.freeze({
|
|
|
46239
49455
|
addonId: null,
|
|
46240
49456
|
access: "view"
|
|
46241
49457
|
},
|
|
49458
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
49459
|
+
capName: "pipeline-orchestrator",
|
|
49460
|
+
capScope: "system",
|
|
49461
|
+
addonId: null,
|
|
49462
|
+
access: "view"
|
|
49463
|
+
},
|
|
49464
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
49465
|
+
capName: "pipeline-orchestrator",
|
|
49466
|
+
capScope: "system",
|
|
49467
|
+
addonId: null,
|
|
49468
|
+
access: "view"
|
|
49469
|
+
},
|
|
49470
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
49471
|
+
capName: "pipeline-orchestrator",
|
|
49472
|
+
capScope: "system",
|
|
49473
|
+
addonId: null,
|
|
49474
|
+
access: "view"
|
|
49475
|
+
},
|
|
46242
49476
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46243
49477
|
capName: "pipeline-orchestrator",
|
|
46244
49478
|
capScope: "system",
|
|
@@ -46281,6 +49515,12 @@ Object.freeze({
|
|
|
46281
49515
|
addonId: null,
|
|
46282
49516
|
access: "view"
|
|
46283
49517
|
},
|
|
49518
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49519
|
+
capName: "pipeline-orchestrator",
|
|
49520
|
+
capScope: "system",
|
|
49521
|
+
addonId: null,
|
|
49522
|
+
access: "view"
|
|
49523
|
+
},
|
|
46284
49524
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46285
49525
|
capName: "pipeline-orchestrator",
|
|
46286
49526
|
capScope: "system",
|
|
@@ -46425,6 +49665,12 @@ Object.freeze({
|
|
|
46425
49665
|
addonId: null,
|
|
46426
49666
|
access: "create"
|
|
46427
49667
|
},
|
|
49668
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49669
|
+
capName: "pipeline-orchestrator",
|
|
49670
|
+
capScope: "system",
|
|
49671
|
+
addonId: null,
|
|
49672
|
+
access: "create"
|
|
49673
|
+
},
|
|
46428
49674
|
"pipelineOrchestrator.suggestShares": {
|
|
46429
49675
|
capName: "pipeline-orchestrator",
|
|
46430
49676
|
capScope: "system",
|
|
@@ -46443,6 +49689,12 @@ Object.freeze({
|
|
|
46443
49689
|
addonId: null,
|
|
46444
49690
|
access: "create"
|
|
46445
49691
|
},
|
|
49692
|
+
"pipelineRunner.abortNodeBench": {
|
|
49693
|
+
capName: "pipeline-runner",
|
|
49694
|
+
capScope: "system",
|
|
49695
|
+
addonId: null,
|
|
49696
|
+
access: "create"
|
|
49697
|
+
},
|
|
46446
49698
|
"pipelineRunner.attachCamera": {
|
|
46447
49699
|
capName: "pipeline-runner",
|
|
46448
49700
|
capScope: "system",
|
|
@@ -46491,6 +49743,12 @@ Object.freeze({
|
|
|
46491
49743
|
addonId: null,
|
|
46492
49744
|
access: "view"
|
|
46493
49745
|
},
|
|
49746
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49747
|
+
capName: "pipeline-runner",
|
|
49748
|
+
capScope: "system",
|
|
49749
|
+
addonId: null,
|
|
49750
|
+
access: "view"
|
|
49751
|
+
},
|
|
46494
49752
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46495
49753
|
capName: "pipeline-runner",
|
|
46496
49754
|
capScope: "system",
|
|
@@ -46533,6 +49791,12 @@ Object.freeze({
|
|
|
46533
49791
|
addonId: null,
|
|
46534
49792
|
access: "create"
|
|
46535
49793
|
},
|
|
49794
|
+
"pipelineRunner.startNodeBench": {
|
|
49795
|
+
capName: "pipeline-runner",
|
|
49796
|
+
capScope: "system",
|
|
49797
|
+
addonId: null,
|
|
49798
|
+
access: "create"
|
|
49799
|
+
},
|
|
46536
49800
|
"plateGallery.assignPlate": {
|
|
46537
49801
|
capName: "plate-gallery",
|
|
46538
49802
|
capScope: "system",
|
|
@@ -48195,6 +51459,174 @@ Object.freeze({
|
|
|
48195
51459
|
addonId: null,
|
|
48196
51460
|
access: "view"
|
|
48197
51461
|
},
|
|
51462
|
+
"training.canaryResult": {
|
|
51463
|
+
capName: "training",
|
|
51464
|
+
capScope: "system",
|
|
51465
|
+
addonId: null,
|
|
51466
|
+
access: "create"
|
|
51467
|
+
},
|
|
51468
|
+
"training.cancelJob": {
|
|
51469
|
+
capName: "training",
|
|
51470
|
+
capScope: "system",
|
|
51471
|
+
addonId: null,
|
|
51472
|
+
access: "create"
|
|
51473
|
+
},
|
|
51474
|
+
"training.discardResult": {
|
|
51475
|
+
capName: "training",
|
|
51476
|
+
capScope: "system",
|
|
51477
|
+
addonId: null,
|
|
51478
|
+
access: "create"
|
|
51479
|
+
},
|
|
51480
|
+
"training.findDatasetVersionIdByName": {
|
|
51481
|
+
capName: "training",
|
|
51482
|
+
capScope: "system",
|
|
51483
|
+
addonId: null,
|
|
51484
|
+
access: "view"
|
|
51485
|
+
},
|
|
51486
|
+
"training.getDatasetVersion": {
|
|
51487
|
+
capName: "training",
|
|
51488
|
+
capScope: "system",
|
|
51489
|
+
addonId: null,
|
|
51490
|
+
access: "view"
|
|
51491
|
+
},
|
|
51492
|
+
"training.getJob": {
|
|
51493
|
+
capName: "training",
|
|
51494
|
+
capScope: "system",
|
|
51495
|
+
addonId: null,
|
|
51496
|
+
access: "view"
|
|
51497
|
+
},
|
|
51498
|
+
"training.getJobResult": {
|
|
51499
|
+
capName: "training",
|
|
51500
|
+
capScope: "system",
|
|
51501
|
+
addonId: null,
|
|
51502
|
+
access: "view"
|
|
51503
|
+
},
|
|
51504
|
+
"training.listBaseModels": {
|
|
51505
|
+
capName: "training",
|
|
51506
|
+
capScope: "system",
|
|
51507
|
+
addonId: null,
|
|
51508
|
+
access: "view"
|
|
51509
|
+
},
|
|
51510
|
+
"training.listDatasetVersions": {
|
|
51511
|
+
capName: "training",
|
|
51512
|
+
capScope: "system",
|
|
51513
|
+
addonId: null,
|
|
51514
|
+
access: "view"
|
|
51515
|
+
},
|
|
51516
|
+
"training.listJobs": {
|
|
51517
|
+
capName: "training",
|
|
51518
|
+
capScope: "system",
|
|
51519
|
+
addonId: null,
|
|
51520
|
+
access: "view"
|
|
51521
|
+
},
|
|
51522
|
+
"training.planJob": {
|
|
51523
|
+
capName: "training",
|
|
51524
|
+
capScope: "system",
|
|
51525
|
+
addonId: null,
|
|
51526
|
+
access: "view"
|
|
51527
|
+
},
|
|
51528
|
+
"training.putDatasetVersion": {
|
|
51529
|
+
capName: "training",
|
|
51530
|
+
capScope: "system",
|
|
51531
|
+
addonId: null,
|
|
51532
|
+
access: "create"
|
|
51533
|
+
},
|
|
51534
|
+
"training.registerResult": {
|
|
51535
|
+
capName: "training",
|
|
51536
|
+
capScope: "system",
|
|
51537
|
+
addonId: null,
|
|
51538
|
+
access: "create"
|
|
51539
|
+
},
|
|
51540
|
+
"training.removeDatasetVersion": {
|
|
51541
|
+
capName: "training",
|
|
51542
|
+
capScope: "system",
|
|
51543
|
+
addonId: null,
|
|
51544
|
+
access: "delete"
|
|
51545
|
+
},
|
|
51546
|
+
"training.rollbackCanary": {
|
|
51547
|
+
capName: "training",
|
|
51548
|
+
capScope: "system",
|
|
51549
|
+
addonId: null,
|
|
51550
|
+
access: "create"
|
|
51551
|
+
},
|
|
51552
|
+
"training.startJob": {
|
|
51553
|
+
capName: "training",
|
|
51554
|
+
capScope: "system",
|
|
51555
|
+
addonId: null,
|
|
51556
|
+
access: "create"
|
|
51557
|
+
},
|
|
51558
|
+
"trainingProvider.cancelJob": {
|
|
51559
|
+
capName: "training-provider",
|
|
51560
|
+
capScope: "system",
|
|
51561
|
+
addonId: null,
|
|
51562
|
+
access: "create"
|
|
51563
|
+
},
|
|
51564
|
+
"trainingProvider.cleanupJob": {
|
|
51565
|
+
capName: "training-provider",
|
|
51566
|
+
capScope: "system",
|
|
51567
|
+
addonId: null,
|
|
51568
|
+
access: "create"
|
|
51569
|
+
},
|
|
51570
|
+
"trainingProvider.describe": {
|
|
51571
|
+
capName: "training-provider",
|
|
51572
|
+
capScope: "system",
|
|
51573
|
+
addonId: null,
|
|
51574
|
+
access: "view"
|
|
51575
|
+
},
|
|
51576
|
+
"trainingProvider.estimateJob": {
|
|
51577
|
+
capName: "training-provider",
|
|
51578
|
+
capScope: "system",
|
|
51579
|
+
addonId: null,
|
|
51580
|
+
access: "view"
|
|
51581
|
+
},
|
|
51582
|
+
"trainingProvider.getJob": {
|
|
51583
|
+
capName: "training-provider",
|
|
51584
|
+
capScope: "system",
|
|
51585
|
+
addonId: null,
|
|
51586
|
+
access: "view"
|
|
51587
|
+
},
|
|
51588
|
+
"trainingProvider.listJobEvents": {
|
|
51589
|
+
capName: "training-provider",
|
|
51590
|
+
capScope: "system",
|
|
51591
|
+
addonId: null,
|
|
51592
|
+
access: "view"
|
|
51593
|
+
},
|
|
51594
|
+
"trainingProvider.listJobs": {
|
|
51595
|
+
capName: "training-provider",
|
|
51596
|
+
capScope: "system",
|
|
51597
|
+
addonId: null,
|
|
51598
|
+
access: "view"
|
|
51599
|
+
},
|
|
51600
|
+
"trainingProvider.offerArtifact": {
|
|
51601
|
+
capName: "training-provider",
|
|
51602
|
+
capScope: "system",
|
|
51603
|
+
addonId: null,
|
|
51604
|
+
access: "create"
|
|
51605
|
+
},
|
|
51606
|
+
"trainingProvider.readResult": {
|
|
51607
|
+
capName: "training-provider",
|
|
51608
|
+
capScope: "system",
|
|
51609
|
+
addonId: null,
|
|
51610
|
+
access: "create"
|
|
51611
|
+
},
|
|
51612
|
+
"trainingProvider.submitJob": {
|
|
51613
|
+
capName: "training-provider",
|
|
51614
|
+
capScope: "system",
|
|
51615
|
+
addonId: null,
|
|
51616
|
+
access: "create"
|
|
51617
|
+
},
|
|
51618
|
+
"trainingProvider.uploadDataset": {
|
|
51619
|
+
capName: "training-provider",
|
|
51620
|
+
capScope: "system",
|
|
51621
|
+
addonId: null,
|
|
51622
|
+
access: "create"
|
|
51623
|
+
},
|
|
51624
|
+
"trainingProvider.validateCredentials": {
|
|
51625
|
+
capName: "training-provider",
|
|
51626
|
+
capScope: "system",
|
|
51627
|
+
addonId: null,
|
|
51628
|
+
access: "create"
|
|
51629
|
+
},
|
|
48198
51630
|
"turnProvider.getTurnServers": {
|
|
48199
51631
|
capName: "turn-provider",
|
|
48200
51632
|
capScope: "system",
|
|
@@ -48219,12 +51651,6 @@ Object.freeze({
|
|
|
48219
51651
|
addonId: null,
|
|
48220
51652
|
access: "create"
|
|
48221
51653
|
},
|
|
48222
|
-
"userManagement.createApiKey": {
|
|
48223
|
-
capName: "user-management",
|
|
48224
|
-
capScope: "system",
|
|
48225
|
-
addonId: null,
|
|
48226
|
-
access: "create"
|
|
48227
|
-
},
|
|
48228
51654
|
"userManagement.createScopedToken": {
|
|
48229
51655
|
capName: "user-management",
|
|
48230
51656
|
capScope: "system",
|
|
@@ -48261,12 +51687,6 @@ Object.freeze({
|
|
|
48261
51687
|
addonId: null,
|
|
48262
51688
|
access: "view"
|
|
48263
51689
|
},
|
|
48264
|
-
"userManagement.linkExternalIdentity": {
|
|
48265
|
-
capName: "user-management",
|
|
48266
|
-
capScope: "system",
|
|
48267
|
-
addonId: null,
|
|
48268
|
-
access: "create"
|
|
48269
|
-
},
|
|
48270
51690
|
"userManagement.listApiKeys": {
|
|
48271
51691
|
capName: "user-management",
|
|
48272
51692
|
capScope: "system",
|
|
@@ -48369,12 +51789,6 @@ Object.freeze({
|
|
|
48369
51789
|
addonId: null,
|
|
48370
51790
|
access: "create"
|
|
48371
51791
|
},
|
|
48372
|
-
"userManagement.validateApiKey": {
|
|
48373
|
-
capName: "user-management",
|
|
48374
|
-
capScope: "system",
|
|
48375
|
-
addonId: null,
|
|
48376
|
-
access: "view"
|
|
48377
|
-
},
|
|
48378
51792
|
"userManagement.validateCredentials": {
|
|
48379
51793
|
capName: "user-management",
|
|
48380
51794
|
capScope: "system",
|
|
@@ -51462,6 +54876,11 @@ Object.freeze({
|
|
|
51462
54876
|
form: "single",
|
|
51463
54877
|
optional: false
|
|
51464
54878
|
}],
|
|
54879
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
54880
|
+
name: "deviceId",
|
|
54881
|
+
form: "single",
|
|
54882
|
+
optional: false
|
|
54883
|
+
}],
|
|
51465
54884
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51466
54885
|
name: "deviceId",
|
|
51467
54886
|
form: "single",
|
|
@@ -51652,6 +55071,11 @@ Object.freeze({
|
|
|
51652
55071
|
form: "single",
|
|
51653
55072
|
optional: false
|
|
51654
55073
|
}],
|
|
55074
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55075
|
+
name: "deviceId",
|
|
55076
|
+
form: "single",
|
|
55077
|
+
optional: false
|
|
55078
|
+
}],
|
|
51655
55079
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51656
55080
|
name: "deviceId",
|
|
51657
55081
|
form: "single",
|
|
@@ -52478,6 +55902,11 @@ Object.freeze({
|
|
|
52478
55902
|
form: "single",
|
|
52479
55903
|
optional: false
|
|
52480
55904
|
}],
|
|
55905
|
+
"training.canaryResult": [{
|
|
55906
|
+
name: "deviceIds",
|
|
55907
|
+
form: "array",
|
|
55908
|
+
optional: false
|
|
55909
|
+
}],
|
|
52481
55910
|
"update.getStatus": [{
|
|
52482
55911
|
name: "deviceId",
|
|
52483
55912
|
form: "single",
|