@camstack/addon-provider-homematic 1.2.129 → 1.2.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +3555 -126
- package/dist/addon.mjs +3555 -126
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { join } from "path";
|
|
|
9
9
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region ../types/dist/event-category-
|
|
12
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
13
13
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
14
14
|
EventCategory["SystemBoot"] = "system.boot";
|
|
15
15
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -88,6 +88,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
88
88
|
*/
|
|
89
89
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
90
90
|
/**
|
|
91
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
92
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
93
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
94
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
95
|
+
*/
|
|
96
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
97
|
+
/**
|
|
91
98
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
92
99
|
* transitions from `failed` back to `healthy` (typically via the
|
|
93
100
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5380,7 +5387,7 @@ var ZodIssueCode = {
|
|
|
5380
5387
|
var ZodFirstPartyTypeKind;
|
|
5381
5388
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5382
5389
|
//#endregion
|
|
5383
|
-
//#region ../types/dist/sleep-
|
|
5390
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5384
5391
|
/**
|
|
5385
5392
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5386
5393
|
* window to float samples (D455).
|
|
@@ -5459,6 +5466,97 @@ function buildAlawTable() {
|
|
|
5459
5466
|
}
|
|
5460
5467
|
buildUlawTable();
|
|
5461
5468
|
buildAlawTable();
|
|
5469
|
+
/** Is this field's stored value a credential? */
|
|
5470
|
+
function isSecretConfigField(field) {
|
|
5471
|
+
if (field.type === "password") return true;
|
|
5472
|
+
return "secret" in field && field.secret === true;
|
|
5473
|
+
}
|
|
5474
|
+
/**
|
|
5475
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5476
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5477
|
+
*/
|
|
5478
|
+
function isKeychainStoredField(field) {
|
|
5479
|
+
if (!isSecretConfigField(field)) return false;
|
|
5480
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5481
|
+
return !("storage" in field && field.storage === "inline");
|
|
5482
|
+
}
|
|
5483
|
+
/**
|
|
5484
|
+
* What a settings blob holds where a secret used to be.
|
|
5485
|
+
*
|
|
5486
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5487
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5488
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5489
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5490
|
+
*
|
|
5491
|
+
* The same shapes travel to and from the admin UI:
|
|
5492
|
+
*
|
|
5493
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5494
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5495
|
+
* value is set, never the value.
|
|
5496
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5497
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5498
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5499
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5500
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5501
|
+
*
|
|
5502
|
+
* Pure and browser-safe.
|
|
5503
|
+
*/
|
|
5504
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5505
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5506
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5507
|
+
function isRecord$2(value) {
|
|
5508
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5509
|
+
}
|
|
5510
|
+
function makeSecretMarker(ref) {
|
|
5511
|
+
return {
|
|
5512
|
+
$secret: ref,
|
|
5513
|
+
v: 1
|
|
5514
|
+
};
|
|
5515
|
+
}
|
|
5516
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5517
|
+
function isSecretMarker(value) {
|
|
5518
|
+
if (!isRecord$2(value)) return false;
|
|
5519
|
+
const ref = value["$secret"];
|
|
5520
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5521
|
+
}
|
|
5522
|
+
function isSecretClear(value) {
|
|
5523
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5524
|
+
}
|
|
5525
|
+
/**
|
|
5526
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5527
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5528
|
+
* survives this function.
|
|
5529
|
+
*/
|
|
5530
|
+
function toSecretFieldView(stored) {
|
|
5531
|
+
if (isSecretMarker(stored)) return {
|
|
5532
|
+
$secret: stored.$secret,
|
|
5533
|
+
v: 1,
|
|
5534
|
+
set: true
|
|
5535
|
+
};
|
|
5536
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5537
|
+
$secret: null,
|
|
5538
|
+
v: 1,
|
|
5539
|
+
set: true,
|
|
5540
|
+
inline: true
|
|
5541
|
+
};
|
|
5542
|
+
return null;
|
|
5543
|
+
}
|
|
5544
|
+
/**
|
|
5545
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5546
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5547
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5548
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5549
|
+
*/
|
|
5550
|
+
function classifySecretWrite(incoming) {
|
|
5551
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5552
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5553
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5554
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5555
|
+
return {
|
|
5556
|
+
kind: "set",
|
|
5557
|
+
value: incoming
|
|
5558
|
+
};
|
|
5559
|
+
}
|
|
5462
5560
|
Object.fromEntries([
|
|
5463
5561
|
{
|
|
5464
5562
|
id: "overview",
|
|
@@ -5630,33 +5728,19 @@ Object.fromEntries([
|
|
|
5630
5728
|
function isValuelessField(field) {
|
|
5631
5729
|
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";
|
|
5632
5730
|
}
|
|
5633
|
-
|
|
5634
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5635
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5636
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5637
|
-
*
|
|
5638
|
-
* For each leaf field:
|
|
5639
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5640
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5641
|
-
*
|
|
5642
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5643
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5644
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5645
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5646
|
-
*/
|
|
5647
|
-
function hydrateSchema(schema, values) {
|
|
5731
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5648
5732
|
return {
|
|
5649
5733
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5650
5734
|
sections: schema.sections.map((section) => ({
|
|
5651
5735
|
...section,
|
|
5652
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5736
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5653
5737
|
}))
|
|
5654
5738
|
};
|
|
5655
5739
|
}
|
|
5656
|
-
function hydrateField(field, values) {
|
|
5740
|
+
function hydrateField(field, values, options) {
|
|
5657
5741
|
if (isValuelessField(field)) return field;
|
|
5658
5742
|
if (field.type === "group") {
|
|
5659
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5743
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5660
5744
|
return {
|
|
5661
5745
|
...field,
|
|
5662
5746
|
fields: hydratedChildren
|
|
@@ -5665,7 +5749,7 @@ function hydrateField(field, values) {
|
|
|
5665
5749
|
if (field.type === "sub-tabs") {
|
|
5666
5750
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5667
5751
|
...tab,
|
|
5668
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5752
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5669
5753
|
}));
|
|
5670
5754
|
return {
|
|
5671
5755
|
...field,
|
|
@@ -5675,6 +5759,33 @@ function hydrateField(field, values) {
|
|
|
5675
5759
|
const key = field.key;
|
|
5676
5760
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5677
5761
|
const defaultValue = field.default;
|
|
5762
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5763
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5764
|
+
...field,
|
|
5765
|
+
value: toSecretFieldView(storedValue)
|
|
5766
|
+
};
|
|
5767
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5768
|
+
...field,
|
|
5769
|
+
value: null
|
|
5770
|
+
};
|
|
5771
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5772
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5773
|
+
if (secretItemKeys.length > 0) {
|
|
5774
|
+
const rows = storedValue.map((row) => {
|
|
5775
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5776
|
+
const out = { ...row };
|
|
5777
|
+
for (const k of secretItemKeys) {
|
|
5778
|
+
const v = Reflect.get(row, k);
|
|
5779
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5780
|
+
}
|
|
5781
|
+
return out;
|
|
5782
|
+
});
|
|
5783
|
+
return {
|
|
5784
|
+
...field,
|
|
5785
|
+
value: rows
|
|
5786
|
+
};
|
|
5787
|
+
}
|
|
5788
|
+
}
|
|
5678
5789
|
if (field.multiple) {
|
|
5679
5790
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5680
5791
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5917,6 +6028,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5917
6028
|
}
|
|
5918
6029
|
return out;
|
|
5919
6030
|
}
|
|
6031
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6032
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6033
|
+
function globalSecretScope() {
|
|
6034
|
+
return GLOBAL_SCOPE;
|
|
6035
|
+
}
|
|
6036
|
+
function encodeSegment(value) {
|
|
6037
|
+
return encodeURIComponent(value);
|
|
6038
|
+
}
|
|
6039
|
+
function decodeSegment(value) {
|
|
6040
|
+
try {
|
|
6041
|
+
return decodeURIComponent(value);
|
|
6042
|
+
} catch {
|
|
6043
|
+
return null;
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
/**
|
|
6047
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6048
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6049
|
+
* `providers[authentik].clientSecret`.
|
|
6050
|
+
*/
|
|
6051
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6052
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6053
|
+
}
|
|
6054
|
+
function parseScope(segments) {
|
|
6055
|
+
switch (segments[0]) {
|
|
6056
|
+
case "global": return {
|
|
6057
|
+
scope: GLOBAL_SCOPE,
|
|
6058
|
+
used: 1
|
|
6059
|
+
};
|
|
6060
|
+
case "node": {
|
|
6061
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6062
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6063
|
+
scope: {
|
|
6064
|
+
kind: "node",
|
|
6065
|
+
nodeId
|
|
6066
|
+
},
|
|
6067
|
+
used: 2
|
|
6068
|
+
};
|
|
6069
|
+
}
|
|
6070
|
+
case "device": {
|
|
6071
|
+
const raw = segments[1];
|
|
6072
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6073
|
+
return {
|
|
6074
|
+
scope: {
|
|
6075
|
+
kind: "device",
|
|
6076
|
+
deviceId: Number(raw)
|
|
6077
|
+
},
|
|
6078
|
+
used: 2
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
case "integration": {
|
|
6082
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6083
|
+
return id === null || id.length === 0 ? null : {
|
|
6084
|
+
scope: {
|
|
6085
|
+
kind: "integration",
|
|
6086
|
+
integrationId: id
|
|
6087
|
+
},
|
|
6088
|
+
used: 2
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
case "row": {
|
|
6092
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6093
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6094
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6095
|
+
return {
|
|
6096
|
+
scope: {
|
|
6097
|
+
kind: "row",
|
|
6098
|
+
collection,
|
|
6099
|
+
rowId
|
|
6100
|
+
},
|
|
6101
|
+
used: 3
|
|
6102
|
+
};
|
|
6103
|
+
}
|
|
6104
|
+
default: return null;
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6108
|
+
function parseSecretRef(ref) {
|
|
6109
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6110
|
+
const segments = ref.slice(9).split("/");
|
|
6111
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6112
|
+
if (owner === null || owner.length === 0) return null;
|
|
6113
|
+
const parsed = parseScope(segments.slice(1));
|
|
6114
|
+
if (parsed === null) return null;
|
|
6115
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6116
|
+
if (fieldPath.length === 0) return null;
|
|
6117
|
+
return {
|
|
6118
|
+
owner,
|
|
6119
|
+
scope: parsed.scope,
|
|
6120
|
+
fieldPath
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6123
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6124
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6125
|
+
fieldPath;
|
|
6126
|
+
constructor(fieldPath, cause) {
|
|
6127
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6128
|
+
this.fieldPath = fieldPath;
|
|
6129
|
+
this.name = "KeychainWriteRefusedError";
|
|
6130
|
+
}
|
|
6131
|
+
};
|
|
6132
|
+
var KEEP = { kind: "keep" };
|
|
6133
|
+
function isRecord$1(value) {
|
|
6134
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6135
|
+
}
|
|
6136
|
+
function defaultMintId() {
|
|
6137
|
+
return globalThis.crypto.randomUUID();
|
|
6138
|
+
}
|
|
6139
|
+
/** Every marker ref anywhere under `value`. */
|
|
6140
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6141
|
+
if (isSecretMarker(value)) {
|
|
6142
|
+
out.push(value.$secret);
|
|
6143
|
+
return out;
|
|
6144
|
+
}
|
|
6145
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6146
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6147
|
+
return out;
|
|
6148
|
+
}
|
|
6149
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6150
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6151
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6152
|
+
}
|
|
6153
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6154
|
+
const intent = classifySecretWrite(incoming);
|
|
6155
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6156
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6157
|
+
if (intent.kind === "keep") return KEEP;
|
|
6158
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6159
|
+
if (intent.kind === "clear") {
|
|
6160
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6161
|
+
return {
|
|
6162
|
+
kind: "value",
|
|
6163
|
+
value: null
|
|
6164
|
+
};
|
|
6165
|
+
}
|
|
6166
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6167
|
+
kind: "value",
|
|
6168
|
+
value: stored
|
|
6169
|
+
};
|
|
6170
|
+
try {
|
|
6171
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6172
|
+
} catch (err) {
|
|
6173
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6174
|
+
}
|
|
6175
|
+
return {
|
|
6176
|
+
kind: "value",
|
|
6177
|
+
value: makeSecretMarker(ref)
|
|
6178
|
+
};
|
|
6179
|
+
}
|
|
6180
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6181
|
+
function applyMember(out, key, result, storedParent) {
|
|
6182
|
+
if (result.kind === "value") {
|
|
6183
|
+
out[key] = result.value;
|
|
6184
|
+
return;
|
|
6185
|
+
}
|
|
6186
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6187
|
+
else delete out[key];
|
|
6188
|
+
}
|
|
6189
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6190
|
+
const out = { ...incoming };
|
|
6191
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6192
|
+
return out;
|
|
6193
|
+
}
|
|
6194
|
+
function rowId(row, idKey) {
|
|
6195
|
+
const raw = row[idKey];
|
|
6196
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6197
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6198
|
+
return null;
|
|
6199
|
+
}
|
|
6200
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6201
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6202
|
+
if (!Array.isArray(incoming)) {
|
|
6203
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6204
|
+
return {
|
|
6205
|
+
kind: "value",
|
|
6206
|
+
value: incoming
|
|
6207
|
+
};
|
|
6208
|
+
}
|
|
6209
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6210
|
+
for (const row of storedRows) {
|
|
6211
|
+
const id = rowId(row, node.idKey);
|
|
6212
|
+
if (id !== null) storedById.set(id, row);
|
|
6213
|
+
}
|
|
6214
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6215
|
+
const rows = [];
|
|
6216
|
+
for (const row of incoming) {
|
|
6217
|
+
if (!isRecord$1(row)) {
|
|
6218
|
+
rows.push(row);
|
|
6219
|
+
continue;
|
|
6220
|
+
}
|
|
6221
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6222
|
+
kept.add(id);
|
|
6223
|
+
const withId = {
|
|
6224
|
+
...row,
|
|
6225
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6226
|
+
};
|
|
6227
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6228
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6229
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6230
|
+
}
|
|
6231
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6232
|
+
return {
|
|
6233
|
+
kind: "value",
|
|
6234
|
+
value: rows
|
|
6235
|
+
};
|
|
6236
|
+
}
|
|
6237
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6238
|
+
switch (node.kind) {
|
|
6239
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6240
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6241
|
+
case "object": {
|
|
6242
|
+
if (!isRecord$1(incoming)) {
|
|
6243
|
+
if (incoming === void 0) return KEEP;
|
|
6244
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6245
|
+
return {
|
|
6246
|
+
kind: "value",
|
|
6247
|
+
value: incoming
|
|
6248
|
+
};
|
|
6249
|
+
}
|
|
6250
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6251
|
+
return {
|
|
6252
|
+
kind: "value",
|
|
6253
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6254
|
+
};
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
}
|
|
6258
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6259
|
+
function splitNodeKey(key) {
|
|
6260
|
+
const at = key.indexOf("@");
|
|
6261
|
+
return at <= 0 ? {
|
|
6262
|
+
base: key,
|
|
6263
|
+
nodeId: null
|
|
6264
|
+
} : {
|
|
6265
|
+
base: key.slice(0, at),
|
|
6266
|
+
nodeId: key.slice(at + 1)
|
|
6267
|
+
};
|
|
6268
|
+
}
|
|
6269
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6270
|
+
async function transformSecretWrite(input) {
|
|
6271
|
+
const deletes = [];
|
|
6272
|
+
const base = {
|
|
6273
|
+
secrets: input.secrets,
|
|
6274
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6275
|
+
deletes,
|
|
6276
|
+
operatorWrite: input.operatorWrite === true
|
|
6277
|
+
};
|
|
6278
|
+
const out = {};
|
|
6279
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6280
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6281
|
+
const node = input.tree.get(baseKey);
|
|
6282
|
+
if (node === void 0) {
|
|
6283
|
+
out[key] = incoming;
|
|
6284
|
+
continue;
|
|
6285
|
+
}
|
|
6286
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6287
|
+
kind: "node",
|
|
6288
|
+
nodeId
|
|
6289
|
+
} : input.scope ?? globalSecretScope();
|
|
6290
|
+
const result = await writeNode({
|
|
6291
|
+
...base,
|
|
6292
|
+
scope
|
|
6293
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6294
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6295
|
+
}
|
|
6296
|
+
return {
|
|
6297
|
+
patch: out,
|
|
6298
|
+
afterWrite: async () => {
|
|
6299
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6300
|
+
try {
|
|
6301
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6302
|
+
return { orphaned: [] };
|
|
6303
|
+
} catch {
|
|
6304
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
};
|
|
6308
|
+
}
|
|
6309
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6310
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6311
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6312
|
+
}
|
|
6313
|
+
/**
|
|
6314
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6315
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6316
|
+
*/
|
|
6317
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6318
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6319
|
+
const owner = options.ownedBy;
|
|
6320
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6321
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6322
|
+
if (refs.length === 0) return {
|
|
6323
|
+
value,
|
|
6324
|
+
unresolved: []
|
|
6325
|
+
};
|
|
6326
|
+
const answers = await secrets.resolve(refs);
|
|
6327
|
+
const unresolved = [];
|
|
6328
|
+
for (const ref of new Set(refs)) {
|
|
6329
|
+
const answer = answers[ref];
|
|
6330
|
+
if (answer === void 0) unresolved.push({
|
|
6331
|
+
ref,
|
|
6332
|
+
reason: "not-initialized"
|
|
6333
|
+
});
|
|
6334
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6335
|
+
ref,
|
|
6336
|
+
reason: answer.reason
|
|
6337
|
+
});
|
|
6338
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6339
|
+
ref,
|
|
6340
|
+
reason: answer.kind
|
|
6341
|
+
});
|
|
6342
|
+
}
|
|
6343
|
+
const substitute = (v) => {
|
|
6344
|
+
if (isSecretMarker(v)) {
|
|
6345
|
+
if (!inScope(v.$secret)) return {
|
|
6346
|
+
keep: true,
|
|
6347
|
+
value: v
|
|
6348
|
+
};
|
|
6349
|
+
const answer = answers[v.$secret];
|
|
6350
|
+
if (answer?.kind === "value") return {
|
|
6351
|
+
keep: true,
|
|
6352
|
+
value: answer.value
|
|
6353
|
+
};
|
|
6354
|
+
return keepMarker ? {
|
|
6355
|
+
keep: true,
|
|
6356
|
+
value: v
|
|
6357
|
+
} : {
|
|
6358
|
+
keep: false,
|
|
6359
|
+
value: void 0
|
|
6360
|
+
};
|
|
6361
|
+
}
|
|
6362
|
+
if (Array.isArray(v)) {
|
|
6363
|
+
const items = [];
|
|
6364
|
+
for (const item of v) {
|
|
6365
|
+
const s = substitute(item);
|
|
6366
|
+
if (s.keep) items.push(s.value);
|
|
6367
|
+
}
|
|
6368
|
+
return {
|
|
6369
|
+
keep: true,
|
|
6370
|
+
value: items
|
|
6371
|
+
};
|
|
6372
|
+
}
|
|
6373
|
+
if (isRecord$1(v)) {
|
|
6374
|
+
const out = {};
|
|
6375
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6376
|
+
const s = substitute(child);
|
|
6377
|
+
if (s.keep) out[k] = s.value;
|
|
6378
|
+
}
|
|
6379
|
+
return {
|
|
6380
|
+
keep: true,
|
|
6381
|
+
value: out
|
|
6382
|
+
};
|
|
6383
|
+
}
|
|
6384
|
+
return {
|
|
6385
|
+
keep: true,
|
|
6386
|
+
value: v
|
|
6387
|
+
};
|
|
6388
|
+
};
|
|
6389
|
+
return {
|
|
6390
|
+
value: substitute(value).value,
|
|
6391
|
+
unresolved
|
|
6392
|
+
};
|
|
6393
|
+
}
|
|
6394
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6395
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6396
|
+
ref;
|
|
6397
|
+
reason;
|
|
6398
|
+
constructor(ref, reason) {
|
|
6399
|
+
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.`);
|
|
6400
|
+
this.ref = ref;
|
|
6401
|
+
this.reason = reason;
|
|
6402
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6403
|
+
}
|
|
6404
|
+
};
|
|
6405
|
+
function isRecord$3(value) {
|
|
6406
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6407
|
+
}
|
|
6408
|
+
function resolvedValue(pass, marker) {
|
|
6409
|
+
const answer = pass.answers[marker.$secret];
|
|
6410
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6411
|
+
}
|
|
6412
|
+
async function atMarker(pass, incoming, stored) {
|
|
6413
|
+
if (incoming === null) return stored;
|
|
6414
|
+
if (typeof incoming !== "string") return incoming;
|
|
6415
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6416
|
+
const intent = classifySecretWrite(incoming);
|
|
6417
|
+
if (intent.kind !== "set") return stored;
|
|
6418
|
+
const ref = stored.$secret;
|
|
6419
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6420
|
+
const answer = pass.answers[ref];
|
|
6421
|
+
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);
|
|
6422
|
+
try {
|
|
6423
|
+
await pass.secrets.put(ref, intent.value);
|
|
6424
|
+
} catch (err) {
|
|
6425
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6426
|
+
}
|
|
6427
|
+
pass.changedRefs.push(ref);
|
|
6428
|
+
return stored;
|
|
6429
|
+
}
|
|
6430
|
+
function inArray(pass, incoming, stored) {
|
|
6431
|
+
return incoming.map((item, index) => {
|
|
6432
|
+
const twin = stored[index];
|
|
6433
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6434
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6435
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6436
|
+
return item;
|
|
6437
|
+
});
|
|
6438
|
+
}
|
|
6439
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6440
|
+
const out = { ...incoming };
|
|
6441
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6442
|
+
const twin = stored[key];
|
|
6443
|
+
if (isSecretMarker(twin)) {
|
|
6444
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6445
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6446
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6447
|
+
}
|
|
6448
|
+
return out;
|
|
6449
|
+
}
|
|
6450
|
+
async function walk(pass, incoming, stored) {
|
|
6451
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6452
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6453
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6454
|
+
const out = { ...incoming };
|
|
6455
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6456
|
+
return out;
|
|
6457
|
+
}
|
|
6458
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6459
|
+
async function restoreUnchangedSecrets(input) {
|
|
6460
|
+
const refs = [];
|
|
6461
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6462
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6463
|
+
if (owned.length === 0) return {
|
|
6464
|
+
patch: input.patch,
|
|
6465
|
+
changedRefs: []
|
|
6466
|
+
};
|
|
6467
|
+
const pass = {
|
|
6468
|
+
secrets: input.secrets,
|
|
6469
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6470
|
+
operatorWrite: input.operatorWrite,
|
|
6471
|
+
changedRefs: []
|
|
6472
|
+
};
|
|
6473
|
+
const out = {};
|
|
6474
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6475
|
+
return {
|
|
6476
|
+
patch: out,
|
|
6477
|
+
changedRefs: pass.changedRefs
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6481
|
+
function isJsonEqual(a, b) {
|
|
6482
|
+
if (Object.is(a, b)) return true;
|
|
6483
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6484
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6485
|
+
const keys = Object.keys(a);
|
|
6486
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6487
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6488
|
+
}
|
|
6489
|
+
return false;
|
|
6490
|
+
}
|
|
6491
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6492
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6493
|
+
const out = {};
|
|
6494
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6495
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6496
|
+
out[key] = value;
|
|
6497
|
+
}
|
|
6498
|
+
return out;
|
|
6499
|
+
}
|
|
6500
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6501
|
+
function markerKeysOf(blob, owner) {
|
|
6502
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6503
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6504
|
+
return keys;
|
|
6505
|
+
}
|
|
6506
|
+
function nodeFromStored(value, owner) {
|
|
6507
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6508
|
+
if (!isRecord$3(value)) return null;
|
|
6509
|
+
const children = /* @__PURE__ */ new Map();
|
|
6510
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6511
|
+
const node = nodeFromStored(child, owner);
|
|
6512
|
+
if (node !== null) children.set(key, node);
|
|
6513
|
+
}
|
|
6514
|
+
return children.size > 0 ? {
|
|
6515
|
+
kind: "object",
|
|
6516
|
+
children
|
|
6517
|
+
} : null;
|
|
6518
|
+
}
|
|
6519
|
+
/**
|
|
6520
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6521
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6522
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6523
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6524
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6525
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6526
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6527
|
+
* over.
|
|
6528
|
+
*/
|
|
6529
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6530
|
+
const added = /* @__PURE__ */ new Map();
|
|
6531
|
+
for (const key of keys) {
|
|
6532
|
+
const at = key.indexOf("@");
|
|
6533
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6534
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6535
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6536
|
+
if (node !== null) added.set(base, node);
|
|
6537
|
+
}
|
|
6538
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6539
|
+
}
|
|
6540
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6541
|
+
async function readStoredAddonBlob(raw) {
|
|
6542
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6543
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6544
|
+
const result = await threeWay.call(raw);
|
|
6545
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6546
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6547
|
+
}
|
|
6548
|
+
function touchesTree(tree, patch) {
|
|
6549
|
+
if (tree.size === 0) return false;
|
|
6550
|
+
for (const key of Object.keys(patch)) {
|
|
6551
|
+
const at = key.indexOf("@");
|
|
6552
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6553
|
+
}
|
|
6554
|
+
return false;
|
|
6555
|
+
}
|
|
6556
|
+
/**
|
|
6557
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6558
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6559
|
+
*/
|
|
6560
|
+
var MarkerKeyIndex = class {
|
|
6561
|
+
owner;
|
|
6562
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6563
|
+
constructor(owner) {
|
|
6564
|
+
this.owner = owner;
|
|
6565
|
+
}
|
|
6566
|
+
seen(store, blob) {
|
|
6567
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6568
|
+
}
|
|
6569
|
+
wrote(store, patch) {
|
|
6570
|
+
const keys = this.byStore.get(store);
|
|
6571
|
+
if (keys === void 0) return;
|
|
6572
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6573
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6574
|
+
else keys.delete(key);
|
|
6575
|
+
}
|
|
6576
|
+
mayHoldMarkers(store, patch) {
|
|
6577
|
+
const keys = this.byStore.get(store);
|
|
6578
|
+
if (keys === void 0) return true;
|
|
6579
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6580
|
+
}
|
|
6581
|
+
};
|
|
6582
|
+
function createHandle(raw, opts) {
|
|
6583
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6584
|
+
const serialize = (key, fn) => {
|
|
6585
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6586
|
+
const tail = next.catch(() => void 0);
|
|
6587
|
+
chains.set(key, tail);
|
|
6588
|
+
tail.then(() => {
|
|
6589
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6590
|
+
});
|
|
6591
|
+
return next;
|
|
6592
|
+
};
|
|
6593
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6594
|
+
const resolveRead = async (store, blob) => {
|
|
6595
|
+
index.seen(store, blob);
|
|
6596
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6597
|
+
unresolved: "keep-marker",
|
|
6598
|
+
ownedBy: opts.secrets.owner
|
|
6599
|
+
});
|
|
6600
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6601
|
+
return value;
|
|
6602
|
+
};
|
|
6603
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6604
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6605
|
+
await rawWrite(patch);
|
|
6606
|
+
index.wrote(store, patch);
|
|
6607
|
+
return { changed: true };
|
|
6608
|
+
}
|
|
6609
|
+
return serialize(store, async () => {
|
|
6610
|
+
const stored = await readStored();
|
|
6611
|
+
index.seen(store, stored);
|
|
6612
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6613
|
+
const restored = await restoreUnchangedSecrets({
|
|
6614
|
+
patch,
|
|
6615
|
+
stored,
|
|
6616
|
+
secrets: opts.secrets,
|
|
6617
|
+
operatorWrite
|
|
6618
|
+
});
|
|
6619
|
+
const result = await transformSecretWrite({
|
|
6620
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6621
|
+
secrets: opts.secrets,
|
|
6622
|
+
patch: restored.patch,
|
|
6623
|
+
stored,
|
|
6624
|
+
...scope !== void 0 ? { scope } : {},
|
|
6625
|
+
operatorWrite
|
|
6626
|
+
});
|
|
6627
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6628
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6629
|
+
if (wroteBlob) {
|
|
6630
|
+
await rawWrite(effective);
|
|
6631
|
+
index.wrote(store, effective);
|
|
6632
|
+
}
|
|
6633
|
+
const { orphaned } = await result.afterWrite();
|
|
6634
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6635
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6636
|
+
});
|
|
6637
|
+
};
|
|
6638
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6639
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6640
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6641
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6642
|
+
const overrides = {
|
|
6643
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6644
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6645
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6646
|
+
return result.kind === "value" ? {
|
|
6647
|
+
kind: "value",
|
|
6648
|
+
value: await resolveRead("addon", result.value)
|
|
6649
|
+
} : result;
|
|
6650
|
+
} } : {},
|
|
6651
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6652
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6653
|
+
if (result.kind !== "present") return result;
|
|
6654
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6655
|
+
unresolved: "keep-marker",
|
|
6656
|
+
ownedBy: opts.secrets.owner
|
|
6657
|
+
});
|
|
6658
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6659
|
+
return {
|
|
6660
|
+
kind: "present",
|
|
6661
|
+
value: value[key]
|
|
6662
|
+
};
|
|
6663
|
+
} } : {},
|
|
6664
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6665
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6666
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6667
|
+
const out = /* @__PURE__ */ new Map();
|
|
6668
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6669
|
+
return out;
|
|
6670
|
+
} } : {},
|
|
6671
|
+
writeAddonStore: async (patch) => {
|
|
6672
|
+
await writeAddon(patch);
|
|
6673
|
+
},
|
|
6674
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6675
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6676
|
+
kind: "device",
|
|
6677
|
+
deviceId
|
|
6678
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6679
|
+
}
|
|
6680
|
+
};
|
|
6681
|
+
return {
|
|
6682
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6683
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6684
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6685
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6686
|
+
} }),
|
|
6687
|
+
raw: {
|
|
6688
|
+
readAddonStore: async () => {
|
|
6689
|
+
const blob = await raw.readAddonStore();
|
|
6690
|
+
index.seen("addon", blob);
|
|
6691
|
+
return blob;
|
|
6692
|
+
},
|
|
6693
|
+
readDeviceStore: async (deviceId) => {
|
|
6694
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6695
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6696
|
+
return blob;
|
|
6697
|
+
}
|
|
6698
|
+
},
|
|
6699
|
+
writeAddonStore: writeAddon
|
|
6700
|
+
};
|
|
6701
|
+
}
|
|
6702
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6703
|
+
function createSecretAwareContext(context, opts) {
|
|
6704
|
+
const raw = context.settings;
|
|
6705
|
+
if (raw === void 0) return {
|
|
6706
|
+
context,
|
|
6707
|
+
handle: null
|
|
6708
|
+
};
|
|
6709
|
+
const handle = createHandle(raw, opts);
|
|
6710
|
+
return {
|
|
6711
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6712
|
+
if (prop === "settings") return handle.settings;
|
|
6713
|
+
return Reflect.get(target, prop, receiver);
|
|
6714
|
+
} }),
|
|
6715
|
+
handle
|
|
6716
|
+
};
|
|
6717
|
+
}
|
|
6718
|
+
var LEAF = { kind: "leaf" };
|
|
6719
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6720
|
+
function collectFields(fields, out) {
|
|
6721
|
+
for (const field of fields) {
|
|
6722
|
+
if (field.type === "group") {
|
|
6723
|
+
collectFields(field.fields, out);
|
|
6724
|
+
continue;
|
|
6725
|
+
}
|
|
6726
|
+
if (field.type === "sub-tabs") {
|
|
6727
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6728
|
+
continue;
|
|
6729
|
+
}
|
|
6730
|
+
if (field.type === "editable-array") {
|
|
6731
|
+
const item = /* @__PURE__ */ new Map();
|
|
6732
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6733
|
+
if (item.size > 0) out.set(field.key, {
|
|
6734
|
+
kind: "array",
|
|
6735
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6736
|
+
item
|
|
6737
|
+
});
|
|
6738
|
+
continue;
|
|
6739
|
+
}
|
|
6740
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6741
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6742
|
+
}
|
|
6743
|
+
}
|
|
6744
|
+
/** The secret tree a settings schema declares. */
|
|
6745
|
+
function secretTreeFromSchema(schema) {
|
|
6746
|
+
const out = /* @__PURE__ */ new Map();
|
|
6747
|
+
if (schema === null) return out;
|
|
6748
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6749
|
+
return out;
|
|
6750
|
+
}
|
|
6751
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6752
|
+
function parseSecretStatePath(path) {
|
|
6753
|
+
const segments = [];
|
|
6754
|
+
for (const raw of path.split(".")) {
|
|
6755
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6756
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6757
|
+
segments.push(m[2] !== void 0 ? {
|
|
6758
|
+
key: m[1],
|
|
6759
|
+
idKey: m[2]
|
|
6760
|
+
} : { key: m[1] });
|
|
6761
|
+
}
|
|
6762
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6763
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6764
|
+
return segments;
|
|
6765
|
+
}
|
|
6766
|
+
function insert(into, segments) {
|
|
6767
|
+
const [head, ...rest] = segments;
|
|
6768
|
+
if (head === void 0) return;
|
|
6769
|
+
if (rest.length === 0) {
|
|
6770
|
+
into.set(head.key, LEAF);
|
|
6771
|
+
return;
|
|
6772
|
+
}
|
|
6773
|
+
const existing = into.get(head.key);
|
|
6774
|
+
if (head.idKey !== void 0) {
|
|
6775
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6776
|
+
insert(item, rest);
|
|
6777
|
+
into.set(head.key, {
|
|
6778
|
+
kind: "array",
|
|
6779
|
+
idKey: head.idKey,
|
|
6780
|
+
item
|
|
6781
|
+
});
|
|
6782
|
+
return;
|
|
6783
|
+
}
|
|
6784
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6785
|
+
insert(children, rest);
|
|
6786
|
+
into.set(head.key, {
|
|
6787
|
+
kind: "object",
|
|
6788
|
+
children
|
|
6789
|
+
});
|
|
6790
|
+
}
|
|
6791
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6792
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6793
|
+
if (paths.length === 0) return tree;
|
|
6794
|
+
const out = new Map(tree);
|
|
6795
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6796
|
+
return out;
|
|
6797
|
+
}
|
|
6798
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6799
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6800
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6801
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6802
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5920
6803
|
/**
|
|
5921
6804
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5922
6805
|
*
|
|
@@ -5986,6 +6869,33 @@ var BaseAddon = class {
|
|
|
5986
6869
|
settingsStoreReady = false;
|
|
5987
6870
|
/** Default config values. Provided via constructor. */
|
|
5988
6871
|
defaults;
|
|
6872
|
+
/**
|
|
6873
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6874
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6875
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6876
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6877
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6878
|
+
*/
|
|
6879
|
+
secretStatePaths = [];
|
|
6880
|
+
_addonSecretTree = null;
|
|
6881
|
+
_deviceSecretTree = null;
|
|
6882
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6883
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6884
|
+
_unresolvedSecrets = [];
|
|
6885
|
+
_secretRetryTimer = null;
|
|
6886
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6887
|
+
_secretChangeTimer = null;
|
|
6888
|
+
_secretChangeUnsub = null;
|
|
6889
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6890
|
+
_operatorWriteDepth = 0;
|
|
6891
|
+
/**
|
|
6892
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6893
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6894
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6895
|
+
*/
|
|
6896
|
+
_secretSettings = null;
|
|
6897
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6898
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
5989
6899
|
constructor(defaults) {
|
|
5990
6900
|
this.defaults = defaults;
|
|
5991
6901
|
this._config = { ...defaults };
|
|
@@ -6021,8 +6931,26 @@ var BaseAddon = class {
|
|
|
6021
6931
|
return this._config;
|
|
6022
6932
|
}
|
|
6023
6933
|
async initialize(context) {
|
|
6024
|
-
|
|
6934
|
+
const secrets = context.secrets;
|
|
6935
|
+
if (secrets !== void 0) {
|
|
6936
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6937
|
+
secrets,
|
|
6938
|
+
addonTree: () => this.addonSecretTree(),
|
|
6939
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6940
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6941
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6942
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6943
|
+
});
|
|
6944
|
+
this._ctx = wrapped;
|
|
6945
|
+
this._secretSettings = handle;
|
|
6946
|
+
} else {
|
|
6947
|
+
this._ctx = context;
|
|
6948
|
+
this._secretSettings = null;
|
|
6949
|
+
}
|
|
6025
6950
|
await this.resolveConfig();
|
|
6951
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6952
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6953
|
+
});
|
|
6026
6954
|
const result = await this.onInitialize();
|
|
6027
6955
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6028
6956
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6055,6 +6983,12 @@ var BaseAddon = class {
|
|
|
6055
6983
|
*/
|
|
6056
6984
|
async onHubReachable() {}
|
|
6057
6985
|
async shutdown() {
|
|
6986
|
+
this._secretChangeUnsub?.();
|
|
6987
|
+
this._secretChangeUnsub = null;
|
|
6988
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6989
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6990
|
+
this._secretRetryTimer = null;
|
|
6991
|
+
this._secretChangeTimer = null;
|
|
6058
6992
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6059
6993
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6060
6994
|
await this.onShutdown();
|
|
@@ -6129,11 +7063,8 @@ var BaseAddon = class {
|
|
|
6129
7063
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6130
7064
|
const schema = this.globalSettingsSchema(cap);
|
|
6131
7065
|
if (!schema) return { sections: [] };
|
|
6132
|
-
const projected = await this.
|
|
6133
|
-
return hydrateSchema(schema, overlay ? {
|
|
6134
|
-
...projected,
|
|
6135
|
-
...overlay
|
|
6136
|
-
} : projected);
|
|
7066
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7067
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6137
7068
|
}
|
|
6138
7069
|
/**
|
|
6139
7070
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6178,11 +7109,11 @@ var BaseAddon = class {
|
|
|
6178
7109
|
});
|
|
6179
7110
|
}
|
|
6180
7111
|
if (sections.length === 0) return null;
|
|
6181
|
-
const projected = await this.
|
|
7112
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6182
7113
|
return hydrateSchema({
|
|
6183
7114
|
...schema,
|
|
6184
7115
|
sections
|
|
6185
|
-
}, projected);
|
|
7116
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6186
7117
|
}
|
|
6187
7118
|
/**
|
|
6188
7119
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6195,12 +7126,50 @@ var BaseAddon = class {
|
|
|
6195
7126
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6196
7127
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6197
7128
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7129
|
+
*
|
|
7130
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7131
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7132
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7133
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7134
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7135
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6198
7136
|
*/
|
|
6199
7137
|
async resolveGlobalStore(nodeId, cap) {
|
|
6200
7138
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7139
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7140
|
+
}
|
|
7141
|
+
projectForNode(store, nodeId, cap) {
|
|
6201
7142
|
const keys = this.perNodeKeys(cap);
|
|
6202
7143
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6203
|
-
return keys.size > 0 ? projectStore(
|
|
7144
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7145
|
+
}
|
|
7146
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7147
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7148
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7149
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7150
|
+
}
|
|
7151
|
+
/**
|
|
7152
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7153
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7154
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7155
|
+
* its value.
|
|
7156
|
+
*/
|
|
7157
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7158
|
+
const secrets = this._ctx?.secrets;
|
|
7159
|
+
const merged = {
|
|
7160
|
+
...stored,
|
|
7161
|
+
...overlay
|
|
7162
|
+
};
|
|
7163
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7164
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7165
|
+
unresolved: "keep-marker",
|
|
7166
|
+
ownedBy: secrets.owner
|
|
7167
|
+
});
|
|
7168
|
+
for (const key of Object.keys(overlay)) {
|
|
7169
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7170
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7171
|
+
}
|
|
7172
|
+
return merged;
|
|
6204
7173
|
}
|
|
6205
7174
|
/**
|
|
6206
7175
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6236,18 +7205,58 @@ var BaseAddon = class {
|
|
|
6236
7205
|
value: result.value[key]
|
|
6237
7206
|
};
|
|
6238
7207
|
}
|
|
7208
|
+
/**
|
|
7209
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7210
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7211
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7212
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7213
|
+
* writing back what it read is not (D787).
|
|
7214
|
+
*/
|
|
7215
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7216
|
+
this._operatorWriteDepth++;
|
|
7217
|
+
try {
|
|
7218
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7219
|
+
} finally {
|
|
7220
|
+
this._operatorWriteDepth--;
|
|
7221
|
+
}
|
|
7222
|
+
}
|
|
6239
7223
|
async updateGlobalSettings(patch, nodeId) {
|
|
7224
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7225
|
+
}
|
|
7226
|
+
/**
|
|
7227
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7228
|
+
*
|
|
7229
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7230
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7231
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7232
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7233
|
+
*/
|
|
7234
|
+
async clearSecrets(keys, nodeId) {
|
|
7235
|
+
const tree = this.addonSecretTree();
|
|
7236
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7237
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7238
|
+
const patch = {};
|
|
7239
|
+
for (const key of keys) {
|
|
7240
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7241
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7242
|
+
}
|
|
7243
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7244
|
+
}
|
|
7245
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6240
7246
|
const keys = this.perNodeKeys();
|
|
6241
7247
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6242
7248
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6243
|
-
const barePatch = patch;
|
|
6244
7249
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6245
|
-
|
|
7250
|
+
const handle = this._secretSettings;
|
|
7251
|
+
if (handle !== null) {
|
|
7252
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7253
|
+
if (!changed) return;
|
|
7254
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6246
7255
|
if (target !== localNode) return;
|
|
6247
7256
|
await this.resolveConfig();
|
|
6248
7257
|
await this.onConfigChanged();
|
|
6249
7258
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6250
|
-
this.maybeAutoRestart(
|
|
7259
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6251
7260
|
}
|
|
6252
7261
|
/**
|
|
6253
7262
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6272,7 +7281,7 @@ var BaseAddon = class {
|
|
|
6272
7281
|
* time to return its response before the addon is torn down and
|
|
6273
7282
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6274
7283
|
*/
|
|
6275
|
-
maybeAutoRestart(
|
|
7284
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6276
7285
|
if (!schema) return;
|
|
6277
7286
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6278
7287
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6280,13 +7289,13 @@ var BaseAddon = class {
|
|
|
6280
7289
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6281
7290
|
}
|
|
6282
7291
|
if (restartKeys.size === 0) return;
|
|
6283
|
-
if (!
|
|
7292
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6284
7293
|
const ctx = this._ctx;
|
|
6285
7294
|
if (!ctx) return;
|
|
6286
7295
|
const addonId = ctx.id;
|
|
6287
7296
|
setImmediate(() => {
|
|
6288
7297
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6289
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7298
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6290
7299
|
}).catch((err) => {
|
|
6291
7300
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6292
7301
|
});
|
|
@@ -6295,7 +7304,7 @@ var BaseAddon = class {
|
|
|
6295
7304
|
async getDeviceSettings(deviceId) {
|
|
6296
7305
|
const schema = this.deviceSettingsSchema();
|
|
6297
7306
|
if (!schema) return { sections: [] };
|
|
6298
|
-
return hydrateSchema(schema, await this.
|
|
7307
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6299
7308
|
}
|
|
6300
7309
|
async updateDeviceSettings(deviceId, patch) {
|
|
6301
7310
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6425,7 +7434,7 @@ var BaseAddon = class {
|
|
|
6425
7434
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6426
7435
|
*/
|
|
6427
7436
|
async resolveConfig() {
|
|
6428
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7437
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6429
7438
|
const perNode = this.perNodeKeys();
|
|
6430
7439
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6431
7440
|
const resolved = { ...this.defaults };
|
|
@@ -6450,7 +7459,7 @@ var BaseAddon = class {
|
|
|
6450
7459
|
key,
|
|
6451
7460
|
schema,
|
|
6452
7461
|
fallback,
|
|
6453
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7462
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6454
7463
|
write: async (patch) => {
|
|
6455
7464
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6456
7465
|
},
|
|
@@ -6467,7 +7476,7 @@ var BaseAddon = class {
|
|
|
6467
7476
|
key,
|
|
6468
7477
|
schema,
|
|
6469
7478
|
fallback,
|
|
6470
|
-
read: async () => await this.
|
|
7479
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6471
7480
|
write: async (patch) => {
|
|
6472
7481
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6473
7482
|
},
|
|
@@ -6479,6 +7488,87 @@ var BaseAddon = class {
|
|
|
6479
7488
|
} })
|
|
6480
7489
|
});
|
|
6481
7490
|
}
|
|
7491
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7492
|
+
addonSecretTree() {
|
|
7493
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7494
|
+
return this._addonSecretTree;
|
|
7495
|
+
}
|
|
7496
|
+
deviceSecretTree() {
|
|
7497
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7498
|
+
return this._deviceSecretTree;
|
|
7499
|
+
}
|
|
7500
|
+
/**
|
|
7501
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7502
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7503
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7504
|
+
* than start on an empty credential.
|
|
7505
|
+
*/
|
|
7506
|
+
get unresolvedSecrets() {
|
|
7507
|
+
return this._unresolvedSecrets;
|
|
7508
|
+
}
|
|
7509
|
+
/**
|
|
7510
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7511
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7512
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7513
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7514
|
+
* ever written back from here.
|
|
7515
|
+
*/
|
|
7516
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7517
|
+
const secrets = this._ctx?.secrets;
|
|
7518
|
+
if (secrets === void 0) return blob;
|
|
7519
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7520
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7521
|
+
if (refs.length === 0) {
|
|
7522
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7523
|
+
return blob;
|
|
7524
|
+
}
|
|
7525
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7526
|
+
if (trackForConfig) {
|
|
7527
|
+
this._unresolvedSecrets = unresolved;
|
|
7528
|
+
if (unresolved.length > 0) {
|
|
7529
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7530
|
+
ref: u.ref,
|
|
7531
|
+
reason: u.reason
|
|
7532
|
+
})) } });
|
|
7533
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7534
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7535
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7536
|
+
}
|
|
7537
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7538
|
+
}
|
|
7539
|
+
return value;
|
|
7540
|
+
}
|
|
7541
|
+
/**
|
|
7542
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7543
|
+
* keychain the context's own view is already raw.
|
|
7544
|
+
*/
|
|
7545
|
+
rawSettings() {
|
|
7546
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7547
|
+
}
|
|
7548
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7549
|
+
logUnresolvedRead(unresolved) {
|
|
7550
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7551
|
+
if (fresh.length === 0) return;
|
|
7552
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7553
|
+
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) => ({
|
|
7554
|
+
ref: u.ref,
|
|
7555
|
+
reason: u.reason
|
|
7556
|
+
})) } });
|
|
7557
|
+
}
|
|
7558
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7559
|
+
scheduleSecretReresolve(delayMs) {
|
|
7560
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7561
|
+
if (this[timerOf] !== null) return;
|
|
7562
|
+
const timer = setTimeout(() => {
|
|
7563
|
+
this[timerOf] = null;
|
|
7564
|
+
if (this._ctx === null) return;
|
|
7565
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7566
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7567
|
+
});
|
|
7568
|
+
}, delayMs);
|
|
7569
|
+
timer.unref?.();
|
|
7570
|
+
this[timerOf] = timer;
|
|
7571
|
+
}
|
|
6482
7572
|
/**
|
|
6483
7573
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6484
7574
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6491,7 +7581,7 @@ var BaseAddon = class {
|
|
|
6491
7581
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6492
7582
|
*/
|
|
6493
7583
|
async readAddonStoreWithRetry() {
|
|
6494
|
-
const settings = this.
|
|
7584
|
+
const settings = this.rawSettings();
|
|
6495
7585
|
if (!settings) return {};
|
|
6496
7586
|
const delaysMs = [
|
|
6497
7587
|
150,
|
|
@@ -7054,6 +8144,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7054
8144
|
kind: "mutation",
|
|
7055
8145
|
auth: "admin"
|
|
7056
8146
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8147
|
+
function defOf(schema) {
|
|
8148
|
+
return schema._zod?.def ?? {};
|
|
8149
|
+
}
|
|
8150
|
+
function declaredHere(schema) {
|
|
8151
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8152
|
+
}
|
|
8153
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8154
|
+
var WRAPPERS = new Set([
|
|
8155
|
+
"optional",
|
|
8156
|
+
"nullable",
|
|
8157
|
+
"default",
|
|
8158
|
+
"prefault",
|
|
8159
|
+
"catch",
|
|
8160
|
+
"readonly",
|
|
8161
|
+
"nonoptional"
|
|
8162
|
+
]);
|
|
8163
|
+
/**
|
|
8164
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8165
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8166
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8167
|
+
* `.transform` on `in`).
|
|
8168
|
+
*/
|
|
8169
|
+
function layersOf(schema) {
|
|
8170
|
+
const out = [];
|
|
8171
|
+
const queue = [schema];
|
|
8172
|
+
while (queue.length > 0) {
|
|
8173
|
+
const s = queue.shift();
|
|
8174
|
+
if (!s || out.includes(s)) continue;
|
|
8175
|
+
out.push(s);
|
|
8176
|
+
const def = defOf(s);
|
|
8177
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8178
|
+
if (def.type === "pipe") {
|
|
8179
|
+
if (def.in) queue.push(def.in);
|
|
8180
|
+
if (def.out) queue.push(def.out);
|
|
8181
|
+
}
|
|
8182
|
+
}
|
|
8183
|
+
return out;
|
|
8184
|
+
}
|
|
8185
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8186
|
+
function isZodSecret(schema) {
|
|
8187
|
+
return layersOf(schema).some(declaredHere);
|
|
8188
|
+
}
|
|
8189
|
+
/**
|
|
8190
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8191
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8192
|
+
* object or array is reported as one path and not descended into — everything
|
|
8193
|
+
* under it is secret.
|
|
8194
|
+
*/
|
|
8195
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8196
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8197
|
+
const paths = [];
|
|
8198
|
+
for (const layer of layersOf(schema)) {
|
|
8199
|
+
const def = defOf(layer);
|
|
8200
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8201
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8202
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8203
|
+
else if (def.type === "intersection") {
|
|
8204
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8205
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8206
|
+
}
|
|
8207
|
+
}
|
|
8208
|
+
return [...new Set(paths)];
|
|
8209
|
+
}
|
|
7057
8210
|
//#endregion
|
|
7058
8211
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7059
8212
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8731,6 +9884,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8731
9884
|
fetchedAt: number()
|
|
8732
9885
|
});
|
|
8733
9886
|
/**
|
|
9887
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9888
|
+
* gets back (cloud training, D805+).
|
|
9889
|
+
*
|
|
9890
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9891
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9892
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9893
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9894
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9895
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9896
|
+
* change there, in the same piece of work.
|
|
9897
|
+
*
|
|
9898
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9899
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9900
|
+
*/
|
|
9901
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9902
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9903
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9904
|
+
var TrainingExportSchema = _enum([
|
|
9905
|
+
"onnx",
|
|
9906
|
+
"openvino-fp16",
|
|
9907
|
+
"openvino-int8",
|
|
9908
|
+
"coreml-fp16"
|
|
9909
|
+
]);
|
|
9910
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9911
|
+
object({
|
|
9912
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9913
|
+
jobKey: string().uuid(),
|
|
9914
|
+
target: object({
|
|
9915
|
+
kind: literal("detector"),
|
|
9916
|
+
step: literal("object-detection")
|
|
9917
|
+
}),
|
|
9918
|
+
base: object({
|
|
9919
|
+
modelId: string().min(1),
|
|
9920
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9921
|
+
weights: string().min(1),
|
|
9922
|
+
imgsz: number().int().positive()
|
|
9923
|
+
}),
|
|
9924
|
+
baseline: object({
|
|
9925
|
+
modelId: string().min(1),
|
|
9926
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9927
|
+
onnxUrl: string().url(),
|
|
9928
|
+
imgsz: number().int().positive(),
|
|
9929
|
+
floors: FloorsSchema
|
|
9930
|
+
}),
|
|
9931
|
+
dataset: object({
|
|
9932
|
+
versionId: string().min(1),
|
|
9933
|
+
annotationHash: string(),
|
|
9934
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9935
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9936
|
+
}),
|
|
9937
|
+
split: object({
|
|
9938
|
+
holdoutCameras: array(number().int()),
|
|
9939
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9940
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9941
|
+
valFraction: number().min(0).max(.5),
|
|
9942
|
+
seed: number().int()
|
|
9943
|
+
}),
|
|
9944
|
+
hyper: object({
|
|
9945
|
+
epochs: number().int().positive(),
|
|
9946
|
+
batch: number().int().positive(),
|
|
9947
|
+
lr0: number().positive(),
|
|
9948
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9949
|
+
freeze: number().int().nonnegative(),
|
|
9950
|
+
patience: number().int().nonnegative(),
|
|
9951
|
+
seed: number().int()
|
|
9952
|
+
}),
|
|
9953
|
+
replay: object({
|
|
9954
|
+
source: literal("coco2017"),
|
|
9955
|
+
count: number().int().nonnegative()
|
|
9956
|
+
}),
|
|
9957
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9958
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9959
|
+
floors: object({
|
|
9960
|
+
minSupport: number().int().positive(),
|
|
9961
|
+
clamp: number().min(0).max(1)
|
|
9962
|
+
}),
|
|
9963
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9964
|
+
catalog: object({
|
|
9965
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9966
|
+
name: string().min(1).max(160)
|
|
9967
|
+
})
|
|
9968
|
+
});
|
|
9969
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9970
|
+
var TrainingResultFileSchema = object({
|
|
9971
|
+
path: string().min(1),
|
|
9972
|
+
bytes: number().int().nonnegative(),
|
|
9973
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9974
|
+
format: _enum([
|
|
9975
|
+
"onnx",
|
|
9976
|
+
"openvino",
|
|
9977
|
+
"coreml",
|
|
9978
|
+
"pt"
|
|
9979
|
+
]),
|
|
9980
|
+
variant: _enum(["base", "int8"])
|
|
9981
|
+
});
|
|
9982
|
+
var DraftFormatSchema = object({
|
|
9983
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9984
|
+
url: string().min(1),
|
|
9985
|
+
sizeMB: number().nonnegative(),
|
|
9986
|
+
isDirectory: boolean().optional(),
|
|
9987
|
+
files: array(string()).optional(),
|
|
9988
|
+
runtimes: array(literal("python")).optional(),
|
|
9989
|
+
revision: string().min(1)
|
|
9990
|
+
});
|
|
9991
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9992
|
+
var TrainingCatalogDraftSchema = object({
|
|
9993
|
+
id: string().min(1),
|
|
9994
|
+
name: string().min(1),
|
|
9995
|
+
description: string(),
|
|
9996
|
+
labels: array(unknown()),
|
|
9997
|
+
inputSize: object({
|
|
9998
|
+
width: number().int().positive(),
|
|
9999
|
+
height: number().int().positive()
|
|
10000
|
+
}),
|
|
10001
|
+
preprocessMode: literal("letterbox"),
|
|
10002
|
+
defaultClassFloors: FloorsSchema,
|
|
10003
|
+
formats: object({
|
|
10004
|
+
onnx: DraftFormatSchema.optional(),
|
|
10005
|
+
openvino: DraftFormatSchema.optional(),
|
|
10006
|
+
coreml: DraftFormatSchema.optional()
|
|
10007
|
+
})
|
|
10008
|
+
});
|
|
10009
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10010
|
+
var TrainingEvalClassSchema = object({
|
|
10011
|
+
positives: number().int(),
|
|
10012
|
+
floor: number().nullable(),
|
|
10013
|
+
tp: number().int(),
|
|
10014
|
+
fp: number().int(),
|
|
10015
|
+
fn: number().int(),
|
|
10016
|
+
precision: number().nullable(),
|
|
10017
|
+
recall: number().nullable(),
|
|
10018
|
+
ap50: number().nullable(),
|
|
10019
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10020
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10021
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10022
|
+
smallFound: number().int().optional(),
|
|
10023
|
+
smallTotal: number().int().optional()
|
|
10024
|
+
}).passthrough();
|
|
10025
|
+
var TrainingEvalReportSchema = object({
|
|
10026
|
+
frames: number().int(),
|
|
10027
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10028
|
+
}).passthrough();
|
|
10029
|
+
/**
|
|
10030
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10031
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10032
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10033
|
+
*/
|
|
10034
|
+
var TrainingResultSchema = object({
|
|
10035
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10036
|
+
jobKey: string(),
|
|
10037
|
+
status: _enum(["succeeded", "failed"]),
|
|
10038
|
+
error: object({
|
|
10039
|
+
stage: string(),
|
|
10040
|
+
code: string(),
|
|
10041
|
+
message: string()
|
|
10042
|
+
}).nullable(),
|
|
10043
|
+
trainer: object({
|
|
10044
|
+
version: string(),
|
|
10045
|
+
revision: string()
|
|
10046
|
+
}),
|
|
10047
|
+
toolchain: record(string(), string().nullable()),
|
|
10048
|
+
dataset: object({
|
|
10049
|
+
versionId: string(),
|
|
10050
|
+
annotationHash: string(),
|
|
10051
|
+
sha256: string(),
|
|
10052
|
+
frames: object({
|
|
10053
|
+
train: number().int(),
|
|
10054
|
+
val: number().int(),
|
|
10055
|
+
holdout: number().int()
|
|
10056
|
+
}),
|
|
10057
|
+
holdoutCameras: array(number().int()),
|
|
10058
|
+
replayImages: number().int()
|
|
10059
|
+
}).optional(),
|
|
10060
|
+
training: object({
|
|
10061
|
+
epochsRun: number().int(),
|
|
10062
|
+
bestEpoch: number().int(),
|
|
10063
|
+
bestMap50: number(),
|
|
10064
|
+
bestMap50_95: number(),
|
|
10065
|
+
seconds: number()
|
|
10066
|
+
}).optional(),
|
|
10067
|
+
evaluation: object({
|
|
10068
|
+
holdoutFrames: number().int(),
|
|
10069
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10070
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10071
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10072
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10073
|
+
map50: record(string(), number().nullable())
|
|
10074
|
+
}).optional(),
|
|
10075
|
+
floors: object({
|
|
10076
|
+
baseline: FloorsSchema,
|
|
10077
|
+
candidate: FloorsSchema,
|
|
10078
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10079
|
+
notes: array(string())
|
|
10080
|
+
}).optional(),
|
|
10081
|
+
int8: object({
|
|
10082
|
+
kept: boolean(),
|
|
10083
|
+
map50Fp16: number().nullable(),
|
|
10084
|
+
map50Int8: number().nullable(),
|
|
10085
|
+
reason: string().nullable()
|
|
10086
|
+
}).optional(),
|
|
10087
|
+
exportsDropped: array(object({
|
|
10088
|
+
export: string(),
|
|
10089
|
+
reason: string()
|
|
10090
|
+
})).optional(),
|
|
10091
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10092
|
+
bundle: object({
|
|
10093
|
+
path: literal("bundle.tar"),
|
|
10094
|
+
bytes: number().int().nonnegative(),
|
|
10095
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10096
|
+
}).nullable().optional(),
|
|
10097
|
+
catalogDraft: object({
|
|
10098
|
+
base: TrainingCatalogDraftSchema,
|
|
10099
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10100
|
+
}).nullable().optional(),
|
|
10101
|
+
licence: string()
|
|
10102
|
+
});
|
|
10103
|
+
var TrainingStageSchema = _enum([
|
|
10104
|
+
"prepare",
|
|
10105
|
+
"replay",
|
|
10106
|
+
"train",
|
|
10107
|
+
"eval",
|
|
10108
|
+
"export",
|
|
10109
|
+
"package"
|
|
10110
|
+
]);
|
|
10111
|
+
var EventBase = {
|
|
10112
|
+
v: literal(1),
|
|
10113
|
+
ts: number()
|
|
10114
|
+
};
|
|
10115
|
+
discriminatedUnion("type", [
|
|
10116
|
+
object({
|
|
10117
|
+
...EventBase,
|
|
10118
|
+
type: literal("stage"),
|
|
10119
|
+
stage: TrainingStageSchema
|
|
10120
|
+
}),
|
|
10121
|
+
object({
|
|
10122
|
+
...EventBase,
|
|
10123
|
+
type: literal("epoch"),
|
|
10124
|
+
epoch: number().int(),
|
|
10125
|
+
epochs: number().int(),
|
|
10126
|
+
boxLoss: number().nullable().optional(),
|
|
10127
|
+
map50: number().nullable().optional(),
|
|
10128
|
+
map50_95: number().nullable().optional(),
|
|
10129
|
+
etaSec: number().nullable().optional()
|
|
10130
|
+
}),
|
|
10131
|
+
object({
|
|
10132
|
+
...EventBase,
|
|
10133
|
+
type: literal("metric"),
|
|
10134
|
+
name: string(),
|
|
10135
|
+
value: number()
|
|
10136
|
+
}),
|
|
10137
|
+
object({
|
|
10138
|
+
...EventBase,
|
|
10139
|
+
type: literal("artifact"),
|
|
10140
|
+
path: string(),
|
|
10141
|
+
bytes: number(),
|
|
10142
|
+
sha256: string()
|
|
10143
|
+
}),
|
|
10144
|
+
object({
|
|
10145
|
+
...EventBase,
|
|
10146
|
+
type: literal("done"),
|
|
10147
|
+
status: _enum(["succeeded", "failed"]),
|
|
10148
|
+
resultSha256: string().nullable().optional()
|
|
10149
|
+
}),
|
|
10150
|
+
object({
|
|
10151
|
+
...EventBase,
|
|
10152
|
+
type: literal("error"),
|
|
10153
|
+
stage: string(),
|
|
10154
|
+
code: string(),
|
|
10155
|
+
message: string()
|
|
10156
|
+
})
|
|
10157
|
+
]);
|
|
10158
|
+
/**
|
|
8734
10159
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8735
10160
|
*
|
|
8736
10161
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11058,7 +12483,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11058
12483
|
"authenticated",
|
|
11059
12484
|
"admin"
|
|
11060
12485
|
]).optional(),
|
|
11061
|
-
description: string().optional()
|
|
12486
|
+
description: string().optional(),
|
|
12487
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12488
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11062
12489
|
});
|
|
11063
12490
|
/**
|
|
11064
12491
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11763,6 +13190,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11763
13190
|
lastError: string().optional()
|
|
11764
13191
|
});
|
|
11765
13192
|
/**
|
|
13193
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13194
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13195
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13196
|
+
* with it off — which restores without a key.
|
|
13197
|
+
*/
|
|
13198
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13199
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13200
|
+
scheme: string(),
|
|
13201
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13202
|
+
keyId: string()
|
|
13203
|
+
});
|
|
13204
|
+
/**
|
|
13205
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13206
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13207
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13208
|
+
*/
|
|
13209
|
+
var BackupEncryptionStatusSchema = object({
|
|
13210
|
+
enabled: boolean(),
|
|
13211
|
+
active: object({
|
|
13212
|
+
keyId: string(),
|
|
13213
|
+
publicKey: string(),
|
|
13214
|
+
createdAt: number()
|
|
13215
|
+
}).nullable(),
|
|
13216
|
+
/** Every key ever set up, newest first. */
|
|
13217
|
+
keys: array(object({
|
|
13218
|
+
keyId: string(),
|
|
13219
|
+
createdAt: number(),
|
|
13220
|
+
retiredAt: number().nullable()
|
|
13221
|
+
})).readonly()
|
|
13222
|
+
});
|
|
13223
|
+
/**
|
|
11766
13224
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11767
13225
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11768
13226
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11774,7 +13232,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11774
13232
|
sizeBytes: number(),
|
|
11775
13233
|
label: string().optional(),
|
|
11776
13234
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11777
|
-
locations: array(string()).readonly()
|
|
13235
|
+
locations: array(string()).readonly(),
|
|
13236
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13237
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11778
13238
|
});
|
|
11779
13239
|
var BackupEntrySchema = object({
|
|
11780
13240
|
id: string(),
|
|
@@ -11783,7 +13243,8 @@ var BackupEntrySchema = object({
|
|
|
11783
13243
|
label: string().optional(),
|
|
11784
13244
|
createdAt: number(),
|
|
11785
13245
|
sizeBytes: number(),
|
|
11786
|
-
locations: array(string()).optional()
|
|
13246
|
+
locations: array(string()).optional(),
|
|
13247
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11787
13248
|
});
|
|
11788
13249
|
var ArchiveEntrySchema = object({
|
|
11789
13250
|
path: string(),
|
|
@@ -11972,10 +13433,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
11972
13433
|
* this list and skips entries whose path doesn't start with
|
|
11973
13434
|
* any of them.
|
|
11974
13435
|
*/
|
|
11975
|
-
locations: array(string()).optional()
|
|
13436
|
+
locations: array(string()).optional(),
|
|
13437
|
+
/**
|
|
13438
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13439
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13440
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13441
|
+
* is refused before the archive is downloaded.
|
|
13442
|
+
*/
|
|
13443
|
+
backupSecretKey: string().optional()
|
|
11976
13444
|
}), _void(), {
|
|
11977
13445
|
kind: "mutation",
|
|
11978
13446
|
auth: "admin"
|
|
13447
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13448
|
+
keyId: string(),
|
|
13449
|
+
secretKey: string(),
|
|
13450
|
+
publicKey: string(),
|
|
13451
|
+
createdAt: number(),
|
|
13452
|
+
replacedKeyId: string().nullable()
|
|
13453
|
+
}), {
|
|
13454
|
+
kind: "mutation",
|
|
13455
|
+
auth: "admin"
|
|
13456
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13457
|
+
kind: "mutation",
|
|
13458
|
+
auth: "admin"
|
|
13459
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13460
|
+
valid: boolean(),
|
|
13461
|
+
keyId: string().nullable(),
|
|
13462
|
+
/** The hub knows this key (active or retired). */
|
|
13463
|
+
known: boolean(),
|
|
13464
|
+
/** It is the key new archives are encrypted to. */
|
|
13465
|
+
active: boolean(),
|
|
13466
|
+
error: string().optional()
|
|
13467
|
+
}), {
|
|
13468
|
+
kind: "mutation",
|
|
13469
|
+
auth: "admin"
|
|
11979
13470
|
}), method(object({
|
|
11980
13471
|
destinationId: string(),
|
|
11981
13472
|
backupId: string()
|
|
@@ -13750,7 +15241,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13750
15241
|
stepId: string(),
|
|
13751
15242
|
entry: ModelCatalogEntrySchema
|
|
13752
15243
|
});
|
|
13753
|
-
|
|
15244
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15245
|
+
var ModelBundleFileSchema = object({
|
|
15246
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15247
|
+
path: string().min(1),
|
|
15248
|
+
bytes: number().int().nonnegative(),
|
|
15249
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15250
|
+
});
|
|
15251
|
+
var ImportModelBundleInputSchema = object({
|
|
15252
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15253
|
+
addonId: string(),
|
|
15254
|
+
stepId: string().min(1),
|
|
15255
|
+
/**
|
|
15256
|
+
* The catalog rows to register, complete, every format URL already
|
|
15257
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15258
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15259
|
+
*/
|
|
15260
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15261
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15262
|
+
bundle: object({
|
|
15263
|
+
ticket: PeerBytesTicketSchema,
|
|
15264
|
+
bytes: number().int().positive(),
|
|
15265
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15266
|
+
}),
|
|
15267
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15268
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15269
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15270
|
+
distribute: boolean()
|
|
15271
|
+
});
|
|
15272
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15273
|
+
kind: literal("imported"),
|
|
15274
|
+
modelIds: array(string()).readonly(),
|
|
15275
|
+
distributed: array(object({
|
|
15276
|
+
modelId: string(),
|
|
15277
|
+
nodeId: string(),
|
|
15278
|
+
format: _enum(MODEL_FORMATS),
|
|
15279
|
+
ok: boolean(),
|
|
15280
|
+
error: string().optional()
|
|
15281
|
+
})).readonly()
|
|
15282
|
+
}), object({
|
|
15283
|
+
kind: literal("refused"),
|
|
15284
|
+
reason: _enum([
|
|
15285
|
+
"transfer-failed",
|
|
15286
|
+
"checksum-mismatch",
|
|
15287
|
+
"bundle-mismatch",
|
|
15288
|
+
"invalid-entry",
|
|
15289
|
+
"id-taken"
|
|
15290
|
+
]),
|
|
15291
|
+
detail: string()
|
|
15292
|
+
})]);
|
|
15293
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15294
|
+
kind: "mutation",
|
|
15295
|
+
auth: "admin",
|
|
15296
|
+
timeoutMs: 30 * 6e4
|
|
15297
|
+
});
|
|
13754
15298
|
/**
|
|
13755
15299
|
* Query filter for settings-store collections.
|
|
13756
15300
|
*/
|
|
@@ -14133,6 +15677,253 @@ id: union([string(), number()]) }), {
|
|
|
14133
15677
|
kind: "mutation",
|
|
14134
15678
|
auth: "admin"
|
|
14135
15679
|
});
|
|
15680
|
+
/**
|
|
15681
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15682
|
+
*
|
|
15683
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15684
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15685
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15686
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15687
|
+
* against the CALLER, never against anything the caller claims.
|
|
15688
|
+
*
|
|
15689
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15690
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15691
|
+
* connection, the agent from its child's connection carried in
|
|
15692
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15693
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15694
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15695
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15696
|
+
* runner is the same OS user): see the threat model in
|
|
15697
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15698
|
+
*
|
|
15699
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15700
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15701
|
+
* floors every method to admin anyway (D240).
|
|
15702
|
+
*
|
|
15703
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15704
|
+
*/
|
|
15705
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15706
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15707
|
+
"key-missing",
|
|
15708
|
+
"wrong-key",
|
|
15709
|
+
"key-file-unreadable",
|
|
15710
|
+
"store-unavailable",
|
|
15711
|
+
"not-initialized",
|
|
15712
|
+
"decrypt-failed"
|
|
15713
|
+
]);
|
|
15714
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15715
|
+
state: literal("locked"),
|
|
15716
|
+
reason: KeychainUnavailableReasonSchema
|
|
15717
|
+
})]);
|
|
15718
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15719
|
+
object({
|
|
15720
|
+
kind: literal("value"),
|
|
15721
|
+
value: string(),
|
|
15722
|
+
version: number().int()
|
|
15723
|
+
}),
|
|
15724
|
+
object({ kind: literal("missing") }),
|
|
15725
|
+
object({
|
|
15726
|
+
kind: literal("unavailable"),
|
|
15727
|
+
reason: KeychainUnavailableReasonSchema
|
|
15728
|
+
}),
|
|
15729
|
+
object({ kind: literal("forbidden") })
|
|
15730
|
+
]);
|
|
15731
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15732
|
+
/** Metadata of one stored value — never the value. */
|
|
15733
|
+
var KeychainSecretMetaSchema = object({
|
|
15734
|
+
ref: string(),
|
|
15735
|
+
owner: string(),
|
|
15736
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15737
|
+
scope: string(),
|
|
15738
|
+
fieldPath: string(),
|
|
15739
|
+
version: number().int(),
|
|
15740
|
+
createdAt: number(),
|
|
15741
|
+
updatedAt: number(),
|
|
15742
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15743
|
+
updatedBy: string(),
|
|
15744
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15745
|
+
lastReadAt: number().nullable()
|
|
15746
|
+
});
|
|
15747
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15748
|
+
method(object({
|
|
15749
|
+
ref: string().min(1),
|
|
15750
|
+
value: string().min(1)
|
|
15751
|
+
}), object({
|
|
15752
|
+
ref: string(),
|
|
15753
|
+
version: number().int()
|
|
15754
|
+
}), {
|
|
15755
|
+
kind: "mutation",
|
|
15756
|
+
auth: "admin"
|
|
15757
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15758
|
+
kind: "mutation",
|
|
15759
|
+
auth: "admin"
|
|
15760
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15761
|
+
var KeychainKeySourceSchema = object({
|
|
15762
|
+
kind: _enum([
|
|
15763
|
+
"config-file",
|
|
15764
|
+
"previous-config-file",
|
|
15765
|
+
"platform",
|
|
15766
|
+
"default-file"
|
|
15767
|
+
]),
|
|
15768
|
+
/** File sources only — a path is not a secret. */
|
|
15769
|
+
path: string().optional(),
|
|
15770
|
+
/**
|
|
15771
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15772
|
+
* next to the database it protects (the default file). The page warns.
|
|
15773
|
+
*/
|
|
15774
|
+
sharesBackupWithDatabase: boolean()
|
|
15775
|
+
});
|
|
15776
|
+
/**
|
|
15777
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15778
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15779
|
+
*/
|
|
15780
|
+
var KeychainResetRecordSchema = object({
|
|
15781
|
+
id: string(),
|
|
15782
|
+
at: number(),
|
|
15783
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15784
|
+
actor: string(),
|
|
15785
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15786
|
+
lockedReason: string().nullable(),
|
|
15787
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15788
|
+
archived: number().int(),
|
|
15789
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15790
|
+
archivedCollection: string().nullable(),
|
|
15791
|
+
/**
|
|
15792
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15793
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15794
|
+
*/
|
|
15795
|
+
archivedKeysCollection: string().nullable(),
|
|
15796
|
+
/**
|
|
15797
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15798
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15799
|
+
* agent forever (D797).
|
|
15800
|
+
*/
|
|
15801
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15802
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15803
|
+
acknowledgedAt: number().nullable()
|
|
15804
|
+
});
|
|
15805
|
+
var KeychainStatusSchema = object({
|
|
15806
|
+
keychain: KeychainStateSchema,
|
|
15807
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15808
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15809
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15810
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15811
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15812
|
+
fingerprint: string().nullable(),
|
|
15813
|
+
activeKeyId: string().nullable(),
|
|
15814
|
+
/**
|
|
15815
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15816
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15817
|
+
*/
|
|
15818
|
+
rotationPending: boolean(),
|
|
15819
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15820
|
+
retiredWraps: number().int(),
|
|
15821
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15822
|
+
secretCount: number().int(),
|
|
15823
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15824
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15825
|
+
});
|
|
15826
|
+
/**
|
|
15827
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15828
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15829
|
+
* never reported as an orphan (and never deleted as one).
|
|
15830
|
+
*/
|
|
15831
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15832
|
+
"in-use",
|
|
15833
|
+
"orphan",
|
|
15834
|
+
"unknown"
|
|
15835
|
+
]);
|
|
15836
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15837
|
+
var KeychainAuditActionSchema = _enum([
|
|
15838
|
+
"put",
|
|
15839
|
+
"delete",
|
|
15840
|
+
"reveal",
|
|
15841
|
+
"rotate-master-key",
|
|
15842
|
+
"purge-retired-keys",
|
|
15843
|
+
"download-recovery-key",
|
|
15844
|
+
"delete-orphans",
|
|
15845
|
+
"reset",
|
|
15846
|
+
"acknowledge-reset",
|
|
15847
|
+
"initialize"
|
|
15848
|
+
]);
|
|
15849
|
+
var KeychainAuditEntrySchema = object({
|
|
15850
|
+
id: string(),
|
|
15851
|
+
at: number(),
|
|
15852
|
+
action: KeychainAuditActionSchema,
|
|
15853
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15854
|
+
actor: string(),
|
|
15855
|
+
ref: string().nullable(),
|
|
15856
|
+
detail: string().nullable()
|
|
15857
|
+
});
|
|
15858
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15859
|
+
/**
|
|
15860
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15861
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15862
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15863
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15864
|
+
*/
|
|
15865
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15866
|
+
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({
|
|
15867
|
+
value: string(),
|
|
15868
|
+
version: number().int()
|
|
15869
|
+
}), {
|
|
15870
|
+
kind: "mutation",
|
|
15871
|
+
auth: "admin",
|
|
15872
|
+
caller: "required"
|
|
15873
|
+
}), method(object({
|
|
15874
|
+
name: SystemHeldSecretNameSchema,
|
|
15875
|
+
value: string().min(16)
|
|
15876
|
+
}), object({
|
|
15877
|
+
ref: string(),
|
|
15878
|
+
version: number().int()
|
|
15879
|
+
}), {
|
|
15880
|
+
kind: "mutation",
|
|
15881
|
+
auth: "admin",
|
|
15882
|
+
caller: "required"
|
|
15883
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15884
|
+
deleted: array(string()).readonly(),
|
|
15885
|
+
kept: array(object({
|
|
15886
|
+
ref: string(),
|
|
15887
|
+
usage: KeychainSecretUsageSchema
|
|
15888
|
+
})).readonly()
|
|
15889
|
+
}), {
|
|
15890
|
+
kind: "mutation",
|
|
15891
|
+
auth: "admin",
|
|
15892
|
+
caller: "required"
|
|
15893
|
+
}), method(object({}), object({
|
|
15894
|
+
fingerprint: string(),
|
|
15895
|
+
keySource: KeychainKeySourceSchema
|
|
15896
|
+
}), {
|
|
15897
|
+
kind: "mutation",
|
|
15898
|
+
auth: "admin",
|
|
15899
|
+
caller: "required"
|
|
15900
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15901
|
+
kind: "mutation",
|
|
15902
|
+
auth: "admin",
|
|
15903
|
+
caller: "required"
|
|
15904
|
+
}), method(object({}), object({
|
|
15905
|
+
key: string(),
|
|
15906
|
+
fingerprint: string(),
|
|
15907
|
+
keySource: KeychainKeySourceSchema
|
|
15908
|
+
}), {
|
|
15909
|
+
kind: "mutation",
|
|
15910
|
+
auth: "admin",
|
|
15911
|
+
caller: "required"
|
|
15912
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15913
|
+
archivedCollection: string().nullable(),
|
|
15914
|
+
archived: number().int()
|
|
15915
|
+
}), {
|
|
15916
|
+
kind: "mutation",
|
|
15917
|
+
auth: "admin",
|
|
15918
|
+
caller: "required"
|
|
15919
|
+
}), method(object({}), object({
|
|
15920
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15921
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15922
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15923
|
+
kind: "mutation",
|
|
15924
|
+
auth: "admin",
|
|
15925
|
+
caller: "required"
|
|
15926
|
+
});
|
|
14136
15927
|
method(_void(), object({
|
|
14137
15928
|
id: string(),
|
|
14138
15929
|
name: string(),
|
|
@@ -15488,7 +17279,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15488
17279
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15489
17280
|
var DevicePersistConfigPayloadSchema = object({
|
|
15490
17281
|
deviceId: number(),
|
|
15491
|
-
data: record(string(), unknown())
|
|
17282
|
+
data: record(string(), unknown()),
|
|
17283
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17284
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17285
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17286
|
+
secretConfigPaths: array(string()).optional()
|
|
15492
17287
|
});
|
|
15493
17288
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15494
17289
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17091,7 +18886,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17091
18886
|
* `login-method` — collection cap through which auth addons contribute
|
|
17092
18887
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17093
18888
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17094
|
-
* every auth addon (OIDC,
|
|
18889
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17095
18890
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17096
18891
|
* procedure aggregates them for the unauthenticated login page.
|
|
17097
18892
|
*
|
|
@@ -17099,8 +18894,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17099
18894
|
*
|
|
17100
18895
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17101
18896
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17102
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17103
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18897
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17104
18898
|
* login page needs NO change.
|
|
17105
18899
|
*
|
|
17106
18900
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17119,8 +18913,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17119
18913
|
* decision.
|
|
17120
18914
|
*
|
|
17121
18915
|
* Every contribution carries a `stage`:
|
|
17122
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17123
|
-
*
|
|
18916
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18917
|
+
* buttons; a usernameless passkey).
|
|
17124
18918
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17125
18919
|
* returned `factors` (passkey-as-2FA today).
|
|
17126
18920
|
*
|
|
@@ -17147,7 +18941,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17147
18941
|
* The provider names an external identity a signed-in user can link to
|
|
17148
18942
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17149
18943
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17150
|
-
* whatever their id. Absent / false — a login button only
|
|
18944
|
+
* whatever their id. Absent / false — a login button only.
|
|
17151
18945
|
*/
|
|
17152
18946
|
linkable: boolean().optional()
|
|
17153
18947
|
}),
|
|
@@ -21002,8 +22796,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21002
22796
|
* `super_admin` — collapsed onto the single boolean because every
|
|
21003
22797
|
* non-admin caller is governed by the same scope-check rules; the
|
|
21004
22798
|
* distinction was only ever used to route role-specific procedures
|
|
21005
|
-
* which we no longer have.
|
|
21006
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22799
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
21007
22800
|
* with `isAdmin: false` + an explicit scope list.
|
|
21008
22801
|
*/
|
|
21009
22802
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22505,8 +24298,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22505
24298
|
]);
|
|
22506
24299
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22507
24300
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22508
|
-
/**
|
|
22509
|
-
|
|
24301
|
+
/**
|
|
24302
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24303
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24304
|
+
*
|
|
24305
|
+
* - `operator` — drawn by hand.
|
|
24306
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24307
|
+
* model, or a larger teacher model).
|
|
24308
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24309
|
+
* back from the track store (never a re-run).
|
|
24310
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24311
|
+
*/
|
|
24312
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24313
|
+
"operator",
|
|
24314
|
+
"assist",
|
|
24315
|
+
"pipeline",
|
|
24316
|
+
"llm"
|
|
24317
|
+
]);
|
|
22510
24318
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22511
24319
|
var RetrainBboxSchema = object({
|
|
22512
24320
|
x: number(),
|
|
@@ -22524,7 +24332,8 @@ var RetrainBboxSchema = object({
|
|
|
22524
24332
|
*/
|
|
22525
24333
|
var RetrainAnnotationSchema = object({
|
|
22526
24334
|
id: string(),
|
|
22527
|
-
|
|
24335
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24336
|
+
trackId: string().optional(),
|
|
22528
24337
|
deviceId: number(),
|
|
22529
24338
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22530
24339
|
mediaKey: string(),
|
|
@@ -22573,13 +24382,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22573
24382
|
* fail, whatever became of the original. */
|
|
22574
24383
|
copied: boolean()
|
|
22575
24384
|
});
|
|
24385
|
+
/**
|
|
24386
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24387
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24388
|
+
* box recorded on the source media row when there is one, else the track
|
|
24389
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24390
|
+
* until the operator confirms it.
|
|
24391
|
+
*/
|
|
24392
|
+
var RetrainPipelineBoxSchema = object({
|
|
24393
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24394
|
+
bbox: RetrainBboxSchema,
|
|
24395
|
+
macroClass: RetrainMacroClassSchema,
|
|
24396
|
+
label: string().optional(),
|
|
24397
|
+
subLabel: string().optional(),
|
|
24398
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24399
|
+
score: number().optional(),
|
|
24400
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24401
|
+
modelId: string().optional(),
|
|
24402
|
+
trackId: string(),
|
|
24403
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24404
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24405
|
+
basis: _enum(["subject-box", "position"]),
|
|
24406
|
+
deltaMs: number()
|
|
24407
|
+
});
|
|
24408
|
+
/**
|
|
24409
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24410
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24411
|
+
* track at all.
|
|
24412
|
+
*/
|
|
24413
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22576
24414
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22577
24415
|
var RetrainFrameSchema = object({
|
|
22578
24416
|
frameId: string(),
|
|
22579
24417
|
deviceId: number(),
|
|
22580
|
-
|
|
22581
|
-
/**
|
|
22582
|
-
|
|
24418
|
+
origin: RetrainFrameOriginSchema,
|
|
24419
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24420
|
+
trackId: string().optional(),
|
|
24421
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24422
|
+
* Absent on a recording still. */
|
|
24423
|
+
sourceMediaId: number().int().optional(),
|
|
24424
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24425
|
+
epochMs: number().optional(),
|
|
22583
24426
|
sourceKind: MediaFileKindEnum,
|
|
22584
24427
|
sizeBytes: number().int(),
|
|
22585
24428
|
width: number().int(),
|
|
@@ -22590,7 +24433,12 @@ var RetrainFrameSchema = object({
|
|
|
22590
24433
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22591
24434
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22592
24435
|
* a false positive. */
|
|
22593
|
-
complete: boolean()
|
|
24436
|
+
complete: boolean(),
|
|
24437
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24438
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24439
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24440
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24441
|
+
collectionIds: array(string()).readonly().optional()
|
|
22594
24442
|
});
|
|
22595
24443
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22596
24444
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22621,6 +24469,11 @@ var RetrainFrameListSchema = object({
|
|
|
22621
24469
|
var RetrainExportFilterSchema = object({
|
|
22622
24470
|
deviceIds: array(number()).optional(),
|
|
22623
24471
|
frameIds: array(string()).max(2e4).optional(),
|
|
24472
|
+
/** Only frames in at least one of these named collections. */
|
|
24473
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24474
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24475
|
+
* unknown id selects nothing. */
|
|
24476
|
+
datasetVersionId: string().optional(),
|
|
22624
24477
|
batchId: string().optional(),
|
|
22625
24478
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22626
24479
|
completeOnly: boolean().optional()
|
|
@@ -22685,6 +24538,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22685
24538
|
reason: string(),
|
|
22686
24539
|
detail: string().optional()
|
|
22687
24540
|
})]);
|
|
24541
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24542
|
+
var RetrainCollectionSchema = object({
|
|
24543
|
+
id: string(),
|
|
24544
|
+
name: string(),
|
|
24545
|
+
createdAt: number(),
|
|
24546
|
+
frameCount: number().int()
|
|
24547
|
+
});
|
|
24548
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24549
|
+
kind: literal("created"),
|
|
24550
|
+
collection: RetrainCollectionSchema
|
|
24551
|
+
}), object({
|
|
24552
|
+
kind: literal("refused"),
|
|
24553
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24554
|
+
})]);
|
|
24555
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24556
|
+
kind: literal("renamed"),
|
|
24557
|
+
collection: RetrainCollectionSchema
|
|
24558
|
+
}), object({
|
|
24559
|
+
kind: literal("refused"),
|
|
24560
|
+
reason: _enum([
|
|
24561
|
+
"empty-name",
|
|
24562
|
+
"duplicate-name",
|
|
24563
|
+
"unknown-collection"
|
|
24564
|
+
])
|
|
24565
|
+
})]);
|
|
24566
|
+
/**
|
|
24567
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24568
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24569
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24570
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24571
|
+
*/
|
|
24572
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24573
|
+
kind: literal("added"),
|
|
24574
|
+
collectionId: string(),
|
|
24575
|
+
frame: RetrainFrameSchema,
|
|
24576
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24577
|
+
reused: boolean()
|
|
24578
|
+
}), object({
|
|
24579
|
+
kind: literal("refused"),
|
|
24580
|
+
reason: _enum([
|
|
24581
|
+
"unknown-collection",
|
|
24582
|
+
"still-unavailable",
|
|
24583
|
+
"still-busy",
|
|
24584
|
+
"unreadable-image",
|
|
24585
|
+
"write-failed"
|
|
24586
|
+
]),
|
|
24587
|
+
detail: string().optional()
|
|
24588
|
+
})]);
|
|
24589
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24590
|
+
var RetrainAssistProfileSchema = object({
|
|
24591
|
+
id: string(),
|
|
24592
|
+
name: string(),
|
|
24593
|
+
model: string(),
|
|
24594
|
+
kind: string(),
|
|
24595
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24596
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24597
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24598
|
+
leavesHouse: boolean()
|
|
24599
|
+
});
|
|
24600
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24601
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24602
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24603
|
+
var RetrainLlmReviewSchema = object({
|
|
24604
|
+
/** The `ref` the page sent the box under. */
|
|
24605
|
+
ref: string(),
|
|
24606
|
+
verdict: _enum([
|
|
24607
|
+
"confirmed",
|
|
24608
|
+
"wrong-class",
|
|
24609
|
+
"not-an-object",
|
|
24610
|
+
"uncertain"
|
|
24611
|
+
]),
|
|
24612
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24613
|
+
reason: string()
|
|
24614
|
+
});
|
|
24615
|
+
/**
|
|
24616
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24617
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24618
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24619
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24620
|
+
*/
|
|
24621
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24622
|
+
kind: literal("proposed"),
|
|
24623
|
+
profileId: string(),
|
|
24624
|
+
model: string(),
|
|
24625
|
+
/** The frame was sent outside the house for this answer. */
|
|
24626
|
+
leftHouse: boolean(),
|
|
24627
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24628
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24629
|
+
rejected: number().int()
|
|
24630
|
+
}), object({
|
|
24631
|
+
kind: literal("refused"),
|
|
24632
|
+
reason: _enum([
|
|
24633
|
+
"unknown-frame",
|
|
24634
|
+
"unreadable-frame",
|
|
24635
|
+
"unknown-profile",
|
|
24636
|
+
"profile-disabled",
|
|
24637
|
+
"no-vision",
|
|
24638
|
+
"cloud-not-confirmed",
|
|
24639
|
+
"llm-error",
|
|
24640
|
+
"malformed-answer"
|
|
24641
|
+
]),
|
|
24642
|
+
detail: string().optional()
|
|
24643
|
+
})]);
|
|
24644
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24645
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24646
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24647
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24648
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24649
|
+
});
|
|
24650
|
+
/** The counts a dataset is judged by. */
|
|
24651
|
+
var RetrainDatasetStatsSchema = object({
|
|
24652
|
+
frames: number().int(),
|
|
24653
|
+
completeFrames: number().int(),
|
|
24654
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24655
|
+
completeness: number(),
|
|
24656
|
+
/** Boxes to learn (model errors excluded). */
|
|
24657
|
+
subjects: number().int(),
|
|
24658
|
+
modelErrors: number().int(),
|
|
24659
|
+
/** Complete frames with no subject. */
|
|
24660
|
+
hardNegatives: number().int(),
|
|
24661
|
+
/** Subjects per class × camera × day/night. */
|
|
24662
|
+
cells: array(object({
|
|
24663
|
+
macroClass: string(),
|
|
24664
|
+
deviceId: number(),
|
|
24665
|
+
lighting: _enum([
|
|
24666
|
+
"day",
|
|
24667
|
+
"night",
|
|
24668
|
+
"unknown"
|
|
24669
|
+
]),
|
|
24670
|
+
subjects: number().int(),
|
|
24671
|
+
frames: number().int()
|
|
24672
|
+
})).readonly(),
|
|
24673
|
+
cameras: array(object({
|
|
24674
|
+
deviceId: number(),
|
|
24675
|
+
frames: number().int(),
|
|
24676
|
+
completeFrames: number().int()
|
|
24677
|
+
})).readonly()
|
|
24678
|
+
});
|
|
24679
|
+
/** An immutable dataset version, without its frame list. */
|
|
24680
|
+
var RetrainDatasetVersionSchema = object({
|
|
24681
|
+
id: string(),
|
|
24682
|
+
name: string(),
|
|
24683
|
+
createdAt: number(),
|
|
24684
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24685
|
+
layout: RetrainExportLayoutSchema,
|
|
24686
|
+
completeOnly: boolean(),
|
|
24687
|
+
frameCount: number().int(),
|
|
24688
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24689
|
+
annotationHash: string(),
|
|
24690
|
+
/** The export manifest schema the version was cut under. */
|
|
24691
|
+
manifestSchema: string(),
|
|
24692
|
+
stats: RetrainDatasetStatsSchema
|
|
24693
|
+
});
|
|
24694
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24695
|
+
kind: literal("created"),
|
|
24696
|
+
version: RetrainDatasetVersionSchema
|
|
24697
|
+
}), object({
|
|
24698
|
+
kind: literal("refused"),
|
|
24699
|
+
reason: _enum([
|
|
24700
|
+
"empty-name",
|
|
24701
|
+
"duplicate-name",
|
|
24702
|
+
"no-frames"
|
|
24703
|
+
])
|
|
24704
|
+
})]);
|
|
22688
24705
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22689
24706
|
var RetrainTransitionResultSchema = object({
|
|
22690
24707
|
trackId: string(),
|
|
@@ -23402,7 +25419,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23402
25419
|
auth: "admin"
|
|
23403
25420
|
}), method(object({
|
|
23404
25421
|
deviceId: number(),
|
|
23405
|
-
trackId: string(),
|
|
25422
|
+
trackId: string().optional(),
|
|
23406
25423
|
frameId: string()
|
|
23407
25424
|
}), object({
|
|
23408
25425
|
removed: boolean(),
|
|
@@ -23419,7 +25436,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23419
25436
|
auth: "admin"
|
|
23420
25437
|
}), method(object({
|
|
23421
25438
|
deviceId: number(),
|
|
23422
|
-
|
|
25439
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25440
|
+
trackId: string().optional(),
|
|
23423
25441
|
frameId: string(),
|
|
23424
25442
|
subject: RetrainAssistSubjectSchema,
|
|
23425
25443
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23427,12 +25445,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23427
25445
|
}), RetrainAssistResultSchema, {
|
|
23428
25446
|
kind: "mutation",
|
|
23429
25447
|
auth: "admin"
|
|
23430
|
-
}), method(object({
|
|
25448
|
+
}), method(object({
|
|
25449
|
+
trackId: string().optional(),
|
|
25450
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25451
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23431
25452
|
kind: "query",
|
|
23432
25453
|
auth: "admin"
|
|
23433
25454
|
}), method(object({
|
|
23434
25455
|
deviceId: number(),
|
|
23435
|
-
|
|
25456
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25457
|
+
trackId: string().optional(),
|
|
23436
25458
|
frameId: string(),
|
|
23437
25459
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23438
25460
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23455,7 +25477,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23455
25477
|
auth: "admin"
|
|
23456
25478
|
}), method(object({
|
|
23457
25479
|
deviceId: number(),
|
|
23458
|
-
trackId: string(),
|
|
25480
|
+
trackId: string().optional(),
|
|
23459
25481
|
frameId: string(),
|
|
23460
25482
|
complete: boolean()
|
|
23461
25483
|
}), RetrainFrameSchema, {
|
|
@@ -23469,6 +25491,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23469
25491
|
kind: "mutation",
|
|
23470
25492
|
auth: "admin",
|
|
23471
25493
|
timeoutMs: 60 * 6e4
|
|
25494
|
+
}), method(object({
|
|
25495
|
+
filter: RetrainExportFilterSchema,
|
|
25496
|
+
layout: RetrainExportLayoutSchema
|
|
25497
|
+
}), object({
|
|
25498
|
+
ticket: PeerBytesTicketSchema,
|
|
25499
|
+
frames: number().int(),
|
|
25500
|
+
annotations: number().int()
|
|
25501
|
+
}), {
|
|
25502
|
+
kind: "mutation",
|
|
25503
|
+
auth: "admin",
|
|
25504
|
+
timeoutMs: 12e4
|
|
25505
|
+
}), method(object({
|
|
25506
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25507
|
+
completeOnly: boolean().optional()
|
|
25508
|
+
}), RetrainDatasetStatsSchema, {
|
|
25509
|
+
kind: "query",
|
|
25510
|
+
auth: "admin"
|
|
25511
|
+
}), method(object({
|
|
25512
|
+
name: string().max(120),
|
|
25513
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25514
|
+
layout: RetrainExportLayoutSchema,
|
|
25515
|
+
completeOnly: boolean()
|
|
25516
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25517
|
+
kind: "mutation",
|
|
25518
|
+
auth: "admin",
|
|
25519
|
+
timeoutMs: 12e4
|
|
25520
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25521
|
+
kind: "query",
|
|
25522
|
+
auth: "admin"
|
|
25523
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25524
|
+
kind: "mutation",
|
|
25525
|
+
auth: "admin"
|
|
25526
|
+
}), method(object({ id: string() }), object({
|
|
25527
|
+
found: boolean(),
|
|
25528
|
+
annotationHash: string(),
|
|
25529
|
+
matches: boolean(),
|
|
25530
|
+
missingFrames: number().int()
|
|
25531
|
+
}), {
|
|
25532
|
+
kind: "query",
|
|
25533
|
+
auth: "admin",
|
|
25534
|
+
timeoutMs: 12e4
|
|
25535
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25536
|
+
kind: "query",
|
|
25537
|
+
auth: "admin"
|
|
25538
|
+
}), method(object({
|
|
25539
|
+
deviceId: number(),
|
|
25540
|
+
trackId: string().optional(),
|
|
25541
|
+
frameId: string(),
|
|
25542
|
+
profileId: string(),
|
|
25543
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25544
|
+
boxes: array(object({
|
|
25545
|
+
ref: string(),
|
|
25546
|
+
bbox: RetrainBboxSchema,
|
|
25547
|
+
macroClass: RetrainMacroClassSchema,
|
|
25548
|
+
label: string().optional()
|
|
25549
|
+
})).max(50),
|
|
25550
|
+
allowCloud: boolean()
|
|
25551
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25552
|
+
kind: "mutation",
|
|
25553
|
+
auth: "admin",
|
|
25554
|
+
timeoutMs: 18e4
|
|
25555
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25556
|
+
kind: "mutation",
|
|
25557
|
+
auth: "admin"
|
|
25558
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25559
|
+
kind: "query",
|
|
25560
|
+
auth: "admin"
|
|
25561
|
+
}), method(object({
|
|
25562
|
+
id: string(),
|
|
25563
|
+
name: string().max(120)
|
|
25564
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25565
|
+
kind: "mutation",
|
|
25566
|
+
auth: "admin"
|
|
25567
|
+
}), method(object({ id: string() }), object({
|
|
25568
|
+
deleted: boolean(),
|
|
25569
|
+
removedFrames: number().int()
|
|
25570
|
+
}), {
|
|
25571
|
+
kind: "mutation",
|
|
25572
|
+
auth: "admin"
|
|
25573
|
+
}), method(object({
|
|
25574
|
+
collectionId: string(),
|
|
25575
|
+
deviceId: number(),
|
|
25576
|
+
epochMs: number()
|
|
25577
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25578
|
+
kind: "mutation",
|
|
25579
|
+
auth: "admin",
|
|
25580
|
+
timeoutMs: 6e4
|
|
25581
|
+
}), method(object({
|
|
25582
|
+
collectionId: string(),
|
|
25583
|
+
frameIds: array(string()).min(1).max(500)
|
|
25584
|
+
}), object({
|
|
25585
|
+
added: number().int(),
|
|
25586
|
+
alreadyMember: number().int(),
|
|
25587
|
+
unknownFrameIds: array(string()).readonly()
|
|
25588
|
+
}), {
|
|
25589
|
+
kind: "mutation",
|
|
25590
|
+
auth: "admin"
|
|
25591
|
+
}), method(object({
|
|
25592
|
+
collectionId: string(),
|
|
25593
|
+
frameId: string()
|
|
25594
|
+
}), object({
|
|
25595
|
+
removed: boolean(),
|
|
25596
|
+
deletedFrame: boolean()
|
|
25597
|
+
}), {
|
|
25598
|
+
kind: "mutation",
|
|
25599
|
+
auth: "admin"
|
|
25600
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25601
|
+
kind: "query",
|
|
25602
|
+
auth: "admin"
|
|
23472
25603
|
}), method(object({
|
|
23473
25604
|
/** Which of the three event tables owns the row. */
|
|
23474
25605
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24092,13 +26223,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24092
26223
|
object({
|
|
24093
26224
|
kind: literal("no-family-build"),
|
|
24094
26225
|
format: ModelFormatSchema$1
|
|
26226
|
+
}),
|
|
26227
|
+
object({
|
|
26228
|
+
kind: literal("kept-custom-pin"),
|
|
26229
|
+
modelId: string(),
|
|
26230
|
+
deviceKey: string()
|
|
24095
26231
|
})
|
|
24096
26232
|
]);
|
|
26233
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26234
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26235
|
+
/**
|
|
26236
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26237
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26238
|
+
*/
|
|
26239
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26240
|
+
kind: literal("node-benchmark"),
|
|
26241
|
+
resultId: string(),
|
|
26242
|
+
measuredAtMs: number()
|
|
26243
|
+
})]);
|
|
24097
26244
|
var DeviceModelChoiceSchema = object({
|
|
24098
26245
|
modelId: string(),
|
|
24099
26246
|
p50Ms: number(),
|
|
24100
26247
|
fps: number(),
|
|
24101
26248
|
measured: boolean(),
|
|
26249
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26250
|
+
source: LatencySourceSchema.optional(),
|
|
24102
26251
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24103
26252
|
capacitySessions: number(),
|
|
24104
26253
|
personRecall: number()
|
|
@@ -24109,6 +26258,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24109
26258
|
enabled: boolean(),
|
|
24110
26259
|
available: boolean(),
|
|
24111
26260
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26261
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26262
|
+
kept: KeptReasonSchema.optional(),
|
|
24112
26263
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24113
26264
|
});
|
|
24114
26265
|
var NodeRecommendationSchema = object({
|
|
@@ -24162,6 +26313,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24162
26313
|
kind: literal("coral-enabled"),
|
|
24163
26314
|
nodeId: string(),
|
|
24164
26315
|
deviceKey: string()
|
|
26316
|
+
}),
|
|
26317
|
+
object({
|
|
26318
|
+
kind: literal("custom-pin-kept"),
|
|
26319
|
+
nodeId: string(),
|
|
26320
|
+
deviceKey: string().nullable(),
|
|
26321
|
+
deviceId: number().nullable(),
|
|
26322
|
+
modelId: string()
|
|
26323
|
+
}),
|
|
26324
|
+
object({
|
|
26325
|
+
kind: literal("custom-registry-unreadable"),
|
|
26326
|
+
error: string()
|
|
24165
26327
|
})
|
|
24166
26328
|
]);
|
|
24167
26329
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24340,13 +26502,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24340
26502
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24341
26503
|
});
|
|
24342
26504
|
/**
|
|
24343
|
-
* Where the node and device shares come from (D750, D755).
|
|
24344
|
-
* - `
|
|
24345
|
-
*
|
|
24346
|
-
*
|
|
24347
|
-
*
|
|
24348
|
-
*
|
|
24349
|
-
*
|
|
26505
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26506
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26507
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26508
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26509
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26510
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26511
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26512
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24350
26513
|
* - `manual` — the operator's stored sliders.
|
|
24351
26514
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24352
26515
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24395,6 +26558,362 @@ var EffectiveSharesSchema = object({
|
|
|
24395
26558
|
nodeWeights: record(string(), number()),
|
|
24396
26559
|
deviceWeights: record(string(), record(string(), number()))
|
|
24397
26560
|
});
|
|
26561
|
+
/**
|
|
26562
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26563
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26564
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26565
|
+
* shares read.
|
|
26566
|
+
*
|
|
26567
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26568
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26569
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26570
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26571
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26572
|
+
*
|
|
26573
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26574
|
+
* cross a process at frame rate, D9):
|
|
26575
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26576
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26577
|
+
* interval;
|
|
26578
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26579
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26580
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26581
|
+
* CPU, RAM or the event loop give out.
|
|
26582
|
+
*/
|
|
26583
|
+
/** Defaults and bounds, one place. */
|
|
26584
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26585
|
+
fpsPerStream: 10,
|
|
26586
|
+
budgetMinutes: 45,
|
|
26587
|
+
minBudgetMinutes: 10,
|
|
26588
|
+
maxBudgetMinutes: 120,
|
|
26589
|
+
/** A result older than this no longer beats the table. */
|
|
26590
|
+
staleAfterDays: 30,
|
|
26591
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26592
|
+
settleSec: 5,
|
|
26593
|
+
/** Accounted window per ramp step. */
|
|
26594
|
+
measureSec: 20,
|
|
26595
|
+
/** Longest the drain may take before the run is refused. */
|
|
26596
|
+
drainTimeoutSec: 120,
|
|
26597
|
+
/** Candidate models per device in one run. */
|
|
26598
|
+
maxModelsPerDevice: 6
|
|
26599
|
+
};
|
|
26600
|
+
/** The two measurements a run can make. */
|
|
26601
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26602
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26603
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26604
|
+
deviceKey: string().min(1),
|
|
26605
|
+
/**
|
|
26606
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26607
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26608
|
+
*/
|
|
26609
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26610
|
+
});
|
|
26611
|
+
/** What the operator confirmed. */
|
|
26612
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26613
|
+
nodeId: string().min(1),
|
|
26614
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26615
|
+
/** Which measurements run. At least one. */
|
|
26616
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26617
|
+
/**
|
|
26618
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26619
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26620
|
+
* detector always runs.
|
|
26621
|
+
*/
|
|
26622
|
+
steps: array(string().min(1)).default([]),
|
|
26623
|
+
/** Offered rate of one stream / session. */
|
|
26624
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26625
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26626
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26627
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26628
|
+
keepDownloadedModels: boolean().default(false),
|
|
26629
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26630
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26631
|
+
});
|
|
26632
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26633
|
+
kind: _enum([
|
|
26634
|
+
"benchmark-active",
|
|
26635
|
+
"node-offline",
|
|
26636
|
+
"unknown-device",
|
|
26637
|
+
"no-phase",
|
|
26638
|
+
"insufficient-headroom"
|
|
26639
|
+
]),
|
|
26640
|
+
detail: string(),
|
|
26641
|
+
overridable: boolean()
|
|
26642
|
+
});
|
|
26643
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26644
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26645
|
+
deviceId: number(),
|
|
26646
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26647
|
+
placedOnNode: boolean(),
|
|
26648
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26649
|
+
pinnedToNode: boolean()
|
|
26650
|
+
});
|
|
26651
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26652
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26653
|
+
deviceId: number(),
|
|
26654
|
+
reason: literal("only-frame-source")
|
|
26655
|
+
});
|
|
26656
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26657
|
+
nodeId: string(),
|
|
26658
|
+
online: boolean(),
|
|
26659
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26660
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26661
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26662
|
+
estimatedDurationMs: number(),
|
|
26663
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26664
|
+
budgetMs: number(),
|
|
26665
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26666
|
+
steps: array(string()).readonly(),
|
|
26667
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26668
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26669
|
+
headroom: object({
|
|
26670
|
+
sessionsNow: number(),
|
|
26671
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26672
|
+
}),
|
|
26673
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26674
|
+
canStart: boolean()
|
|
26675
|
+
});
|
|
26676
|
+
/** Where the measuring runner is. */
|
|
26677
|
+
var NodeBenchProgressSchema = object({
|
|
26678
|
+
phase: _enum([
|
|
26679
|
+
"preparing",
|
|
26680
|
+
"device",
|
|
26681
|
+
"pipeline",
|
|
26682
|
+
"cleanup"
|
|
26683
|
+
]),
|
|
26684
|
+
deviceKey: string().nullable(),
|
|
26685
|
+
modelId: string().nullable(),
|
|
26686
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26687
|
+
load: number().nullable(),
|
|
26688
|
+
cellsDone: number(),
|
|
26689
|
+
cellsTotal: number(),
|
|
26690
|
+
message: string()
|
|
26691
|
+
});
|
|
26692
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26693
|
+
var NodeBenchLimitSchema = _enum([
|
|
26694
|
+
"p95",
|
|
26695
|
+
"drops",
|
|
26696
|
+
"errors",
|
|
26697
|
+
"stall",
|
|
26698
|
+
"cpu",
|
|
26699
|
+
"ram",
|
|
26700
|
+
"none"
|
|
26701
|
+
]);
|
|
26702
|
+
var NodeBenchRampStepSchema = object({
|
|
26703
|
+
load: number(),
|
|
26704
|
+
pass: boolean(),
|
|
26705
|
+
p95Ms: number(),
|
|
26706
|
+
dropRatio: number(),
|
|
26707
|
+
/** Completed frames per second over the accounted window. */
|
|
26708
|
+
fps: number(),
|
|
26709
|
+
cpuPct: number().nullable(),
|
|
26710
|
+
ramFreePct: number().nullable(),
|
|
26711
|
+
failReasons: array(string()).readonly()
|
|
26712
|
+
});
|
|
26713
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26714
|
+
phase: literal("device"),
|
|
26715
|
+
deviceKey: string(),
|
|
26716
|
+
modelId: string(),
|
|
26717
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26718
|
+
p50Ms: number(),
|
|
26719
|
+
p95Ms: number(),
|
|
26720
|
+
p99Ms: number(),
|
|
26721
|
+
/** Frames per second sustained at the last passing step. */
|
|
26722
|
+
fps: number(),
|
|
26723
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26724
|
+
kMax: number(),
|
|
26725
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26726
|
+
/** First call (model load + warm-up). */
|
|
26727
|
+
warmupMs: number(),
|
|
26728
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26729
|
+
}), object({
|
|
26730
|
+
phase: literal("pipeline"),
|
|
26731
|
+
deviceKey: string(),
|
|
26732
|
+
modelId: string(),
|
|
26733
|
+
steps: array(string()).readonly(),
|
|
26734
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26735
|
+
maxSessions: number(),
|
|
26736
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26737
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26738
|
+
stepsFired: array(string()).readonly(),
|
|
26739
|
+
warmupMs: number(),
|
|
26740
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26741
|
+
})]);
|
|
26742
|
+
/**
|
|
26743
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26744
|
+
* the node no longer beats the table.
|
|
26745
|
+
*/
|
|
26746
|
+
var NodeBenchFingerprintSchema = object({
|
|
26747
|
+
pipelineVersion: string().nullable(),
|
|
26748
|
+
cpuModel: string().nullable(),
|
|
26749
|
+
ramGb: number().nullable(),
|
|
26750
|
+
os: string().nullable(),
|
|
26751
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26752
|
+
pools: record(string(), object({
|
|
26753
|
+
runtime: string(),
|
|
26754
|
+
numWorkers: number(),
|
|
26755
|
+
concurrency: number(),
|
|
26756
|
+
batchMode: string()
|
|
26757
|
+
})).default({})
|
|
26758
|
+
});
|
|
26759
|
+
/** The frames the run used. */
|
|
26760
|
+
var NodeBenchClipSchema = object({
|
|
26761
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26762
|
+
id: string(),
|
|
26763
|
+
revision: string().nullable(),
|
|
26764
|
+
frames: number(),
|
|
26765
|
+
width: number(),
|
|
26766
|
+
height: number()
|
|
26767
|
+
});
|
|
26768
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26769
|
+
runId: string().min(1),
|
|
26770
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26771
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26772
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26773
|
+
steps: array(string()).default([]),
|
|
26774
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26775
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26776
|
+
deadlineAtMs: number(),
|
|
26777
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26778
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26779
|
+
keepDownloadedModels: boolean().default(false)
|
|
26780
|
+
});
|
|
26781
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26782
|
+
"running",
|
|
26783
|
+
"done",
|
|
26784
|
+
"failed",
|
|
26785
|
+
"aborted"
|
|
26786
|
+
]);
|
|
26787
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26788
|
+
runId: string(),
|
|
26789
|
+
nodeId: string(),
|
|
26790
|
+
state: NodeBenchRunnerStateSchema,
|
|
26791
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26792
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26793
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26794
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26795
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26796
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26797
|
+
activeCameraIds: array(number()).readonly(),
|
|
26798
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26799
|
+
deletedModels: array(string()).readonly(),
|
|
26800
|
+
error: string().nullable(),
|
|
26801
|
+
startedAtMs: number(),
|
|
26802
|
+
finishedAtMs: number().nullable()
|
|
26803
|
+
});
|
|
26804
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26805
|
+
"draining",
|
|
26806
|
+
"measuring",
|
|
26807
|
+
"restoring",
|
|
26808
|
+
"done",
|
|
26809
|
+
"failed",
|
|
26810
|
+
"aborted"
|
|
26811
|
+
]);
|
|
26812
|
+
/** Why a run ended. */
|
|
26813
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26814
|
+
"completed",
|
|
26815
|
+
"operator-abort",
|
|
26816
|
+
"deadline",
|
|
26817
|
+
"node-lost",
|
|
26818
|
+
"runner-lost",
|
|
26819
|
+
"hub-restart",
|
|
26820
|
+
"drain-timeout",
|
|
26821
|
+
"failed"
|
|
26822
|
+
]);
|
|
26823
|
+
var NodeBenchmarkRunSchema = object({
|
|
26824
|
+
runId: string(),
|
|
26825
|
+
nodeId: string(),
|
|
26826
|
+
state: NodeBenchmarkStateSchema,
|
|
26827
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26828
|
+
startedAtMs: number(),
|
|
26829
|
+
deadlineAtMs: number(),
|
|
26830
|
+
finishedAtMs: number().nullable(),
|
|
26831
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26832
|
+
error: string().nullable(),
|
|
26833
|
+
/** Cameras moved off the node for the run. */
|
|
26834
|
+
moved: array(number()).readonly(),
|
|
26835
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26836
|
+
staying: array(number()).readonly(),
|
|
26837
|
+
/** Something else ran on the node's pools during the run. */
|
|
26838
|
+
contaminated: boolean(),
|
|
26839
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26840
|
+
resultIds: array(string()).readonly()
|
|
26841
|
+
});
|
|
26842
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26843
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26844
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26845
|
+
modeNodeId: string().nullable(),
|
|
26846
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26847
|
+
});
|
|
26848
|
+
/**
|
|
26849
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26850
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26851
|
+
* ends, never by anyone else.
|
|
26852
|
+
*/
|
|
26853
|
+
var NodeBenchmarkResultSchema = object({
|
|
26854
|
+
id: string(),
|
|
26855
|
+
runId: string(),
|
|
26856
|
+
nodeId: string(),
|
|
26857
|
+
cell: NodeBenchCellSchema,
|
|
26858
|
+
fpsPerStream: number(),
|
|
26859
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26860
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26861
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26862
|
+
contaminated: boolean(),
|
|
26863
|
+
stayingCameras: array(number()).readonly(),
|
|
26864
|
+
/** The run ended early; the cell itself completed. */
|
|
26865
|
+
partialRun: boolean(),
|
|
26866
|
+
measuredAtMs: number()
|
|
26867
|
+
});
|
|
26868
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26869
|
+
nodeId: string().optional(),
|
|
26870
|
+
deviceKey: string().optional()
|
|
26871
|
+
});
|
|
26872
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26873
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26874
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26875
|
+
standing: _enum([
|
|
26876
|
+
"fresh",
|
|
26877
|
+
"stale",
|
|
26878
|
+
"superseded"
|
|
26879
|
+
]),
|
|
26880
|
+
staleWhy: _enum([
|
|
26881
|
+
"age",
|
|
26882
|
+
"runtime",
|
|
26883
|
+
"pool-tuning"
|
|
26884
|
+
]).nullable()
|
|
26885
|
+
});
|
|
26886
|
+
object({
|
|
26887
|
+
runId: string(),
|
|
26888
|
+
nodeId: string(),
|
|
26889
|
+
startedAtMs: number(),
|
|
26890
|
+
deadlineAtMs: number(),
|
|
26891
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26892
|
+
moved: array(number()).readonly(),
|
|
26893
|
+
staying: array(number()).readonly()
|
|
26894
|
+
});
|
|
26895
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26896
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26897
|
+
nodeId: string(),
|
|
26898
|
+
reachable: boolean(),
|
|
26899
|
+
devices: array(object({
|
|
26900
|
+
deviceKey: string(),
|
|
26901
|
+
enabled: boolean(),
|
|
26902
|
+
available: boolean(),
|
|
26903
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26904
|
+
suggested: array(string()).readonly(),
|
|
26905
|
+
/** Every root detector the device has a build for. */
|
|
26906
|
+
all: array(string()).readonly(),
|
|
26907
|
+
/** The model the device runs now, when pinned. */
|
|
26908
|
+
currentModelId: string().nullable()
|
|
26909
|
+
})).readonly(),
|
|
26910
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26911
|
+
steps: array(object({
|
|
26912
|
+
id: string(),
|
|
26913
|
+
name: string(),
|
|
26914
|
+
slot: string()
|
|
26915
|
+
})).readonly()
|
|
26916
|
+
});
|
|
24398
26917
|
object({
|
|
24399
26918
|
activeCameras: number(),
|
|
24400
26919
|
throttledCameras: number(),
|
|
@@ -25523,7 +28042,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25523
28042
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25524
28043
|
deviceId: number(),
|
|
25525
28044
|
trackId: string()
|
|
25526
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
28045
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
28046
|
+
accepted: literal(true),
|
|
28047
|
+
runId: string()
|
|
28048
|
+
}), {
|
|
28049
|
+
kind: "mutation",
|
|
28050
|
+
auth: "admin"
|
|
28051
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28052
|
+
kind: "mutation",
|
|
28053
|
+
auth: "admin"
|
|
28054
|
+
});
|
|
25527
28055
|
var CameraPipelineConfigSchema = object({
|
|
25528
28056
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25529
28057
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26162,6 +28690,21 @@ method(object({
|
|
|
26162
28690
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26163
28691
|
kind: "mutation",
|
|
26164
28692
|
auth: "admin"
|
|
28693
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28694
|
+
kind: literal("started"),
|
|
28695
|
+
runId: string()
|
|
28696
|
+
}), object({
|
|
28697
|
+
kind: literal("refused"),
|
|
28698
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28699
|
+
})]), {
|
|
28700
|
+
kind: "mutation",
|
|
28701
|
+
auth: "admin"
|
|
28702
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28703
|
+
kind: "mutation",
|
|
28704
|
+
auth: "admin"
|
|
28705
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28706
|
+
kind: "mutation",
|
|
28707
|
+
auth: "admin"
|
|
26165
28708
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26166
28709
|
deviceId: number(),
|
|
26167
28710
|
addonId: string(),
|
|
@@ -26567,8 +29110,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26567
29110
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26568
29111
|
*
|
|
26569
29112
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26570
|
-
* one for transactional / one for notifications). Consumers (
|
|
26571
|
-
*
|
|
29113
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29114
|
+
* addons, …) walk the collection and pick the first
|
|
26572
29115
|
* ready provider OR target a specific addonId.
|
|
26573
29116
|
*
|
|
26574
29117
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26747,7 +29290,7 @@ targets: array(object({
|
|
|
26747
29290
|
})));
|
|
26748
29291
|
/**
|
|
26749
29292
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26750
|
-
* providers (OIDC, SAML,
|
|
29293
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26751
29294
|
* carrying the post-callback claims before redirecting back to
|
|
26752
29295
|
* `/api/auth/sso/finish`.
|
|
26753
29296
|
*
|
|
@@ -26810,7 +29353,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26810
29353
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26811
29354
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26812
29355
|
*/
|
|
26813
|
-
issuer: string().optional()
|
|
29356
|
+
issuer: string().optional(),
|
|
29357
|
+
/**
|
|
29358
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29359
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29360
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29361
|
+
* any other browser.
|
|
29362
|
+
*/
|
|
29363
|
+
browserBinding: string().optional()
|
|
26814
29364
|
});
|
|
26815
29365
|
method(object({
|
|
26816
29366
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32269,6 +34819,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32269
34819
|
enabled: boolean().optional(),
|
|
32270
34820
|
info: record(string(), unknown()).optional(),
|
|
32271
34821
|
settings: record(string(), unknown()).optional(),
|
|
34822
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34823
|
+
* the keychain, not the table (D787). */
|
|
34824
|
+
secretKeys: array(string()).optional(),
|
|
32272
34825
|
skipRestart: boolean().optional()
|
|
32273
34826
|
});
|
|
32274
34827
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32292,7 +34845,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32292
34845
|
auth: "admin"
|
|
32293
34846
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32294
34847
|
id: string(),
|
|
32295
|
-
settings: record(string(), unknown())
|
|
34848
|
+
settings: record(string(), unknown()),
|
|
34849
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34850
|
+
secretKeys: array(string()).optional()
|
|
32296
34851
|
}), object({ success: boolean() }), {
|
|
32297
34852
|
kind: "mutation",
|
|
32298
34853
|
auth: "admin"
|
|
@@ -39064,16 +41619,6 @@ var ApiKeySummarySchema = object({
|
|
|
39064
41619
|
createdAt: number(),
|
|
39065
41620
|
lastUsedAt: number().optional()
|
|
39066
41621
|
});
|
|
39067
|
-
var CreateApiKeyInputSchema = object({
|
|
39068
|
-
label: string(),
|
|
39069
|
-
isAdmin: boolean().default(false),
|
|
39070
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39071
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39072
|
-
});
|
|
39073
|
-
var CreateApiKeyResultSchema = object({
|
|
39074
|
-
token: string(),
|
|
39075
|
-
record: ApiKeySummarySchema
|
|
39076
|
-
});
|
|
39077
41622
|
var ScopedTokenSummarySchema = object({
|
|
39078
41623
|
id: string(),
|
|
39079
41624
|
userId: string(),
|
|
@@ -39172,17 +41717,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39172
41717
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39173
41718
|
kind: "mutation",
|
|
39174
41719
|
access: "view"
|
|
39175
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39176
|
-
kind: "mutation",
|
|
39177
|
-
auth: "admin",
|
|
39178
|
-
access: "create"
|
|
39179
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41720
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39180
41721
|
kind: "mutation",
|
|
39181
41722
|
auth: "admin",
|
|
39182
41723
|
access: "delete"
|
|
39183
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39184
|
-
kind: "mutation",
|
|
39185
|
-
access: "view"
|
|
39186
41724
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39187
41725
|
kind: "mutation",
|
|
39188
41726
|
auth: "admin",
|
|
@@ -39256,15 +41794,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39256
41794
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39257
41795
|
userId: string(),
|
|
39258
41796
|
issuer: string()
|
|
39259
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39260
|
-
userId: string(),
|
|
39261
|
-
issuer: string().min(1),
|
|
39262
|
-
label: string().optional()
|
|
39263
|
-
}), object({ success: literal(true) }), {
|
|
39264
|
-
kind: "mutation",
|
|
39265
|
-
auth: "admin",
|
|
39266
|
-
access: "create"
|
|
39267
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41797
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39268
41798
|
kind: "mutation",
|
|
39269
41799
|
auth: "admin",
|
|
39270
41800
|
access: "delete"
|
|
@@ -39969,6 +42499,451 @@ var zoneRulesCapability = {
|
|
|
39969
42499
|
*/
|
|
39970
42500
|
durability: "restored"
|
|
39971
42501
|
};
|
|
42502
|
+
/**
|
|
42503
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42504
|
+
*
|
|
42505
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42506
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42507
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42508
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42509
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42510
|
+
* manifest entry and nothing else.
|
|
42511
|
+
*
|
|
42512
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42513
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42514
|
+
* Every method is `admin`: these spend money.
|
|
42515
|
+
*
|
|
42516
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42517
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42518
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42519
|
+
*
|
|
42520
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42521
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42522
|
+
* ticket the provider mints (D613).
|
|
42523
|
+
*/
|
|
42524
|
+
var TrainingGpuOptionSchema = object({
|
|
42525
|
+
id: string(),
|
|
42526
|
+
label: string(),
|
|
42527
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42528
|
+
usdPerHour: number().nonnegative(),
|
|
42529
|
+
vramGb: number().nonnegative()
|
|
42530
|
+
});
|
|
42531
|
+
var TrainingRegionOptionSchema = object({
|
|
42532
|
+
/** `''` = any region (the provider's choice). */
|
|
42533
|
+
id: string(),
|
|
42534
|
+
label: string(),
|
|
42535
|
+
priceMultiplier: number().positive()
|
|
42536
|
+
});
|
|
42537
|
+
/**
|
|
42538
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42539
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42540
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42541
|
+
*/
|
|
42542
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42543
|
+
gpuType: string(),
|
|
42544
|
+
region: string(),
|
|
42545
|
+
costCapUsd: number().nonnegative(),
|
|
42546
|
+
maxRuntimeSec: number().int().positive(),
|
|
42547
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42548
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42549
|
+
});
|
|
42550
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42551
|
+
addonId: string(),
|
|
42552
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42553
|
+
kind: string(),
|
|
42554
|
+
label: string(),
|
|
42555
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42556
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42557
|
+
maxDatasetBytes: number().int().positive(),
|
|
42558
|
+
maxRuntimeSec: number().int().positive(),
|
|
42559
|
+
freeTierNote: string().optional(),
|
|
42560
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42561
|
+
dataResidencyNote: string(),
|
|
42562
|
+
/** Credentials are present — never the values. */
|
|
42563
|
+
configured: boolean(),
|
|
42564
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42565
|
+
});
|
|
42566
|
+
var TrainingCredentialCheckSchema = object({
|
|
42567
|
+
ok: boolean(),
|
|
42568
|
+
/** Workspace / account name, when the provider says. */
|
|
42569
|
+
account: string().optional(),
|
|
42570
|
+
reason: _enum([
|
|
42571
|
+
"missing",
|
|
42572
|
+
"invalid",
|
|
42573
|
+
"forbidden",
|
|
42574
|
+
"network",
|
|
42575
|
+
"quota"
|
|
42576
|
+
]).optional(),
|
|
42577
|
+
detail: string().optional()
|
|
42578
|
+
});
|
|
42579
|
+
var ProviderJobStateSchema = _enum([
|
|
42580
|
+
"pending",
|
|
42581
|
+
"starting",
|
|
42582
|
+
"running",
|
|
42583
|
+
"succeeded",
|
|
42584
|
+
"failed",
|
|
42585
|
+
"cancelled",
|
|
42586
|
+
"lost"
|
|
42587
|
+
]);
|
|
42588
|
+
var ProviderJobStatusSchema = object({
|
|
42589
|
+
jobKey: string(),
|
|
42590
|
+
providerJobId: string().optional(),
|
|
42591
|
+
state: ProviderJobStateSchema,
|
|
42592
|
+
startedAt: number().optional(),
|
|
42593
|
+
endedAt: number().optional(),
|
|
42594
|
+
exitCode: number().int().optional(),
|
|
42595
|
+
failureReason: string().optional(),
|
|
42596
|
+
gpuType: string(),
|
|
42597
|
+
region: string().optional(),
|
|
42598
|
+
billedSeconds: number().nonnegative(),
|
|
42599
|
+
costUsd: number().nonnegative(),
|
|
42600
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42601
|
+
costIsEstimate: boolean(),
|
|
42602
|
+
lastFetchedAt: number()
|
|
42603
|
+
});
|
|
42604
|
+
/**
|
|
42605
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42606
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42607
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42608
|
+
* in `result.json`.
|
|
42609
|
+
*/
|
|
42610
|
+
var TrainerSourceRefSchema = object({
|
|
42611
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42612
|
+
repo: string().min(1),
|
|
42613
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42614
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42615
|
+
});
|
|
42616
|
+
var JobRef = {
|
|
42617
|
+
addonId: string(),
|
|
42618
|
+
jobKey: string().uuid()
|
|
42619
|
+
};
|
|
42620
|
+
var TrainingLogLineSchema = object({
|
|
42621
|
+
ts: number(),
|
|
42622
|
+
text: string()
|
|
42623
|
+
});
|
|
42624
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42625
|
+
kind: "mutation",
|
|
42626
|
+
auth: "admin",
|
|
42627
|
+
timeoutMs: 3e4
|
|
42628
|
+
}), method(object({
|
|
42629
|
+
addonId: string(),
|
|
42630
|
+
gpuType: string(),
|
|
42631
|
+
region: string(),
|
|
42632
|
+
datasetBytes: number().int().nonnegative(),
|
|
42633
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42634
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42635
|
+
}), object({
|
|
42636
|
+
usdLow: number().nonnegative(),
|
|
42637
|
+
usdHigh: number().nonnegative(),
|
|
42638
|
+
notes: array(string()).readonly()
|
|
42639
|
+
}), { auth: "admin" }), method(object({
|
|
42640
|
+
...JobRef,
|
|
42641
|
+
ticket: PeerBytesTicketSchema
|
|
42642
|
+
}), object({
|
|
42643
|
+
bytes: number().int().nonnegative(),
|
|
42644
|
+
sha256: string()
|
|
42645
|
+
}), {
|
|
42646
|
+
kind: "mutation",
|
|
42647
|
+
auth: "admin",
|
|
42648
|
+
timeoutMs: 120 * 6e4
|
|
42649
|
+
}), method(object({
|
|
42650
|
+
...JobRef,
|
|
42651
|
+
trainer: TrainerSourceRefSchema,
|
|
42652
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42653
|
+
gpuType: string(),
|
|
42654
|
+
region: string(),
|
|
42655
|
+
maxRuntimeSec: number().int().positive()
|
|
42656
|
+
}), ProviderJobStatusSchema, {
|
|
42657
|
+
kind: "mutation",
|
|
42658
|
+
auth: "admin",
|
|
42659
|
+
timeoutMs: 30 * 6e4
|
|
42660
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42661
|
+
auth: "admin",
|
|
42662
|
+
timeoutMs: 6e4
|
|
42663
|
+
}), method(object({
|
|
42664
|
+
...JobRef,
|
|
42665
|
+
cursor: string().optional(),
|
|
42666
|
+
max: number().int().min(1).max(500)
|
|
42667
|
+
}), object({
|
|
42668
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42669
|
+
cursor: string()
|
|
42670
|
+
}), {
|
|
42671
|
+
auth: "admin",
|
|
42672
|
+
timeoutMs: 6e4
|
|
42673
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42674
|
+
kind: "mutation",
|
|
42675
|
+
auth: "admin",
|
|
42676
|
+
timeoutMs: 6e4
|
|
42677
|
+
}), method(object(JobRef), object({
|
|
42678
|
+
found: boolean(),
|
|
42679
|
+
text: string().optional()
|
|
42680
|
+
}), {
|
|
42681
|
+
kind: "mutation",
|
|
42682
|
+
auth: "admin",
|
|
42683
|
+
timeoutMs: 5 * 6e4
|
|
42684
|
+
}), method(object({
|
|
42685
|
+
...JobRef,
|
|
42686
|
+
path: _enum(["bundle.tar"])
|
|
42687
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42688
|
+
kind: "mutation",
|
|
42689
|
+
auth: "admin",
|
|
42690
|
+
timeoutMs: 5 * 6e4
|
|
42691
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42692
|
+
kind: "mutation",
|
|
42693
|
+
auth: "admin",
|
|
42694
|
+
timeoutMs: 5 * 6e4
|
|
42695
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42696
|
+
auth: "admin",
|
|
42697
|
+
timeoutMs: 2 * 6e4
|
|
42698
|
+
});
|
|
42699
|
+
/**
|
|
42700
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42701
|
+
* provided by `addon-training`.
|
|
42702
|
+
*
|
|
42703
|
+
* It owns what every provider must agree on, written once:
|
|
42704
|
+
*
|
|
42705
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42706
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42707
|
+
* the export plan) and reaches this store through the five row methods
|
|
42708
|
+
* below, so the Retrain page and the export did not change.
|
|
42709
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42710
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42711
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42712
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42713
|
+
* rollback. Nothing is ever registered automatically.
|
|
42714
|
+
*
|
|
42715
|
+
* Every method is `admin`.
|
|
42716
|
+
*/
|
|
42717
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42718
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42719
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42720
|
+
var TrainingBaseModelSchema = object({
|
|
42721
|
+
modelId: string(),
|
|
42722
|
+
label: string(),
|
|
42723
|
+
weights: string(),
|
|
42724
|
+
imgsz: number().int(),
|
|
42725
|
+
baselineOnnxUrl: string(),
|
|
42726
|
+
baselineFloors: record(string(), number()),
|
|
42727
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42728
|
+
recommended: boolean()
|
|
42729
|
+
});
|
|
42730
|
+
var TrainingPresetSchema = _enum([
|
|
42731
|
+
"quick",
|
|
42732
|
+
"standard",
|
|
42733
|
+
"thorough"
|
|
42734
|
+
]);
|
|
42735
|
+
var TrainingJobRequestSchema = object({
|
|
42736
|
+
datasetVersionId: string().min(1),
|
|
42737
|
+
/** The `training-provider` addon that runs it. */
|
|
42738
|
+
addonId: string().min(1),
|
|
42739
|
+
gpuType: string().min(1),
|
|
42740
|
+
region: string(),
|
|
42741
|
+
baseModelId: string().min(1),
|
|
42742
|
+
preset: TrainingPresetSchema,
|
|
42743
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42744
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42745
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42746
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42747
|
+
});
|
|
42748
|
+
var TrainingSplitPlanSchema = object({
|
|
42749
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42750
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42751
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42752
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42753
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42754
|
+
trainSubjects: number().int()
|
|
42755
|
+
});
|
|
42756
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42757
|
+
"unknown-dataset",
|
|
42758
|
+
"unknown-provider",
|
|
42759
|
+
"provider-not-configured",
|
|
42760
|
+
"unknown-base-model",
|
|
42761
|
+
"unknown-gpu",
|
|
42762
|
+
"dataset-too-large",
|
|
42763
|
+
"no-training-subjects",
|
|
42764
|
+
"job-already-running"
|
|
42765
|
+
]);
|
|
42766
|
+
var TrainingJobPlanSchema = object({
|
|
42767
|
+
refusal: object({
|
|
42768
|
+
reason: TrainingRefusalReasonSchema,
|
|
42769
|
+
detail: string()
|
|
42770
|
+
}).nullable(),
|
|
42771
|
+
warnings: array(string()).readonly(),
|
|
42772
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42773
|
+
estimate: object({
|
|
42774
|
+
datasetBytes: number().int(),
|
|
42775
|
+
uploadMinutesAt20Mbps: number(),
|
|
42776
|
+
gpuSecondsLow: number(),
|
|
42777
|
+
gpuSecondsHigh: number(),
|
|
42778
|
+
usdLow: number(),
|
|
42779
|
+
usdHigh: number(),
|
|
42780
|
+
notes: array(string()).readonly()
|
|
42781
|
+
}).nullable(),
|
|
42782
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42783
|
+
defaults: object({
|
|
42784
|
+
maxCostUsd: number(),
|
|
42785
|
+
maxRuntimeSec: number().int()
|
|
42786
|
+
}).nullable(),
|
|
42787
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42788
|
+
dataNotice: string()
|
|
42789
|
+
});
|
|
42790
|
+
/**
|
|
42791
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42792
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42793
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42794
|
+
* result lives after the operator acted on it.
|
|
42795
|
+
*/
|
|
42796
|
+
var TrainingJobStateSchema = _enum([
|
|
42797
|
+
"uploading",
|
|
42798
|
+
"submitted",
|
|
42799
|
+
"starting",
|
|
42800
|
+
"running",
|
|
42801
|
+
"collecting",
|
|
42802
|
+
"ready",
|
|
42803
|
+
"registered",
|
|
42804
|
+
"canary",
|
|
42805
|
+
"failed",
|
|
42806
|
+
"cancelling",
|
|
42807
|
+
"cancelled",
|
|
42808
|
+
"lost",
|
|
42809
|
+
"expired",
|
|
42810
|
+
"discarded"
|
|
42811
|
+
]);
|
|
42812
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42813
|
+
"cost-cap",
|
|
42814
|
+
"runtime-cap",
|
|
42815
|
+
"upload-failed",
|
|
42816
|
+
"submit-failed",
|
|
42817
|
+
"trainer-failed",
|
|
42818
|
+
"result-invalid",
|
|
42819
|
+
"checksum-mismatch",
|
|
42820
|
+
"fetch-failed",
|
|
42821
|
+
"provider-error",
|
|
42822
|
+
"hub-restart-during-upload"
|
|
42823
|
+
]);
|
|
42824
|
+
var TrainingProgressPointSchema = object({
|
|
42825
|
+
epoch: number().int(),
|
|
42826
|
+
map50: number().nullable(),
|
|
42827
|
+
map50_95: number().nullable()
|
|
42828
|
+
});
|
|
42829
|
+
var TrainingCanarySchema = object({
|
|
42830
|
+
deviceIds: array(number().int()).readonly(),
|
|
42831
|
+
since: number(),
|
|
42832
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42833
|
+
previous: array(object({
|
|
42834
|
+
deviceId: number().int(),
|
|
42835
|
+
nodeId: string(),
|
|
42836
|
+
deviceKey: string(),
|
|
42837
|
+
patch: object({
|
|
42838
|
+
modelId: string().optional(),
|
|
42839
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42840
|
+
}).nullable()
|
|
42841
|
+
})).readonly()
|
|
42842
|
+
});
|
|
42843
|
+
var TrainingJobSchema = object({
|
|
42844
|
+
id: string(),
|
|
42845
|
+
idempotencyKey: string(),
|
|
42846
|
+
name: string(),
|
|
42847
|
+
createdAt: number(),
|
|
42848
|
+
updatedAt: number(),
|
|
42849
|
+
state: TrainingJobStateSchema,
|
|
42850
|
+
stage: TrainingStageSchema.nullable(),
|
|
42851
|
+
failure: object({
|
|
42852
|
+
reason: TrainingFailureReasonSchema,
|
|
42853
|
+
stage: string().nullable(),
|
|
42854
|
+
detail: string()
|
|
42855
|
+
}).nullable(),
|
|
42856
|
+
request: TrainingJobRequestSchema,
|
|
42857
|
+
maxCostUsd: number().nonnegative(),
|
|
42858
|
+
maxRuntimeSec: number().int().positive(),
|
|
42859
|
+
trainer: TrainerSourceRefSchema,
|
|
42860
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42861
|
+
dataset: object({
|
|
42862
|
+
bytes: number().int(),
|
|
42863
|
+
sha256: string(),
|
|
42864
|
+
uploadedAt: number()
|
|
42865
|
+
}).nullable(),
|
|
42866
|
+
split: TrainingSplitPlanSchema,
|
|
42867
|
+
provider: object({
|
|
42868
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42869
|
+
providerJobId: string().nullable(),
|
|
42870
|
+
startedAt: number().nullable(),
|
|
42871
|
+
endedAt: number().nullable(),
|
|
42872
|
+
billedSeconds: number(),
|
|
42873
|
+
costUsd: number(),
|
|
42874
|
+
costIsEstimate: boolean(),
|
|
42875
|
+
lastPolledAt: number().nullable()
|
|
42876
|
+
}),
|
|
42877
|
+
progress: object({
|
|
42878
|
+
epoch: number().int().nullable(),
|
|
42879
|
+
epochs: number().int().nullable(),
|
|
42880
|
+
etaSec: number().nullable(),
|
|
42881
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42882
|
+
}),
|
|
42883
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42884
|
+
logTail: array(string()).readonly(),
|
|
42885
|
+
logCursor: string().nullable(),
|
|
42886
|
+
artifacts: object({
|
|
42887
|
+
bundleBytes: number().int(),
|
|
42888
|
+
bundleSha256: string(),
|
|
42889
|
+
fetchedAt: number(),
|
|
42890
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42891
|
+
expiresAt: number()
|
|
42892
|
+
}).nullable(),
|
|
42893
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42894
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42895
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42896
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42897
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42898
|
+
registeredModelIds: array(string()).readonly(),
|
|
42899
|
+
canary: TrainingCanarySchema.nullable()
|
|
42900
|
+
});
|
|
42901
|
+
var IdInput = object({ id: string().min(1) });
|
|
42902
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42903
|
+
kind: "mutation",
|
|
42904
|
+
auth: "admin"
|
|
42905
|
+
}), 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() }), {
|
|
42906
|
+
kind: "mutation",
|
|
42907
|
+
auth: "admin"
|
|
42908
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42909
|
+
auth: "admin",
|
|
42910
|
+
timeoutMs: 6e4
|
|
42911
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42912
|
+
name: string().min(1).max(120),
|
|
42913
|
+
maxCostUsd: number().positive(),
|
|
42914
|
+
maxRuntimeSec: number().int().positive(),
|
|
42915
|
+
idempotencyKey: string().min(8).max(80)
|
|
42916
|
+
}), discriminatedUnion("kind", [object({
|
|
42917
|
+
kind: literal("started"),
|
|
42918
|
+
job: TrainingJobSchema
|
|
42919
|
+
}), object({
|
|
42920
|
+
kind: literal("refused"),
|
|
42921
|
+
reason: TrainingRefusalReasonSchema,
|
|
42922
|
+
detail: string()
|
|
42923
|
+
})]), {
|
|
42924
|
+
kind: "mutation",
|
|
42925
|
+
auth: "admin",
|
|
42926
|
+
timeoutMs: 12e4
|
|
42927
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42928
|
+
kind: "mutation",
|
|
42929
|
+
auth: "admin",
|
|
42930
|
+
timeoutMs: 12e4
|
|
42931
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42932
|
+
kind: "mutation",
|
|
42933
|
+
auth: "admin",
|
|
42934
|
+
timeoutMs: 30 * 6e4
|
|
42935
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42936
|
+
kind: "mutation",
|
|
42937
|
+
auth: "admin",
|
|
42938
|
+
timeoutMs: 12e4
|
|
42939
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42940
|
+
kind: "mutation",
|
|
42941
|
+
auth: "admin",
|
|
42942
|
+
timeoutMs: 12e4
|
|
42943
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42944
|
+
kind: "mutation",
|
|
42945
|
+
auth: "admin"
|
|
42946
|
+
});
|
|
39972
42947
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39973
42948
|
Object.freeze({
|
|
39974
42949
|
person: .5,
|
|
@@ -40455,7 +43430,8 @@ var BaseDevice = class {
|
|
|
40455
43430
|
this.role = options.role;
|
|
40456
43431
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40457
43432
|
const seedData = ctx.persistedConfig ?? {};
|
|
40458
|
-
|
|
43433
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
43434
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40459
43435
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40460
43436
|
tags: {
|
|
40461
43437
|
deviceId: ctx.id,
|
|
@@ -42116,6 +45092,12 @@ Object.freeze({
|
|
|
42116
45092
|
addonId: null,
|
|
42117
45093
|
access: "create"
|
|
42118
45094
|
},
|
|
45095
|
+
"backup.checkBackupKey": {
|
|
45096
|
+
capName: "backup",
|
|
45097
|
+
capScope: "system",
|
|
45098
|
+
addonId: null,
|
|
45099
|
+
access: "create"
|
|
45100
|
+
},
|
|
42119
45101
|
"backup.delete": {
|
|
42120
45102
|
capName: "backup",
|
|
42121
45103
|
capScope: "system",
|
|
@@ -42128,6 +45110,18 @@ Object.freeze({
|
|
|
42128
45110
|
addonId: null,
|
|
42129
45111
|
access: "delete"
|
|
42130
45112
|
},
|
|
45113
|
+
"backup.disableEncryption": {
|
|
45114
|
+
capName: "backup",
|
|
45115
|
+
capScope: "system",
|
|
45116
|
+
addonId: null,
|
|
45117
|
+
access: "create"
|
|
45118
|
+
},
|
|
45119
|
+
"backup.getEncryption": {
|
|
45120
|
+
capName: "backup",
|
|
45121
|
+
capScope: "system",
|
|
45122
|
+
addonId: null,
|
|
45123
|
+
access: "view"
|
|
45124
|
+
},
|
|
42131
45125
|
"backup.getEntries": {
|
|
42132
45126
|
capName: "backup",
|
|
42133
45127
|
capScope: "system",
|
|
@@ -42182,6 +45176,12 @@ Object.freeze({
|
|
|
42182
45176
|
addonId: null,
|
|
42183
45177
|
access: "create"
|
|
42184
45178
|
},
|
|
45179
|
+
"backup.setupEncryption": {
|
|
45180
|
+
capName: "backup",
|
|
45181
|
+
capScope: "system",
|
|
45182
|
+
addonId: null,
|
|
45183
|
+
access: "create"
|
|
45184
|
+
},
|
|
42185
45185
|
"backup.trigger": {
|
|
42186
45186
|
capName: "backup",
|
|
42187
45187
|
capScope: "system",
|
|
@@ -42734,6 +45734,12 @@ Object.freeze({
|
|
|
42734
45734
|
addonId: null,
|
|
42735
45735
|
access: "create"
|
|
42736
45736
|
},
|
|
45737
|
+
"customModelRegistry.importModelBundle": {
|
|
45738
|
+
capName: "custom-model-registry",
|
|
45739
|
+
capScope: "system",
|
|
45740
|
+
addonId: null,
|
|
45741
|
+
access: "create"
|
|
45742
|
+
},
|
|
42737
45743
|
"customModelRegistry.listModels": {
|
|
42738
45744
|
capName: "custom-model-registry",
|
|
42739
45745
|
capScope: "system",
|
|
@@ -44144,6 +47150,108 @@ Object.freeze({
|
|
|
44144
47150
|
addonId: null,
|
|
44145
47151
|
access: "create"
|
|
44146
47152
|
},
|
|
47153
|
+
"keychain.delete": {
|
|
47154
|
+
capName: "keychain",
|
|
47155
|
+
capScope: "system",
|
|
47156
|
+
addonId: null,
|
|
47157
|
+
access: "delete"
|
|
47158
|
+
},
|
|
47159
|
+
"keychain.getState": {
|
|
47160
|
+
capName: "keychain",
|
|
47161
|
+
capScope: "system",
|
|
47162
|
+
addonId: null,
|
|
47163
|
+
access: "view"
|
|
47164
|
+
},
|
|
47165
|
+
"keychain.listMeta": {
|
|
47166
|
+
capName: "keychain",
|
|
47167
|
+
capScope: "system",
|
|
47168
|
+
addonId: null,
|
|
47169
|
+
access: "view"
|
|
47170
|
+
},
|
|
47171
|
+
"keychain.put": {
|
|
47172
|
+
capName: "keychain",
|
|
47173
|
+
capScope: "system",
|
|
47174
|
+
addonId: null,
|
|
47175
|
+
access: "create"
|
|
47176
|
+
},
|
|
47177
|
+
"keychain.resolve": {
|
|
47178
|
+
capName: "keychain",
|
|
47179
|
+
capScope: "system",
|
|
47180
|
+
addonId: null,
|
|
47181
|
+
access: "view"
|
|
47182
|
+
},
|
|
47183
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47184
|
+
capName: "keychain-admin",
|
|
47185
|
+
capScope: "system",
|
|
47186
|
+
addonId: null,
|
|
47187
|
+
access: "create"
|
|
47188
|
+
},
|
|
47189
|
+
"keychainAdmin.deleteOrphans": {
|
|
47190
|
+
capName: "keychain-admin",
|
|
47191
|
+
capScope: "system",
|
|
47192
|
+
addonId: null,
|
|
47193
|
+
access: "delete"
|
|
47194
|
+
},
|
|
47195
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47196
|
+
capName: "keychain-admin",
|
|
47197
|
+
capScope: "system",
|
|
47198
|
+
addonId: null,
|
|
47199
|
+
access: "create"
|
|
47200
|
+
},
|
|
47201
|
+
"keychainAdmin.listAudit": {
|
|
47202
|
+
capName: "keychain-admin",
|
|
47203
|
+
capScope: "system",
|
|
47204
|
+
addonId: null,
|
|
47205
|
+
access: "view"
|
|
47206
|
+
},
|
|
47207
|
+
"keychainAdmin.listSecrets": {
|
|
47208
|
+
capName: "keychain-admin",
|
|
47209
|
+
capScope: "system",
|
|
47210
|
+
addonId: null,
|
|
47211
|
+
access: "view"
|
|
47212
|
+
},
|
|
47213
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47214
|
+
capName: "keychain-admin",
|
|
47215
|
+
capScope: "system",
|
|
47216
|
+
addonId: null,
|
|
47217
|
+
access: "delete"
|
|
47218
|
+
},
|
|
47219
|
+
"keychainAdmin.resetKeychain": {
|
|
47220
|
+
capName: "keychain-admin",
|
|
47221
|
+
capScope: "system",
|
|
47222
|
+
addonId: null,
|
|
47223
|
+
access: "delete"
|
|
47224
|
+
},
|
|
47225
|
+
"keychainAdmin.resetReport": {
|
|
47226
|
+
capName: "keychain-admin",
|
|
47227
|
+
capScope: "system",
|
|
47228
|
+
addonId: null,
|
|
47229
|
+
access: "delete"
|
|
47230
|
+
},
|
|
47231
|
+
"keychainAdmin.reveal": {
|
|
47232
|
+
capName: "keychain-admin",
|
|
47233
|
+
capScope: "system",
|
|
47234
|
+
addonId: null,
|
|
47235
|
+
access: "create"
|
|
47236
|
+
},
|
|
47237
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47238
|
+
capName: "keychain-admin",
|
|
47239
|
+
capScope: "system",
|
|
47240
|
+
addonId: null,
|
|
47241
|
+
access: "create"
|
|
47242
|
+
},
|
|
47243
|
+
"keychainAdmin.setSystemSecret": {
|
|
47244
|
+
capName: "keychain-admin",
|
|
47245
|
+
capScope: "system",
|
|
47246
|
+
addonId: null,
|
|
47247
|
+
access: "create"
|
|
47248
|
+
},
|
|
47249
|
+
"keychainAdmin.status": {
|
|
47250
|
+
capName: "keychain-admin",
|
|
47251
|
+
capScope: "system",
|
|
47252
|
+
addonId: null,
|
|
47253
|
+
access: "view"
|
|
47254
|
+
},
|
|
44147
47255
|
"lawnMowerControl.dock": {
|
|
44148
47256
|
capName: "lawn-mower-control",
|
|
44149
47257
|
capScope: "device",
|
|
@@ -45518,6 +48626,18 @@ Object.freeze({
|
|
|
45518
48626
|
addonId: null,
|
|
45519
48627
|
access: "create"
|
|
45520
48628
|
},
|
|
48629
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48630
|
+
capName: "pipeline-analytics",
|
|
48631
|
+
capScope: "device",
|
|
48632
|
+
addonId: null,
|
|
48633
|
+
access: "create"
|
|
48634
|
+
},
|
|
48635
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48636
|
+
capName: "pipeline-analytics",
|
|
48637
|
+
capScope: "device",
|
|
48638
|
+
addonId: null,
|
|
48639
|
+
access: "create"
|
|
48640
|
+
},
|
|
45521
48641
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45522
48642
|
capName: "pipeline-analytics",
|
|
45523
48643
|
capScope: "device",
|
|
@@ -45566,12 +48686,36 @@ Object.freeze({
|
|
|
45566
48686
|
addonId: null,
|
|
45567
48687
|
access: "view"
|
|
45568
48688
|
},
|
|
48689
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48690
|
+
capName: "pipeline-analytics",
|
|
48691
|
+
capScope: "device",
|
|
48692
|
+
addonId: null,
|
|
48693
|
+
access: "create"
|
|
48694
|
+
},
|
|
48695
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48696
|
+
capName: "pipeline-analytics",
|
|
48697
|
+
capScope: "device",
|
|
48698
|
+
addonId: null,
|
|
48699
|
+
access: "create"
|
|
48700
|
+
},
|
|
45569
48701
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45570
48702
|
capName: "pipeline-analytics",
|
|
45571
48703
|
capScope: "device",
|
|
45572
48704
|
addonId: null,
|
|
45573
48705
|
access: "delete"
|
|
45574
48706
|
},
|
|
48707
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48708
|
+
capName: "pipeline-analytics",
|
|
48709
|
+
capScope: "device",
|
|
48710
|
+
addonId: null,
|
|
48711
|
+
access: "delete"
|
|
48712
|
+
},
|
|
48713
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48714
|
+
capName: "pipeline-analytics",
|
|
48715
|
+
capScope: "device",
|
|
48716
|
+
addonId: null,
|
|
48717
|
+
access: "delete"
|
|
48718
|
+
},
|
|
45575
48719
|
"pipelineAnalytics.deleteTracks": {
|
|
45576
48720
|
capName: "pipeline-analytics",
|
|
45577
48721
|
capScope: "device",
|
|
@@ -45776,6 +48920,30 @@ Object.freeze({
|
|
|
45776
48920
|
addonId: null,
|
|
45777
48921
|
access: "view"
|
|
45778
48922
|
},
|
|
48923
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48924
|
+
capName: "pipeline-analytics",
|
|
48925
|
+
capScope: "device",
|
|
48926
|
+
addonId: null,
|
|
48927
|
+
access: "view"
|
|
48928
|
+
},
|
|
48929
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48930
|
+
capName: "pipeline-analytics",
|
|
48931
|
+
capScope: "device",
|
|
48932
|
+
addonId: null,
|
|
48933
|
+
access: "view"
|
|
48934
|
+
},
|
|
48935
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
48936
|
+
capName: "pipeline-analytics",
|
|
48937
|
+
capScope: "device",
|
|
48938
|
+
addonId: null,
|
|
48939
|
+
access: "view"
|
|
48940
|
+
},
|
|
48941
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48942
|
+
capName: "pipeline-analytics",
|
|
48943
|
+
capScope: "device",
|
|
48944
|
+
addonId: null,
|
|
48945
|
+
access: "view"
|
|
48946
|
+
},
|
|
45779
48947
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45780
48948
|
capName: "pipeline-analytics",
|
|
45781
48949
|
capScope: "device",
|
|
@@ -45806,6 +48974,12 @@ Object.freeze({
|
|
|
45806
48974
|
addonId: null,
|
|
45807
48975
|
access: "view"
|
|
45808
48976
|
},
|
|
48977
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48978
|
+
capName: "pipeline-analytics",
|
|
48979
|
+
capScope: "device",
|
|
48980
|
+
addonId: null,
|
|
48981
|
+
access: "create"
|
|
48982
|
+
},
|
|
45809
48983
|
"pipelineAnalytics.ownersWithMedia": {
|
|
45810
48984
|
capName: "pipeline-analytics",
|
|
45811
48985
|
capScope: "device",
|
|
@@ -45818,12 +48992,24 @@ Object.freeze({
|
|
|
45818
48992
|
addonId: null,
|
|
45819
48993
|
access: "create"
|
|
45820
48994
|
},
|
|
48995
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48996
|
+
capName: "pipeline-analytics",
|
|
48997
|
+
capScope: "device",
|
|
48998
|
+
addonId: null,
|
|
48999
|
+
access: "view"
|
|
49000
|
+
},
|
|
45821
49001
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
45822
49002
|
capName: "pipeline-analytics",
|
|
45823
49003
|
capScope: "device",
|
|
45824
49004
|
addonId: null,
|
|
45825
49005
|
access: "create"
|
|
45826
49006
|
},
|
|
49007
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49008
|
+
capName: "pipeline-analytics",
|
|
49009
|
+
capScope: "device",
|
|
49010
|
+
addonId: null,
|
|
49011
|
+
access: "create"
|
|
49012
|
+
},
|
|
45827
49013
|
"pipelineAnalytics.pruneEvents": {
|
|
45828
49014
|
capName: "pipeline-analytics",
|
|
45829
49015
|
capScope: "device",
|
|
@@ -45878,6 +49064,18 @@ Object.freeze({
|
|
|
45878
49064
|
addonId: null,
|
|
45879
49065
|
access: "create"
|
|
45880
49066
|
},
|
|
49067
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49068
|
+
capName: "pipeline-analytics",
|
|
49069
|
+
capScope: "device",
|
|
49070
|
+
addonId: null,
|
|
49071
|
+
access: "delete"
|
|
49072
|
+
},
|
|
49073
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49074
|
+
capName: "pipeline-analytics",
|
|
49075
|
+
capScope: "device",
|
|
49076
|
+
addonId: null,
|
|
49077
|
+
access: "create"
|
|
49078
|
+
},
|
|
45881
49079
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45882
49080
|
capName: "pipeline-analytics",
|
|
45883
49081
|
capScope: "device",
|
|
@@ -45938,6 +49136,12 @@ Object.freeze({
|
|
|
45938
49136
|
addonId: null,
|
|
45939
49137
|
access: "create"
|
|
45940
49138
|
},
|
|
49139
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49140
|
+
capName: "pipeline-analytics",
|
|
49141
|
+
capScope: "device",
|
|
49142
|
+
addonId: null,
|
|
49143
|
+
access: "view"
|
|
49144
|
+
},
|
|
45941
49145
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
45942
49146
|
capName: "pipeline-analytics",
|
|
45943
49147
|
capScope: "device",
|
|
@@ -46166,6 +49370,12 @@ Object.freeze({
|
|
|
46166
49370
|
addonId: null,
|
|
46167
49371
|
access: "view"
|
|
46168
49372
|
},
|
|
49373
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
49374
|
+
capName: "pipeline-orchestrator",
|
|
49375
|
+
capScope: "system",
|
|
49376
|
+
addonId: null,
|
|
49377
|
+
access: "create"
|
|
49378
|
+
},
|
|
46169
49379
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46170
49380
|
capName: "pipeline-orchestrator",
|
|
46171
49381
|
capScope: "system",
|
|
@@ -46190,6 +49400,12 @@ Object.freeze({
|
|
|
46190
49400
|
addonId: null,
|
|
46191
49401
|
access: "create"
|
|
46192
49402
|
},
|
|
49403
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
49404
|
+
capName: "pipeline-orchestrator",
|
|
49405
|
+
capScope: "system",
|
|
49406
|
+
addonId: null,
|
|
49407
|
+
access: "delete"
|
|
49408
|
+
},
|
|
46193
49409
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46194
49410
|
capName: "pipeline-orchestrator",
|
|
46195
49411
|
capScope: "system",
|
|
@@ -46298,6 +49514,24 @@ Object.freeze({
|
|
|
46298
49514
|
addonId: null,
|
|
46299
49515
|
access: "view"
|
|
46300
49516
|
},
|
|
49517
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
49518
|
+
capName: "pipeline-orchestrator",
|
|
49519
|
+
capScope: "system",
|
|
49520
|
+
addonId: null,
|
|
49521
|
+
access: "view"
|
|
49522
|
+
},
|
|
49523
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
49524
|
+
capName: "pipeline-orchestrator",
|
|
49525
|
+
capScope: "system",
|
|
49526
|
+
addonId: null,
|
|
49527
|
+
access: "view"
|
|
49528
|
+
},
|
|
49529
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
49530
|
+
capName: "pipeline-orchestrator",
|
|
49531
|
+
capScope: "system",
|
|
49532
|
+
addonId: null,
|
|
49533
|
+
access: "view"
|
|
49534
|
+
},
|
|
46301
49535
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46302
49536
|
capName: "pipeline-orchestrator",
|
|
46303
49537
|
capScope: "system",
|
|
@@ -46340,6 +49574,12 @@ Object.freeze({
|
|
|
46340
49574
|
addonId: null,
|
|
46341
49575
|
access: "view"
|
|
46342
49576
|
},
|
|
49577
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49578
|
+
capName: "pipeline-orchestrator",
|
|
49579
|
+
capScope: "system",
|
|
49580
|
+
addonId: null,
|
|
49581
|
+
access: "view"
|
|
49582
|
+
},
|
|
46343
49583
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46344
49584
|
capName: "pipeline-orchestrator",
|
|
46345
49585
|
capScope: "system",
|
|
@@ -46484,6 +49724,12 @@ Object.freeze({
|
|
|
46484
49724
|
addonId: null,
|
|
46485
49725
|
access: "create"
|
|
46486
49726
|
},
|
|
49727
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49728
|
+
capName: "pipeline-orchestrator",
|
|
49729
|
+
capScope: "system",
|
|
49730
|
+
addonId: null,
|
|
49731
|
+
access: "create"
|
|
49732
|
+
},
|
|
46487
49733
|
"pipelineOrchestrator.suggestShares": {
|
|
46488
49734
|
capName: "pipeline-orchestrator",
|
|
46489
49735
|
capScope: "system",
|
|
@@ -46502,6 +49748,12 @@ Object.freeze({
|
|
|
46502
49748
|
addonId: null,
|
|
46503
49749
|
access: "create"
|
|
46504
49750
|
},
|
|
49751
|
+
"pipelineRunner.abortNodeBench": {
|
|
49752
|
+
capName: "pipeline-runner",
|
|
49753
|
+
capScope: "system",
|
|
49754
|
+
addonId: null,
|
|
49755
|
+
access: "create"
|
|
49756
|
+
},
|
|
46505
49757
|
"pipelineRunner.attachCamera": {
|
|
46506
49758
|
capName: "pipeline-runner",
|
|
46507
49759
|
capScope: "system",
|
|
@@ -46550,6 +49802,12 @@ Object.freeze({
|
|
|
46550
49802
|
addonId: null,
|
|
46551
49803
|
access: "view"
|
|
46552
49804
|
},
|
|
49805
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49806
|
+
capName: "pipeline-runner",
|
|
49807
|
+
capScope: "system",
|
|
49808
|
+
addonId: null,
|
|
49809
|
+
access: "view"
|
|
49810
|
+
},
|
|
46553
49811
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46554
49812
|
capName: "pipeline-runner",
|
|
46555
49813
|
capScope: "system",
|
|
@@ -46592,6 +49850,12 @@ Object.freeze({
|
|
|
46592
49850
|
addonId: null,
|
|
46593
49851
|
access: "create"
|
|
46594
49852
|
},
|
|
49853
|
+
"pipelineRunner.startNodeBench": {
|
|
49854
|
+
capName: "pipeline-runner",
|
|
49855
|
+
capScope: "system",
|
|
49856
|
+
addonId: null,
|
|
49857
|
+
access: "create"
|
|
49858
|
+
},
|
|
46595
49859
|
"plateGallery.assignPlate": {
|
|
46596
49860
|
capName: "plate-gallery",
|
|
46597
49861
|
capScope: "system",
|
|
@@ -48254,6 +51518,174 @@ Object.freeze({
|
|
|
48254
51518
|
addonId: null,
|
|
48255
51519
|
access: "view"
|
|
48256
51520
|
},
|
|
51521
|
+
"training.canaryResult": {
|
|
51522
|
+
capName: "training",
|
|
51523
|
+
capScope: "system",
|
|
51524
|
+
addonId: null,
|
|
51525
|
+
access: "create"
|
|
51526
|
+
},
|
|
51527
|
+
"training.cancelJob": {
|
|
51528
|
+
capName: "training",
|
|
51529
|
+
capScope: "system",
|
|
51530
|
+
addonId: null,
|
|
51531
|
+
access: "create"
|
|
51532
|
+
},
|
|
51533
|
+
"training.discardResult": {
|
|
51534
|
+
capName: "training",
|
|
51535
|
+
capScope: "system",
|
|
51536
|
+
addonId: null,
|
|
51537
|
+
access: "create"
|
|
51538
|
+
},
|
|
51539
|
+
"training.findDatasetVersionIdByName": {
|
|
51540
|
+
capName: "training",
|
|
51541
|
+
capScope: "system",
|
|
51542
|
+
addonId: null,
|
|
51543
|
+
access: "view"
|
|
51544
|
+
},
|
|
51545
|
+
"training.getDatasetVersion": {
|
|
51546
|
+
capName: "training",
|
|
51547
|
+
capScope: "system",
|
|
51548
|
+
addonId: null,
|
|
51549
|
+
access: "view"
|
|
51550
|
+
},
|
|
51551
|
+
"training.getJob": {
|
|
51552
|
+
capName: "training",
|
|
51553
|
+
capScope: "system",
|
|
51554
|
+
addonId: null,
|
|
51555
|
+
access: "view"
|
|
51556
|
+
},
|
|
51557
|
+
"training.getJobResult": {
|
|
51558
|
+
capName: "training",
|
|
51559
|
+
capScope: "system",
|
|
51560
|
+
addonId: null,
|
|
51561
|
+
access: "view"
|
|
51562
|
+
},
|
|
51563
|
+
"training.listBaseModels": {
|
|
51564
|
+
capName: "training",
|
|
51565
|
+
capScope: "system",
|
|
51566
|
+
addonId: null,
|
|
51567
|
+
access: "view"
|
|
51568
|
+
},
|
|
51569
|
+
"training.listDatasetVersions": {
|
|
51570
|
+
capName: "training",
|
|
51571
|
+
capScope: "system",
|
|
51572
|
+
addonId: null,
|
|
51573
|
+
access: "view"
|
|
51574
|
+
},
|
|
51575
|
+
"training.listJobs": {
|
|
51576
|
+
capName: "training",
|
|
51577
|
+
capScope: "system",
|
|
51578
|
+
addonId: null,
|
|
51579
|
+
access: "view"
|
|
51580
|
+
},
|
|
51581
|
+
"training.planJob": {
|
|
51582
|
+
capName: "training",
|
|
51583
|
+
capScope: "system",
|
|
51584
|
+
addonId: null,
|
|
51585
|
+
access: "view"
|
|
51586
|
+
},
|
|
51587
|
+
"training.putDatasetVersion": {
|
|
51588
|
+
capName: "training",
|
|
51589
|
+
capScope: "system",
|
|
51590
|
+
addonId: null,
|
|
51591
|
+
access: "create"
|
|
51592
|
+
},
|
|
51593
|
+
"training.registerResult": {
|
|
51594
|
+
capName: "training",
|
|
51595
|
+
capScope: "system",
|
|
51596
|
+
addonId: null,
|
|
51597
|
+
access: "create"
|
|
51598
|
+
},
|
|
51599
|
+
"training.removeDatasetVersion": {
|
|
51600
|
+
capName: "training",
|
|
51601
|
+
capScope: "system",
|
|
51602
|
+
addonId: null,
|
|
51603
|
+
access: "delete"
|
|
51604
|
+
},
|
|
51605
|
+
"training.rollbackCanary": {
|
|
51606
|
+
capName: "training",
|
|
51607
|
+
capScope: "system",
|
|
51608
|
+
addonId: null,
|
|
51609
|
+
access: "create"
|
|
51610
|
+
},
|
|
51611
|
+
"training.startJob": {
|
|
51612
|
+
capName: "training",
|
|
51613
|
+
capScope: "system",
|
|
51614
|
+
addonId: null,
|
|
51615
|
+
access: "create"
|
|
51616
|
+
},
|
|
51617
|
+
"trainingProvider.cancelJob": {
|
|
51618
|
+
capName: "training-provider",
|
|
51619
|
+
capScope: "system",
|
|
51620
|
+
addonId: null,
|
|
51621
|
+
access: "create"
|
|
51622
|
+
},
|
|
51623
|
+
"trainingProvider.cleanupJob": {
|
|
51624
|
+
capName: "training-provider",
|
|
51625
|
+
capScope: "system",
|
|
51626
|
+
addonId: null,
|
|
51627
|
+
access: "create"
|
|
51628
|
+
},
|
|
51629
|
+
"trainingProvider.describe": {
|
|
51630
|
+
capName: "training-provider",
|
|
51631
|
+
capScope: "system",
|
|
51632
|
+
addonId: null,
|
|
51633
|
+
access: "view"
|
|
51634
|
+
},
|
|
51635
|
+
"trainingProvider.estimateJob": {
|
|
51636
|
+
capName: "training-provider",
|
|
51637
|
+
capScope: "system",
|
|
51638
|
+
addonId: null,
|
|
51639
|
+
access: "view"
|
|
51640
|
+
},
|
|
51641
|
+
"trainingProvider.getJob": {
|
|
51642
|
+
capName: "training-provider",
|
|
51643
|
+
capScope: "system",
|
|
51644
|
+
addonId: null,
|
|
51645
|
+
access: "view"
|
|
51646
|
+
},
|
|
51647
|
+
"trainingProvider.listJobEvents": {
|
|
51648
|
+
capName: "training-provider",
|
|
51649
|
+
capScope: "system",
|
|
51650
|
+
addonId: null,
|
|
51651
|
+
access: "view"
|
|
51652
|
+
},
|
|
51653
|
+
"trainingProvider.listJobs": {
|
|
51654
|
+
capName: "training-provider",
|
|
51655
|
+
capScope: "system",
|
|
51656
|
+
addonId: null,
|
|
51657
|
+
access: "view"
|
|
51658
|
+
},
|
|
51659
|
+
"trainingProvider.offerArtifact": {
|
|
51660
|
+
capName: "training-provider",
|
|
51661
|
+
capScope: "system",
|
|
51662
|
+
addonId: null,
|
|
51663
|
+
access: "create"
|
|
51664
|
+
},
|
|
51665
|
+
"trainingProvider.readResult": {
|
|
51666
|
+
capName: "training-provider",
|
|
51667
|
+
capScope: "system",
|
|
51668
|
+
addonId: null,
|
|
51669
|
+
access: "create"
|
|
51670
|
+
},
|
|
51671
|
+
"trainingProvider.submitJob": {
|
|
51672
|
+
capName: "training-provider",
|
|
51673
|
+
capScope: "system",
|
|
51674
|
+
addonId: null,
|
|
51675
|
+
access: "create"
|
|
51676
|
+
},
|
|
51677
|
+
"trainingProvider.uploadDataset": {
|
|
51678
|
+
capName: "training-provider",
|
|
51679
|
+
capScope: "system",
|
|
51680
|
+
addonId: null,
|
|
51681
|
+
access: "create"
|
|
51682
|
+
},
|
|
51683
|
+
"trainingProvider.validateCredentials": {
|
|
51684
|
+
capName: "training-provider",
|
|
51685
|
+
capScope: "system",
|
|
51686
|
+
addonId: null,
|
|
51687
|
+
access: "create"
|
|
51688
|
+
},
|
|
48257
51689
|
"turnProvider.getTurnServers": {
|
|
48258
51690
|
capName: "turn-provider",
|
|
48259
51691
|
capScope: "system",
|
|
@@ -48278,12 +51710,6 @@ Object.freeze({
|
|
|
48278
51710
|
addonId: null,
|
|
48279
51711
|
access: "create"
|
|
48280
51712
|
},
|
|
48281
|
-
"userManagement.createApiKey": {
|
|
48282
|
-
capName: "user-management",
|
|
48283
|
-
capScope: "system",
|
|
48284
|
-
addonId: null,
|
|
48285
|
-
access: "create"
|
|
48286
|
-
},
|
|
48287
51713
|
"userManagement.createScopedToken": {
|
|
48288
51714
|
capName: "user-management",
|
|
48289
51715
|
capScope: "system",
|
|
@@ -48320,12 +51746,6 @@ Object.freeze({
|
|
|
48320
51746
|
addonId: null,
|
|
48321
51747
|
access: "view"
|
|
48322
51748
|
},
|
|
48323
|
-
"userManagement.linkExternalIdentity": {
|
|
48324
|
-
capName: "user-management",
|
|
48325
|
-
capScope: "system",
|
|
48326
|
-
addonId: null,
|
|
48327
|
-
access: "create"
|
|
48328
|
-
},
|
|
48329
51749
|
"userManagement.listApiKeys": {
|
|
48330
51750
|
capName: "user-management",
|
|
48331
51751
|
capScope: "system",
|
|
@@ -48428,12 +51848,6 @@ Object.freeze({
|
|
|
48428
51848
|
addonId: null,
|
|
48429
51849
|
access: "create"
|
|
48430
51850
|
},
|
|
48431
|
-
"userManagement.validateApiKey": {
|
|
48432
|
-
capName: "user-management",
|
|
48433
|
-
capScope: "system",
|
|
48434
|
-
addonId: null,
|
|
48435
|
-
access: "view"
|
|
48436
|
-
},
|
|
48437
51851
|
"userManagement.validateCredentials": {
|
|
48438
51852
|
capName: "user-management",
|
|
48439
51853
|
capScope: "system",
|
|
@@ -51521,6 +54935,11 @@ Object.freeze({
|
|
|
51521
54935
|
form: "single",
|
|
51522
54936
|
optional: false
|
|
51523
54937
|
}],
|
|
54938
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
54939
|
+
name: "deviceId",
|
|
54940
|
+
form: "single",
|
|
54941
|
+
optional: false
|
|
54942
|
+
}],
|
|
51524
54943
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51525
54944
|
name: "deviceId",
|
|
51526
54945
|
form: "single",
|
|
@@ -51711,6 +55130,11 @@ Object.freeze({
|
|
|
51711
55130
|
form: "single",
|
|
51712
55131
|
optional: false
|
|
51713
55132
|
}],
|
|
55133
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55134
|
+
name: "deviceId",
|
|
55135
|
+
form: "single",
|
|
55136
|
+
optional: false
|
|
55137
|
+
}],
|
|
51714
55138
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51715
55139
|
name: "deviceId",
|
|
51716
55140
|
form: "single",
|
|
@@ -52537,6 +55961,11 @@ Object.freeze({
|
|
|
52537
55961
|
form: "single",
|
|
52538
55962
|
optional: false
|
|
52539
55963
|
}],
|
|
55964
|
+
"training.canaryResult": [{
|
|
55965
|
+
name: "deviceIds",
|
|
55966
|
+
form: "array",
|
|
55967
|
+
optional: false
|
|
55968
|
+
}],
|
|
52540
55969
|
"update.getStatus": [{
|
|
52541
55970
|
name: "deviceId",
|
|
52542
55971
|
form: "single",
|