@camstack/addon-provider-amcrest 0.2.132 → 0.2.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +3555 -126
- package/dist/addon.mjs +3555 -126
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { networkInterfaces } from "node:os";
|
|
|
13
13
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
14
14
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
15
15
|
//#endregion
|
|
16
|
-
//#region ../types/dist/event-category-
|
|
16
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
17
17
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
18
18
|
EventCategory["SystemBoot"] = "system.boot";
|
|
19
19
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -92,6 +92,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
92
92
|
*/
|
|
93
93
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
94
94
|
/**
|
|
95
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
96
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
97
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
98
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
99
|
+
*/
|
|
100
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
101
|
+
/**
|
|
95
102
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
96
103
|
* transitions from `failed` back to `healthy` (typically via the
|
|
97
104
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5384,7 +5391,7 @@ var ZodIssueCode = {
|
|
|
5384
5391
|
var ZodFirstPartyTypeKind;
|
|
5385
5392
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5386
5393
|
//#endregion
|
|
5387
|
-
//#region ../types/dist/sleep-
|
|
5394
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5388
5395
|
/**
|
|
5389
5396
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5390
5397
|
* window to float samples (D455).
|
|
@@ -5463,6 +5470,97 @@ function buildAlawTable() {
|
|
|
5463
5470
|
}
|
|
5464
5471
|
buildUlawTable();
|
|
5465
5472
|
buildAlawTable();
|
|
5473
|
+
/** Is this field's stored value a credential? */
|
|
5474
|
+
function isSecretConfigField(field) {
|
|
5475
|
+
if (field.type === "password") return true;
|
|
5476
|
+
return "secret" in field && field.secret === true;
|
|
5477
|
+
}
|
|
5478
|
+
/**
|
|
5479
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5480
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5481
|
+
*/
|
|
5482
|
+
function isKeychainStoredField(field) {
|
|
5483
|
+
if (!isSecretConfigField(field)) return false;
|
|
5484
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5485
|
+
return !("storage" in field && field.storage === "inline");
|
|
5486
|
+
}
|
|
5487
|
+
/**
|
|
5488
|
+
* What a settings blob holds where a secret used to be.
|
|
5489
|
+
*
|
|
5490
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5491
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5492
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5493
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5494
|
+
*
|
|
5495
|
+
* The same shapes travel to and from the admin UI:
|
|
5496
|
+
*
|
|
5497
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5498
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5499
|
+
* value is set, never the value.
|
|
5500
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5501
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5502
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5503
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5504
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5505
|
+
*
|
|
5506
|
+
* Pure and browser-safe.
|
|
5507
|
+
*/
|
|
5508
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5509
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5510
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5511
|
+
function isRecord$2(value) {
|
|
5512
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5513
|
+
}
|
|
5514
|
+
function makeSecretMarker(ref) {
|
|
5515
|
+
return {
|
|
5516
|
+
$secret: ref,
|
|
5517
|
+
v: 1
|
|
5518
|
+
};
|
|
5519
|
+
}
|
|
5520
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5521
|
+
function isSecretMarker(value) {
|
|
5522
|
+
if (!isRecord$2(value)) return false;
|
|
5523
|
+
const ref = value["$secret"];
|
|
5524
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5525
|
+
}
|
|
5526
|
+
function isSecretClear(value) {
|
|
5527
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5528
|
+
}
|
|
5529
|
+
/**
|
|
5530
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5531
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5532
|
+
* survives this function.
|
|
5533
|
+
*/
|
|
5534
|
+
function toSecretFieldView(stored) {
|
|
5535
|
+
if (isSecretMarker(stored)) return {
|
|
5536
|
+
$secret: stored.$secret,
|
|
5537
|
+
v: 1,
|
|
5538
|
+
set: true
|
|
5539
|
+
};
|
|
5540
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5541
|
+
$secret: null,
|
|
5542
|
+
v: 1,
|
|
5543
|
+
set: true,
|
|
5544
|
+
inline: true
|
|
5545
|
+
};
|
|
5546
|
+
return null;
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5549
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5550
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5551
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5552
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5553
|
+
*/
|
|
5554
|
+
function classifySecretWrite(incoming) {
|
|
5555
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5556
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5557
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5558
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5559
|
+
return {
|
|
5560
|
+
kind: "set",
|
|
5561
|
+
value: incoming
|
|
5562
|
+
};
|
|
5563
|
+
}
|
|
5466
5564
|
Object.fromEntries([
|
|
5467
5565
|
{
|
|
5468
5566
|
id: "overview",
|
|
@@ -5634,33 +5732,19 @@ Object.fromEntries([
|
|
|
5634
5732
|
function isValuelessField(field) {
|
|
5635
5733
|
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";
|
|
5636
5734
|
}
|
|
5637
|
-
|
|
5638
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5639
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5640
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5641
|
-
*
|
|
5642
|
-
* For each leaf field:
|
|
5643
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5644
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5645
|
-
*
|
|
5646
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5647
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5648
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5649
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5650
|
-
*/
|
|
5651
|
-
function hydrateSchema(schema, values) {
|
|
5735
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5652
5736
|
return {
|
|
5653
5737
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5654
5738
|
sections: schema.sections.map((section) => ({
|
|
5655
5739
|
...section,
|
|
5656
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5740
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5657
5741
|
}))
|
|
5658
5742
|
};
|
|
5659
5743
|
}
|
|
5660
|
-
function hydrateField(field, values) {
|
|
5744
|
+
function hydrateField(field, values, options) {
|
|
5661
5745
|
if (isValuelessField(field)) return field;
|
|
5662
5746
|
if (field.type === "group") {
|
|
5663
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5747
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5664
5748
|
return {
|
|
5665
5749
|
...field,
|
|
5666
5750
|
fields: hydratedChildren
|
|
@@ -5669,7 +5753,7 @@ function hydrateField(field, values) {
|
|
|
5669
5753
|
if (field.type === "sub-tabs") {
|
|
5670
5754
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5671
5755
|
...tab,
|
|
5672
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5756
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5673
5757
|
}));
|
|
5674
5758
|
return {
|
|
5675
5759
|
...field,
|
|
@@ -5679,6 +5763,33 @@ function hydrateField(field, values) {
|
|
|
5679
5763
|
const key = field.key;
|
|
5680
5764
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5681
5765
|
const defaultValue = field.default;
|
|
5766
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5767
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5768
|
+
...field,
|
|
5769
|
+
value: toSecretFieldView(storedValue)
|
|
5770
|
+
};
|
|
5771
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5772
|
+
...field,
|
|
5773
|
+
value: null
|
|
5774
|
+
};
|
|
5775
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5776
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5777
|
+
if (secretItemKeys.length > 0) {
|
|
5778
|
+
const rows = storedValue.map((row) => {
|
|
5779
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5780
|
+
const out = { ...row };
|
|
5781
|
+
for (const k of secretItemKeys) {
|
|
5782
|
+
const v = Reflect.get(row, k);
|
|
5783
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5784
|
+
}
|
|
5785
|
+
return out;
|
|
5786
|
+
});
|
|
5787
|
+
return {
|
|
5788
|
+
...field,
|
|
5789
|
+
value: rows
|
|
5790
|
+
};
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5682
5793
|
if (field.multiple) {
|
|
5683
5794
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5684
5795
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5921,6 +6032,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5921
6032
|
}
|
|
5922
6033
|
return out;
|
|
5923
6034
|
}
|
|
6035
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6036
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6037
|
+
function globalSecretScope() {
|
|
6038
|
+
return GLOBAL_SCOPE;
|
|
6039
|
+
}
|
|
6040
|
+
function encodeSegment(value) {
|
|
6041
|
+
return encodeURIComponent(value);
|
|
6042
|
+
}
|
|
6043
|
+
function decodeSegment(value) {
|
|
6044
|
+
try {
|
|
6045
|
+
return decodeURIComponent(value);
|
|
6046
|
+
} catch {
|
|
6047
|
+
return null;
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6050
|
+
/**
|
|
6051
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6052
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6053
|
+
* `providers[authentik].clientSecret`.
|
|
6054
|
+
*/
|
|
6055
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6056
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6057
|
+
}
|
|
6058
|
+
function parseScope(segments) {
|
|
6059
|
+
switch (segments[0]) {
|
|
6060
|
+
case "global": return {
|
|
6061
|
+
scope: GLOBAL_SCOPE,
|
|
6062
|
+
used: 1
|
|
6063
|
+
};
|
|
6064
|
+
case "node": {
|
|
6065
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6066
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6067
|
+
scope: {
|
|
6068
|
+
kind: "node",
|
|
6069
|
+
nodeId
|
|
6070
|
+
},
|
|
6071
|
+
used: 2
|
|
6072
|
+
};
|
|
6073
|
+
}
|
|
6074
|
+
case "device": {
|
|
6075
|
+
const raw = segments[1];
|
|
6076
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6077
|
+
return {
|
|
6078
|
+
scope: {
|
|
6079
|
+
kind: "device",
|
|
6080
|
+
deviceId: Number(raw)
|
|
6081
|
+
},
|
|
6082
|
+
used: 2
|
|
6083
|
+
};
|
|
6084
|
+
}
|
|
6085
|
+
case "integration": {
|
|
6086
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6087
|
+
return id === null || id.length === 0 ? null : {
|
|
6088
|
+
scope: {
|
|
6089
|
+
kind: "integration",
|
|
6090
|
+
integrationId: id
|
|
6091
|
+
},
|
|
6092
|
+
used: 2
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
case "row": {
|
|
6096
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6097
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6098
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6099
|
+
return {
|
|
6100
|
+
scope: {
|
|
6101
|
+
kind: "row",
|
|
6102
|
+
collection,
|
|
6103
|
+
rowId
|
|
6104
|
+
},
|
|
6105
|
+
used: 3
|
|
6106
|
+
};
|
|
6107
|
+
}
|
|
6108
|
+
default: return null;
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6112
|
+
function parseSecretRef(ref) {
|
|
6113
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6114
|
+
const segments = ref.slice(9).split("/");
|
|
6115
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6116
|
+
if (owner === null || owner.length === 0) return null;
|
|
6117
|
+
const parsed = parseScope(segments.slice(1));
|
|
6118
|
+
if (parsed === null) return null;
|
|
6119
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6120
|
+
if (fieldPath.length === 0) return null;
|
|
6121
|
+
return {
|
|
6122
|
+
owner,
|
|
6123
|
+
scope: parsed.scope,
|
|
6124
|
+
fieldPath
|
|
6125
|
+
};
|
|
6126
|
+
}
|
|
6127
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6128
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6129
|
+
fieldPath;
|
|
6130
|
+
constructor(fieldPath, cause) {
|
|
6131
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6132
|
+
this.fieldPath = fieldPath;
|
|
6133
|
+
this.name = "KeychainWriteRefusedError";
|
|
6134
|
+
}
|
|
6135
|
+
};
|
|
6136
|
+
var KEEP = { kind: "keep" };
|
|
6137
|
+
function isRecord$1$1(value) {
|
|
6138
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6139
|
+
}
|
|
6140
|
+
function defaultMintId() {
|
|
6141
|
+
return globalThis.crypto.randomUUID();
|
|
6142
|
+
}
|
|
6143
|
+
/** Every marker ref anywhere under `value`. */
|
|
6144
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6145
|
+
if (isSecretMarker(value)) {
|
|
6146
|
+
out.push(value.$secret);
|
|
6147
|
+
return out;
|
|
6148
|
+
}
|
|
6149
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6150
|
+
else if (isRecord$1$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6151
|
+
return out;
|
|
6152
|
+
}
|
|
6153
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6154
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6155
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6156
|
+
}
|
|
6157
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6158
|
+
const intent = classifySecretWrite(incoming);
|
|
6159
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6160
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6161
|
+
if (intent.kind === "keep") return KEEP;
|
|
6162
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6163
|
+
if (intent.kind === "clear") {
|
|
6164
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6165
|
+
return {
|
|
6166
|
+
kind: "value",
|
|
6167
|
+
value: null
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6171
|
+
kind: "value",
|
|
6172
|
+
value: stored
|
|
6173
|
+
};
|
|
6174
|
+
try {
|
|
6175
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6176
|
+
} catch (err) {
|
|
6177
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6178
|
+
}
|
|
6179
|
+
return {
|
|
6180
|
+
kind: "value",
|
|
6181
|
+
value: makeSecretMarker(ref)
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6185
|
+
function applyMember(out, key, result, storedParent) {
|
|
6186
|
+
if (result.kind === "value") {
|
|
6187
|
+
out[key] = result.value;
|
|
6188
|
+
return;
|
|
6189
|
+
}
|
|
6190
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6191
|
+
else delete out[key];
|
|
6192
|
+
}
|
|
6193
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6194
|
+
const out = { ...incoming };
|
|
6195
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6196
|
+
return out;
|
|
6197
|
+
}
|
|
6198
|
+
function rowId(row, idKey) {
|
|
6199
|
+
const raw = row[idKey];
|
|
6200
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6201
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6202
|
+
return null;
|
|
6203
|
+
}
|
|
6204
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6205
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1$1) : [];
|
|
6206
|
+
if (!Array.isArray(incoming)) {
|
|
6207
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6208
|
+
return {
|
|
6209
|
+
kind: "value",
|
|
6210
|
+
value: incoming
|
|
6211
|
+
};
|
|
6212
|
+
}
|
|
6213
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6214
|
+
for (const row of storedRows) {
|
|
6215
|
+
const id = rowId(row, node.idKey);
|
|
6216
|
+
if (id !== null) storedById.set(id, row);
|
|
6217
|
+
}
|
|
6218
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6219
|
+
const rows = [];
|
|
6220
|
+
for (const row of incoming) {
|
|
6221
|
+
if (!isRecord$1$1(row)) {
|
|
6222
|
+
rows.push(row);
|
|
6223
|
+
continue;
|
|
6224
|
+
}
|
|
6225
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6226
|
+
kept.add(id);
|
|
6227
|
+
const withId = {
|
|
6228
|
+
...row,
|
|
6229
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6230
|
+
};
|
|
6231
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6232
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6233
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6234
|
+
}
|
|
6235
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6236
|
+
return {
|
|
6237
|
+
kind: "value",
|
|
6238
|
+
value: rows
|
|
6239
|
+
};
|
|
6240
|
+
}
|
|
6241
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6242
|
+
switch (node.kind) {
|
|
6243
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6244
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6245
|
+
case "object": {
|
|
6246
|
+
if (!isRecord$1$1(incoming)) {
|
|
6247
|
+
if (incoming === void 0) return KEEP;
|
|
6248
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6249
|
+
return {
|
|
6250
|
+
kind: "value",
|
|
6251
|
+
value: incoming
|
|
6252
|
+
};
|
|
6253
|
+
}
|
|
6254
|
+
const storedObj = isRecord$1$1(stored) ? stored : {};
|
|
6255
|
+
return {
|
|
6256
|
+
kind: "value",
|
|
6257
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
}
|
|
6262
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6263
|
+
function splitNodeKey(key) {
|
|
6264
|
+
const at = key.indexOf("@");
|
|
6265
|
+
return at <= 0 ? {
|
|
6266
|
+
base: key,
|
|
6267
|
+
nodeId: null
|
|
6268
|
+
} : {
|
|
6269
|
+
base: key.slice(0, at),
|
|
6270
|
+
nodeId: key.slice(at + 1)
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6273
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6274
|
+
async function transformSecretWrite(input) {
|
|
6275
|
+
const deletes = [];
|
|
6276
|
+
const base = {
|
|
6277
|
+
secrets: input.secrets,
|
|
6278
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6279
|
+
deletes,
|
|
6280
|
+
operatorWrite: input.operatorWrite === true
|
|
6281
|
+
};
|
|
6282
|
+
const out = {};
|
|
6283
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6284
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6285
|
+
const node = input.tree.get(baseKey);
|
|
6286
|
+
if (node === void 0) {
|
|
6287
|
+
out[key] = incoming;
|
|
6288
|
+
continue;
|
|
6289
|
+
}
|
|
6290
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6291
|
+
kind: "node",
|
|
6292
|
+
nodeId
|
|
6293
|
+
} : input.scope ?? globalSecretScope();
|
|
6294
|
+
const result = await writeNode({
|
|
6295
|
+
...base,
|
|
6296
|
+
scope
|
|
6297
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6298
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6299
|
+
}
|
|
6300
|
+
return {
|
|
6301
|
+
patch: out,
|
|
6302
|
+
afterWrite: async () => {
|
|
6303
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6304
|
+
try {
|
|
6305
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6306
|
+
return { orphaned: [] };
|
|
6307
|
+
} catch {
|
|
6308
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
};
|
|
6312
|
+
}
|
|
6313
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6314
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6315
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6316
|
+
}
|
|
6317
|
+
/**
|
|
6318
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6319
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6320
|
+
*/
|
|
6321
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6322
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6323
|
+
const owner = options.ownedBy;
|
|
6324
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6325
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6326
|
+
if (refs.length === 0) return {
|
|
6327
|
+
value,
|
|
6328
|
+
unresolved: []
|
|
6329
|
+
};
|
|
6330
|
+
const answers = await secrets.resolve(refs);
|
|
6331
|
+
const unresolved = [];
|
|
6332
|
+
for (const ref of new Set(refs)) {
|
|
6333
|
+
const answer = answers[ref];
|
|
6334
|
+
if (answer === void 0) unresolved.push({
|
|
6335
|
+
ref,
|
|
6336
|
+
reason: "not-initialized"
|
|
6337
|
+
});
|
|
6338
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6339
|
+
ref,
|
|
6340
|
+
reason: answer.reason
|
|
6341
|
+
});
|
|
6342
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6343
|
+
ref,
|
|
6344
|
+
reason: answer.kind
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
const substitute = (v) => {
|
|
6348
|
+
if (isSecretMarker(v)) {
|
|
6349
|
+
if (!inScope(v.$secret)) return {
|
|
6350
|
+
keep: true,
|
|
6351
|
+
value: v
|
|
6352
|
+
};
|
|
6353
|
+
const answer = answers[v.$secret];
|
|
6354
|
+
if (answer?.kind === "value") return {
|
|
6355
|
+
keep: true,
|
|
6356
|
+
value: answer.value
|
|
6357
|
+
};
|
|
6358
|
+
return keepMarker ? {
|
|
6359
|
+
keep: true,
|
|
6360
|
+
value: v
|
|
6361
|
+
} : {
|
|
6362
|
+
keep: false,
|
|
6363
|
+
value: void 0
|
|
6364
|
+
};
|
|
6365
|
+
}
|
|
6366
|
+
if (Array.isArray(v)) {
|
|
6367
|
+
const items = [];
|
|
6368
|
+
for (const item of v) {
|
|
6369
|
+
const s = substitute(item);
|
|
6370
|
+
if (s.keep) items.push(s.value);
|
|
6371
|
+
}
|
|
6372
|
+
return {
|
|
6373
|
+
keep: true,
|
|
6374
|
+
value: items
|
|
6375
|
+
};
|
|
6376
|
+
}
|
|
6377
|
+
if (isRecord$1$1(v)) {
|
|
6378
|
+
const out = {};
|
|
6379
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6380
|
+
const s = substitute(child);
|
|
6381
|
+
if (s.keep) out[k] = s.value;
|
|
6382
|
+
}
|
|
6383
|
+
return {
|
|
6384
|
+
keep: true,
|
|
6385
|
+
value: out
|
|
6386
|
+
};
|
|
6387
|
+
}
|
|
6388
|
+
return {
|
|
6389
|
+
keep: true,
|
|
6390
|
+
value: v
|
|
6391
|
+
};
|
|
6392
|
+
};
|
|
6393
|
+
return {
|
|
6394
|
+
value: substitute(value).value,
|
|
6395
|
+
unresolved
|
|
6396
|
+
};
|
|
6397
|
+
}
|
|
6398
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6399
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6400
|
+
ref;
|
|
6401
|
+
reason;
|
|
6402
|
+
constructor(ref, reason) {
|
|
6403
|
+
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.`);
|
|
6404
|
+
this.ref = ref;
|
|
6405
|
+
this.reason = reason;
|
|
6406
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6407
|
+
}
|
|
6408
|
+
};
|
|
6409
|
+
function isRecord$3(value) {
|
|
6410
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6411
|
+
}
|
|
6412
|
+
function resolvedValue(pass, marker) {
|
|
6413
|
+
const answer = pass.answers[marker.$secret];
|
|
6414
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6415
|
+
}
|
|
6416
|
+
async function atMarker(pass, incoming, stored) {
|
|
6417
|
+
if (incoming === null) return stored;
|
|
6418
|
+
if (typeof incoming !== "string") return incoming;
|
|
6419
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6420
|
+
const intent = classifySecretWrite(incoming);
|
|
6421
|
+
if (intent.kind !== "set") return stored;
|
|
6422
|
+
const ref = stored.$secret;
|
|
6423
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6424
|
+
const answer = pass.answers[ref];
|
|
6425
|
+
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);
|
|
6426
|
+
try {
|
|
6427
|
+
await pass.secrets.put(ref, intent.value);
|
|
6428
|
+
} catch (err) {
|
|
6429
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6430
|
+
}
|
|
6431
|
+
pass.changedRefs.push(ref);
|
|
6432
|
+
return stored;
|
|
6433
|
+
}
|
|
6434
|
+
function inArray(pass, incoming, stored) {
|
|
6435
|
+
return incoming.map((item, index) => {
|
|
6436
|
+
const twin = stored[index];
|
|
6437
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6438
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6439
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6440
|
+
return item;
|
|
6441
|
+
});
|
|
6442
|
+
}
|
|
6443
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6444
|
+
const out = { ...incoming };
|
|
6445
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6446
|
+
const twin = stored[key];
|
|
6447
|
+
if (isSecretMarker(twin)) {
|
|
6448
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6449
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6450
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6451
|
+
}
|
|
6452
|
+
return out;
|
|
6453
|
+
}
|
|
6454
|
+
async function walk(pass, incoming, stored) {
|
|
6455
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6456
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6457
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6458
|
+
const out = { ...incoming };
|
|
6459
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6460
|
+
return out;
|
|
6461
|
+
}
|
|
6462
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6463
|
+
async function restoreUnchangedSecrets(input) {
|
|
6464
|
+
const refs = [];
|
|
6465
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6466
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6467
|
+
if (owned.length === 0) return {
|
|
6468
|
+
patch: input.patch,
|
|
6469
|
+
changedRefs: []
|
|
6470
|
+
};
|
|
6471
|
+
const pass = {
|
|
6472
|
+
secrets: input.secrets,
|
|
6473
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6474
|
+
operatorWrite: input.operatorWrite,
|
|
6475
|
+
changedRefs: []
|
|
6476
|
+
};
|
|
6477
|
+
const out = {};
|
|
6478
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6479
|
+
return {
|
|
6480
|
+
patch: out,
|
|
6481
|
+
changedRefs: pass.changedRefs
|
|
6482
|
+
};
|
|
6483
|
+
}
|
|
6484
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6485
|
+
function isJsonEqual(a, b) {
|
|
6486
|
+
if (Object.is(a, b)) return true;
|
|
6487
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6488
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6489
|
+
const keys = Object.keys(a);
|
|
6490
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6491
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6492
|
+
}
|
|
6493
|
+
return false;
|
|
6494
|
+
}
|
|
6495
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6496
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6497
|
+
const out = {};
|
|
6498
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6499
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6500
|
+
out[key] = value;
|
|
6501
|
+
}
|
|
6502
|
+
return out;
|
|
6503
|
+
}
|
|
6504
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6505
|
+
function markerKeysOf(blob, owner) {
|
|
6506
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6507
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6508
|
+
return keys;
|
|
6509
|
+
}
|
|
6510
|
+
function nodeFromStored(value, owner) {
|
|
6511
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6512
|
+
if (!isRecord$3(value)) return null;
|
|
6513
|
+
const children = /* @__PURE__ */ new Map();
|
|
6514
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6515
|
+
const node = nodeFromStored(child, owner);
|
|
6516
|
+
if (node !== null) children.set(key, node);
|
|
6517
|
+
}
|
|
6518
|
+
return children.size > 0 ? {
|
|
6519
|
+
kind: "object",
|
|
6520
|
+
children
|
|
6521
|
+
} : null;
|
|
6522
|
+
}
|
|
6523
|
+
/**
|
|
6524
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6525
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6526
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6527
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6528
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6529
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6530
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6531
|
+
* over.
|
|
6532
|
+
*/
|
|
6533
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6534
|
+
const added = /* @__PURE__ */ new Map();
|
|
6535
|
+
for (const key of keys) {
|
|
6536
|
+
const at = key.indexOf("@");
|
|
6537
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6538
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6539
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6540
|
+
if (node !== null) added.set(base, node);
|
|
6541
|
+
}
|
|
6542
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6543
|
+
}
|
|
6544
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6545
|
+
async function readStoredAddonBlob(raw) {
|
|
6546
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6547
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6548
|
+
const result = await threeWay.call(raw);
|
|
6549
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6550
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6551
|
+
}
|
|
6552
|
+
function touchesTree(tree, patch) {
|
|
6553
|
+
if (tree.size === 0) return false;
|
|
6554
|
+
for (const key of Object.keys(patch)) {
|
|
6555
|
+
const at = key.indexOf("@");
|
|
6556
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6557
|
+
}
|
|
6558
|
+
return false;
|
|
6559
|
+
}
|
|
6560
|
+
/**
|
|
6561
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6562
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6563
|
+
*/
|
|
6564
|
+
var MarkerKeyIndex = class {
|
|
6565
|
+
owner;
|
|
6566
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6567
|
+
constructor(owner) {
|
|
6568
|
+
this.owner = owner;
|
|
6569
|
+
}
|
|
6570
|
+
seen(store, blob) {
|
|
6571
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6572
|
+
}
|
|
6573
|
+
wrote(store, patch) {
|
|
6574
|
+
const keys = this.byStore.get(store);
|
|
6575
|
+
if (keys === void 0) return;
|
|
6576
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6577
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6578
|
+
else keys.delete(key);
|
|
6579
|
+
}
|
|
6580
|
+
mayHoldMarkers(store, patch) {
|
|
6581
|
+
const keys = this.byStore.get(store);
|
|
6582
|
+
if (keys === void 0) return true;
|
|
6583
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6584
|
+
}
|
|
6585
|
+
};
|
|
6586
|
+
function createHandle(raw, opts) {
|
|
6587
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6588
|
+
const serialize = (key, fn) => {
|
|
6589
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6590
|
+
const tail = next.catch(() => void 0);
|
|
6591
|
+
chains.set(key, tail);
|
|
6592
|
+
tail.then(() => {
|
|
6593
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6594
|
+
});
|
|
6595
|
+
return next;
|
|
6596
|
+
};
|
|
6597
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6598
|
+
const resolveRead = async (store, blob) => {
|
|
6599
|
+
index.seen(store, blob);
|
|
6600
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6601
|
+
unresolved: "keep-marker",
|
|
6602
|
+
ownedBy: opts.secrets.owner
|
|
6603
|
+
});
|
|
6604
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6605
|
+
return value;
|
|
6606
|
+
};
|
|
6607
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6608
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6609
|
+
await rawWrite(patch);
|
|
6610
|
+
index.wrote(store, patch);
|
|
6611
|
+
return { changed: true };
|
|
6612
|
+
}
|
|
6613
|
+
return serialize(store, async () => {
|
|
6614
|
+
const stored = await readStored();
|
|
6615
|
+
index.seen(store, stored);
|
|
6616
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6617
|
+
const restored = await restoreUnchangedSecrets({
|
|
6618
|
+
patch,
|
|
6619
|
+
stored,
|
|
6620
|
+
secrets: opts.secrets,
|
|
6621
|
+
operatorWrite
|
|
6622
|
+
});
|
|
6623
|
+
const result = await transformSecretWrite({
|
|
6624
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6625
|
+
secrets: opts.secrets,
|
|
6626
|
+
patch: restored.patch,
|
|
6627
|
+
stored,
|
|
6628
|
+
...scope !== void 0 ? { scope } : {},
|
|
6629
|
+
operatorWrite
|
|
6630
|
+
});
|
|
6631
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6632
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6633
|
+
if (wroteBlob) {
|
|
6634
|
+
await rawWrite(effective);
|
|
6635
|
+
index.wrote(store, effective);
|
|
6636
|
+
}
|
|
6637
|
+
const { orphaned } = await result.afterWrite();
|
|
6638
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6639
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6640
|
+
});
|
|
6641
|
+
};
|
|
6642
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6643
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6644
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6645
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6646
|
+
const overrides = {
|
|
6647
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6648
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6649
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6650
|
+
return result.kind === "value" ? {
|
|
6651
|
+
kind: "value",
|
|
6652
|
+
value: await resolveRead("addon", result.value)
|
|
6653
|
+
} : result;
|
|
6654
|
+
} } : {},
|
|
6655
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6656
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6657
|
+
if (result.kind !== "present") return result;
|
|
6658
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6659
|
+
unresolved: "keep-marker",
|
|
6660
|
+
ownedBy: opts.secrets.owner
|
|
6661
|
+
});
|
|
6662
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6663
|
+
return {
|
|
6664
|
+
kind: "present",
|
|
6665
|
+
value: value[key]
|
|
6666
|
+
};
|
|
6667
|
+
} } : {},
|
|
6668
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6669
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6670
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6671
|
+
const out = /* @__PURE__ */ new Map();
|
|
6672
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6673
|
+
return out;
|
|
6674
|
+
} } : {},
|
|
6675
|
+
writeAddonStore: async (patch) => {
|
|
6676
|
+
await writeAddon(patch);
|
|
6677
|
+
},
|
|
6678
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6679
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6680
|
+
kind: "device",
|
|
6681
|
+
deviceId
|
|
6682
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6683
|
+
}
|
|
6684
|
+
};
|
|
6685
|
+
return {
|
|
6686
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6687
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6688
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6689
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6690
|
+
} }),
|
|
6691
|
+
raw: {
|
|
6692
|
+
readAddonStore: async () => {
|
|
6693
|
+
const blob = await raw.readAddonStore();
|
|
6694
|
+
index.seen("addon", blob);
|
|
6695
|
+
return blob;
|
|
6696
|
+
},
|
|
6697
|
+
readDeviceStore: async (deviceId) => {
|
|
6698
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6699
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6700
|
+
return blob;
|
|
6701
|
+
}
|
|
6702
|
+
},
|
|
6703
|
+
writeAddonStore: writeAddon
|
|
6704
|
+
};
|
|
6705
|
+
}
|
|
6706
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6707
|
+
function createSecretAwareContext(context, opts) {
|
|
6708
|
+
const raw = context.settings;
|
|
6709
|
+
if (raw === void 0) return {
|
|
6710
|
+
context,
|
|
6711
|
+
handle: null
|
|
6712
|
+
};
|
|
6713
|
+
const handle = createHandle(raw, opts);
|
|
6714
|
+
return {
|
|
6715
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6716
|
+
if (prop === "settings") return handle.settings;
|
|
6717
|
+
return Reflect.get(target, prop, receiver);
|
|
6718
|
+
} }),
|
|
6719
|
+
handle
|
|
6720
|
+
};
|
|
6721
|
+
}
|
|
6722
|
+
var LEAF = { kind: "leaf" };
|
|
6723
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6724
|
+
function collectFields(fields, out) {
|
|
6725
|
+
for (const field of fields) {
|
|
6726
|
+
if (field.type === "group") {
|
|
6727
|
+
collectFields(field.fields, out);
|
|
6728
|
+
continue;
|
|
6729
|
+
}
|
|
6730
|
+
if (field.type === "sub-tabs") {
|
|
6731
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6732
|
+
continue;
|
|
6733
|
+
}
|
|
6734
|
+
if (field.type === "editable-array") {
|
|
6735
|
+
const item = /* @__PURE__ */ new Map();
|
|
6736
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6737
|
+
if (item.size > 0) out.set(field.key, {
|
|
6738
|
+
kind: "array",
|
|
6739
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6740
|
+
item
|
|
6741
|
+
});
|
|
6742
|
+
continue;
|
|
6743
|
+
}
|
|
6744
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6745
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
/** The secret tree a settings schema declares. */
|
|
6749
|
+
function secretTreeFromSchema(schema) {
|
|
6750
|
+
const out = /* @__PURE__ */ new Map();
|
|
6751
|
+
if (schema === null) return out;
|
|
6752
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6753
|
+
return out;
|
|
6754
|
+
}
|
|
6755
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6756
|
+
function parseSecretStatePath(path) {
|
|
6757
|
+
const segments = [];
|
|
6758
|
+
for (const raw of path.split(".")) {
|
|
6759
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6760
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6761
|
+
segments.push(m[2] !== void 0 ? {
|
|
6762
|
+
key: m[1],
|
|
6763
|
+
idKey: m[2]
|
|
6764
|
+
} : { key: m[1] });
|
|
6765
|
+
}
|
|
6766
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6767
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6768
|
+
return segments;
|
|
6769
|
+
}
|
|
6770
|
+
function insert(into, segments) {
|
|
6771
|
+
const [head, ...rest] = segments;
|
|
6772
|
+
if (head === void 0) return;
|
|
6773
|
+
if (rest.length === 0) {
|
|
6774
|
+
into.set(head.key, LEAF);
|
|
6775
|
+
return;
|
|
6776
|
+
}
|
|
6777
|
+
const existing = into.get(head.key);
|
|
6778
|
+
if (head.idKey !== void 0) {
|
|
6779
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6780
|
+
insert(item, rest);
|
|
6781
|
+
into.set(head.key, {
|
|
6782
|
+
kind: "array",
|
|
6783
|
+
idKey: head.idKey,
|
|
6784
|
+
item
|
|
6785
|
+
});
|
|
6786
|
+
return;
|
|
6787
|
+
}
|
|
6788
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6789
|
+
insert(children, rest);
|
|
6790
|
+
into.set(head.key, {
|
|
6791
|
+
kind: "object",
|
|
6792
|
+
children
|
|
6793
|
+
});
|
|
6794
|
+
}
|
|
6795
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6796
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6797
|
+
if (paths.length === 0) return tree;
|
|
6798
|
+
const out = new Map(tree);
|
|
6799
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6800
|
+
return out;
|
|
6801
|
+
}
|
|
6802
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6803
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6804
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6805
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6806
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5924
6807
|
/**
|
|
5925
6808
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5926
6809
|
*
|
|
@@ -5990,6 +6873,33 @@ var BaseAddon = class {
|
|
|
5990
6873
|
settingsStoreReady = false;
|
|
5991
6874
|
/** Default config values. Provided via constructor. */
|
|
5992
6875
|
defaults;
|
|
6876
|
+
/**
|
|
6877
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6878
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6879
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6880
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6881
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6882
|
+
*/
|
|
6883
|
+
secretStatePaths = [];
|
|
6884
|
+
_addonSecretTree = null;
|
|
6885
|
+
_deviceSecretTree = null;
|
|
6886
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6887
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6888
|
+
_unresolvedSecrets = [];
|
|
6889
|
+
_secretRetryTimer = null;
|
|
6890
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6891
|
+
_secretChangeTimer = null;
|
|
6892
|
+
_secretChangeUnsub = null;
|
|
6893
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6894
|
+
_operatorWriteDepth = 0;
|
|
6895
|
+
/**
|
|
6896
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6897
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6898
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6899
|
+
*/
|
|
6900
|
+
_secretSettings = null;
|
|
6901
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6902
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
5993
6903
|
constructor(defaults) {
|
|
5994
6904
|
this.defaults = defaults;
|
|
5995
6905
|
this._config = { ...defaults };
|
|
@@ -6025,8 +6935,26 @@ var BaseAddon = class {
|
|
|
6025
6935
|
return this._config;
|
|
6026
6936
|
}
|
|
6027
6937
|
async initialize(context) {
|
|
6028
|
-
|
|
6938
|
+
const secrets = context.secrets;
|
|
6939
|
+
if (secrets !== void 0) {
|
|
6940
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6941
|
+
secrets,
|
|
6942
|
+
addonTree: () => this.addonSecretTree(),
|
|
6943
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6944
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6945
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6946
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6947
|
+
});
|
|
6948
|
+
this._ctx = wrapped;
|
|
6949
|
+
this._secretSettings = handle;
|
|
6950
|
+
} else {
|
|
6951
|
+
this._ctx = context;
|
|
6952
|
+
this._secretSettings = null;
|
|
6953
|
+
}
|
|
6029
6954
|
await this.resolveConfig();
|
|
6955
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6956
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6957
|
+
});
|
|
6030
6958
|
const result = await this.onInitialize();
|
|
6031
6959
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6032
6960
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6059,6 +6987,12 @@ var BaseAddon = class {
|
|
|
6059
6987
|
*/
|
|
6060
6988
|
async onHubReachable() {}
|
|
6061
6989
|
async shutdown() {
|
|
6990
|
+
this._secretChangeUnsub?.();
|
|
6991
|
+
this._secretChangeUnsub = null;
|
|
6992
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6993
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6994
|
+
this._secretRetryTimer = null;
|
|
6995
|
+
this._secretChangeTimer = null;
|
|
6062
6996
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6063
6997
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6064
6998
|
await this.onShutdown();
|
|
@@ -6133,11 +7067,8 @@ var BaseAddon = class {
|
|
|
6133
7067
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6134
7068
|
const schema = this.globalSettingsSchema(cap);
|
|
6135
7069
|
if (!schema) return { sections: [] };
|
|
6136
|
-
const projected = await this.
|
|
6137
|
-
return hydrateSchema(schema, overlay ? {
|
|
6138
|
-
...projected,
|
|
6139
|
-
...overlay
|
|
6140
|
-
} : projected);
|
|
7070
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7071
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6141
7072
|
}
|
|
6142
7073
|
/**
|
|
6143
7074
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6182,11 +7113,11 @@ var BaseAddon = class {
|
|
|
6182
7113
|
});
|
|
6183
7114
|
}
|
|
6184
7115
|
if (sections.length === 0) return null;
|
|
6185
|
-
const projected = await this.
|
|
7116
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6186
7117
|
return hydrateSchema({
|
|
6187
7118
|
...schema,
|
|
6188
7119
|
sections
|
|
6189
|
-
}, projected);
|
|
7120
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6190
7121
|
}
|
|
6191
7122
|
/**
|
|
6192
7123
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6199,12 +7130,50 @@ var BaseAddon = class {
|
|
|
6199
7130
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6200
7131
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6201
7132
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7133
|
+
*
|
|
7134
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7135
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7136
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7137
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7138
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7139
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6202
7140
|
*/
|
|
6203
7141
|
async resolveGlobalStore(nodeId, cap) {
|
|
6204
7142
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7143
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7144
|
+
}
|
|
7145
|
+
projectForNode(store, nodeId, cap) {
|
|
6205
7146
|
const keys = this.perNodeKeys(cap);
|
|
6206
7147
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6207
|
-
return keys.size > 0 ? projectStore(
|
|
7148
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7149
|
+
}
|
|
7150
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7151
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7152
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7153
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7154
|
+
}
|
|
7155
|
+
/**
|
|
7156
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7157
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7158
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7159
|
+
* its value.
|
|
7160
|
+
*/
|
|
7161
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7162
|
+
const secrets = this._ctx?.secrets;
|
|
7163
|
+
const merged = {
|
|
7164
|
+
...stored,
|
|
7165
|
+
...overlay
|
|
7166
|
+
};
|
|
7167
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7168
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7169
|
+
unresolved: "keep-marker",
|
|
7170
|
+
ownedBy: secrets.owner
|
|
7171
|
+
});
|
|
7172
|
+
for (const key of Object.keys(overlay)) {
|
|
7173
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7174
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7175
|
+
}
|
|
7176
|
+
return merged;
|
|
6208
7177
|
}
|
|
6209
7178
|
/**
|
|
6210
7179
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6240,18 +7209,58 @@ var BaseAddon = class {
|
|
|
6240
7209
|
value: result.value[key]
|
|
6241
7210
|
};
|
|
6242
7211
|
}
|
|
7212
|
+
/**
|
|
7213
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7214
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7215
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7216
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7217
|
+
* writing back what it read is not (D787).
|
|
7218
|
+
*/
|
|
7219
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7220
|
+
this._operatorWriteDepth++;
|
|
7221
|
+
try {
|
|
7222
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7223
|
+
} finally {
|
|
7224
|
+
this._operatorWriteDepth--;
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
6243
7227
|
async updateGlobalSettings(patch, nodeId) {
|
|
7228
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7229
|
+
}
|
|
7230
|
+
/**
|
|
7231
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7232
|
+
*
|
|
7233
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7234
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7235
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7236
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7237
|
+
*/
|
|
7238
|
+
async clearSecrets(keys, nodeId) {
|
|
7239
|
+
const tree = this.addonSecretTree();
|
|
7240
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7241
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7242
|
+
const patch = {};
|
|
7243
|
+
for (const key of keys) {
|
|
7244
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7245
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7246
|
+
}
|
|
7247
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7248
|
+
}
|
|
7249
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6244
7250
|
const keys = this.perNodeKeys();
|
|
6245
7251
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6246
7252
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6247
|
-
const barePatch = patch;
|
|
6248
7253
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6249
|
-
|
|
7254
|
+
const handle = this._secretSettings;
|
|
7255
|
+
if (handle !== null) {
|
|
7256
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7257
|
+
if (!changed) return;
|
|
7258
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6250
7259
|
if (target !== localNode) return;
|
|
6251
7260
|
await this.resolveConfig();
|
|
6252
7261
|
await this.onConfigChanged();
|
|
6253
7262
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6254
|
-
this.maybeAutoRestart(
|
|
7263
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6255
7264
|
}
|
|
6256
7265
|
/**
|
|
6257
7266
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6276,7 +7285,7 @@ var BaseAddon = class {
|
|
|
6276
7285
|
* time to return its response before the addon is torn down and
|
|
6277
7286
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6278
7287
|
*/
|
|
6279
|
-
maybeAutoRestart(
|
|
7288
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6280
7289
|
if (!schema) return;
|
|
6281
7290
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6282
7291
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6284,13 +7293,13 @@ var BaseAddon = class {
|
|
|
6284
7293
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6285
7294
|
}
|
|
6286
7295
|
if (restartKeys.size === 0) return;
|
|
6287
|
-
if (!
|
|
7296
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6288
7297
|
const ctx = this._ctx;
|
|
6289
7298
|
if (!ctx) return;
|
|
6290
7299
|
const addonId = ctx.id;
|
|
6291
7300
|
setImmediate(() => {
|
|
6292
7301
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6293
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7302
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6294
7303
|
}).catch((err) => {
|
|
6295
7304
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6296
7305
|
});
|
|
@@ -6299,7 +7308,7 @@ var BaseAddon = class {
|
|
|
6299
7308
|
async getDeviceSettings(deviceId) {
|
|
6300
7309
|
const schema = this.deviceSettingsSchema();
|
|
6301
7310
|
if (!schema) return { sections: [] };
|
|
6302
|
-
return hydrateSchema(schema, await this.
|
|
7311
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6303
7312
|
}
|
|
6304
7313
|
async updateDeviceSettings(deviceId, patch) {
|
|
6305
7314
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6429,7 +7438,7 @@ var BaseAddon = class {
|
|
|
6429
7438
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6430
7439
|
*/
|
|
6431
7440
|
async resolveConfig() {
|
|
6432
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7441
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6433
7442
|
const perNode = this.perNodeKeys();
|
|
6434
7443
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6435
7444
|
const resolved = { ...this.defaults };
|
|
@@ -6454,7 +7463,7 @@ var BaseAddon = class {
|
|
|
6454
7463
|
key,
|
|
6455
7464
|
schema,
|
|
6456
7465
|
fallback,
|
|
6457
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7466
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6458
7467
|
write: async (patch) => {
|
|
6459
7468
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6460
7469
|
},
|
|
@@ -6471,7 +7480,7 @@ var BaseAddon = class {
|
|
|
6471
7480
|
key,
|
|
6472
7481
|
schema,
|
|
6473
7482
|
fallback,
|
|
6474
|
-
read: async () => await this.
|
|
7483
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6475
7484
|
write: async (patch) => {
|
|
6476
7485
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6477
7486
|
},
|
|
@@ -6483,6 +7492,87 @@ var BaseAddon = class {
|
|
|
6483
7492
|
} })
|
|
6484
7493
|
});
|
|
6485
7494
|
}
|
|
7495
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7496
|
+
addonSecretTree() {
|
|
7497
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7498
|
+
return this._addonSecretTree;
|
|
7499
|
+
}
|
|
7500
|
+
deviceSecretTree() {
|
|
7501
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7502
|
+
return this._deviceSecretTree;
|
|
7503
|
+
}
|
|
7504
|
+
/**
|
|
7505
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7506
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7507
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7508
|
+
* than start on an empty credential.
|
|
7509
|
+
*/
|
|
7510
|
+
get unresolvedSecrets() {
|
|
7511
|
+
return this._unresolvedSecrets;
|
|
7512
|
+
}
|
|
7513
|
+
/**
|
|
7514
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7515
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7516
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7517
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7518
|
+
* ever written back from here.
|
|
7519
|
+
*/
|
|
7520
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7521
|
+
const secrets = this._ctx?.secrets;
|
|
7522
|
+
if (secrets === void 0) return blob;
|
|
7523
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7524
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7525
|
+
if (refs.length === 0) {
|
|
7526
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7527
|
+
return blob;
|
|
7528
|
+
}
|
|
7529
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7530
|
+
if (trackForConfig) {
|
|
7531
|
+
this._unresolvedSecrets = unresolved;
|
|
7532
|
+
if (unresolved.length > 0) {
|
|
7533
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7534
|
+
ref: u.ref,
|
|
7535
|
+
reason: u.reason
|
|
7536
|
+
})) } });
|
|
7537
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7538
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7539
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7540
|
+
}
|
|
7541
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7542
|
+
}
|
|
7543
|
+
return value;
|
|
7544
|
+
}
|
|
7545
|
+
/**
|
|
7546
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7547
|
+
* keychain the context's own view is already raw.
|
|
7548
|
+
*/
|
|
7549
|
+
rawSettings() {
|
|
7550
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7551
|
+
}
|
|
7552
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7553
|
+
logUnresolvedRead(unresolved) {
|
|
7554
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7555
|
+
if (fresh.length === 0) return;
|
|
7556
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7557
|
+
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) => ({
|
|
7558
|
+
ref: u.ref,
|
|
7559
|
+
reason: u.reason
|
|
7560
|
+
})) } });
|
|
7561
|
+
}
|
|
7562
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7563
|
+
scheduleSecretReresolve(delayMs) {
|
|
7564
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7565
|
+
if (this[timerOf] !== null) return;
|
|
7566
|
+
const timer = setTimeout(() => {
|
|
7567
|
+
this[timerOf] = null;
|
|
7568
|
+
if (this._ctx === null) return;
|
|
7569
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7570
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7571
|
+
});
|
|
7572
|
+
}, delayMs);
|
|
7573
|
+
timer.unref?.();
|
|
7574
|
+
this[timerOf] = timer;
|
|
7575
|
+
}
|
|
6486
7576
|
/**
|
|
6487
7577
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6488
7578
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6495,7 +7585,7 @@ var BaseAddon = class {
|
|
|
6495
7585
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6496
7586
|
*/
|
|
6497
7587
|
async readAddonStoreWithRetry() {
|
|
6498
|
-
const settings = this.
|
|
7588
|
+
const settings = this.rawSettings();
|
|
6499
7589
|
if (!settings) return {};
|
|
6500
7590
|
const delaysMs = [
|
|
6501
7591
|
150,
|
|
@@ -7058,6 +8148,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7058
8148
|
kind: "mutation",
|
|
7059
8149
|
auth: "admin"
|
|
7060
8150
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8151
|
+
function defOf(schema) {
|
|
8152
|
+
return schema._zod?.def ?? {};
|
|
8153
|
+
}
|
|
8154
|
+
function declaredHere(schema) {
|
|
8155
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8156
|
+
}
|
|
8157
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8158
|
+
var WRAPPERS = new Set([
|
|
8159
|
+
"optional",
|
|
8160
|
+
"nullable",
|
|
8161
|
+
"default",
|
|
8162
|
+
"prefault",
|
|
8163
|
+
"catch",
|
|
8164
|
+
"readonly",
|
|
8165
|
+
"nonoptional"
|
|
8166
|
+
]);
|
|
8167
|
+
/**
|
|
8168
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8169
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8170
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8171
|
+
* `.transform` on `in`).
|
|
8172
|
+
*/
|
|
8173
|
+
function layersOf(schema) {
|
|
8174
|
+
const out = [];
|
|
8175
|
+
const queue = [schema];
|
|
8176
|
+
while (queue.length > 0) {
|
|
8177
|
+
const s = queue.shift();
|
|
8178
|
+
if (!s || out.includes(s)) continue;
|
|
8179
|
+
out.push(s);
|
|
8180
|
+
const def = defOf(s);
|
|
8181
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8182
|
+
if (def.type === "pipe") {
|
|
8183
|
+
if (def.in) queue.push(def.in);
|
|
8184
|
+
if (def.out) queue.push(def.out);
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8187
|
+
return out;
|
|
8188
|
+
}
|
|
8189
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8190
|
+
function isZodSecret(schema) {
|
|
8191
|
+
return layersOf(schema).some(declaredHere);
|
|
8192
|
+
}
|
|
8193
|
+
/**
|
|
8194
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8195
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8196
|
+
* object or array is reported as one path and not descended into — everything
|
|
8197
|
+
* under it is secret.
|
|
8198
|
+
*/
|
|
8199
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8200
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8201
|
+
const paths = [];
|
|
8202
|
+
for (const layer of layersOf(schema)) {
|
|
8203
|
+
const def = defOf(layer);
|
|
8204
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8205
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8206
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8207
|
+
else if (def.type === "intersection") {
|
|
8208
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8209
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8210
|
+
}
|
|
8211
|
+
}
|
|
8212
|
+
return [...new Set(paths)];
|
|
8213
|
+
}
|
|
7061
8214
|
//#endregion
|
|
7062
8215
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7063
8216
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8745,6 +9898,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8745
9898
|
fetchedAt: number()
|
|
8746
9899
|
});
|
|
8747
9900
|
/**
|
|
9901
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9902
|
+
* gets back (cloud training, D805+).
|
|
9903
|
+
*
|
|
9904
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9905
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9906
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9907
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9908
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9909
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9910
|
+
* change there, in the same piece of work.
|
|
9911
|
+
*
|
|
9912
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9913
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9914
|
+
*/
|
|
9915
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9916
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9917
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9918
|
+
var TrainingExportSchema = _enum([
|
|
9919
|
+
"onnx",
|
|
9920
|
+
"openvino-fp16",
|
|
9921
|
+
"openvino-int8",
|
|
9922
|
+
"coreml-fp16"
|
|
9923
|
+
]);
|
|
9924
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9925
|
+
object({
|
|
9926
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9927
|
+
jobKey: string().uuid(),
|
|
9928
|
+
target: object({
|
|
9929
|
+
kind: literal("detector"),
|
|
9930
|
+
step: literal("object-detection")
|
|
9931
|
+
}),
|
|
9932
|
+
base: object({
|
|
9933
|
+
modelId: string().min(1),
|
|
9934
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9935
|
+
weights: string().min(1),
|
|
9936
|
+
imgsz: number().int().positive()
|
|
9937
|
+
}),
|
|
9938
|
+
baseline: object({
|
|
9939
|
+
modelId: string().min(1),
|
|
9940
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9941
|
+
onnxUrl: string().url(),
|
|
9942
|
+
imgsz: number().int().positive(),
|
|
9943
|
+
floors: FloorsSchema
|
|
9944
|
+
}),
|
|
9945
|
+
dataset: object({
|
|
9946
|
+
versionId: string().min(1),
|
|
9947
|
+
annotationHash: string(),
|
|
9948
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9949
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9950
|
+
}),
|
|
9951
|
+
split: object({
|
|
9952
|
+
holdoutCameras: array(number().int()),
|
|
9953
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9954
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9955
|
+
valFraction: number().min(0).max(.5),
|
|
9956
|
+
seed: number().int()
|
|
9957
|
+
}),
|
|
9958
|
+
hyper: object({
|
|
9959
|
+
epochs: number().int().positive(),
|
|
9960
|
+
batch: number().int().positive(),
|
|
9961
|
+
lr0: number().positive(),
|
|
9962
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9963
|
+
freeze: number().int().nonnegative(),
|
|
9964
|
+
patience: number().int().nonnegative(),
|
|
9965
|
+
seed: number().int()
|
|
9966
|
+
}),
|
|
9967
|
+
replay: object({
|
|
9968
|
+
source: literal("coco2017"),
|
|
9969
|
+
count: number().int().nonnegative()
|
|
9970
|
+
}),
|
|
9971
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9972
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9973
|
+
floors: object({
|
|
9974
|
+
minSupport: number().int().positive(),
|
|
9975
|
+
clamp: number().min(0).max(1)
|
|
9976
|
+
}),
|
|
9977
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9978
|
+
catalog: object({
|
|
9979
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9980
|
+
name: string().min(1).max(160)
|
|
9981
|
+
})
|
|
9982
|
+
});
|
|
9983
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9984
|
+
var TrainingResultFileSchema = object({
|
|
9985
|
+
path: string().min(1),
|
|
9986
|
+
bytes: number().int().nonnegative(),
|
|
9987
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9988
|
+
format: _enum([
|
|
9989
|
+
"onnx",
|
|
9990
|
+
"openvino",
|
|
9991
|
+
"coreml",
|
|
9992
|
+
"pt"
|
|
9993
|
+
]),
|
|
9994
|
+
variant: _enum(["base", "int8"])
|
|
9995
|
+
});
|
|
9996
|
+
var DraftFormatSchema = object({
|
|
9997
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9998
|
+
url: string().min(1),
|
|
9999
|
+
sizeMB: number().nonnegative(),
|
|
10000
|
+
isDirectory: boolean().optional(),
|
|
10001
|
+
files: array(string()).optional(),
|
|
10002
|
+
runtimes: array(literal("python")).optional(),
|
|
10003
|
+
revision: string().min(1)
|
|
10004
|
+
});
|
|
10005
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10006
|
+
var TrainingCatalogDraftSchema = object({
|
|
10007
|
+
id: string().min(1),
|
|
10008
|
+
name: string().min(1),
|
|
10009
|
+
description: string(),
|
|
10010
|
+
labels: array(unknown()),
|
|
10011
|
+
inputSize: object({
|
|
10012
|
+
width: number().int().positive(),
|
|
10013
|
+
height: number().int().positive()
|
|
10014
|
+
}),
|
|
10015
|
+
preprocessMode: literal("letterbox"),
|
|
10016
|
+
defaultClassFloors: FloorsSchema,
|
|
10017
|
+
formats: object({
|
|
10018
|
+
onnx: DraftFormatSchema.optional(),
|
|
10019
|
+
openvino: DraftFormatSchema.optional(),
|
|
10020
|
+
coreml: DraftFormatSchema.optional()
|
|
10021
|
+
})
|
|
10022
|
+
});
|
|
10023
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10024
|
+
var TrainingEvalClassSchema = object({
|
|
10025
|
+
positives: number().int(),
|
|
10026
|
+
floor: number().nullable(),
|
|
10027
|
+
tp: number().int(),
|
|
10028
|
+
fp: number().int(),
|
|
10029
|
+
fn: number().int(),
|
|
10030
|
+
precision: number().nullable(),
|
|
10031
|
+
recall: number().nullable(),
|
|
10032
|
+
ap50: number().nullable(),
|
|
10033
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10034
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10035
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10036
|
+
smallFound: number().int().optional(),
|
|
10037
|
+
smallTotal: number().int().optional()
|
|
10038
|
+
}).passthrough();
|
|
10039
|
+
var TrainingEvalReportSchema = object({
|
|
10040
|
+
frames: number().int(),
|
|
10041
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10042
|
+
}).passthrough();
|
|
10043
|
+
/**
|
|
10044
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10045
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10046
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10047
|
+
*/
|
|
10048
|
+
var TrainingResultSchema = object({
|
|
10049
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10050
|
+
jobKey: string(),
|
|
10051
|
+
status: _enum(["succeeded", "failed"]),
|
|
10052
|
+
error: object({
|
|
10053
|
+
stage: string(),
|
|
10054
|
+
code: string(),
|
|
10055
|
+
message: string()
|
|
10056
|
+
}).nullable(),
|
|
10057
|
+
trainer: object({
|
|
10058
|
+
version: string(),
|
|
10059
|
+
revision: string()
|
|
10060
|
+
}),
|
|
10061
|
+
toolchain: record(string(), string().nullable()),
|
|
10062
|
+
dataset: object({
|
|
10063
|
+
versionId: string(),
|
|
10064
|
+
annotationHash: string(),
|
|
10065
|
+
sha256: string(),
|
|
10066
|
+
frames: object({
|
|
10067
|
+
train: number().int(),
|
|
10068
|
+
val: number().int(),
|
|
10069
|
+
holdout: number().int()
|
|
10070
|
+
}),
|
|
10071
|
+
holdoutCameras: array(number().int()),
|
|
10072
|
+
replayImages: number().int()
|
|
10073
|
+
}).optional(),
|
|
10074
|
+
training: object({
|
|
10075
|
+
epochsRun: number().int(),
|
|
10076
|
+
bestEpoch: number().int(),
|
|
10077
|
+
bestMap50: number(),
|
|
10078
|
+
bestMap50_95: number(),
|
|
10079
|
+
seconds: number()
|
|
10080
|
+
}).optional(),
|
|
10081
|
+
evaluation: object({
|
|
10082
|
+
holdoutFrames: number().int(),
|
|
10083
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10084
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10085
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10086
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10087
|
+
map50: record(string(), number().nullable())
|
|
10088
|
+
}).optional(),
|
|
10089
|
+
floors: object({
|
|
10090
|
+
baseline: FloorsSchema,
|
|
10091
|
+
candidate: FloorsSchema,
|
|
10092
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10093
|
+
notes: array(string())
|
|
10094
|
+
}).optional(),
|
|
10095
|
+
int8: object({
|
|
10096
|
+
kept: boolean(),
|
|
10097
|
+
map50Fp16: number().nullable(),
|
|
10098
|
+
map50Int8: number().nullable(),
|
|
10099
|
+
reason: string().nullable()
|
|
10100
|
+
}).optional(),
|
|
10101
|
+
exportsDropped: array(object({
|
|
10102
|
+
export: string(),
|
|
10103
|
+
reason: string()
|
|
10104
|
+
})).optional(),
|
|
10105
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10106
|
+
bundle: object({
|
|
10107
|
+
path: literal("bundle.tar"),
|
|
10108
|
+
bytes: number().int().nonnegative(),
|
|
10109
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10110
|
+
}).nullable().optional(),
|
|
10111
|
+
catalogDraft: object({
|
|
10112
|
+
base: TrainingCatalogDraftSchema,
|
|
10113
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10114
|
+
}).nullable().optional(),
|
|
10115
|
+
licence: string()
|
|
10116
|
+
});
|
|
10117
|
+
var TrainingStageSchema = _enum([
|
|
10118
|
+
"prepare",
|
|
10119
|
+
"replay",
|
|
10120
|
+
"train",
|
|
10121
|
+
"eval",
|
|
10122
|
+
"export",
|
|
10123
|
+
"package"
|
|
10124
|
+
]);
|
|
10125
|
+
var EventBase = {
|
|
10126
|
+
v: literal(1),
|
|
10127
|
+
ts: number()
|
|
10128
|
+
};
|
|
10129
|
+
discriminatedUnion("type", [
|
|
10130
|
+
object({
|
|
10131
|
+
...EventBase,
|
|
10132
|
+
type: literal("stage"),
|
|
10133
|
+
stage: TrainingStageSchema
|
|
10134
|
+
}),
|
|
10135
|
+
object({
|
|
10136
|
+
...EventBase,
|
|
10137
|
+
type: literal("epoch"),
|
|
10138
|
+
epoch: number().int(),
|
|
10139
|
+
epochs: number().int(),
|
|
10140
|
+
boxLoss: number().nullable().optional(),
|
|
10141
|
+
map50: number().nullable().optional(),
|
|
10142
|
+
map50_95: number().nullable().optional(),
|
|
10143
|
+
etaSec: number().nullable().optional()
|
|
10144
|
+
}),
|
|
10145
|
+
object({
|
|
10146
|
+
...EventBase,
|
|
10147
|
+
type: literal("metric"),
|
|
10148
|
+
name: string(),
|
|
10149
|
+
value: number()
|
|
10150
|
+
}),
|
|
10151
|
+
object({
|
|
10152
|
+
...EventBase,
|
|
10153
|
+
type: literal("artifact"),
|
|
10154
|
+
path: string(),
|
|
10155
|
+
bytes: number(),
|
|
10156
|
+
sha256: string()
|
|
10157
|
+
}),
|
|
10158
|
+
object({
|
|
10159
|
+
...EventBase,
|
|
10160
|
+
type: literal("done"),
|
|
10161
|
+
status: _enum(["succeeded", "failed"]),
|
|
10162
|
+
resultSha256: string().nullable().optional()
|
|
10163
|
+
}),
|
|
10164
|
+
object({
|
|
10165
|
+
...EventBase,
|
|
10166
|
+
type: literal("error"),
|
|
10167
|
+
stage: string(),
|
|
10168
|
+
code: string(),
|
|
10169
|
+
message: string()
|
|
10170
|
+
})
|
|
10171
|
+
]);
|
|
10172
|
+
/**
|
|
8748
10173
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8749
10174
|
*
|
|
8750
10175
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11072,7 +12497,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11072
12497
|
"authenticated",
|
|
11073
12498
|
"admin"
|
|
11074
12499
|
]).optional(),
|
|
11075
|
-
description: string().optional()
|
|
12500
|
+
description: string().optional(),
|
|
12501
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12502
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11076
12503
|
});
|
|
11077
12504
|
/**
|
|
11078
12505
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11777,6 +13204,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11777
13204
|
lastError: string().optional()
|
|
11778
13205
|
});
|
|
11779
13206
|
/**
|
|
13207
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13208
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13209
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13210
|
+
* with it off — which restores without a key.
|
|
13211
|
+
*/
|
|
13212
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13213
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13214
|
+
scheme: string(),
|
|
13215
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13216
|
+
keyId: string()
|
|
13217
|
+
});
|
|
13218
|
+
/**
|
|
13219
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13220
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13221
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13222
|
+
*/
|
|
13223
|
+
var BackupEncryptionStatusSchema = object({
|
|
13224
|
+
enabled: boolean(),
|
|
13225
|
+
active: object({
|
|
13226
|
+
keyId: string(),
|
|
13227
|
+
publicKey: string(),
|
|
13228
|
+
createdAt: number()
|
|
13229
|
+
}).nullable(),
|
|
13230
|
+
/** Every key ever set up, newest first. */
|
|
13231
|
+
keys: array(object({
|
|
13232
|
+
keyId: string(),
|
|
13233
|
+
createdAt: number(),
|
|
13234
|
+
retiredAt: number().nullable()
|
|
13235
|
+
})).readonly()
|
|
13236
|
+
});
|
|
13237
|
+
/**
|
|
11780
13238
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11781
13239
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11782
13240
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11788,7 +13246,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11788
13246
|
sizeBytes: number(),
|
|
11789
13247
|
label: string().optional(),
|
|
11790
13248
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11791
|
-
locations: array(string()).readonly()
|
|
13249
|
+
locations: array(string()).readonly(),
|
|
13250
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13251
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11792
13252
|
});
|
|
11793
13253
|
var BackupEntrySchema = object({
|
|
11794
13254
|
id: string(),
|
|
@@ -11797,7 +13257,8 @@ var BackupEntrySchema = object({
|
|
|
11797
13257
|
label: string().optional(),
|
|
11798
13258
|
createdAt: number(),
|
|
11799
13259
|
sizeBytes: number(),
|
|
11800
|
-
locations: array(string()).optional()
|
|
13260
|
+
locations: array(string()).optional(),
|
|
13261
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11801
13262
|
});
|
|
11802
13263
|
var ArchiveEntrySchema = object({
|
|
11803
13264
|
path: string(),
|
|
@@ -11986,10 +13447,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
11986
13447
|
* this list and skips entries whose path doesn't start with
|
|
11987
13448
|
* any of them.
|
|
11988
13449
|
*/
|
|
11989
|
-
locations: array(string()).optional()
|
|
13450
|
+
locations: array(string()).optional(),
|
|
13451
|
+
/**
|
|
13452
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13453
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13454
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13455
|
+
* is refused before the archive is downloaded.
|
|
13456
|
+
*/
|
|
13457
|
+
backupSecretKey: string().optional()
|
|
11990
13458
|
}), _void(), {
|
|
11991
13459
|
kind: "mutation",
|
|
11992
13460
|
auth: "admin"
|
|
13461
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13462
|
+
keyId: string(),
|
|
13463
|
+
secretKey: string(),
|
|
13464
|
+
publicKey: string(),
|
|
13465
|
+
createdAt: number(),
|
|
13466
|
+
replacedKeyId: string().nullable()
|
|
13467
|
+
}), {
|
|
13468
|
+
kind: "mutation",
|
|
13469
|
+
auth: "admin"
|
|
13470
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13471
|
+
kind: "mutation",
|
|
13472
|
+
auth: "admin"
|
|
13473
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13474
|
+
valid: boolean(),
|
|
13475
|
+
keyId: string().nullable(),
|
|
13476
|
+
/** The hub knows this key (active or retired). */
|
|
13477
|
+
known: boolean(),
|
|
13478
|
+
/** It is the key new archives are encrypted to. */
|
|
13479
|
+
active: boolean(),
|
|
13480
|
+
error: string().optional()
|
|
13481
|
+
}), {
|
|
13482
|
+
kind: "mutation",
|
|
13483
|
+
auth: "admin"
|
|
11993
13484
|
}), method(object({
|
|
11994
13485
|
destinationId: string(),
|
|
11995
13486
|
backupId: string()
|
|
@@ -13715,7 +15206,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13715
15206
|
stepId: string(),
|
|
13716
15207
|
entry: ModelCatalogEntrySchema
|
|
13717
15208
|
});
|
|
13718
|
-
|
|
15209
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15210
|
+
var ModelBundleFileSchema = object({
|
|
15211
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15212
|
+
path: string().min(1),
|
|
15213
|
+
bytes: number().int().nonnegative(),
|
|
15214
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15215
|
+
});
|
|
15216
|
+
var ImportModelBundleInputSchema = object({
|
|
15217
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15218
|
+
addonId: string(),
|
|
15219
|
+
stepId: string().min(1),
|
|
15220
|
+
/**
|
|
15221
|
+
* The catalog rows to register, complete, every format URL already
|
|
15222
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15223
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15224
|
+
*/
|
|
15225
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15226
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15227
|
+
bundle: object({
|
|
15228
|
+
ticket: PeerBytesTicketSchema,
|
|
15229
|
+
bytes: number().int().positive(),
|
|
15230
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15231
|
+
}),
|
|
15232
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15233
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15234
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15235
|
+
distribute: boolean()
|
|
15236
|
+
});
|
|
15237
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15238
|
+
kind: literal("imported"),
|
|
15239
|
+
modelIds: array(string()).readonly(),
|
|
15240
|
+
distributed: array(object({
|
|
15241
|
+
modelId: string(),
|
|
15242
|
+
nodeId: string(),
|
|
15243
|
+
format: _enum(MODEL_FORMATS),
|
|
15244
|
+
ok: boolean(),
|
|
15245
|
+
error: string().optional()
|
|
15246
|
+
})).readonly()
|
|
15247
|
+
}), object({
|
|
15248
|
+
kind: literal("refused"),
|
|
15249
|
+
reason: _enum([
|
|
15250
|
+
"transfer-failed",
|
|
15251
|
+
"checksum-mismatch",
|
|
15252
|
+
"bundle-mismatch",
|
|
15253
|
+
"invalid-entry",
|
|
15254
|
+
"id-taken"
|
|
15255
|
+
]),
|
|
15256
|
+
detail: string()
|
|
15257
|
+
})]);
|
|
15258
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15259
|
+
kind: "mutation",
|
|
15260
|
+
auth: "admin",
|
|
15261
|
+
timeoutMs: 30 * 6e4
|
|
15262
|
+
});
|
|
13719
15263
|
/**
|
|
13720
15264
|
* Query filter for settings-store collections.
|
|
13721
15265
|
*/
|
|
@@ -14098,6 +15642,253 @@ id: union([string(), number()]) }), {
|
|
|
14098
15642
|
kind: "mutation",
|
|
14099
15643
|
auth: "admin"
|
|
14100
15644
|
});
|
|
15645
|
+
/**
|
|
15646
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15647
|
+
*
|
|
15648
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15649
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15650
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15651
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15652
|
+
* against the CALLER, never against anything the caller claims.
|
|
15653
|
+
*
|
|
15654
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15655
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15656
|
+
* connection, the agent from its child's connection carried in
|
|
15657
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15658
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15659
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15660
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15661
|
+
* runner is the same OS user): see the threat model in
|
|
15662
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15663
|
+
*
|
|
15664
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15665
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15666
|
+
* floors every method to admin anyway (D240).
|
|
15667
|
+
*
|
|
15668
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15669
|
+
*/
|
|
15670
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15671
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15672
|
+
"key-missing",
|
|
15673
|
+
"wrong-key",
|
|
15674
|
+
"key-file-unreadable",
|
|
15675
|
+
"store-unavailable",
|
|
15676
|
+
"not-initialized",
|
|
15677
|
+
"decrypt-failed"
|
|
15678
|
+
]);
|
|
15679
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15680
|
+
state: literal("locked"),
|
|
15681
|
+
reason: KeychainUnavailableReasonSchema
|
|
15682
|
+
})]);
|
|
15683
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15684
|
+
object({
|
|
15685
|
+
kind: literal("value"),
|
|
15686
|
+
value: string(),
|
|
15687
|
+
version: number().int()
|
|
15688
|
+
}),
|
|
15689
|
+
object({ kind: literal("missing") }),
|
|
15690
|
+
object({
|
|
15691
|
+
kind: literal("unavailable"),
|
|
15692
|
+
reason: KeychainUnavailableReasonSchema
|
|
15693
|
+
}),
|
|
15694
|
+
object({ kind: literal("forbidden") })
|
|
15695
|
+
]);
|
|
15696
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15697
|
+
/** Metadata of one stored value — never the value. */
|
|
15698
|
+
var KeychainSecretMetaSchema = object({
|
|
15699
|
+
ref: string(),
|
|
15700
|
+
owner: string(),
|
|
15701
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15702
|
+
scope: string(),
|
|
15703
|
+
fieldPath: string(),
|
|
15704
|
+
version: number().int(),
|
|
15705
|
+
createdAt: number(),
|
|
15706
|
+
updatedAt: number(),
|
|
15707
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15708
|
+
updatedBy: string(),
|
|
15709
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15710
|
+
lastReadAt: number().nullable()
|
|
15711
|
+
});
|
|
15712
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15713
|
+
method(object({
|
|
15714
|
+
ref: string().min(1),
|
|
15715
|
+
value: string().min(1)
|
|
15716
|
+
}), object({
|
|
15717
|
+
ref: string(),
|
|
15718
|
+
version: number().int()
|
|
15719
|
+
}), {
|
|
15720
|
+
kind: "mutation",
|
|
15721
|
+
auth: "admin"
|
|
15722
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15723
|
+
kind: "mutation",
|
|
15724
|
+
auth: "admin"
|
|
15725
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15726
|
+
var KeychainKeySourceSchema = object({
|
|
15727
|
+
kind: _enum([
|
|
15728
|
+
"config-file",
|
|
15729
|
+
"previous-config-file",
|
|
15730
|
+
"platform",
|
|
15731
|
+
"default-file"
|
|
15732
|
+
]),
|
|
15733
|
+
/** File sources only — a path is not a secret. */
|
|
15734
|
+
path: string().optional(),
|
|
15735
|
+
/**
|
|
15736
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15737
|
+
* next to the database it protects (the default file). The page warns.
|
|
15738
|
+
*/
|
|
15739
|
+
sharesBackupWithDatabase: boolean()
|
|
15740
|
+
});
|
|
15741
|
+
/**
|
|
15742
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15743
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15744
|
+
*/
|
|
15745
|
+
var KeychainResetRecordSchema = object({
|
|
15746
|
+
id: string(),
|
|
15747
|
+
at: number(),
|
|
15748
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15749
|
+
actor: string(),
|
|
15750
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15751
|
+
lockedReason: string().nullable(),
|
|
15752
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15753
|
+
archived: number().int(),
|
|
15754
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15755
|
+
archivedCollection: string().nullable(),
|
|
15756
|
+
/**
|
|
15757
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15758
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15759
|
+
*/
|
|
15760
|
+
archivedKeysCollection: string().nullable(),
|
|
15761
|
+
/**
|
|
15762
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15763
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15764
|
+
* agent forever (D797).
|
|
15765
|
+
*/
|
|
15766
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15767
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15768
|
+
acknowledgedAt: number().nullable()
|
|
15769
|
+
});
|
|
15770
|
+
var KeychainStatusSchema = object({
|
|
15771
|
+
keychain: KeychainStateSchema,
|
|
15772
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15773
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15774
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15775
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15776
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15777
|
+
fingerprint: string().nullable(),
|
|
15778
|
+
activeKeyId: string().nullable(),
|
|
15779
|
+
/**
|
|
15780
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15781
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15782
|
+
*/
|
|
15783
|
+
rotationPending: boolean(),
|
|
15784
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15785
|
+
retiredWraps: number().int(),
|
|
15786
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15787
|
+
secretCount: number().int(),
|
|
15788
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15789
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15790
|
+
});
|
|
15791
|
+
/**
|
|
15792
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15793
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15794
|
+
* never reported as an orphan (and never deleted as one).
|
|
15795
|
+
*/
|
|
15796
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15797
|
+
"in-use",
|
|
15798
|
+
"orphan",
|
|
15799
|
+
"unknown"
|
|
15800
|
+
]);
|
|
15801
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15802
|
+
var KeychainAuditActionSchema = _enum([
|
|
15803
|
+
"put",
|
|
15804
|
+
"delete",
|
|
15805
|
+
"reveal",
|
|
15806
|
+
"rotate-master-key",
|
|
15807
|
+
"purge-retired-keys",
|
|
15808
|
+
"download-recovery-key",
|
|
15809
|
+
"delete-orphans",
|
|
15810
|
+
"reset",
|
|
15811
|
+
"acknowledge-reset",
|
|
15812
|
+
"initialize"
|
|
15813
|
+
]);
|
|
15814
|
+
var KeychainAuditEntrySchema = object({
|
|
15815
|
+
id: string(),
|
|
15816
|
+
at: number(),
|
|
15817
|
+
action: KeychainAuditActionSchema,
|
|
15818
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15819
|
+
actor: string(),
|
|
15820
|
+
ref: string().nullable(),
|
|
15821
|
+
detail: string().nullable()
|
|
15822
|
+
});
|
|
15823
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15824
|
+
/**
|
|
15825
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15826
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15827
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15828
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15829
|
+
*/
|
|
15830
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15831
|
+
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({
|
|
15832
|
+
value: string(),
|
|
15833
|
+
version: number().int()
|
|
15834
|
+
}), {
|
|
15835
|
+
kind: "mutation",
|
|
15836
|
+
auth: "admin",
|
|
15837
|
+
caller: "required"
|
|
15838
|
+
}), method(object({
|
|
15839
|
+
name: SystemHeldSecretNameSchema,
|
|
15840
|
+
value: string().min(16)
|
|
15841
|
+
}), object({
|
|
15842
|
+
ref: string(),
|
|
15843
|
+
version: number().int()
|
|
15844
|
+
}), {
|
|
15845
|
+
kind: "mutation",
|
|
15846
|
+
auth: "admin",
|
|
15847
|
+
caller: "required"
|
|
15848
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15849
|
+
deleted: array(string()).readonly(),
|
|
15850
|
+
kept: array(object({
|
|
15851
|
+
ref: string(),
|
|
15852
|
+
usage: KeychainSecretUsageSchema
|
|
15853
|
+
})).readonly()
|
|
15854
|
+
}), {
|
|
15855
|
+
kind: "mutation",
|
|
15856
|
+
auth: "admin",
|
|
15857
|
+
caller: "required"
|
|
15858
|
+
}), method(object({}), object({
|
|
15859
|
+
fingerprint: string(),
|
|
15860
|
+
keySource: KeychainKeySourceSchema
|
|
15861
|
+
}), {
|
|
15862
|
+
kind: "mutation",
|
|
15863
|
+
auth: "admin",
|
|
15864
|
+
caller: "required"
|
|
15865
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15866
|
+
kind: "mutation",
|
|
15867
|
+
auth: "admin",
|
|
15868
|
+
caller: "required"
|
|
15869
|
+
}), method(object({}), object({
|
|
15870
|
+
key: string(),
|
|
15871
|
+
fingerprint: string(),
|
|
15872
|
+
keySource: KeychainKeySourceSchema
|
|
15873
|
+
}), {
|
|
15874
|
+
kind: "mutation",
|
|
15875
|
+
auth: "admin",
|
|
15876
|
+
caller: "required"
|
|
15877
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15878
|
+
archivedCollection: string().nullable(),
|
|
15879
|
+
archived: number().int()
|
|
15880
|
+
}), {
|
|
15881
|
+
kind: "mutation",
|
|
15882
|
+
auth: "admin",
|
|
15883
|
+
caller: "required"
|
|
15884
|
+
}), method(object({}), object({
|
|
15885
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15886
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15887
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15888
|
+
kind: "mutation",
|
|
15889
|
+
auth: "admin",
|
|
15890
|
+
caller: "required"
|
|
15891
|
+
});
|
|
14101
15892
|
method(_void(), object({
|
|
14102
15893
|
id: string(),
|
|
14103
15894
|
name: string(),
|
|
@@ -15436,7 +17227,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15436
17227
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15437
17228
|
var DevicePersistConfigPayloadSchema = object({
|
|
15438
17229
|
deviceId: number(),
|
|
15439
|
-
data: record(string(), unknown())
|
|
17230
|
+
data: record(string(), unknown()),
|
|
17231
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17232
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17233
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17234
|
+
secretConfigPaths: array(string()).optional()
|
|
15440
17235
|
});
|
|
15441
17236
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15442
17237
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17039,7 +18834,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17039
18834
|
* `login-method` — collection cap through which auth addons contribute
|
|
17040
18835
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17041
18836
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17042
|
-
* every auth addon (OIDC,
|
|
18837
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
17043
18838
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17044
18839
|
* procedure aggregates them for the unauthenticated login page.
|
|
17045
18840
|
*
|
|
@@ -17047,8 +18842,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17047
18842
|
*
|
|
17048
18843
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
17049
18844
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17050
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
17051
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18845
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17052
18846
|
* login page needs NO change.
|
|
17053
18847
|
*
|
|
17054
18848
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -17067,8 +18861,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
17067
18861
|
* decision.
|
|
17068
18862
|
*
|
|
17069
18863
|
* Every contribution carries a `stage`:
|
|
17070
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
17071
|
-
*
|
|
18864
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18865
|
+
* buttons; a usernameless passkey).
|
|
17072
18866
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17073
18867
|
* returned `factors` (passkey-as-2FA today).
|
|
17074
18868
|
*
|
|
@@ -17095,7 +18889,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17095
18889
|
* The provider names an external identity a signed-in user can link to
|
|
17096
18890
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17097
18891
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17098
|
-
* whatever their id. Absent / false — a login button only
|
|
18892
|
+
* whatever their id. Absent / false — a login button only.
|
|
17099
18893
|
*/
|
|
17100
18894
|
linkable: boolean().optional()
|
|
17101
18895
|
}),
|
|
@@ -20950,8 +22744,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20950
22744
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20951
22745
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20952
22746
|
* distinction was only ever used to route role-specific procedures
|
|
20953
|
-
* which we no longer have.
|
|
20954
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22747
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20955
22748
|
* with `isAdmin: false` + an explicit scope list.
|
|
20956
22749
|
*/
|
|
20957
22750
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22453,8 +24246,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22453
24246
|
]);
|
|
22454
24247
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22455
24248
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22456
|
-
/**
|
|
22457
|
-
|
|
24249
|
+
/**
|
|
24250
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24251
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24252
|
+
*
|
|
24253
|
+
* - `operator` — drawn by hand.
|
|
24254
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24255
|
+
* model, or a larger teacher model).
|
|
24256
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24257
|
+
* back from the track store (never a re-run).
|
|
24258
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24259
|
+
*/
|
|
24260
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24261
|
+
"operator",
|
|
24262
|
+
"assist",
|
|
24263
|
+
"pipeline",
|
|
24264
|
+
"llm"
|
|
24265
|
+
]);
|
|
22458
24266
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22459
24267
|
var RetrainBboxSchema = object({
|
|
22460
24268
|
x: number(),
|
|
@@ -22472,7 +24280,8 @@ var RetrainBboxSchema = object({
|
|
|
22472
24280
|
*/
|
|
22473
24281
|
var RetrainAnnotationSchema = object({
|
|
22474
24282
|
id: string(),
|
|
22475
|
-
|
|
24283
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24284
|
+
trackId: string().optional(),
|
|
22476
24285
|
deviceId: number(),
|
|
22477
24286
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22478
24287
|
mediaKey: string(),
|
|
@@ -22521,13 +24330,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22521
24330
|
* fail, whatever became of the original. */
|
|
22522
24331
|
copied: boolean()
|
|
22523
24332
|
});
|
|
24333
|
+
/**
|
|
24334
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24335
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24336
|
+
* box recorded on the source media row when there is one, else the track
|
|
24337
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24338
|
+
* until the operator confirms it.
|
|
24339
|
+
*/
|
|
24340
|
+
var RetrainPipelineBoxSchema = object({
|
|
24341
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24342
|
+
bbox: RetrainBboxSchema,
|
|
24343
|
+
macroClass: RetrainMacroClassSchema,
|
|
24344
|
+
label: string().optional(),
|
|
24345
|
+
subLabel: string().optional(),
|
|
24346
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24347
|
+
score: number().optional(),
|
|
24348
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24349
|
+
modelId: string().optional(),
|
|
24350
|
+
trackId: string(),
|
|
24351
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24352
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24353
|
+
basis: _enum(["subject-box", "position"]),
|
|
24354
|
+
deltaMs: number()
|
|
24355
|
+
});
|
|
24356
|
+
/**
|
|
24357
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24358
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24359
|
+
* track at all.
|
|
24360
|
+
*/
|
|
24361
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22524
24362
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22525
24363
|
var RetrainFrameSchema = object({
|
|
22526
24364
|
frameId: string(),
|
|
22527
24365
|
deviceId: number(),
|
|
22528
|
-
|
|
22529
|
-
/**
|
|
22530
|
-
|
|
24366
|
+
origin: RetrainFrameOriginSchema,
|
|
24367
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24368
|
+
trackId: string().optional(),
|
|
24369
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24370
|
+
* Absent on a recording still. */
|
|
24371
|
+
sourceMediaId: number().int().optional(),
|
|
24372
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24373
|
+
epochMs: number().optional(),
|
|
22531
24374
|
sourceKind: MediaFileKindEnum,
|
|
22532
24375
|
sizeBytes: number().int(),
|
|
22533
24376
|
width: number().int(),
|
|
@@ -22538,7 +24381,12 @@ var RetrainFrameSchema = object({
|
|
|
22538
24381
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22539
24382
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22540
24383
|
* a false positive. */
|
|
22541
|
-
complete: boolean()
|
|
24384
|
+
complete: boolean(),
|
|
24385
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24386
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24387
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24388
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24389
|
+
collectionIds: array(string()).readonly().optional()
|
|
22542
24390
|
});
|
|
22543
24391
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22544
24392
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22569,6 +24417,11 @@ var RetrainFrameListSchema = object({
|
|
|
22569
24417
|
var RetrainExportFilterSchema = object({
|
|
22570
24418
|
deviceIds: array(number()).optional(),
|
|
22571
24419
|
frameIds: array(string()).max(2e4).optional(),
|
|
24420
|
+
/** Only frames in at least one of these named collections. */
|
|
24421
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24422
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24423
|
+
* unknown id selects nothing. */
|
|
24424
|
+
datasetVersionId: string().optional(),
|
|
22572
24425
|
batchId: string().optional(),
|
|
22573
24426
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22574
24427
|
completeOnly: boolean().optional()
|
|
@@ -22633,6 +24486,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22633
24486
|
reason: string(),
|
|
22634
24487
|
detail: string().optional()
|
|
22635
24488
|
})]);
|
|
24489
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24490
|
+
var RetrainCollectionSchema = object({
|
|
24491
|
+
id: string(),
|
|
24492
|
+
name: string(),
|
|
24493
|
+
createdAt: number(),
|
|
24494
|
+
frameCount: number().int()
|
|
24495
|
+
});
|
|
24496
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24497
|
+
kind: literal("created"),
|
|
24498
|
+
collection: RetrainCollectionSchema
|
|
24499
|
+
}), object({
|
|
24500
|
+
kind: literal("refused"),
|
|
24501
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24502
|
+
})]);
|
|
24503
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24504
|
+
kind: literal("renamed"),
|
|
24505
|
+
collection: RetrainCollectionSchema
|
|
24506
|
+
}), object({
|
|
24507
|
+
kind: literal("refused"),
|
|
24508
|
+
reason: _enum([
|
|
24509
|
+
"empty-name",
|
|
24510
|
+
"duplicate-name",
|
|
24511
|
+
"unknown-collection"
|
|
24512
|
+
])
|
|
24513
|
+
})]);
|
|
24514
|
+
/**
|
|
24515
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24516
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24517
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24518
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24519
|
+
*/
|
|
24520
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24521
|
+
kind: literal("added"),
|
|
24522
|
+
collectionId: string(),
|
|
24523
|
+
frame: RetrainFrameSchema,
|
|
24524
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24525
|
+
reused: boolean()
|
|
24526
|
+
}), object({
|
|
24527
|
+
kind: literal("refused"),
|
|
24528
|
+
reason: _enum([
|
|
24529
|
+
"unknown-collection",
|
|
24530
|
+
"still-unavailable",
|
|
24531
|
+
"still-busy",
|
|
24532
|
+
"unreadable-image",
|
|
24533
|
+
"write-failed"
|
|
24534
|
+
]),
|
|
24535
|
+
detail: string().optional()
|
|
24536
|
+
})]);
|
|
24537
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24538
|
+
var RetrainAssistProfileSchema = object({
|
|
24539
|
+
id: string(),
|
|
24540
|
+
name: string(),
|
|
24541
|
+
model: string(),
|
|
24542
|
+
kind: string(),
|
|
24543
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24544
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24545
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24546
|
+
leavesHouse: boolean()
|
|
24547
|
+
});
|
|
24548
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24549
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24550
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24551
|
+
var RetrainLlmReviewSchema = object({
|
|
24552
|
+
/** The `ref` the page sent the box under. */
|
|
24553
|
+
ref: string(),
|
|
24554
|
+
verdict: _enum([
|
|
24555
|
+
"confirmed",
|
|
24556
|
+
"wrong-class",
|
|
24557
|
+
"not-an-object",
|
|
24558
|
+
"uncertain"
|
|
24559
|
+
]),
|
|
24560
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24561
|
+
reason: string()
|
|
24562
|
+
});
|
|
24563
|
+
/**
|
|
24564
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24565
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24566
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24567
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24568
|
+
*/
|
|
24569
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24570
|
+
kind: literal("proposed"),
|
|
24571
|
+
profileId: string(),
|
|
24572
|
+
model: string(),
|
|
24573
|
+
/** The frame was sent outside the house for this answer. */
|
|
24574
|
+
leftHouse: boolean(),
|
|
24575
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24576
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24577
|
+
rejected: number().int()
|
|
24578
|
+
}), object({
|
|
24579
|
+
kind: literal("refused"),
|
|
24580
|
+
reason: _enum([
|
|
24581
|
+
"unknown-frame",
|
|
24582
|
+
"unreadable-frame",
|
|
24583
|
+
"unknown-profile",
|
|
24584
|
+
"profile-disabled",
|
|
24585
|
+
"no-vision",
|
|
24586
|
+
"cloud-not-confirmed",
|
|
24587
|
+
"llm-error",
|
|
24588
|
+
"malformed-answer"
|
|
24589
|
+
]),
|
|
24590
|
+
detail: string().optional()
|
|
24591
|
+
})]);
|
|
24592
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24593
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24594
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24595
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24596
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24597
|
+
});
|
|
24598
|
+
/** The counts a dataset is judged by. */
|
|
24599
|
+
var RetrainDatasetStatsSchema = object({
|
|
24600
|
+
frames: number().int(),
|
|
24601
|
+
completeFrames: number().int(),
|
|
24602
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24603
|
+
completeness: number(),
|
|
24604
|
+
/** Boxes to learn (model errors excluded). */
|
|
24605
|
+
subjects: number().int(),
|
|
24606
|
+
modelErrors: number().int(),
|
|
24607
|
+
/** Complete frames with no subject. */
|
|
24608
|
+
hardNegatives: number().int(),
|
|
24609
|
+
/** Subjects per class × camera × day/night. */
|
|
24610
|
+
cells: array(object({
|
|
24611
|
+
macroClass: string(),
|
|
24612
|
+
deviceId: number(),
|
|
24613
|
+
lighting: _enum([
|
|
24614
|
+
"day",
|
|
24615
|
+
"night",
|
|
24616
|
+
"unknown"
|
|
24617
|
+
]),
|
|
24618
|
+
subjects: number().int(),
|
|
24619
|
+
frames: number().int()
|
|
24620
|
+
})).readonly(),
|
|
24621
|
+
cameras: array(object({
|
|
24622
|
+
deviceId: number(),
|
|
24623
|
+
frames: number().int(),
|
|
24624
|
+
completeFrames: number().int()
|
|
24625
|
+
})).readonly()
|
|
24626
|
+
});
|
|
24627
|
+
/** An immutable dataset version, without its frame list. */
|
|
24628
|
+
var RetrainDatasetVersionSchema = object({
|
|
24629
|
+
id: string(),
|
|
24630
|
+
name: string(),
|
|
24631
|
+
createdAt: number(),
|
|
24632
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24633
|
+
layout: RetrainExportLayoutSchema,
|
|
24634
|
+
completeOnly: boolean(),
|
|
24635
|
+
frameCount: number().int(),
|
|
24636
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24637
|
+
annotationHash: string(),
|
|
24638
|
+
/** The export manifest schema the version was cut under. */
|
|
24639
|
+
manifestSchema: string(),
|
|
24640
|
+
stats: RetrainDatasetStatsSchema
|
|
24641
|
+
});
|
|
24642
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24643
|
+
kind: literal("created"),
|
|
24644
|
+
version: RetrainDatasetVersionSchema
|
|
24645
|
+
}), object({
|
|
24646
|
+
kind: literal("refused"),
|
|
24647
|
+
reason: _enum([
|
|
24648
|
+
"empty-name",
|
|
24649
|
+
"duplicate-name",
|
|
24650
|
+
"no-frames"
|
|
24651
|
+
])
|
|
24652
|
+
})]);
|
|
22636
24653
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22637
24654
|
var RetrainTransitionResultSchema = object({
|
|
22638
24655
|
trackId: string(),
|
|
@@ -23350,7 +25367,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23350
25367
|
auth: "admin"
|
|
23351
25368
|
}), method(object({
|
|
23352
25369
|
deviceId: number(),
|
|
23353
|
-
trackId: string(),
|
|
25370
|
+
trackId: string().optional(),
|
|
23354
25371
|
frameId: string()
|
|
23355
25372
|
}), object({
|
|
23356
25373
|
removed: boolean(),
|
|
@@ -23367,7 +25384,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23367
25384
|
auth: "admin"
|
|
23368
25385
|
}), method(object({
|
|
23369
25386
|
deviceId: number(),
|
|
23370
|
-
|
|
25387
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25388
|
+
trackId: string().optional(),
|
|
23371
25389
|
frameId: string(),
|
|
23372
25390
|
subject: RetrainAssistSubjectSchema,
|
|
23373
25391
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23375,12 +25393,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23375
25393
|
}), RetrainAssistResultSchema, {
|
|
23376
25394
|
kind: "mutation",
|
|
23377
25395
|
auth: "admin"
|
|
23378
|
-
}), method(object({
|
|
25396
|
+
}), method(object({
|
|
25397
|
+
trackId: string().optional(),
|
|
25398
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25399
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23379
25400
|
kind: "query",
|
|
23380
25401
|
auth: "admin"
|
|
23381
25402
|
}), method(object({
|
|
23382
25403
|
deviceId: number(),
|
|
23383
|
-
|
|
25404
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25405
|
+
trackId: string().optional(),
|
|
23384
25406
|
frameId: string(),
|
|
23385
25407
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23386
25408
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23403,7 +25425,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23403
25425
|
auth: "admin"
|
|
23404
25426
|
}), method(object({
|
|
23405
25427
|
deviceId: number(),
|
|
23406
|
-
trackId: string(),
|
|
25428
|
+
trackId: string().optional(),
|
|
23407
25429
|
frameId: string(),
|
|
23408
25430
|
complete: boolean()
|
|
23409
25431
|
}), RetrainFrameSchema, {
|
|
@@ -23417,6 +25439,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23417
25439
|
kind: "mutation",
|
|
23418
25440
|
auth: "admin",
|
|
23419
25441
|
timeoutMs: 60 * 6e4
|
|
25442
|
+
}), method(object({
|
|
25443
|
+
filter: RetrainExportFilterSchema,
|
|
25444
|
+
layout: RetrainExportLayoutSchema
|
|
25445
|
+
}), object({
|
|
25446
|
+
ticket: PeerBytesTicketSchema,
|
|
25447
|
+
frames: number().int(),
|
|
25448
|
+
annotations: number().int()
|
|
25449
|
+
}), {
|
|
25450
|
+
kind: "mutation",
|
|
25451
|
+
auth: "admin",
|
|
25452
|
+
timeoutMs: 12e4
|
|
25453
|
+
}), method(object({
|
|
25454
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25455
|
+
completeOnly: boolean().optional()
|
|
25456
|
+
}), RetrainDatasetStatsSchema, {
|
|
25457
|
+
kind: "query",
|
|
25458
|
+
auth: "admin"
|
|
25459
|
+
}), method(object({
|
|
25460
|
+
name: string().max(120),
|
|
25461
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25462
|
+
layout: RetrainExportLayoutSchema,
|
|
25463
|
+
completeOnly: boolean()
|
|
25464
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25465
|
+
kind: "mutation",
|
|
25466
|
+
auth: "admin",
|
|
25467
|
+
timeoutMs: 12e4
|
|
25468
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25469
|
+
kind: "query",
|
|
25470
|
+
auth: "admin"
|
|
25471
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25472
|
+
kind: "mutation",
|
|
25473
|
+
auth: "admin"
|
|
25474
|
+
}), method(object({ id: string() }), object({
|
|
25475
|
+
found: boolean(),
|
|
25476
|
+
annotationHash: string(),
|
|
25477
|
+
matches: boolean(),
|
|
25478
|
+
missingFrames: number().int()
|
|
25479
|
+
}), {
|
|
25480
|
+
kind: "query",
|
|
25481
|
+
auth: "admin",
|
|
25482
|
+
timeoutMs: 12e4
|
|
25483
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25484
|
+
kind: "query",
|
|
25485
|
+
auth: "admin"
|
|
25486
|
+
}), method(object({
|
|
25487
|
+
deviceId: number(),
|
|
25488
|
+
trackId: string().optional(),
|
|
25489
|
+
frameId: string(),
|
|
25490
|
+
profileId: string(),
|
|
25491
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25492
|
+
boxes: array(object({
|
|
25493
|
+
ref: string(),
|
|
25494
|
+
bbox: RetrainBboxSchema,
|
|
25495
|
+
macroClass: RetrainMacroClassSchema,
|
|
25496
|
+
label: string().optional()
|
|
25497
|
+
})).max(50),
|
|
25498
|
+
allowCloud: boolean()
|
|
25499
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25500
|
+
kind: "mutation",
|
|
25501
|
+
auth: "admin",
|
|
25502
|
+
timeoutMs: 18e4
|
|
25503
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25504
|
+
kind: "mutation",
|
|
25505
|
+
auth: "admin"
|
|
25506
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25507
|
+
kind: "query",
|
|
25508
|
+
auth: "admin"
|
|
25509
|
+
}), method(object({
|
|
25510
|
+
id: string(),
|
|
25511
|
+
name: string().max(120)
|
|
25512
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25513
|
+
kind: "mutation",
|
|
25514
|
+
auth: "admin"
|
|
25515
|
+
}), method(object({ id: string() }), object({
|
|
25516
|
+
deleted: boolean(),
|
|
25517
|
+
removedFrames: number().int()
|
|
25518
|
+
}), {
|
|
25519
|
+
kind: "mutation",
|
|
25520
|
+
auth: "admin"
|
|
25521
|
+
}), method(object({
|
|
25522
|
+
collectionId: string(),
|
|
25523
|
+
deviceId: number(),
|
|
25524
|
+
epochMs: number()
|
|
25525
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25526
|
+
kind: "mutation",
|
|
25527
|
+
auth: "admin",
|
|
25528
|
+
timeoutMs: 6e4
|
|
25529
|
+
}), method(object({
|
|
25530
|
+
collectionId: string(),
|
|
25531
|
+
frameIds: array(string()).min(1).max(500)
|
|
25532
|
+
}), object({
|
|
25533
|
+
added: number().int(),
|
|
25534
|
+
alreadyMember: number().int(),
|
|
25535
|
+
unknownFrameIds: array(string()).readonly()
|
|
25536
|
+
}), {
|
|
25537
|
+
kind: "mutation",
|
|
25538
|
+
auth: "admin"
|
|
25539
|
+
}), method(object({
|
|
25540
|
+
collectionId: string(),
|
|
25541
|
+
frameId: string()
|
|
25542
|
+
}), object({
|
|
25543
|
+
removed: boolean(),
|
|
25544
|
+
deletedFrame: boolean()
|
|
25545
|
+
}), {
|
|
25546
|
+
kind: "mutation",
|
|
25547
|
+
auth: "admin"
|
|
25548
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25549
|
+
kind: "query",
|
|
25550
|
+
auth: "admin"
|
|
23420
25551
|
}), method(object({
|
|
23421
25552
|
/** Which of the three event tables owns the row. */
|
|
23422
25553
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -24040,13 +26171,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24040
26171
|
object({
|
|
24041
26172
|
kind: literal("no-family-build"),
|
|
24042
26173
|
format: ModelFormatSchema$1
|
|
26174
|
+
}),
|
|
26175
|
+
object({
|
|
26176
|
+
kind: literal("kept-custom-pin"),
|
|
26177
|
+
modelId: string(),
|
|
26178
|
+
deviceKey: string()
|
|
24043
26179
|
})
|
|
24044
26180
|
]);
|
|
26181
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26182
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26183
|
+
/**
|
|
26184
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26185
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26186
|
+
*/
|
|
26187
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26188
|
+
kind: literal("node-benchmark"),
|
|
26189
|
+
resultId: string(),
|
|
26190
|
+
measuredAtMs: number()
|
|
26191
|
+
})]);
|
|
24045
26192
|
var DeviceModelChoiceSchema = object({
|
|
24046
26193
|
modelId: string(),
|
|
24047
26194
|
p50Ms: number(),
|
|
24048
26195
|
fps: number(),
|
|
24049
26196
|
measured: boolean(),
|
|
26197
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26198
|
+
source: LatencySourceSchema.optional(),
|
|
24050
26199
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24051
26200
|
capacitySessions: number(),
|
|
24052
26201
|
personRecall: number()
|
|
@@ -24057,6 +26206,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24057
26206
|
enabled: boolean(),
|
|
24058
26207
|
available: boolean(),
|
|
24059
26208
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26209
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26210
|
+
kept: KeptReasonSchema.optional(),
|
|
24060
26211
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24061
26212
|
});
|
|
24062
26213
|
var NodeRecommendationSchema = object({
|
|
@@ -24110,6 +26261,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24110
26261
|
kind: literal("coral-enabled"),
|
|
24111
26262
|
nodeId: string(),
|
|
24112
26263
|
deviceKey: string()
|
|
26264
|
+
}),
|
|
26265
|
+
object({
|
|
26266
|
+
kind: literal("custom-pin-kept"),
|
|
26267
|
+
nodeId: string(),
|
|
26268
|
+
deviceKey: string().nullable(),
|
|
26269
|
+
deviceId: number().nullable(),
|
|
26270
|
+
modelId: string()
|
|
26271
|
+
}),
|
|
26272
|
+
object({
|
|
26273
|
+
kind: literal("custom-registry-unreadable"),
|
|
26274
|
+
error: string()
|
|
24113
26275
|
})
|
|
24114
26276
|
]);
|
|
24115
26277
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24288,13 +26450,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24288
26450
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24289
26451
|
});
|
|
24290
26452
|
/**
|
|
24291
|
-
* Where the node and device shares come from (D750, D755).
|
|
24292
|
-
* - `
|
|
24293
|
-
*
|
|
24294
|
-
*
|
|
24295
|
-
*
|
|
24296
|
-
*
|
|
24297
|
-
*
|
|
26453
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26454
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26455
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26456
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26457
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26458
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26459
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26460
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24298
26461
|
* - `manual` — the operator's stored sliders.
|
|
24299
26462
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24300
26463
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24343,6 +26506,362 @@ var EffectiveSharesSchema = object({
|
|
|
24343
26506
|
nodeWeights: record(string(), number()),
|
|
24344
26507
|
deviceWeights: record(string(), record(string(), number()))
|
|
24345
26508
|
});
|
|
26509
|
+
/**
|
|
26510
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26511
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26512
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26513
|
+
* shares read.
|
|
26514
|
+
*
|
|
26515
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26516
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26517
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26518
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26519
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26520
|
+
*
|
|
26521
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26522
|
+
* cross a process at frame rate, D9):
|
|
26523
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26524
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26525
|
+
* interval;
|
|
26526
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26527
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26528
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26529
|
+
* CPU, RAM or the event loop give out.
|
|
26530
|
+
*/
|
|
26531
|
+
/** Defaults and bounds, one place. */
|
|
26532
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26533
|
+
fpsPerStream: 10,
|
|
26534
|
+
budgetMinutes: 45,
|
|
26535
|
+
minBudgetMinutes: 10,
|
|
26536
|
+
maxBudgetMinutes: 120,
|
|
26537
|
+
/** A result older than this no longer beats the table. */
|
|
26538
|
+
staleAfterDays: 30,
|
|
26539
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26540
|
+
settleSec: 5,
|
|
26541
|
+
/** Accounted window per ramp step. */
|
|
26542
|
+
measureSec: 20,
|
|
26543
|
+
/** Longest the drain may take before the run is refused. */
|
|
26544
|
+
drainTimeoutSec: 120,
|
|
26545
|
+
/** Candidate models per device in one run. */
|
|
26546
|
+
maxModelsPerDevice: 6
|
|
26547
|
+
};
|
|
26548
|
+
/** The two measurements a run can make. */
|
|
26549
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26550
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26551
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26552
|
+
deviceKey: string().min(1),
|
|
26553
|
+
/**
|
|
26554
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26555
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26556
|
+
*/
|
|
26557
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26558
|
+
});
|
|
26559
|
+
/** What the operator confirmed. */
|
|
26560
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26561
|
+
nodeId: string().min(1),
|
|
26562
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26563
|
+
/** Which measurements run. At least one. */
|
|
26564
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26565
|
+
/**
|
|
26566
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26567
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26568
|
+
* detector always runs.
|
|
26569
|
+
*/
|
|
26570
|
+
steps: array(string().min(1)).default([]),
|
|
26571
|
+
/** Offered rate of one stream / session. */
|
|
26572
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26573
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26574
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26575
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26576
|
+
keepDownloadedModels: boolean().default(false),
|
|
26577
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26578
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26579
|
+
});
|
|
26580
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26581
|
+
kind: _enum([
|
|
26582
|
+
"benchmark-active",
|
|
26583
|
+
"node-offline",
|
|
26584
|
+
"unknown-device",
|
|
26585
|
+
"no-phase",
|
|
26586
|
+
"insufficient-headroom"
|
|
26587
|
+
]),
|
|
26588
|
+
detail: string(),
|
|
26589
|
+
overridable: boolean()
|
|
26590
|
+
});
|
|
26591
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26592
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26593
|
+
deviceId: number(),
|
|
26594
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26595
|
+
placedOnNode: boolean(),
|
|
26596
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26597
|
+
pinnedToNode: boolean()
|
|
26598
|
+
});
|
|
26599
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26600
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26601
|
+
deviceId: number(),
|
|
26602
|
+
reason: literal("only-frame-source")
|
|
26603
|
+
});
|
|
26604
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26605
|
+
nodeId: string(),
|
|
26606
|
+
online: boolean(),
|
|
26607
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26608
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26609
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26610
|
+
estimatedDurationMs: number(),
|
|
26611
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26612
|
+
budgetMs: number(),
|
|
26613
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26614
|
+
steps: array(string()).readonly(),
|
|
26615
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26616
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26617
|
+
headroom: object({
|
|
26618
|
+
sessionsNow: number(),
|
|
26619
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26620
|
+
}),
|
|
26621
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26622
|
+
canStart: boolean()
|
|
26623
|
+
});
|
|
26624
|
+
/** Where the measuring runner is. */
|
|
26625
|
+
var NodeBenchProgressSchema = object({
|
|
26626
|
+
phase: _enum([
|
|
26627
|
+
"preparing",
|
|
26628
|
+
"device",
|
|
26629
|
+
"pipeline",
|
|
26630
|
+
"cleanup"
|
|
26631
|
+
]),
|
|
26632
|
+
deviceKey: string().nullable(),
|
|
26633
|
+
modelId: string().nullable(),
|
|
26634
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26635
|
+
load: number().nullable(),
|
|
26636
|
+
cellsDone: number(),
|
|
26637
|
+
cellsTotal: number(),
|
|
26638
|
+
message: string()
|
|
26639
|
+
});
|
|
26640
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26641
|
+
var NodeBenchLimitSchema = _enum([
|
|
26642
|
+
"p95",
|
|
26643
|
+
"drops",
|
|
26644
|
+
"errors",
|
|
26645
|
+
"stall",
|
|
26646
|
+
"cpu",
|
|
26647
|
+
"ram",
|
|
26648
|
+
"none"
|
|
26649
|
+
]);
|
|
26650
|
+
var NodeBenchRampStepSchema = object({
|
|
26651
|
+
load: number(),
|
|
26652
|
+
pass: boolean(),
|
|
26653
|
+
p95Ms: number(),
|
|
26654
|
+
dropRatio: number(),
|
|
26655
|
+
/** Completed frames per second over the accounted window. */
|
|
26656
|
+
fps: number(),
|
|
26657
|
+
cpuPct: number().nullable(),
|
|
26658
|
+
ramFreePct: number().nullable(),
|
|
26659
|
+
failReasons: array(string()).readonly()
|
|
26660
|
+
});
|
|
26661
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26662
|
+
phase: literal("device"),
|
|
26663
|
+
deviceKey: string(),
|
|
26664
|
+
modelId: string(),
|
|
26665
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26666
|
+
p50Ms: number(),
|
|
26667
|
+
p95Ms: number(),
|
|
26668
|
+
p99Ms: number(),
|
|
26669
|
+
/** Frames per second sustained at the last passing step. */
|
|
26670
|
+
fps: number(),
|
|
26671
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26672
|
+
kMax: number(),
|
|
26673
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26674
|
+
/** First call (model load + warm-up). */
|
|
26675
|
+
warmupMs: number(),
|
|
26676
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26677
|
+
}), object({
|
|
26678
|
+
phase: literal("pipeline"),
|
|
26679
|
+
deviceKey: string(),
|
|
26680
|
+
modelId: string(),
|
|
26681
|
+
steps: array(string()).readonly(),
|
|
26682
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26683
|
+
maxSessions: number(),
|
|
26684
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26685
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26686
|
+
stepsFired: array(string()).readonly(),
|
|
26687
|
+
warmupMs: number(),
|
|
26688
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26689
|
+
})]);
|
|
26690
|
+
/**
|
|
26691
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26692
|
+
* the node no longer beats the table.
|
|
26693
|
+
*/
|
|
26694
|
+
var NodeBenchFingerprintSchema = object({
|
|
26695
|
+
pipelineVersion: string().nullable(),
|
|
26696
|
+
cpuModel: string().nullable(),
|
|
26697
|
+
ramGb: number().nullable(),
|
|
26698
|
+
os: string().nullable(),
|
|
26699
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26700
|
+
pools: record(string(), object({
|
|
26701
|
+
runtime: string(),
|
|
26702
|
+
numWorkers: number(),
|
|
26703
|
+
concurrency: number(),
|
|
26704
|
+
batchMode: string()
|
|
26705
|
+
})).default({})
|
|
26706
|
+
});
|
|
26707
|
+
/** The frames the run used. */
|
|
26708
|
+
var NodeBenchClipSchema = object({
|
|
26709
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26710
|
+
id: string(),
|
|
26711
|
+
revision: string().nullable(),
|
|
26712
|
+
frames: number(),
|
|
26713
|
+
width: number(),
|
|
26714
|
+
height: number()
|
|
26715
|
+
});
|
|
26716
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26717
|
+
runId: string().min(1),
|
|
26718
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26719
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26720
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26721
|
+
steps: array(string()).default([]),
|
|
26722
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26723
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26724
|
+
deadlineAtMs: number(),
|
|
26725
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26726
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26727
|
+
keepDownloadedModels: boolean().default(false)
|
|
26728
|
+
});
|
|
26729
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26730
|
+
"running",
|
|
26731
|
+
"done",
|
|
26732
|
+
"failed",
|
|
26733
|
+
"aborted"
|
|
26734
|
+
]);
|
|
26735
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26736
|
+
runId: string(),
|
|
26737
|
+
nodeId: string(),
|
|
26738
|
+
state: NodeBenchRunnerStateSchema,
|
|
26739
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26740
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26741
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26742
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26743
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26744
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26745
|
+
activeCameraIds: array(number()).readonly(),
|
|
26746
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26747
|
+
deletedModels: array(string()).readonly(),
|
|
26748
|
+
error: string().nullable(),
|
|
26749
|
+
startedAtMs: number(),
|
|
26750
|
+
finishedAtMs: number().nullable()
|
|
26751
|
+
});
|
|
26752
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26753
|
+
"draining",
|
|
26754
|
+
"measuring",
|
|
26755
|
+
"restoring",
|
|
26756
|
+
"done",
|
|
26757
|
+
"failed",
|
|
26758
|
+
"aborted"
|
|
26759
|
+
]);
|
|
26760
|
+
/** Why a run ended. */
|
|
26761
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26762
|
+
"completed",
|
|
26763
|
+
"operator-abort",
|
|
26764
|
+
"deadline",
|
|
26765
|
+
"node-lost",
|
|
26766
|
+
"runner-lost",
|
|
26767
|
+
"hub-restart",
|
|
26768
|
+
"drain-timeout",
|
|
26769
|
+
"failed"
|
|
26770
|
+
]);
|
|
26771
|
+
var NodeBenchmarkRunSchema = object({
|
|
26772
|
+
runId: string(),
|
|
26773
|
+
nodeId: string(),
|
|
26774
|
+
state: NodeBenchmarkStateSchema,
|
|
26775
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26776
|
+
startedAtMs: number(),
|
|
26777
|
+
deadlineAtMs: number(),
|
|
26778
|
+
finishedAtMs: number().nullable(),
|
|
26779
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26780
|
+
error: string().nullable(),
|
|
26781
|
+
/** Cameras moved off the node for the run. */
|
|
26782
|
+
moved: array(number()).readonly(),
|
|
26783
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26784
|
+
staying: array(number()).readonly(),
|
|
26785
|
+
/** Something else ran on the node's pools during the run. */
|
|
26786
|
+
contaminated: boolean(),
|
|
26787
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26788
|
+
resultIds: array(string()).readonly()
|
|
26789
|
+
});
|
|
26790
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26791
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26792
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26793
|
+
modeNodeId: string().nullable(),
|
|
26794
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26795
|
+
});
|
|
26796
|
+
/**
|
|
26797
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26798
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26799
|
+
* ends, never by anyone else.
|
|
26800
|
+
*/
|
|
26801
|
+
var NodeBenchmarkResultSchema = object({
|
|
26802
|
+
id: string(),
|
|
26803
|
+
runId: string(),
|
|
26804
|
+
nodeId: string(),
|
|
26805
|
+
cell: NodeBenchCellSchema,
|
|
26806
|
+
fpsPerStream: number(),
|
|
26807
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26808
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26809
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26810
|
+
contaminated: boolean(),
|
|
26811
|
+
stayingCameras: array(number()).readonly(),
|
|
26812
|
+
/** The run ended early; the cell itself completed. */
|
|
26813
|
+
partialRun: boolean(),
|
|
26814
|
+
measuredAtMs: number()
|
|
26815
|
+
});
|
|
26816
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26817
|
+
nodeId: string().optional(),
|
|
26818
|
+
deviceKey: string().optional()
|
|
26819
|
+
});
|
|
26820
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26821
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26822
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26823
|
+
standing: _enum([
|
|
26824
|
+
"fresh",
|
|
26825
|
+
"stale",
|
|
26826
|
+
"superseded"
|
|
26827
|
+
]),
|
|
26828
|
+
staleWhy: _enum([
|
|
26829
|
+
"age",
|
|
26830
|
+
"runtime",
|
|
26831
|
+
"pool-tuning"
|
|
26832
|
+
]).nullable()
|
|
26833
|
+
});
|
|
26834
|
+
object({
|
|
26835
|
+
runId: string(),
|
|
26836
|
+
nodeId: string(),
|
|
26837
|
+
startedAtMs: number(),
|
|
26838
|
+
deadlineAtMs: number(),
|
|
26839
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26840
|
+
moved: array(number()).readonly(),
|
|
26841
|
+
staying: array(number()).readonly()
|
|
26842
|
+
});
|
|
26843
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26844
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26845
|
+
nodeId: string(),
|
|
26846
|
+
reachable: boolean(),
|
|
26847
|
+
devices: array(object({
|
|
26848
|
+
deviceKey: string(),
|
|
26849
|
+
enabled: boolean(),
|
|
26850
|
+
available: boolean(),
|
|
26851
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26852
|
+
suggested: array(string()).readonly(),
|
|
26853
|
+
/** Every root detector the device has a build for. */
|
|
26854
|
+
all: array(string()).readonly(),
|
|
26855
|
+
/** The model the device runs now, when pinned. */
|
|
26856
|
+
currentModelId: string().nullable()
|
|
26857
|
+
})).readonly(),
|
|
26858
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26859
|
+
steps: array(object({
|
|
26860
|
+
id: string(),
|
|
26861
|
+
name: string(),
|
|
26862
|
+
slot: string()
|
|
26863
|
+
})).readonly()
|
|
26864
|
+
});
|
|
24346
26865
|
object({
|
|
24347
26866
|
activeCameras: number(),
|
|
24348
26867
|
throttledCameras: number(),
|
|
@@ -25471,7 +27990,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25471
27990
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25472
27991
|
deviceId: number(),
|
|
25473
27992
|
trackId: string()
|
|
25474
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27993
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27994
|
+
accepted: literal(true),
|
|
27995
|
+
runId: string()
|
|
27996
|
+
}), {
|
|
27997
|
+
kind: "mutation",
|
|
27998
|
+
auth: "admin"
|
|
27999
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28000
|
+
kind: "mutation",
|
|
28001
|
+
auth: "admin"
|
|
28002
|
+
});
|
|
25475
28003
|
var CameraPipelineConfigSchema = object({
|
|
25476
28004
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25477
28005
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26110,6 +28638,21 @@ method(object({
|
|
|
26110
28638
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26111
28639
|
kind: "mutation",
|
|
26112
28640
|
auth: "admin"
|
|
28641
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28642
|
+
kind: literal("started"),
|
|
28643
|
+
runId: string()
|
|
28644
|
+
}), object({
|
|
28645
|
+
kind: literal("refused"),
|
|
28646
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28647
|
+
})]), {
|
|
28648
|
+
kind: "mutation",
|
|
28649
|
+
auth: "admin"
|
|
28650
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28651
|
+
kind: "mutation",
|
|
28652
|
+
auth: "admin"
|
|
28653
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28654
|
+
kind: "mutation",
|
|
28655
|
+
auth: "admin"
|
|
26113
28656
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26114
28657
|
deviceId: number(),
|
|
26115
28658
|
addonId: string(),
|
|
@@ -26515,8 +29058,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26515
29058
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26516
29059
|
*
|
|
26517
29060
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26518
|
-
* one for transactional / one for notifications). Consumers (
|
|
26519
|
-
*
|
|
29061
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29062
|
+
* addons, …) walk the collection and pick the first
|
|
26520
29063
|
* ready provider OR target a specific addonId.
|
|
26521
29064
|
*
|
|
26522
29065
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26799,7 +29342,7 @@ targets: array(object({
|
|
|
26799
29342
|
};
|
|
26800
29343
|
/**
|
|
26801
29344
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26802
|
-
* providers (OIDC, SAML,
|
|
29345
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26803
29346
|
* carrying the post-callback claims before redirecting back to
|
|
26804
29347
|
* `/api/auth/sso/finish`.
|
|
26805
29348
|
*
|
|
@@ -26862,7 +29405,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26862
29405
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26863
29406
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26864
29407
|
*/
|
|
26865
|
-
issuer: string().optional()
|
|
29408
|
+
issuer: string().optional(),
|
|
29409
|
+
/**
|
|
29410
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29411
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29412
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29413
|
+
* any other browser.
|
|
29414
|
+
*/
|
|
29415
|
+
browserBinding: string().optional()
|
|
26866
29416
|
});
|
|
26867
29417
|
method(object({
|
|
26868
29418
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32730,6 +35280,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32730
35280
|
enabled: boolean().optional(),
|
|
32731
35281
|
info: record(string(), unknown()).optional(),
|
|
32732
35282
|
settings: record(string(), unknown()).optional(),
|
|
35283
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
35284
|
+
* the keychain, not the table (D787). */
|
|
35285
|
+
secretKeys: array(string()).optional(),
|
|
32733
35286
|
skipRestart: boolean().optional()
|
|
32734
35287
|
});
|
|
32735
35288
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32753,7 +35306,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32753
35306
|
auth: "admin"
|
|
32754
35307
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32755
35308
|
id: string(),
|
|
32756
|
-
settings: record(string(), unknown())
|
|
35309
|
+
settings: record(string(), unknown()),
|
|
35310
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
35311
|
+
secretKeys: array(string()).optional()
|
|
32757
35312
|
}), object({ success: boolean() }), {
|
|
32758
35313
|
kind: "mutation",
|
|
32759
35314
|
auth: "admin"
|
|
@@ -39987,16 +42542,6 @@ var ApiKeySummarySchema = object({
|
|
|
39987
42542
|
createdAt: number(),
|
|
39988
42543
|
lastUsedAt: number().optional()
|
|
39989
42544
|
});
|
|
39990
|
-
var CreateApiKeyInputSchema = object({
|
|
39991
|
-
label: string(),
|
|
39992
|
-
isAdmin: boolean().default(false),
|
|
39993
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39994
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39995
|
-
});
|
|
39996
|
-
var CreateApiKeyResultSchema = object({
|
|
39997
|
-
token: string(),
|
|
39998
|
-
record: ApiKeySummarySchema
|
|
39999
|
-
});
|
|
40000
42545
|
var ScopedTokenSummarySchema = object({
|
|
40001
42546
|
id: string(),
|
|
40002
42547
|
userId: string(),
|
|
@@ -40095,17 +42640,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40095
42640
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
40096
42641
|
kind: "mutation",
|
|
40097
42642
|
access: "view"
|
|
40098
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
40099
|
-
kind: "mutation",
|
|
40100
|
-
auth: "admin",
|
|
40101
|
-
access: "create"
|
|
40102
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
42643
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
40103
42644
|
kind: "mutation",
|
|
40104
42645
|
auth: "admin",
|
|
40105
42646
|
access: "delete"
|
|
40106
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
40107
|
-
kind: "mutation",
|
|
40108
|
-
access: "view"
|
|
40109
42647
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
40110
42648
|
kind: "mutation",
|
|
40111
42649
|
auth: "admin",
|
|
@@ -40179,15 +42717,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40179
42717
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40180
42718
|
userId: string(),
|
|
40181
42719
|
issuer: string()
|
|
40182
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40183
|
-
userId: string(),
|
|
40184
|
-
issuer: string().min(1),
|
|
40185
|
-
label: string().optional()
|
|
40186
|
-
}), object({ success: literal(true) }), {
|
|
40187
|
-
kind: "mutation",
|
|
40188
|
-
auth: "admin",
|
|
40189
|
-
access: "create"
|
|
40190
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
42720
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40191
42721
|
kind: "mutation",
|
|
40192
42722
|
auth: "admin",
|
|
40193
42723
|
access: "delete"
|
|
@@ -40892,6 +43422,451 @@ var zoneRulesCapability = {
|
|
|
40892
43422
|
*/
|
|
40893
43423
|
durability: "restored"
|
|
40894
43424
|
};
|
|
43425
|
+
/**
|
|
43426
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
43427
|
+
*
|
|
43428
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
43429
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
43430
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
43431
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
43432
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
43433
|
+
* manifest entry and nothing else.
|
|
43434
|
+
*
|
|
43435
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
43436
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
43437
|
+
* Every method is `admin`: these spend money.
|
|
43438
|
+
*
|
|
43439
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
43440
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
43441
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
43442
|
+
*
|
|
43443
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
43444
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
43445
|
+
* ticket the provider mints (D613).
|
|
43446
|
+
*/
|
|
43447
|
+
var TrainingGpuOptionSchema = object({
|
|
43448
|
+
id: string(),
|
|
43449
|
+
label: string(),
|
|
43450
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
43451
|
+
usdPerHour: number().nonnegative(),
|
|
43452
|
+
vramGb: number().nonnegative()
|
|
43453
|
+
});
|
|
43454
|
+
var TrainingRegionOptionSchema = object({
|
|
43455
|
+
/** `''` = any region (the provider's choice). */
|
|
43456
|
+
id: string(),
|
|
43457
|
+
label: string(),
|
|
43458
|
+
priceMultiplier: number().positive()
|
|
43459
|
+
});
|
|
43460
|
+
/**
|
|
43461
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
43462
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
43463
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
43464
|
+
*/
|
|
43465
|
+
var TrainingProviderDefaultsSchema = object({
|
|
43466
|
+
gpuType: string(),
|
|
43467
|
+
region: string(),
|
|
43468
|
+
costCapUsd: number().nonnegative(),
|
|
43469
|
+
maxRuntimeSec: number().int().positive(),
|
|
43470
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
43471
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
43472
|
+
});
|
|
43473
|
+
var TrainingProviderDescriptorSchema = object({
|
|
43474
|
+
addonId: string(),
|
|
43475
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
43476
|
+
kind: string(),
|
|
43477
|
+
label: string(),
|
|
43478
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
43479
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
43480
|
+
maxDatasetBytes: number().int().positive(),
|
|
43481
|
+
maxRuntimeSec: number().int().positive(),
|
|
43482
|
+
freeTierNote: string().optional(),
|
|
43483
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
43484
|
+
dataResidencyNote: string(),
|
|
43485
|
+
/** Credentials are present — never the values. */
|
|
43486
|
+
configured: boolean(),
|
|
43487
|
+
defaults: TrainingProviderDefaultsSchema
|
|
43488
|
+
});
|
|
43489
|
+
var TrainingCredentialCheckSchema = object({
|
|
43490
|
+
ok: boolean(),
|
|
43491
|
+
/** Workspace / account name, when the provider says. */
|
|
43492
|
+
account: string().optional(),
|
|
43493
|
+
reason: _enum([
|
|
43494
|
+
"missing",
|
|
43495
|
+
"invalid",
|
|
43496
|
+
"forbidden",
|
|
43497
|
+
"network",
|
|
43498
|
+
"quota"
|
|
43499
|
+
]).optional(),
|
|
43500
|
+
detail: string().optional()
|
|
43501
|
+
});
|
|
43502
|
+
var ProviderJobStateSchema = _enum([
|
|
43503
|
+
"pending",
|
|
43504
|
+
"starting",
|
|
43505
|
+
"running",
|
|
43506
|
+
"succeeded",
|
|
43507
|
+
"failed",
|
|
43508
|
+
"cancelled",
|
|
43509
|
+
"lost"
|
|
43510
|
+
]);
|
|
43511
|
+
var ProviderJobStatusSchema = object({
|
|
43512
|
+
jobKey: string(),
|
|
43513
|
+
providerJobId: string().optional(),
|
|
43514
|
+
state: ProviderJobStateSchema,
|
|
43515
|
+
startedAt: number().optional(),
|
|
43516
|
+
endedAt: number().optional(),
|
|
43517
|
+
exitCode: number().int().optional(),
|
|
43518
|
+
failureReason: string().optional(),
|
|
43519
|
+
gpuType: string(),
|
|
43520
|
+
region: string().optional(),
|
|
43521
|
+
billedSeconds: number().nonnegative(),
|
|
43522
|
+
costUsd: number().nonnegative(),
|
|
43523
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
43524
|
+
costIsEstimate: boolean(),
|
|
43525
|
+
lastFetchedAt: number()
|
|
43526
|
+
});
|
|
43527
|
+
/**
|
|
43528
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
43529
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
43530
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
43531
|
+
* in `result.json`.
|
|
43532
|
+
*/
|
|
43533
|
+
var TrainerSourceRefSchema = object({
|
|
43534
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
43535
|
+
repo: string().min(1),
|
|
43536
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
43537
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
43538
|
+
});
|
|
43539
|
+
var JobRef = {
|
|
43540
|
+
addonId: string(),
|
|
43541
|
+
jobKey: string().uuid()
|
|
43542
|
+
};
|
|
43543
|
+
var TrainingLogLineSchema = object({
|
|
43544
|
+
ts: number(),
|
|
43545
|
+
text: string()
|
|
43546
|
+
});
|
|
43547
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
43548
|
+
kind: "mutation",
|
|
43549
|
+
auth: "admin",
|
|
43550
|
+
timeoutMs: 3e4
|
|
43551
|
+
}), method(object({
|
|
43552
|
+
addonId: string(),
|
|
43553
|
+
gpuType: string(),
|
|
43554
|
+
region: string(),
|
|
43555
|
+
datasetBytes: number().int().nonnegative(),
|
|
43556
|
+
gpuSecondsLow: number().nonnegative(),
|
|
43557
|
+
gpuSecondsHigh: number().nonnegative()
|
|
43558
|
+
}), object({
|
|
43559
|
+
usdLow: number().nonnegative(),
|
|
43560
|
+
usdHigh: number().nonnegative(),
|
|
43561
|
+
notes: array(string()).readonly()
|
|
43562
|
+
}), { auth: "admin" }), method(object({
|
|
43563
|
+
...JobRef,
|
|
43564
|
+
ticket: PeerBytesTicketSchema
|
|
43565
|
+
}), object({
|
|
43566
|
+
bytes: number().int().nonnegative(),
|
|
43567
|
+
sha256: string()
|
|
43568
|
+
}), {
|
|
43569
|
+
kind: "mutation",
|
|
43570
|
+
auth: "admin",
|
|
43571
|
+
timeoutMs: 120 * 6e4
|
|
43572
|
+
}), method(object({
|
|
43573
|
+
...JobRef,
|
|
43574
|
+
trainer: TrainerSourceRefSchema,
|
|
43575
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
43576
|
+
gpuType: string(),
|
|
43577
|
+
region: string(),
|
|
43578
|
+
maxRuntimeSec: number().int().positive()
|
|
43579
|
+
}), ProviderJobStatusSchema, {
|
|
43580
|
+
kind: "mutation",
|
|
43581
|
+
auth: "admin",
|
|
43582
|
+
timeoutMs: 30 * 6e4
|
|
43583
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
43584
|
+
auth: "admin",
|
|
43585
|
+
timeoutMs: 6e4
|
|
43586
|
+
}), method(object({
|
|
43587
|
+
...JobRef,
|
|
43588
|
+
cursor: string().optional(),
|
|
43589
|
+
max: number().int().min(1).max(500)
|
|
43590
|
+
}), object({
|
|
43591
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
43592
|
+
cursor: string()
|
|
43593
|
+
}), {
|
|
43594
|
+
auth: "admin",
|
|
43595
|
+
timeoutMs: 6e4
|
|
43596
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
43597
|
+
kind: "mutation",
|
|
43598
|
+
auth: "admin",
|
|
43599
|
+
timeoutMs: 6e4
|
|
43600
|
+
}), method(object(JobRef), object({
|
|
43601
|
+
found: boolean(),
|
|
43602
|
+
text: string().optional()
|
|
43603
|
+
}), {
|
|
43604
|
+
kind: "mutation",
|
|
43605
|
+
auth: "admin",
|
|
43606
|
+
timeoutMs: 5 * 6e4
|
|
43607
|
+
}), method(object({
|
|
43608
|
+
...JobRef,
|
|
43609
|
+
path: _enum(["bundle.tar"])
|
|
43610
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
43611
|
+
kind: "mutation",
|
|
43612
|
+
auth: "admin",
|
|
43613
|
+
timeoutMs: 5 * 6e4
|
|
43614
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
43615
|
+
kind: "mutation",
|
|
43616
|
+
auth: "admin",
|
|
43617
|
+
timeoutMs: 5 * 6e4
|
|
43618
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
43619
|
+
auth: "admin",
|
|
43620
|
+
timeoutMs: 2 * 6e4
|
|
43621
|
+
});
|
|
43622
|
+
/**
|
|
43623
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
43624
|
+
* provided by `addon-training`.
|
|
43625
|
+
*
|
|
43626
|
+
* It owns what every provider must agree on, written once:
|
|
43627
|
+
*
|
|
43628
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
43629
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
43630
|
+
* the export plan) and reaches this store through the five row methods
|
|
43631
|
+
* below, so the Retrain page and the export did not change.
|
|
43632
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
43633
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
43634
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
43635
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
43636
|
+
* rollback. Nothing is ever registered automatically.
|
|
43637
|
+
*
|
|
43638
|
+
* Every method is `admin`.
|
|
43639
|
+
*/
|
|
43640
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
43641
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
43642
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
43643
|
+
var TrainingBaseModelSchema = object({
|
|
43644
|
+
modelId: string(),
|
|
43645
|
+
label: string(),
|
|
43646
|
+
weights: string(),
|
|
43647
|
+
imgsz: number().int(),
|
|
43648
|
+
baselineOnnxUrl: string(),
|
|
43649
|
+
baselineFloors: record(string(), number()),
|
|
43650
|
+
/** The base the fleet runs most — the UI's default. */
|
|
43651
|
+
recommended: boolean()
|
|
43652
|
+
});
|
|
43653
|
+
var TrainingPresetSchema = _enum([
|
|
43654
|
+
"quick",
|
|
43655
|
+
"standard",
|
|
43656
|
+
"thorough"
|
|
43657
|
+
]);
|
|
43658
|
+
var TrainingJobRequestSchema = object({
|
|
43659
|
+
datasetVersionId: string().min(1),
|
|
43660
|
+
/** The `training-provider` addon that runs it. */
|
|
43661
|
+
addonId: string().min(1),
|
|
43662
|
+
gpuType: string().min(1),
|
|
43663
|
+
region: string(),
|
|
43664
|
+
baseModelId: string().min(1),
|
|
43665
|
+
preset: TrainingPresetSchema,
|
|
43666
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
43667
|
+
freeze: number().int().nonnegative().nullable(),
|
|
43668
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
43669
|
+
holdoutCameras: array(number().int()).nullable()
|
|
43670
|
+
});
|
|
43671
|
+
var TrainingSplitPlanSchema = object({
|
|
43672
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
43673
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
43674
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
43675
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
43676
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
43677
|
+
trainSubjects: number().int()
|
|
43678
|
+
});
|
|
43679
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
43680
|
+
"unknown-dataset",
|
|
43681
|
+
"unknown-provider",
|
|
43682
|
+
"provider-not-configured",
|
|
43683
|
+
"unknown-base-model",
|
|
43684
|
+
"unknown-gpu",
|
|
43685
|
+
"dataset-too-large",
|
|
43686
|
+
"no-training-subjects",
|
|
43687
|
+
"job-already-running"
|
|
43688
|
+
]);
|
|
43689
|
+
var TrainingJobPlanSchema = object({
|
|
43690
|
+
refusal: object({
|
|
43691
|
+
reason: TrainingRefusalReasonSchema,
|
|
43692
|
+
detail: string()
|
|
43693
|
+
}).nullable(),
|
|
43694
|
+
warnings: array(string()).readonly(),
|
|
43695
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
43696
|
+
estimate: object({
|
|
43697
|
+
datasetBytes: number().int(),
|
|
43698
|
+
uploadMinutesAt20Mbps: number(),
|
|
43699
|
+
gpuSecondsLow: number(),
|
|
43700
|
+
gpuSecondsHigh: number(),
|
|
43701
|
+
usdLow: number(),
|
|
43702
|
+
usdHigh: number(),
|
|
43703
|
+
notes: array(string()).readonly()
|
|
43704
|
+
}).nullable(),
|
|
43705
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
43706
|
+
defaults: object({
|
|
43707
|
+
maxCostUsd: number(),
|
|
43708
|
+
maxRuntimeSec: number().int()
|
|
43709
|
+
}).nullable(),
|
|
43710
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
43711
|
+
dataNotice: string()
|
|
43712
|
+
});
|
|
43713
|
+
/**
|
|
43714
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
43715
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
43716
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
43717
|
+
* result lives after the operator acted on it.
|
|
43718
|
+
*/
|
|
43719
|
+
var TrainingJobStateSchema = _enum([
|
|
43720
|
+
"uploading",
|
|
43721
|
+
"submitted",
|
|
43722
|
+
"starting",
|
|
43723
|
+
"running",
|
|
43724
|
+
"collecting",
|
|
43725
|
+
"ready",
|
|
43726
|
+
"registered",
|
|
43727
|
+
"canary",
|
|
43728
|
+
"failed",
|
|
43729
|
+
"cancelling",
|
|
43730
|
+
"cancelled",
|
|
43731
|
+
"lost",
|
|
43732
|
+
"expired",
|
|
43733
|
+
"discarded"
|
|
43734
|
+
]);
|
|
43735
|
+
var TrainingFailureReasonSchema = _enum([
|
|
43736
|
+
"cost-cap",
|
|
43737
|
+
"runtime-cap",
|
|
43738
|
+
"upload-failed",
|
|
43739
|
+
"submit-failed",
|
|
43740
|
+
"trainer-failed",
|
|
43741
|
+
"result-invalid",
|
|
43742
|
+
"checksum-mismatch",
|
|
43743
|
+
"fetch-failed",
|
|
43744
|
+
"provider-error",
|
|
43745
|
+
"hub-restart-during-upload"
|
|
43746
|
+
]);
|
|
43747
|
+
var TrainingProgressPointSchema = object({
|
|
43748
|
+
epoch: number().int(),
|
|
43749
|
+
map50: number().nullable(),
|
|
43750
|
+
map50_95: number().nullable()
|
|
43751
|
+
});
|
|
43752
|
+
var TrainingCanarySchema = object({
|
|
43753
|
+
deviceIds: array(number().int()).readonly(),
|
|
43754
|
+
since: number(),
|
|
43755
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
43756
|
+
previous: array(object({
|
|
43757
|
+
deviceId: number().int(),
|
|
43758
|
+
nodeId: string(),
|
|
43759
|
+
deviceKey: string(),
|
|
43760
|
+
patch: object({
|
|
43761
|
+
modelId: string().optional(),
|
|
43762
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
43763
|
+
}).nullable()
|
|
43764
|
+
})).readonly()
|
|
43765
|
+
});
|
|
43766
|
+
var TrainingJobSchema = object({
|
|
43767
|
+
id: string(),
|
|
43768
|
+
idempotencyKey: string(),
|
|
43769
|
+
name: string(),
|
|
43770
|
+
createdAt: number(),
|
|
43771
|
+
updatedAt: number(),
|
|
43772
|
+
state: TrainingJobStateSchema,
|
|
43773
|
+
stage: TrainingStageSchema.nullable(),
|
|
43774
|
+
failure: object({
|
|
43775
|
+
reason: TrainingFailureReasonSchema,
|
|
43776
|
+
stage: string().nullable(),
|
|
43777
|
+
detail: string()
|
|
43778
|
+
}).nullable(),
|
|
43779
|
+
request: TrainingJobRequestSchema,
|
|
43780
|
+
maxCostUsd: number().nonnegative(),
|
|
43781
|
+
maxRuntimeSec: number().int().positive(),
|
|
43782
|
+
trainer: TrainerSourceRefSchema,
|
|
43783
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
43784
|
+
dataset: object({
|
|
43785
|
+
bytes: number().int(),
|
|
43786
|
+
sha256: string(),
|
|
43787
|
+
uploadedAt: number()
|
|
43788
|
+
}).nullable(),
|
|
43789
|
+
split: TrainingSplitPlanSchema,
|
|
43790
|
+
provider: object({
|
|
43791
|
+
state: ProviderJobStateSchema.nullable(),
|
|
43792
|
+
providerJobId: string().nullable(),
|
|
43793
|
+
startedAt: number().nullable(),
|
|
43794
|
+
endedAt: number().nullable(),
|
|
43795
|
+
billedSeconds: number(),
|
|
43796
|
+
costUsd: number(),
|
|
43797
|
+
costIsEstimate: boolean(),
|
|
43798
|
+
lastPolledAt: number().nullable()
|
|
43799
|
+
}),
|
|
43800
|
+
progress: object({
|
|
43801
|
+
epoch: number().int().nullable(),
|
|
43802
|
+
epochs: number().int().nullable(),
|
|
43803
|
+
etaSec: number().nullable(),
|
|
43804
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
43805
|
+
}),
|
|
43806
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
43807
|
+
logTail: array(string()).readonly(),
|
|
43808
|
+
logCursor: string().nullable(),
|
|
43809
|
+
artifacts: object({
|
|
43810
|
+
bundleBytes: number().int(),
|
|
43811
|
+
bundleSha256: string(),
|
|
43812
|
+
fetchedAt: number(),
|
|
43813
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
43814
|
+
expiresAt: number()
|
|
43815
|
+
}).nullable(),
|
|
43816
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
43817
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
43818
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
43819
|
+
cloudCleanupDueAt: number().nullable(),
|
|
43820
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
43821
|
+
registeredModelIds: array(string()).readonly(),
|
|
43822
|
+
canary: TrainingCanarySchema.nullable()
|
|
43823
|
+
});
|
|
43824
|
+
var IdInput = object({ id: string().min(1) });
|
|
43825
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
43826
|
+
kind: "mutation",
|
|
43827
|
+
auth: "admin"
|
|
43828
|
+
}), 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() }), {
|
|
43829
|
+
kind: "mutation",
|
|
43830
|
+
auth: "admin"
|
|
43831
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
43832
|
+
auth: "admin",
|
|
43833
|
+
timeoutMs: 6e4
|
|
43834
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
43835
|
+
name: string().min(1).max(120),
|
|
43836
|
+
maxCostUsd: number().positive(),
|
|
43837
|
+
maxRuntimeSec: number().int().positive(),
|
|
43838
|
+
idempotencyKey: string().min(8).max(80)
|
|
43839
|
+
}), discriminatedUnion("kind", [object({
|
|
43840
|
+
kind: literal("started"),
|
|
43841
|
+
job: TrainingJobSchema
|
|
43842
|
+
}), object({
|
|
43843
|
+
kind: literal("refused"),
|
|
43844
|
+
reason: TrainingRefusalReasonSchema,
|
|
43845
|
+
detail: string()
|
|
43846
|
+
})]), {
|
|
43847
|
+
kind: "mutation",
|
|
43848
|
+
auth: "admin",
|
|
43849
|
+
timeoutMs: 12e4
|
|
43850
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
43851
|
+
kind: "mutation",
|
|
43852
|
+
auth: "admin",
|
|
43853
|
+
timeoutMs: 12e4
|
|
43854
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
43855
|
+
kind: "mutation",
|
|
43856
|
+
auth: "admin",
|
|
43857
|
+
timeoutMs: 30 * 6e4
|
|
43858
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
43859
|
+
kind: "mutation",
|
|
43860
|
+
auth: "admin",
|
|
43861
|
+
timeoutMs: 12e4
|
|
43862
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43863
|
+
kind: "mutation",
|
|
43864
|
+
auth: "admin",
|
|
43865
|
+
timeoutMs: 12e4
|
|
43866
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
43867
|
+
kind: "mutation",
|
|
43868
|
+
auth: "admin"
|
|
43869
|
+
});
|
|
40895
43870
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
40896
43871
|
Object.freeze({
|
|
40897
43872
|
person: .5,
|
|
@@ -41378,7 +44353,8 @@ var BaseDevice = class {
|
|
|
41378
44353
|
this.role = options.role;
|
|
41379
44354
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41380
44355
|
const seedData = ctx.persistedConfig ?? {};
|
|
41381
|
-
|
|
44356
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
44357
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41382
44358
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41383
44359
|
tags: {
|
|
41384
44360
|
deviceId: ctx.id,
|
|
@@ -43039,6 +46015,12 @@ Object.freeze({
|
|
|
43039
46015
|
addonId: null,
|
|
43040
46016
|
access: "create"
|
|
43041
46017
|
},
|
|
46018
|
+
"backup.checkBackupKey": {
|
|
46019
|
+
capName: "backup",
|
|
46020
|
+
capScope: "system",
|
|
46021
|
+
addonId: null,
|
|
46022
|
+
access: "create"
|
|
46023
|
+
},
|
|
43042
46024
|
"backup.delete": {
|
|
43043
46025
|
capName: "backup",
|
|
43044
46026
|
capScope: "system",
|
|
@@ -43051,6 +46033,18 @@ Object.freeze({
|
|
|
43051
46033
|
addonId: null,
|
|
43052
46034
|
access: "delete"
|
|
43053
46035
|
},
|
|
46036
|
+
"backup.disableEncryption": {
|
|
46037
|
+
capName: "backup",
|
|
46038
|
+
capScope: "system",
|
|
46039
|
+
addonId: null,
|
|
46040
|
+
access: "create"
|
|
46041
|
+
},
|
|
46042
|
+
"backup.getEncryption": {
|
|
46043
|
+
capName: "backup",
|
|
46044
|
+
capScope: "system",
|
|
46045
|
+
addonId: null,
|
|
46046
|
+
access: "view"
|
|
46047
|
+
},
|
|
43054
46048
|
"backup.getEntries": {
|
|
43055
46049
|
capName: "backup",
|
|
43056
46050
|
capScope: "system",
|
|
@@ -43105,6 +46099,12 @@ Object.freeze({
|
|
|
43105
46099
|
addonId: null,
|
|
43106
46100
|
access: "create"
|
|
43107
46101
|
},
|
|
46102
|
+
"backup.setupEncryption": {
|
|
46103
|
+
capName: "backup",
|
|
46104
|
+
capScope: "system",
|
|
46105
|
+
addonId: null,
|
|
46106
|
+
access: "create"
|
|
46107
|
+
},
|
|
43108
46108
|
"backup.trigger": {
|
|
43109
46109
|
capName: "backup",
|
|
43110
46110
|
capScope: "system",
|
|
@@ -43657,6 +46657,12 @@ Object.freeze({
|
|
|
43657
46657
|
addonId: null,
|
|
43658
46658
|
access: "create"
|
|
43659
46659
|
},
|
|
46660
|
+
"customModelRegistry.importModelBundle": {
|
|
46661
|
+
capName: "custom-model-registry",
|
|
46662
|
+
capScope: "system",
|
|
46663
|
+
addonId: null,
|
|
46664
|
+
access: "create"
|
|
46665
|
+
},
|
|
43660
46666
|
"customModelRegistry.listModels": {
|
|
43661
46667
|
capName: "custom-model-registry",
|
|
43662
46668
|
capScope: "system",
|
|
@@ -45067,6 +48073,108 @@ Object.freeze({
|
|
|
45067
48073
|
addonId: null,
|
|
45068
48074
|
access: "create"
|
|
45069
48075
|
},
|
|
48076
|
+
"keychain.delete": {
|
|
48077
|
+
capName: "keychain",
|
|
48078
|
+
capScope: "system",
|
|
48079
|
+
addonId: null,
|
|
48080
|
+
access: "delete"
|
|
48081
|
+
},
|
|
48082
|
+
"keychain.getState": {
|
|
48083
|
+
capName: "keychain",
|
|
48084
|
+
capScope: "system",
|
|
48085
|
+
addonId: null,
|
|
48086
|
+
access: "view"
|
|
48087
|
+
},
|
|
48088
|
+
"keychain.listMeta": {
|
|
48089
|
+
capName: "keychain",
|
|
48090
|
+
capScope: "system",
|
|
48091
|
+
addonId: null,
|
|
48092
|
+
access: "view"
|
|
48093
|
+
},
|
|
48094
|
+
"keychain.put": {
|
|
48095
|
+
capName: "keychain",
|
|
48096
|
+
capScope: "system",
|
|
48097
|
+
addonId: null,
|
|
48098
|
+
access: "create"
|
|
48099
|
+
},
|
|
48100
|
+
"keychain.resolve": {
|
|
48101
|
+
capName: "keychain",
|
|
48102
|
+
capScope: "system",
|
|
48103
|
+
addonId: null,
|
|
48104
|
+
access: "view"
|
|
48105
|
+
},
|
|
48106
|
+
"keychainAdmin.acknowledgeReset": {
|
|
48107
|
+
capName: "keychain-admin",
|
|
48108
|
+
capScope: "system",
|
|
48109
|
+
addonId: null,
|
|
48110
|
+
access: "create"
|
|
48111
|
+
},
|
|
48112
|
+
"keychainAdmin.deleteOrphans": {
|
|
48113
|
+
capName: "keychain-admin",
|
|
48114
|
+
capScope: "system",
|
|
48115
|
+
addonId: null,
|
|
48116
|
+
access: "delete"
|
|
48117
|
+
},
|
|
48118
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
48119
|
+
capName: "keychain-admin",
|
|
48120
|
+
capScope: "system",
|
|
48121
|
+
addonId: null,
|
|
48122
|
+
access: "create"
|
|
48123
|
+
},
|
|
48124
|
+
"keychainAdmin.listAudit": {
|
|
48125
|
+
capName: "keychain-admin",
|
|
48126
|
+
capScope: "system",
|
|
48127
|
+
addonId: null,
|
|
48128
|
+
access: "view"
|
|
48129
|
+
},
|
|
48130
|
+
"keychainAdmin.listSecrets": {
|
|
48131
|
+
capName: "keychain-admin",
|
|
48132
|
+
capScope: "system",
|
|
48133
|
+
addonId: null,
|
|
48134
|
+
access: "view"
|
|
48135
|
+
},
|
|
48136
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
48137
|
+
capName: "keychain-admin",
|
|
48138
|
+
capScope: "system",
|
|
48139
|
+
addonId: null,
|
|
48140
|
+
access: "delete"
|
|
48141
|
+
},
|
|
48142
|
+
"keychainAdmin.resetKeychain": {
|
|
48143
|
+
capName: "keychain-admin",
|
|
48144
|
+
capScope: "system",
|
|
48145
|
+
addonId: null,
|
|
48146
|
+
access: "delete"
|
|
48147
|
+
},
|
|
48148
|
+
"keychainAdmin.resetReport": {
|
|
48149
|
+
capName: "keychain-admin",
|
|
48150
|
+
capScope: "system",
|
|
48151
|
+
addonId: null,
|
|
48152
|
+
access: "delete"
|
|
48153
|
+
},
|
|
48154
|
+
"keychainAdmin.reveal": {
|
|
48155
|
+
capName: "keychain-admin",
|
|
48156
|
+
capScope: "system",
|
|
48157
|
+
addonId: null,
|
|
48158
|
+
access: "create"
|
|
48159
|
+
},
|
|
48160
|
+
"keychainAdmin.rotateMasterKey": {
|
|
48161
|
+
capName: "keychain-admin",
|
|
48162
|
+
capScope: "system",
|
|
48163
|
+
addonId: null,
|
|
48164
|
+
access: "create"
|
|
48165
|
+
},
|
|
48166
|
+
"keychainAdmin.setSystemSecret": {
|
|
48167
|
+
capName: "keychain-admin",
|
|
48168
|
+
capScope: "system",
|
|
48169
|
+
addonId: null,
|
|
48170
|
+
access: "create"
|
|
48171
|
+
},
|
|
48172
|
+
"keychainAdmin.status": {
|
|
48173
|
+
capName: "keychain-admin",
|
|
48174
|
+
capScope: "system",
|
|
48175
|
+
addonId: null,
|
|
48176
|
+
access: "view"
|
|
48177
|
+
},
|
|
45070
48178
|
"lawnMowerControl.dock": {
|
|
45071
48179
|
capName: "lawn-mower-control",
|
|
45072
48180
|
capScope: "device",
|
|
@@ -46441,6 +49549,18 @@ Object.freeze({
|
|
|
46441
49549
|
addonId: null,
|
|
46442
49550
|
access: "create"
|
|
46443
49551
|
},
|
|
49552
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
49553
|
+
capName: "pipeline-analytics",
|
|
49554
|
+
capScope: "device",
|
|
49555
|
+
addonId: null,
|
|
49556
|
+
access: "create"
|
|
49557
|
+
},
|
|
49558
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
49559
|
+
capName: "pipeline-analytics",
|
|
49560
|
+
capScope: "device",
|
|
49561
|
+
addonId: null,
|
|
49562
|
+
access: "create"
|
|
49563
|
+
},
|
|
46444
49564
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46445
49565
|
capName: "pipeline-analytics",
|
|
46446
49566
|
capScope: "device",
|
|
@@ -46489,12 +49609,36 @@ Object.freeze({
|
|
|
46489
49609
|
addonId: null,
|
|
46490
49610
|
access: "view"
|
|
46491
49611
|
},
|
|
49612
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
49613
|
+
capName: "pipeline-analytics",
|
|
49614
|
+
capScope: "device",
|
|
49615
|
+
addonId: null,
|
|
49616
|
+
access: "create"
|
|
49617
|
+
},
|
|
49618
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
49619
|
+
capName: "pipeline-analytics",
|
|
49620
|
+
capScope: "device",
|
|
49621
|
+
addonId: null,
|
|
49622
|
+
access: "create"
|
|
49623
|
+
},
|
|
46492
49624
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46493
49625
|
capName: "pipeline-analytics",
|
|
46494
49626
|
capScope: "device",
|
|
46495
49627
|
addonId: null,
|
|
46496
49628
|
access: "delete"
|
|
46497
49629
|
},
|
|
49630
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
49631
|
+
capName: "pipeline-analytics",
|
|
49632
|
+
capScope: "device",
|
|
49633
|
+
addonId: null,
|
|
49634
|
+
access: "delete"
|
|
49635
|
+
},
|
|
49636
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
49637
|
+
capName: "pipeline-analytics",
|
|
49638
|
+
capScope: "device",
|
|
49639
|
+
addonId: null,
|
|
49640
|
+
access: "delete"
|
|
49641
|
+
},
|
|
46498
49642
|
"pipelineAnalytics.deleteTracks": {
|
|
46499
49643
|
capName: "pipeline-analytics",
|
|
46500
49644
|
capScope: "device",
|
|
@@ -46699,6 +49843,30 @@ Object.freeze({
|
|
|
46699
49843
|
addonId: null,
|
|
46700
49844
|
access: "view"
|
|
46701
49845
|
},
|
|
49846
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
49847
|
+
capName: "pipeline-analytics",
|
|
49848
|
+
capScope: "device",
|
|
49849
|
+
addonId: null,
|
|
49850
|
+
access: "view"
|
|
49851
|
+
},
|
|
49852
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
49853
|
+
capName: "pipeline-analytics",
|
|
49854
|
+
capScope: "device",
|
|
49855
|
+
addonId: null,
|
|
49856
|
+
access: "view"
|
|
49857
|
+
},
|
|
49858
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
49859
|
+
capName: "pipeline-analytics",
|
|
49860
|
+
capScope: "device",
|
|
49861
|
+
addonId: null,
|
|
49862
|
+
access: "view"
|
|
49863
|
+
},
|
|
49864
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
49865
|
+
capName: "pipeline-analytics",
|
|
49866
|
+
capScope: "device",
|
|
49867
|
+
addonId: null,
|
|
49868
|
+
access: "view"
|
|
49869
|
+
},
|
|
46702
49870
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46703
49871
|
capName: "pipeline-analytics",
|
|
46704
49872
|
capScope: "device",
|
|
@@ -46729,6 +49897,12 @@ Object.freeze({
|
|
|
46729
49897
|
addonId: null,
|
|
46730
49898
|
access: "view"
|
|
46731
49899
|
},
|
|
49900
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
49901
|
+
capName: "pipeline-analytics",
|
|
49902
|
+
capScope: "device",
|
|
49903
|
+
addonId: null,
|
|
49904
|
+
access: "create"
|
|
49905
|
+
},
|
|
46732
49906
|
"pipelineAnalytics.ownersWithMedia": {
|
|
46733
49907
|
capName: "pipeline-analytics",
|
|
46734
49908
|
capScope: "device",
|
|
@@ -46741,12 +49915,24 @@ Object.freeze({
|
|
|
46741
49915
|
addonId: null,
|
|
46742
49916
|
access: "create"
|
|
46743
49917
|
},
|
|
49918
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
49919
|
+
capName: "pipeline-analytics",
|
|
49920
|
+
capScope: "device",
|
|
49921
|
+
addonId: null,
|
|
49922
|
+
access: "view"
|
|
49923
|
+
},
|
|
46744
49924
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
46745
49925
|
capName: "pipeline-analytics",
|
|
46746
49926
|
capScope: "device",
|
|
46747
49927
|
addonId: null,
|
|
46748
49928
|
access: "create"
|
|
46749
49929
|
},
|
|
49930
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
49931
|
+
capName: "pipeline-analytics",
|
|
49932
|
+
capScope: "device",
|
|
49933
|
+
addonId: null,
|
|
49934
|
+
access: "create"
|
|
49935
|
+
},
|
|
46750
49936
|
"pipelineAnalytics.pruneEvents": {
|
|
46751
49937
|
capName: "pipeline-analytics",
|
|
46752
49938
|
capScope: "device",
|
|
@@ -46801,6 +49987,18 @@ Object.freeze({
|
|
|
46801
49987
|
addonId: null,
|
|
46802
49988
|
access: "create"
|
|
46803
49989
|
},
|
|
49990
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49991
|
+
capName: "pipeline-analytics",
|
|
49992
|
+
capScope: "device",
|
|
49993
|
+
addonId: null,
|
|
49994
|
+
access: "delete"
|
|
49995
|
+
},
|
|
49996
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49997
|
+
capName: "pipeline-analytics",
|
|
49998
|
+
capScope: "device",
|
|
49999
|
+
addonId: null,
|
|
50000
|
+
access: "create"
|
|
50001
|
+
},
|
|
46804
50002
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46805
50003
|
capName: "pipeline-analytics",
|
|
46806
50004
|
capScope: "device",
|
|
@@ -46861,6 +50059,12 @@ Object.freeze({
|
|
|
46861
50059
|
addonId: null,
|
|
46862
50060
|
access: "create"
|
|
46863
50061
|
},
|
|
50062
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
50063
|
+
capName: "pipeline-analytics",
|
|
50064
|
+
capScope: "device",
|
|
50065
|
+
addonId: null,
|
|
50066
|
+
access: "view"
|
|
50067
|
+
},
|
|
46864
50068
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
46865
50069
|
capName: "pipeline-analytics",
|
|
46866
50070
|
capScope: "device",
|
|
@@ -47089,6 +50293,12 @@ Object.freeze({
|
|
|
47089
50293
|
addonId: null,
|
|
47090
50294
|
access: "view"
|
|
47091
50295
|
},
|
|
50296
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
50297
|
+
capName: "pipeline-orchestrator",
|
|
50298
|
+
capScope: "system",
|
|
50299
|
+
addonId: null,
|
|
50300
|
+
access: "create"
|
|
50301
|
+
},
|
|
47092
50302
|
"pipelineOrchestrator.applyAutoTune": {
|
|
47093
50303
|
capName: "pipeline-orchestrator",
|
|
47094
50304
|
capScope: "system",
|
|
@@ -47113,6 +50323,12 @@ Object.freeze({
|
|
|
47113
50323
|
addonId: null,
|
|
47114
50324
|
access: "create"
|
|
47115
50325
|
},
|
|
50326
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
50327
|
+
capName: "pipeline-orchestrator",
|
|
50328
|
+
capScope: "system",
|
|
50329
|
+
addonId: null,
|
|
50330
|
+
access: "delete"
|
|
50331
|
+
},
|
|
47116
50332
|
"pipelineOrchestrator.getAgentLoad": {
|
|
47117
50333
|
capName: "pipeline-orchestrator",
|
|
47118
50334
|
capScope: "system",
|
|
@@ -47221,6 +50437,24 @@ Object.freeze({
|
|
|
47221
50437
|
addonId: null,
|
|
47222
50438
|
access: "view"
|
|
47223
50439
|
},
|
|
50440
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
50441
|
+
capName: "pipeline-orchestrator",
|
|
50442
|
+
capScope: "system",
|
|
50443
|
+
addonId: null,
|
|
50444
|
+
access: "view"
|
|
50445
|
+
},
|
|
50446
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
50447
|
+
capName: "pipeline-orchestrator",
|
|
50448
|
+
capScope: "system",
|
|
50449
|
+
addonId: null,
|
|
50450
|
+
access: "view"
|
|
50451
|
+
},
|
|
50452
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
50453
|
+
capName: "pipeline-orchestrator",
|
|
50454
|
+
capScope: "system",
|
|
50455
|
+
addonId: null,
|
|
50456
|
+
access: "view"
|
|
50457
|
+
},
|
|
47224
50458
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
47225
50459
|
capName: "pipeline-orchestrator",
|
|
47226
50460
|
capScope: "system",
|
|
@@ -47263,6 +50497,12 @@ Object.freeze({
|
|
|
47263
50497
|
addonId: null,
|
|
47264
50498
|
access: "view"
|
|
47265
50499
|
},
|
|
50500
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
50501
|
+
capName: "pipeline-orchestrator",
|
|
50502
|
+
capScope: "system",
|
|
50503
|
+
addonId: null,
|
|
50504
|
+
access: "view"
|
|
50505
|
+
},
|
|
47266
50506
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
47267
50507
|
capName: "pipeline-orchestrator",
|
|
47268
50508
|
capScope: "system",
|
|
@@ -47407,6 +50647,12 @@ Object.freeze({
|
|
|
47407
50647
|
addonId: null,
|
|
47408
50648
|
access: "create"
|
|
47409
50649
|
},
|
|
50650
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
50651
|
+
capName: "pipeline-orchestrator",
|
|
50652
|
+
capScope: "system",
|
|
50653
|
+
addonId: null,
|
|
50654
|
+
access: "create"
|
|
50655
|
+
},
|
|
47410
50656
|
"pipelineOrchestrator.suggestShares": {
|
|
47411
50657
|
capName: "pipeline-orchestrator",
|
|
47412
50658
|
capScope: "system",
|
|
@@ -47425,6 +50671,12 @@ Object.freeze({
|
|
|
47425
50671
|
addonId: null,
|
|
47426
50672
|
access: "create"
|
|
47427
50673
|
},
|
|
50674
|
+
"pipelineRunner.abortNodeBench": {
|
|
50675
|
+
capName: "pipeline-runner",
|
|
50676
|
+
capScope: "system",
|
|
50677
|
+
addonId: null,
|
|
50678
|
+
access: "create"
|
|
50679
|
+
},
|
|
47428
50680
|
"pipelineRunner.attachCamera": {
|
|
47429
50681
|
capName: "pipeline-runner",
|
|
47430
50682
|
capScope: "system",
|
|
@@ -47473,6 +50725,12 @@ Object.freeze({
|
|
|
47473
50725
|
addonId: null,
|
|
47474
50726
|
access: "view"
|
|
47475
50727
|
},
|
|
50728
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
50729
|
+
capName: "pipeline-runner",
|
|
50730
|
+
capScope: "system",
|
|
50731
|
+
addonId: null,
|
|
50732
|
+
access: "view"
|
|
50733
|
+
},
|
|
47476
50734
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47477
50735
|
capName: "pipeline-runner",
|
|
47478
50736
|
capScope: "system",
|
|
@@ -47515,6 +50773,12 @@ Object.freeze({
|
|
|
47515
50773
|
addonId: null,
|
|
47516
50774
|
access: "create"
|
|
47517
50775
|
},
|
|
50776
|
+
"pipelineRunner.startNodeBench": {
|
|
50777
|
+
capName: "pipeline-runner",
|
|
50778
|
+
capScope: "system",
|
|
50779
|
+
addonId: null,
|
|
50780
|
+
access: "create"
|
|
50781
|
+
},
|
|
47518
50782
|
"plateGallery.assignPlate": {
|
|
47519
50783
|
capName: "plate-gallery",
|
|
47520
50784
|
capScope: "system",
|
|
@@ -49177,6 +52441,174 @@ Object.freeze({
|
|
|
49177
52441
|
addonId: null,
|
|
49178
52442
|
access: "view"
|
|
49179
52443
|
},
|
|
52444
|
+
"training.canaryResult": {
|
|
52445
|
+
capName: "training",
|
|
52446
|
+
capScope: "system",
|
|
52447
|
+
addonId: null,
|
|
52448
|
+
access: "create"
|
|
52449
|
+
},
|
|
52450
|
+
"training.cancelJob": {
|
|
52451
|
+
capName: "training",
|
|
52452
|
+
capScope: "system",
|
|
52453
|
+
addonId: null,
|
|
52454
|
+
access: "create"
|
|
52455
|
+
},
|
|
52456
|
+
"training.discardResult": {
|
|
52457
|
+
capName: "training",
|
|
52458
|
+
capScope: "system",
|
|
52459
|
+
addonId: null,
|
|
52460
|
+
access: "create"
|
|
52461
|
+
},
|
|
52462
|
+
"training.findDatasetVersionIdByName": {
|
|
52463
|
+
capName: "training",
|
|
52464
|
+
capScope: "system",
|
|
52465
|
+
addonId: null,
|
|
52466
|
+
access: "view"
|
|
52467
|
+
},
|
|
52468
|
+
"training.getDatasetVersion": {
|
|
52469
|
+
capName: "training",
|
|
52470
|
+
capScope: "system",
|
|
52471
|
+
addonId: null,
|
|
52472
|
+
access: "view"
|
|
52473
|
+
},
|
|
52474
|
+
"training.getJob": {
|
|
52475
|
+
capName: "training",
|
|
52476
|
+
capScope: "system",
|
|
52477
|
+
addonId: null,
|
|
52478
|
+
access: "view"
|
|
52479
|
+
},
|
|
52480
|
+
"training.getJobResult": {
|
|
52481
|
+
capName: "training",
|
|
52482
|
+
capScope: "system",
|
|
52483
|
+
addonId: null,
|
|
52484
|
+
access: "view"
|
|
52485
|
+
},
|
|
52486
|
+
"training.listBaseModels": {
|
|
52487
|
+
capName: "training",
|
|
52488
|
+
capScope: "system",
|
|
52489
|
+
addonId: null,
|
|
52490
|
+
access: "view"
|
|
52491
|
+
},
|
|
52492
|
+
"training.listDatasetVersions": {
|
|
52493
|
+
capName: "training",
|
|
52494
|
+
capScope: "system",
|
|
52495
|
+
addonId: null,
|
|
52496
|
+
access: "view"
|
|
52497
|
+
},
|
|
52498
|
+
"training.listJobs": {
|
|
52499
|
+
capName: "training",
|
|
52500
|
+
capScope: "system",
|
|
52501
|
+
addonId: null,
|
|
52502
|
+
access: "view"
|
|
52503
|
+
},
|
|
52504
|
+
"training.planJob": {
|
|
52505
|
+
capName: "training",
|
|
52506
|
+
capScope: "system",
|
|
52507
|
+
addonId: null,
|
|
52508
|
+
access: "view"
|
|
52509
|
+
},
|
|
52510
|
+
"training.putDatasetVersion": {
|
|
52511
|
+
capName: "training",
|
|
52512
|
+
capScope: "system",
|
|
52513
|
+
addonId: null,
|
|
52514
|
+
access: "create"
|
|
52515
|
+
},
|
|
52516
|
+
"training.registerResult": {
|
|
52517
|
+
capName: "training",
|
|
52518
|
+
capScope: "system",
|
|
52519
|
+
addonId: null,
|
|
52520
|
+
access: "create"
|
|
52521
|
+
},
|
|
52522
|
+
"training.removeDatasetVersion": {
|
|
52523
|
+
capName: "training",
|
|
52524
|
+
capScope: "system",
|
|
52525
|
+
addonId: null,
|
|
52526
|
+
access: "delete"
|
|
52527
|
+
},
|
|
52528
|
+
"training.rollbackCanary": {
|
|
52529
|
+
capName: "training",
|
|
52530
|
+
capScope: "system",
|
|
52531
|
+
addonId: null,
|
|
52532
|
+
access: "create"
|
|
52533
|
+
},
|
|
52534
|
+
"training.startJob": {
|
|
52535
|
+
capName: "training",
|
|
52536
|
+
capScope: "system",
|
|
52537
|
+
addonId: null,
|
|
52538
|
+
access: "create"
|
|
52539
|
+
},
|
|
52540
|
+
"trainingProvider.cancelJob": {
|
|
52541
|
+
capName: "training-provider",
|
|
52542
|
+
capScope: "system",
|
|
52543
|
+
addonId: null,
|
|
52544
|
+
access: "create"
|
|
52545
|
+
},
|
|
52546
|
+
"trainingProvider.cleanupJob": {
|
|
52547
|
+
capName: "training-provider",
|
|
52548
|
+
capScope: "system",
|
|
52549
|
+
addonId: null,
|
|
52550
|
+
access: "create"
|
|
52551
|
+
},
|
|
52552
|
+
"trainingProvider.describe": {
|
|
52553
|
+
capName: "training-provider",
|
|
52554
|
+
capScope: "system",
|
|
52555
|
+
addonId: null,
|
|
52556
|
+
access: "view"
|
|
52557
|
+
},
|
|
52558
|
+
"trainingProvider.estimateJob": {
|
|
52559
|
+
capName: "training-provider",
|
|
52560
|
+
capScope: "system",
|
|
52561
|
+
addonId: null,
|
|
52562
|
+
access: "view"
|
|
52563
|
+
},
|
|
52564
|
+
"trainingProvider.getJob": {
|
|
52565
|
+
capName: "training-provider",
|
|
52566
|
+
capScope: "system",
|
|
52567
|
+
addonId: null,
|
|
52568
|
+
access: "view"
|
|
52569
|
+
},
|
|
52570
|
+
"trainingProvider.listJobEvents": {
|
|
52571
|
+
capName: "training-provider",
|
|
52572
|
+
capScope: "system",
|
|
52573
|
+
addonId: null,
|
|
52574
|
+
access: "view"
|
|
52575
|
+
},
|
|
52576
|
+
"trainingProvider.listJobs": {
|
|
52577
|
+
capName: "training-provider",
|
|
52578
|
+
capScope: "system",
|
|
52579
|
+
addonId: null,
|
|
52580
|
+
access: "view"
|
|
52581
|
+
},
|
|
52582
|
+
"trainingProvider.offerArtifact": {
|
|
52583
|
+
capName: "training-provider",
|
|
52584
|
+
capScope: "system",
|
|
52585
|
+
addonId: null,
|
|
52586
|
+
access: "create"
|
|
52587
|
+
},
|
|
52588
|
+
"trainingProvider.readResult": {
|
|
52589
|
+
capName: "training-provider",
|
|
52590
|
+
capScope: "system",
|
|
52591
|
+
addonId: null,
|
|
52592
|
+
access: "create"
|
|
52593
|
+
},
|
|
52594
|
+
"trainingProvider.submitJob": {
|
|
52595
|
+
capName: "training-provider",
|
|
52596
|
+
capScope: "system",
|
|
52597
|
+
addonId: null,
|
|
52598
|
+
access: "create"
|
|
52599
|
+
},
|
|
52600
|
+
"trainingProvider.uploadDataset": {
|
|
52601
|
+
capName: "training-provider",
|
|
52602
|
+
capScope: "system",
|
|
52603
|
+
addonId: null,
|
|
52604
|
+
access: "create"
|
|
52605
|
+
},
|
|
52606
|
+
"trainingProvider.validateCredentials": {
|
|
52607
|
+
capName: "training-provider",
|
|
52608
|
+
capScope: "system",
|
|
52609
|
+
addonId: null,
|
|
52610
|
+
access: "create"
|
|
52611
|
+
},
|
|
49180
52612
|
"turnProvider.getTurnServers": {
|
|
49181
52613
|
capName: "turn-provider",
|
|
49182
52614
|
capScope: "system",
|
|
@@ -49201,12 +52633,6 @@ Object.freeze({
|
|
|
49201
52633
|
addonId: null,
|
|
49202
52634
|
access: "create"
|
|
49203
52635
|
},
|
|
49204
|
-
"userManagement.createApiKey": {
|
|
49205
|
-
capName: "user-management",
|
|
49206
|
-
capScope: "system",
|
|
49207
|
-
addonId: null,
|
|
49208
|
-
access: "create"
|
|
49209
|
-
},
|
|
49210
52636
|
"userManagement.createScopedToken": {
|
|
49211
52637
|
capName: "user-management",
|
|
49212
52638
|
capScope: "system",
|
|
@@ -49243,12 +52669,6 @@ Object.freeze({
|
|
|
49243
52669
|
addonId: null,
|
|
49244
52670
|
access: "view"
|
|
49245
52671
|
},
|
|
49246
|
-
"userManagement.linkExternalIdentity": {
|
|
49247
|
-
capName: "user-management",
|
|
49248
|
-
capScope: "system",
|
|
49249
|
-
addonId: null,
|
|
49250
|
-
access: "create"
|
|
49251
|
-
},
|
|
49252
52672
|
"userManagement.listApiKeys": {
|
|
49253
52673
|
capName: "user-management",
|
|
49254
52674
|
capScope: "system",
|
|
@@ -49351,12 +52771,6 @@ Object.freeze({
|
|
|
49351
52771
|
addonId: null,
|
|
49352
52772
|
access: "create"
|
|
49353
52773
|
},
|
|
49354
|
-
"userManagement.validateApiKey": {
|
|
49355
|
-
capName: "user-management",
|
|
49356
|
-
capScope: "system",
|
|
49357
|
-
addonId: null,
|
|
49358
|
-
access: "view"
|
|
49359
|
-
},
|
|
49360
52774
|
"userManagement.validateCredentials": {
|
|
49361
52775
|
capName: "user-management",
|
|
49362
52776
|
capScope: "system",
|
|
@@ -52650,6 +56064,11 @@ Object.freeze({
|
|
|
52650
56064
|
form: "single",
|
|
52651
56065
|
optional: false
|
|
52652
56066
|
}],
|
|
56067
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
56068
|
+
name: "deviceId",
|
|
56069
|
+
form: "single",
|
|
56070
|
+
optional: false
|
|
56071
|
+
}],
|
|
52653
56072
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52654
56073
|
name: "deviceId",
|
|
52655
56074
|
form: "single",
|
|
@@ -52840,6 +56259,11 @@ Object.freeze({
|
|
|
52840
56259
|
form: "single",
|
|
52841
56260
|
optional: false
|
|
52842
56261
|
}],
|
|
56262
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
56263
|
+
name: "deviceId",
|
|
56264
|
+
form: "single",
|
|
56265
|
+
optional: false
|
|
56266
|
+
}],
|
|
52843
56267
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52844
56268
|
name: "deviceId",
|
|
52845
56269
|
form: "single",
|
|
@@ -53666,6 +57090,11 @@ Object.freeze({
|
|
|
53666
57090
|
form: "single",
|
|
53667
57091
|
optional: false
|
|
53668
57092
|
}],
|
|
57093
|
+
"training.canaryResult": [{
|
|
57094
|
+
name: "deviceIds",
|
|
57095
|
+
form: "array",
|
|
57096
|
+
optional: false
|
|
57097
|
+
}],
|
|
53669
57098
|
"update.getStatus": [{
|
|
53670
57099
|
name: "deviceId",
|
|
53671
57100
|
form: "single",
|