@camstack/addon-provider-rtsp 1.2.122 → 1.2.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +3565 -127
- package/dist/addon.mjs +3565 -127
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let node_net = require("node:net");
|
|
25
25
|
node_net = __toESM(node_net);
|
|
26
|
-
//#region ../types/dist/event-category-
|
|
26
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
27
27
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
28
28
|
EventCategory["SystemBoot"] = "system.boot";
|
|
29
29
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -102,6 +102,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
102
102
|
*/
|
|
103
103
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
104
104
|
/**
|
|
105
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
106
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
107
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
108
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
109
|
+
*/
|
|
110
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
111
|
+
/**
|
|
105
112
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
106
113
|
* transitions from `failed` back to `healthy` (typically via the
|
|
107
114
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5394,7 +5401,7 @@ var ZodIssueCode = {
|
|
|
5394
5401
|
var ZodFirstPartyTypeKind;
|
|
5395
5402
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5396
5403
|
//#endregion
|
|
5397
|
-
//#region ../types/dist/sleep-
|
|
5404
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5398
5405
|
/**
|
|
5399
5406
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5400
5407
|
* window to float samples (D455).
|
|
@@ -5473,6 +5480,97 @@ function buildAlawTable() {
|
|
|
5473
5480
|
}
|
|
5474
5481
|
buildUlawTable();
|
|
5475
5482
|
buildAlawTable();
|
|
5483
|
+
/** Is this field's stored value a credential? */
|
|
5484
|
+
function isSecretConfigField(field) {
|
|
5485
|
+
if (field.type === "password") return true;
|
|
5486
|
+
return "secret" in field && field.secret === true;
|
|
5487
|
+
}
|
|
5488
|
+
/**
|
|
5489
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5490
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5491
|
+
*/
|
|
5492
|
+
function isKeychainStoredField(field) {
|
|
5493
|
+
if (!isSecretConfigField(field)) return false;
|
|
5494
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5495
|
+
return !("storage" in field && field.storage === "inline");
|
|
5496
|
+
}
|
|
5497
|
+
/**
|
|
5498
|
+
* What a settings blob holds where a secret used to be.
|
|
5499
|
+
*
|
|
5500
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5501
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5502
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5503
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5504
|
+
*
|
|
5505
|
+
* The same shapes travel to and from the admin UI:
|
|
5506
|
+
*
|
|
5507
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5508
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5509
|
+
* value is set, never the value.
|
|
5510
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5511
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5512
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5513
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5514
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5515
|
+
*
|
|
5516
|
+
* Pure and browser-safe.
|
|
5517
|
+
*/
|
|
5518
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5519
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5520
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5521
|
+
function isRecord$2(value) {
|
|
5522
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5523
|
+
}
|
|
5524
|
+
function makeSecretMarker(ref) {
|
|
5525
|
+
return {
|
|
5526
|
+
$secret: ref,
|
|
5527
|
+
v: 1
|
|
5528
|
+
};
|
|
5529
|
+
}
|
|
5530
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5531
|
+
function isSecretMarker(value) {
|
|
5532
|
+
if (!isRecord$2(value)) return false;
|
|
5533
|
+
const ref = value["$secret"];
|
|
5534
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5535
|
+
}
|
|
5536
|
+
function isSecretClear(value) {
|
|
5537
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5538
|
+
}
|
|
5539
|
+
/**
|
|
5540
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5541
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5542
|
+
* survives this function.
|
|
5543
|
+
*/
|
|
5544
|
+
function toSecretFieldView(stored) {
|
|
5545
|
+
if (isSecretMarker(stored)) return {
|
|
5546
|
+
$secret: stored.$secret,
|
|
5547
|
+
v: 1,
|
|
5548
|
+
set: true
|
|
5549
|
+
};
|
|
5550
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5551
|
+
$secret: null,
|
|
5552
|
+
v: 1,
|
|
5553
|
+
set: true,
|
|
5554
|
+
inline: true
|
|
5555
|
+
};
|
|
5556
|
+
return null;
|
|
5557
|
+
}
|
|
5558
|
+
/**
|
|
5559
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5560
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5561
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5562
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5563
|
+
*/
|
|
5564
|
+
function classifySecretWrite(incoming) {
|
|
5565
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5566
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5567
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5568
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5569
|
+
return {
|
|
5570
|
+
kind: "set",
|
|
5571
|
+
value: incoming
|
|
5572
|
+
};
|
|
5573
|
+
}
|
|
5476
5574
|
Object.fromEntries([
|
|
5477
5575
|
{
|
|
5478
5576
|
id: "overview",
|
|
@@ -5644,33 +5742,19 @@ Object.fromEntries([
|
|
|
5644
5742
|
function isValuelessField(field) {
|
|
5645
5743
|
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";
|
|
5646
5744
|
}
|
|
5647
|
-
|
|
5648
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5649
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5650
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5651
|
-
*
|
|
5652
|
-
* For each leaf field:
|
|
5653
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5654
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5655
|
-
*
|
|
5656
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5657
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5658
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5659
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5660
|
-
*/
|
|
5661
|
-
function hydrateSchema(schema, values) {
|
|
5745
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5662
5746
|
return {
|
|
5663
5747
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5664
5748
|
sections: schema.sections.map((section) => ({
|
|
5665
5749
|
...section,
|
|
5666
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5750
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5667
5751
|
}))
|
|
5668
5752
|
};
|
|
5669
5753
|
}
|
|
5670
|
-
function hydrateField(field, values) {
|
|
5754
|
+
function hydrateField(field, values, options) {
|
|
5671
5755
|
if (isValuelessField(field)) return field;
|
|
5672
5756
|
if (field.type === "group") {
|
|
5673
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5757
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5674
5758
|
return {
|
|
5675
5759
|
...field,
|
|
5676
5760
|
fields: hydratedChildren
|
|
@@ -5679,7 +5763,7 @@ function hydrateField(field, values) {
|
|
|
5679
5763
|
if (field.type === "sub-tabs") {
|
|
5680
5764
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5681
5765
|
...tab,
|
|
5682
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5766
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5683
5767
|
}));
|
|
5684
5768
|
return {
|
|
5685
5769
|
...field,
|
|
@@ -5689,6 +5773,33 @@ function hydrateField(field, values) {
|
|
|
5689
5773
|
const key = field.key;
|
|
5690
5774
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5691
5775
|
const defaultValue = field.default;
|
|
5776
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5777
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5778
|
+
...field,
|
|
5779
|
+
value: toSecretFieldView(storedValue)
|
|
5780
|
+
};
|
|
5781
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5782
|
+
...field,
|
|
5783
|
+
value: null
|
|
5784
|
+
};
|
|
5785
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5786
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5787
|
+
if (secretItemKeys.length > 0) {
|
|
5788
|
+
const rows = storedValue.map((row) => {
|
|
5789
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5790
|
+
const out = { ...row };
|
|
5791
|
+
for (const k of secretItemKeys) {
|
|
5792
|
+
const v = Reflect.get(row, k);
|
|
5793
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5794
|
+
}
|
|
5795
|
+
return out;
|
|
5796
|
+
});
|
|
5797
|
+
return {
|
|
5798
|
+
...field,
|
|
5799
|
+
value: rows
|
|
5800
|
+
};
|
|
5801
|
+
}
|
|
5802
|
+
}
|
|
5692
5803
|
if (field.multiple) {
|
|
5693
5804
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5694
5805
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5931,6 +6042,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5931
6042
|
}
|
|
5932
6043
|
return out;
|
|
5933
6044
|
}
|
|
6045
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6046
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6047
|
+
function globalSecretScope() {
|
|
6048
|
+
return GLOBAL_SCOPE;
|
|
6049
|
+
}
|
|
6050
|
+
function encodeSegment(value) {
|
|
6051
|
+
return encodeURIComponent(value);
|
|
6052
|
+
}
|
|
6053
|
+
function decodeSegment(value) {
|
|
6054
|
+
try {
|
|
6055
|
+
return decodeURIComponent(value);
|
|
6056
|
+
} catch {
|
|
6057
|
+
return null;
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
6060
|
+
/**
|
|
6061
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6062
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6063
|
+
* `providers[authentik].clientSecret`.
|
|
6064
|
+
*/
|
|
6065
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6066
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6067
|
+
}
|
|
6068
|
+
function parseScope(segments) {
|
|
6069
|
+
switch (segments[0]) {
|
|
6070
|
+
case "global": return {
|
|
6071
|
+
scope: GLOBAL_SCOPE,
|
|
6072
|
+
used: 1
|
|
6073
|
+
};
|
|
6074
|
+
case "node": {
|
|
6075
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6076
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6077
|
+
scope: {
|
|
6078
|
+
kind: "node",
|
|
6079
|
+
nodeId
|
|
6080
|
+
},
|
|
6081
|
+
used: 2
|
|
6082
|
+
};
|
|
6083
|
+
}
|
|
6084
|
+
case "device": {
|
|
6085
|
+
const raw = segments[1];
|
|
6086
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6087
|
+
return {
|
|
6088
|
+
scope: {
|
|
6089
|
+
kind: "device",
|
|
6090
|
+
deviceId: Number(raw)
|
|
6091
|
+
},
|
|
6092
|
+
used: 2
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
case "integration": {
|
|
6096
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6097
|
+
return id === null || id.length === 0 ? null : {
|
|
6098
|
+
scope: {
|
|
6099
|
+
kind: "integration",
|
|
6100
|
+
integrationId: id
|
|
6101
|
+
},
|
|
6102
|
+
used: 2
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
case "row": {
|
|
6106
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6107
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6108
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6109
|
+
return {
|
|
6110
|
+
scope: {
|
|
6111
|
+
kind: "row",
|
|
6112
|
+
collection,
|
|
6113
|
+
rowId
|
|
6114
|
+
},
|
|
6115
|
+
used: 3
|
|
6116
|
+
};
|
|
6117
|
+
}
|
|
6118
|
+
default: return null;
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6122
|
+
function parseSecretRef(ref) {
|
|
6123
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6124
|
+
const segments = ref.slice(9).split("/");
|
|
6125
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6126
|
+
if (owner === null || owner.length === 0) return null;
|
|
6127
|
+
const parsed = parseScope(segments.slice(1));
|
|
6128
|
+
if (parsed === null) return null;
|
|
6129
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6130
|
+
if (fieldPath.length === 0) return null;
|
|
6131
|
+
return {
|
|
6132
|
+
owner,
|
|
6133
|
+
scope: parsed.scope,
|
|
6134
|
+
fieldPath
|
|
6135
|
+
};
|
|
6136
|
+
}
|
|
6137
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6138
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6139
|
+
fieldPath;
|
|
6140
|
+
constructor(fieldPath, cause) {
|
|
6141
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6142
|
+
this.fieldPath = fieldPath;
|
|
6143
|
+
this.name = "KeychainWriteRefusedError";
|
|
6144
|
+
}
|
|
6145
|
+
};
|
|
6146
|
+
var KEEP = { kind: "keep" };
|
|
6147
|
+
function isRecord$1(value) {
|
|
6148
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6149
|
+
}
|
|
6150
|
+
function defaultMintId() {
|
|
6151
|
+
return globalThis.crypto.randomUUID();
|
|
6152
|
+
}
|
|
6153
|
+
/** Every marker ref anywhere under `value`. */
|
|
6154
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6155
|
+
if (isSecretMarker(value)) {
|
|
6156
|
+
out.push(value.$secret);
|
|
6157
|
+
return out;
|
|
6158
|
+
}
|
|
6159
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6160
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6161
|
+
return out;
|
|
6162
|
+
}
|
|
6163
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6164
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6165
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6166
|
+
}
|
|
6167
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6168
|
+
const intent = classifySecretWrite(incoming);
|
|
6169
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6170
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6171
|
+
if (intent.kind === "keep") return KEEP;
|
|
6172
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6173
|
+
if (intent.kind === "clear") {
|
|
6174
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6175
|
+
return {
|
|
6176
|
+
kind: "value",
|
|
6177
|
+
value: null
|
|
6178
|
+
};
|
|
6179
|
+
}
|
|
6180
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6181
|
+
kind: "value",
|
|
6182
|
+
value: stored
|
|
6183
|
+
};
|
|
6184
|
+
try {
|
|
6185
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6186
|
+
} catch (err) {
|
|
6187
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6188
|
+
}
|
|
6189
|
+
return {
|
|
6190
|
+
kind: "value",
|
|
6191
|
+
value: makeSecretMarker(ref)
|
|
6192
|
+
};
|
|
6193
|
+
}
|
|
6194
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6195
|
+
function applyMember(out, key, result, storedParent) {
|
|
6196
|
+
if (result.kind === "value") {
|
|
6197
|
+
out[key] = result.value;
|
|
6198
|
+
return;
|
|
6199
|
+
}
|
|
6200
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6201
|
+
else delete out[key];
|
|
6202
|
+
}
|
|
6203
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6204
|
+
const out = { ...incoming };
|
|
6205
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6206
|
+
return out;
|
|
6207
|
+
}
|
|
6208
|
+
function rowId(row, idKey) {
|
|
6209
|
+
const raw = row[idKey];
|
|
6210
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6211
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6212
|
+
return null;
|
|
6213
|
+
}
|
|
6214
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6215
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6216
|
+
if (!Array.isArray(incoming)) {
|
|
6217
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6218
|
+
return {
|
|
6219
|
+
kind: "value",
|
|
6220
|
+
value: incoming
|
|
6221
|
+
};
|
|
6222
|
+
}
|
|
6223
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6224
|
+
for (const row of storedRows) {
|
|
6225
|
+
const id = rowId(row, node.idKey);
|
|
6226
|
+
if (id !== null) storedById.set(id, row);
|
|
6227
|
+
}
|
|
6228
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6229
|
+
const rows = [];
|
|
6230
|
+
for (const row of incoming) {
|
|
6231
|
+
if (!isRecord$1(row)) {
|
|
6232
|
+
rows.push(row);
|
|
6233
|
+
continue;
|
|
6234
|
+
}
|
|
6235
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6236
|
+
kept.add(id);
|
|
6237
|
+
const withId = {
|
|
6238
|
+
...row,
|
|
6239
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6240
|
+
};
|
|
6241
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6242
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6243
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6244
|
+
}
|
|
6245
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6246
|
+
return {
|
|
6247
|
+
kind: "value",
|
|
6248
|
+
value: rows
|
|
6249
|
+
};
|
|
6250
|
+
}
|
|
6251
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6252
|
+
switch (node.kind) {
|
|
6253
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6254
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6255
|
+
case "object": {
|
|
6256
|
+
if (!isRecord$1(incoming)) {
|
|
6257
|
+
if (incoming === void 0) return KEEP;
|
|
6258
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6259
|
+
return {
|
|
6260
|
+
kind: "value",
|
|
6261
|
+
value: incoming
|
|
6262
|
+
};
|
|
6263
|
+
}
|
|
6264
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6265
|
+
return {
|
|
6266
|
+
kind: "value",
|
|
6267
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6268
|
+
};
|
|
6269
|
+
}
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6273
|
+
function splitNodeKey(key) {
|
|
6274
|
+
const at = key.indexOf("@");
|
|
6275
|
+
return at <= 0 ? {
|
|
6276
|
+
base: key,
|
|
6277
|
+
nodeId: null
|
|
6278
|
+
} : {
|
|
6279
|
+
base: key.slice(0, at),
|
|
6280
|
+
nodeId: key.slice(at + 1)
|
|
6281
|
+
};
|
|
6282
|
+
}
|
|
6283
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6284
|
+
async function transformSecretWrite(input) {
|
|
6285
|
+
const deletes = [];
|
|
6286
|
+
const base = {
|
|
6287
|
+
secrets: input.secrets,
|
|
6288
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6289
|
+
deletes,
|
|
6290
|
+
operatorWrite: input.operatorWrite === true
|
|
6291
|
+
};
|
|
6292
|
+
const out = {};
|
|
6293
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6294
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6295
|
+
const node = input.tree.get(baseKey);
|
|
6296
|
+
if (node === void 0) {
|
|
6297
|
+
out[key] = incoming;
|
|
6298
|
+
continue;
|
|
6299
|
+
}
|
|
6300
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6301
|
+
kind: "node",
|
|
6302
|
+
nodeId
|
|
6303
|
+
} : input.scope ?? globalSecretScope();
|
|
6304
|
+
const result = await writeNode({
|
|
6305
|
+
...base,
|
|
6306
|
+
scope
|
|
6307
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6308
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6309
|
+
}
|
|
6310
|
+
return {
|
|
6311
|
+
patch: out,
|
|
6312
|
+
afterWrite: async () => {
|
|
6313
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6314
|
+
try {
|
|
6315
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6316
|
+
return { orphaned: [] };
|
|
6317
|
+
} catch {
|
|
6318
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6319
|
+
}
|
|
6320
|
+
}
|
|
6321
|
+
};
|
|
6322
|
+
}
|
|
6323
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6324
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6325
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6326
|
+
}
|
|
6327
|
+
/**
|
|
6328
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6329
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6330
|
+
*/
|
|
6331
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6332
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6333
|
+
const owner = options.ownedBy;
|
|
6334
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6335
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6336
|
+
if (refs.length === 0) return {
|
|
6337
|
+
value,
|
|
6338
|
+
unresolved: []
|
|
6339
|
+
};
|
|
6340
|
+
const answers = await secrets.resolve(refs);
|
|
6341
|
+
const unresolved = [];
|
|
6342
|
+
for (const ref of new Set(refs)) {
|
|
6343
|
+
const answer = answers[ref];
|
|
6344
|
+
if (answer === void 0) unresolved.push({
|
|
6345
|
+
ref,
|
|
6346
|
+
reason: "not-initialized"
|
|
6347
|
+
});
|
|
6348
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6349
|
+
ref,
|
|
6350
|
+
reason: answer.reason
|
|
6351
|
+
});
|
|
6352
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6353
|
+
ref,
|
|
6354
|
+
reason: answer.kind
|
|
6355
|
+
});
|
|
6356
|
+
}
|
|
6357
|
+
const substitute = (v) => {
|
|
6358
|
+
if (isSecretMarker(v)) {
|
|
6359
|
+
if (!inScope(v.$secret)) return {
|
|
6360
|
+
keep: true,
|
|
6361
|
+
value: v
|
|
6362
|
+
};
|
|
6363
|
+
const answer = answers[v.$secret];
|
|
6364
|
+
if (answer?.kind === "value") return {
|
|
6365
|
+
keep: true,
|
|
6366
|
+
value: answer.value
|
|
6367
|
+
};
|
|
6368
|
+
return keepMarker ? {
|
|
6369
|
+
keep: true,
|
|
6370
|
+
value: v
|
|
6371
|
+
} : {
|
|
6372
|
+
keep: false,
|
|
6373
|
+
value: void 0
|
|
6374
|
+
};
|
|
6375
|
+
}
|
|
6376
|
+
if (Array.isArray(v)) {
|
|
6377
|
+
const items = [];
|
|
6378
|
+
for (const item of v) {
|
|
6379
|
+
const s = substitute(item);
|
|
6380
|
+
if (s.keep) items.push(s.value);
|
|
6381
|
+
}
|
|
6382
|
+
return {
|
|
6383
|
+
keep: true,
|
|
6384
|
+
value: items
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
if (isRecord$1(v)) {
|
|
6388
|
+
const out = {};
|
|
6389
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6390
|
+
const s = substitute(child);
|
|
6391
|
+
if (s.keep) out[k] = s.value;
|
|
6392
|
+
}
|
|
6393
|
+
return {
|
|
6394
|
+
keep: true,
|
|
6395
|
+
value: out
|
|
6396
|
+
};
|
|
6397
|
+
}
|
|
6398
|
+
return {
|
|
6399
|
+
keep: true,
|
|
6400
|
+
value: v
|
|
6401
|
+
};
|
|
6402
|
+
};
|
|
6403
|
+
return {
|
|
6404
|
+
value: substitute(value).value,
|
|
6405
|
+
unresolved
|
|
6406
|
+
};
|
|
6407
|
+
}
|
|
6408
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6409
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6410
|
+
ref;
|
|
6411
|
+
reason;
|
|
6412
|
+
constructor(ref, reason) {
|
|
6413
|
+
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.`);
|
|
6414
|
+
this.ref = ref;
|
|
6415
|
+
this.reason = reason;
|
|
6416
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6417
|
+
}
|
|
6418
|
+
};
|
|
6419
|
+
function isRecord(value) {
|
|
6420
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6421
|
+
}
|
|
6422
|
+
function resolvedValue(pass, marker) {
|
|
6423
|
+
const answer = pass.answers[marker.$secret];
|
|
6424
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6425
|
+
}
|
|
6426
|
+
async function atMarker(pass, incoming, stored) {
|
|
6427
|
+
if (incoming === null) return stored;
|
|
6428
|
+
if (typeof incoming !== "string") return incoming;
|
|
6429
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6430
|
+
const intent = classifySecretWrite(incoming);
|
|
6431
|
+
if (intent.kind !== "set") return stored;
|
|
6432
|
+
const ref = stored.$secret;
|
|
6433
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6434
|
+
const answer = pass.answers[ref];
|
|
6435
|
+
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);
|
|
6436
|
+
try {
|
|
6437
|
+
await pass.secrets.put(ref, intent.value);
|
|
6438
|
+
} catch (err) {
|
|
6439
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6440
|
+
}
|
|
6441
|
+
pass.changedRefs.push(ref);
|
|
6442
|
+
return stored;
|
|
6443
|
+
}
|
|
6444
|
+
function inArray(pass, incoming, stored) {
|
|
6445
|
+
return incoming.map((item, index) => {
|
|
6446
|
+
const twin = stored[index];
|
|
6447
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6448
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6449
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6450
|
+
return item;
|
|
6451
|
+
});
|
|
6452
|
+
}
|
|
6453
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6454
|
+
const out = { ...incoming };
|
|
6455
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6456
|
+
const twin = stored[key];
|
|
6457
|
+
if (isSecretMarker(twin)) {
|
|
6458
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6459
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6460
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6461
|
+
}
|
|
6462
|
+
return out;
|
|
6463
|
+
}
|
|
6464
|
+
async function walk(pass, incoming, stored) {
|
|
6465
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6466
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6467
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6468
|
+
const out = { ...incoming };
|
|
6469
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6470
|
+
return out;
|
|
6471
|
+
}
|
|
6472
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6473
|
+
async function restoreUnchangedSecrets(input) {
|
|
6474
|
+
const refs = [];
|
|
6475
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6476
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6477
|
+
if (owned.length === 0) return {
|
|
6478
|
+
patch: input.patch,
|
|
6479
|
+
changedRefs: []
|
|
6480
|
+
};
|
|
6481
|
+
const pass = {
|
|
6482
|
+
secrets: input.secrets,
|
|
6483
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6484
|
+
operatorWrite: input.operatorWrite,
|
|
6485
|
+
changedRefs: []
|
|
6486
|
+
};
|
|
6487
|
+
const out = {};
|
|
6488
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6489
|
+
return {
|
|
6490
|
+
patch: out,
|
|
6491
|
+
changedRefs: pass.changedRefs
|
|
6492
|
+
};
|
|
6493
|
+
}
|
|
6494
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6495
|
+
function isJsonEqual(a, b) {
|
|
6496
|
+
if (Object.is(a, b)) return true;
|
|
6497
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6498
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6499
|
+
const keys = Object.keys(a);
|
|
6500
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6501
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6502
|
+
}
|
|
6503
|
+
return false;
|
|
6504
|
+
}
|
|
6505
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6506
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6507
|
+
const out = {};
|
|
6508
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6509
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6510
|
+
out[key] = value;
|
|
6511
|
+
}
|
|
6512
|
+
return out;
|
|
6513
|
+
}
|
|
6514
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6515
|
+
function markerKeysOf(blob, owner) {
|
|
6516
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6517
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6518
|
+
return keys;
|
|
6519
|
+
}
|
|
6520
|
+
function nodeFromStored(value, owner) {
|
|
6521
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6522
|
+
if (!isRecord(value)) return null;
|
|
6523
|
+
const children = /* @__PURE__ */ new Map();
|
|
6524
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6525
|
+
const node = nodeFromStored(child, owner);
|
|
6526
|
+
if (node !== null) children.set(key, node);
|
|
6527
|
+
}
|
|
6528
|
+
return children.size > 0 ? {
|
|
6529
|
+
kind: "object",
|
|
6530
|
+
children
|
|
6531
|
+
} : null;
|
|
6532
|
+
}
|
|
6533
|
+
/**
|
|
6534
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6535
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6536
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6537
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6538
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6539
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6540
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6541
|
+
* over.
|
|
6542
|
+
*/
|
|
6543
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6544
|
+
const added = /* @__PURE__ */ new Map();
|
|
6545
|
+
for (const key of keys) {
|
|
6546
|
+
const at = key.indexOf("@");
|
|
6547
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6548
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6549
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6550
|
+
if (node !== null) added.set(base, node);
|
|
6551
|
+
}
|
|
6552
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6553
|
+
}
|
|
6554
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6555
|
+
async function readStoredAddonBlob(raw) {
|
|
6556
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6557
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6558
|
+
const result = await threeWay.call(raw);
|
|
6559
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6560
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6561
|
+
}
|
|
6562
|
+
function touchesTree(tree, patch) {
|
|
6563
|
+
if (tree.size === 0) return false;
|
|
6564
|
+
for (const key of Object.keys(patch)) {
|
|
6565
|
+
const at = key.indexOf("@");
|
|
6566
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6567
|
+
}
|
|
6568
|
+
return false;
|
|
6569
|
+
}
|
|
6570
|
+
/**
|
|
6571
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6572
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6573
|
+
*/
|
|
6574
|
+
var MarkerKeyIndex = class {
|
|
6575
|
+
owner;
|
|
6576
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6577
|
+
constructor(owner) {
|
|
6578
|
+
this.owner = owner;
|
|
6579
|
+
}
|
|
6580
|
+
seen(store, blob) {
|
|
6581
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6582
|
+
}
|
|
6583
|
+
wrote(store, patch) {
|
|
6584
|
+
const keys = this.byStore.get(store);
|
|
6585
|
+
if (keys === void 0) return;
|
|
6586
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6587
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6588
|
+
else keys.delete(key);
|
|
6589
|
+
}
|
|
6590
|
+
mayHoldMarkers(store, patch) {
|
|
6591
|
+
const keys = this.byStore.get(store);
|
|
6592
|
+
if (keys === void 0) return true;
|
|
6593
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6594
|
+
}
|
|
6595
|
+
};
|
|
6596
|
+
function createHandle(raw, opts) {
|
|
6597
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6598
|
+
const serialize = (key, fn) => {
|
|
6599
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6600
|
+
const tail = next.catch(() => void 0);
|
|
6601
|
+
chains.set(key, tail);
|
|
6602
|
+
tail.then(() => {
|
|
6603
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6604
|
+
});
|
|
6605
|
+
return next;
|
|
6606
|
+
};
|
|
6607
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6608
|
+
const resolveRead = async (store, blob) => {
|
|
6609
|
+
index.seen(store, blob);
|
|
6610
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6611
|
+
unresolved: "keep-marker",
|
|
6612
|
+
ownedBy: opts.secrets.owner
|
|
6613
|
+
});
|
|
6614
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6615
|
+
return value;
|
|
6616
|
+
};
|
|
6617
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6618
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6619
|
+
await rawWrite(patch);
|
|
6620
|
+
index.wrote(store, patch);
|
|
6621
|
+
return { changed: true };
|
|
6622
|
+
}
|
|
6623
|
+
return serialize(store, async () => {
|
|
6624
|
+
const stored = await readStored();
|
|
6625
|
+
index.seen(store, stored);
|
|
6626
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6627
|
+
const restored = await restoreUnchangedSecrets({
|
|
6628
|
+
patch,
|
|
6629
|
+
stored,
|
|
6630
|
+
secrets: opts.secrets,
|
|
6631
|
+
operatorWrite
|
|
6632
|
+
});
|
|
6633
|
+
const result = await transformSecretWrite({
|
|
6634
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6635
|
+
secrets: opts.secrets,
|
|
6636
|
+
patch: restored.patch,
|
|
6637
|
+
stored,
|
|
6638
|
+
...scope !== void 0 ? { scope } : {},
|
|
6639
|
+
operatorWrite
|
|
6640
|
+
});
|
|
6641
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6642
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6643
|
+
if (wroteBlob) {
|
|
6644
|
+
await rawWrite(effective);
|
|
6645
|
+
index.wrote(store, effective);
|
|
6646
|
+
}
|
|
6647
|
+
const { orphaned } = await result.afterWrite();
|
|
6648
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6649
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6650
|
+
});
|
|
6651
|
+
};
|
|
6652
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6653
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6654
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6655
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6656
|
+
const overrides = {
|
|
6657
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6658
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6659
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6660
|
+
return result.kind === "value" ? {
|
|
6661
|
+
kind: "value",
|
|
6662
|
+
value: await resolveRead("addon", result.value)
|
|
6663
|
+
} : result;
|
|
6664
|
+
} } : {},
|
|
6665
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6666
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6667
|
+
if (result.kind !== "present") return result;
|
|
6668
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6669
|
+
unresolved: "keep-marker",
|
|
6670
|
+
ownedBy: opts.secrets.owner
|
|
6671
|
+
});
|
|
6672
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6673
|
+
return {
|
|
6674
|
+
kind: "present",
|
|
6675
|
+
value: value[key]
|
|
6676
|
+
};
|
|
6677
|
+
} } : {},
|
|
6678
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6679
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6680
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6681
|
+
const out = /* @__PURE__ */ new Map();
|
|
6682
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6683
|
+
return out;
|
|
6684
|
+
} } : {},
|
|
6685
|
+
writeAddonStore: async (patch) => {
|
|
6686
|
+
await writeAddon(patch);
|
|
6687
|
+
},
|
|
6688
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6689
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6690
|
+
kind: "device",
|
|
6691
|
+
deviceId
|
|
6692
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6693
|
+
}
|
|
6694
|
+
};
|
|
6695
|
+
return {
|
|
6696
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6697
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6698
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6699
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6700
|
+
} }),
|
|
6701
|
+
raw: {
|
|
6702
|
+
readAddonStore: async () => {
|
|
6703
|
+
const blob = await raw.readAddonStore();
|
|
6704
|
+
index.seen("addon", blob);
|
|
6705
|
+
return blob;
|
|
6706
|
+
},
|
|
6707
|
+
readDeviceStore: async (deviceId) => {
|
|
6708
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6709
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6710
|
+
return blob;
|
|
6711
|
+
}
|
|
6712
|
+
},
|
|
6713
|
+
writeAddonStore: writeAddon
|
|
6714
|
+
};
|
|
6715
|
+
}
|
|
6716
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6717
|
+
function createSecretAwareContext(context, opts) {
|
|
6718
|
+
const raw = context.settings;
|
|
6719
|
+
if (raw === void 0) return {
|
|
6720
|
+
context,
|
|
6721
|
+
handle: null
|
|
6722
|
+
};
|
|
6723
|
+
const handle = createHandle(raw, opts);
|
|
6724
|
+
return {
|
|
6725
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6726
|
+
if (prop === "settings") return handle.settings;
|
|
6727
|
+
return Reflect.get(target, prop, receiver);
|
|
6728
|
+
} }),
|
|
6729
|
+
handle
|
|
6730
|
+
};
|
|
6731
|
+
}
|
|
6732
|
+
var LEAF = { kind: "leaf" };
|
|
6733
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6734
|
+
function collectFields(fields, out) {
|
|
6735
|
+
for (const field of fields) {
|
|
6736
|
+
if (field.type === "group") {
|
|
6737
|
+
collectFields(field.fields, out);
|
|
6738
|
+
continue;
|
|
6739
|
+
}
|
|
6740
|
+
if (field.type === "sub-tabs") {
|
|
6741
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6742
|
+
continue;
|
|
6743
|
+
}
|
|
6744
|
+
if (field.type === "editable-array") {
|
|
6745
|
+
const item = /* @__PURE__ */ new Map();
|
|
6746
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6747
|
+
if (item.size > 0) out.set(field.key, {
|
|
6748
|
+
kind: "array",
|
|
6749
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6750
|
+
item
|
|
6751
|
+
});
|
|
6752
|
+
continue;
|
|
6753
|
+
}
|
|
6754
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6755
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6756
|
+
}
|
|
6757
|
+
}
|
|
6758
|
+
/** The secret tree a settings schema declares. */
|
|
6759
|
+
function secretTreeFromSchema(schema) {
|
|
6760
|
+
const out = /* @__PURE__ */ new Map();
|
|
6761
|
+
if (schema === null) return out;
|
|
6762
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6763
|
+
return out;
|
|
6764
|
+
}
|
|
6765
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6766
|
+
function parseSecretStatePath(path) {
|
|
6767
|
+
const segments = [];
|
|
6768
|
+
for (const raw of path.split(".")) {
|
|
6769
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6770
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6771
|
+
segments.push(m[2] !== void 0 ? {
|
|
6772
|
+
key: m[1],
|
|
6773
|
+
idKey: m[2]
|
|
6774
|
+
} : { key: m[1] });
|
|
6775
|
+
}
|
|
6776
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6777
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6778
|
+
return segments;
|
|
6779
|
+
}
|
|
6780
|
+
function insert(into, segments) {
|
|
6781
|
+
const [head, ...rest] = segments;
|
|
6782
|
+
if (head === void 0) return;
|
|
6783
|
+
if (rest.length === 0) {
|
|
6784
|
+
into.set(head.key, LEAF);
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
const existing = into.get(head.key);
|
|
6788
|
+
if (head.idKey !== void 0) {
|
|
6789
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6790
|
+
insert(item, rest);
|
|
6791
|
+
into.set(head.key, {
|
|
6792
|
+
kind: "array",
|
|
6793
|
+
idKey: head.idKey,
|
|
6794
|
+
item
|
|
6795
|
+
});
|
|
6796
|
+
return;
|
|
6797
|
+
}
|
|
6798
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6799
|
+
insert(children, rest);
|
|
6800
|
+
into.set(head.key, {
|
|
6801
|
+
kind: "object",
|
|
6802
|
+
children
|
|
6803
|
+
});
|
|
6804
|
+
}
|
|
6805
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6806
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6807
|
+
if (paths.length === 0) return tree;
|
|
6808
|
+
const out = new Map(tree);
|
|
6809
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6810
|
+
return out;
|
|
6811
|
+
}
|
|
6812
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6813
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6814
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6815
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6816
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5934
6817
|
/**
|
|
5935
6818
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5936
6819
|
*
|
|
@@ -6000,6 +6883,33 @@ var BaseAddon = class {
|
|
|
6000
6883
|
settingsStoreReady = false;
|
|
6001
6884
|
/** Default config values. Provided via constructor. */
|
|
6002
6885
|
defaults;
|
|
6886
|
+
/**
|
|
6887
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6888
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6889
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6890
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6891
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6892
|
+
*/
|
|
6893
|
+
secretStatePaths = [];
|
|
6894
|
+
_addonSecretTree = null;
|
|
6895
|
+
_deviceSecretTree = null;
|
|
6896
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6897
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6898
|
+
_unresolvedSecrets = [];
|
|
6899
|
+
_secretRetryTimer = null;
|
|
6900
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6901
|
+
_secretChangeTimer = null;
|
|
6902
|
+
_secretChangeUnsub = null;
|
|
6903
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6904
|
+
_operatorWriteDepth = 0;
|
|
6905
|
+
/**
|
|
6906
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6907
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6908
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6909
|
+
*/
|
|
6910
|
+
_secretSettings = null;
|
|
6911
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6912
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6003
6913
|
constructor(defaults) {
|
|
6004
6914
|
this.defaults = defaults;
|
|
6005
6915
|
this._config = { ...defaults };
|
|
@@ -6035,8 +6945,26 @@ var BaseAddon = class {
|
|
|
6035
6945
|
return this._config;
|
|
6036
6946
|
}
|
|
6037
6947
|
async initialize(context) {
|
|
6038
|
-
|
|
6948
|
+
const secrets = context.secrets;
|
|
6949
|
+
if (secrets !== void 0) {
|
|
6950
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6951
|
+
secrets,
|
|
6952
|
+
addonTree: () => this.addonSecretTree(),
|
|
6953
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6954
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6955
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6956
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6957
|
+
});
|
|
6958
|
+
this._ctx = wrapped;
|
|
6959
|
+
this._secretSettings = handle;
|
|
6960
|
+
} else {
|
|
6961
|
+
this._ctx = context;
|
|
6962
|
+
this._secretSettings = null;
|
|
6963
|
+
}
|
|
6039
6964
|
await this.resolveConfig();
|
|
6965
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6966
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6967
|
+
});
|
|
6040
6968
|
const result = await this.onInitialize();
|
|
6041
6969
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6042
6970
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6069,6 +6997,12 @@ var BaseAddon = class {
|
|
|
6069
6997
|
*/
|
|
6070
6998
|
async onHubReachable() {}
|
|
6071
6999
|
async shutdown() {
|
|
7000
|
+
this._secretChangeUnsub?.();
|
|
7001
|
+
this._secretChangeUnsub = null;
|
|
7002
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7003
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7004
|
+
this._secretRetryTimer = null;
|
|
7005
|
+
this._secretChangeTimer = null;
|
|
6072
7006
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6073
7007
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6074
7008
|
await this.onShutdown();
|
|
@@ -6143,11 +7077,8 @@ var BaseAddon = class {
|
|
|
6143
7077
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6144
7078
|
const schema = this.globalSettingsSchema(cap);
|
|
6145
7079
|
if (!schema) return { sections: [] };
|
|
6146
|
-
const projected = await this.
|
|
6147
|
-
return hydrateSchema(schema, overlay ? {
|
|
6148
|
-
...projected,
|
|
6149
|
-
...overlay
|
|
6150
|
-
} : projected);
|
|
7080
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7081
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6151
7082
|
}
|
|
6152
7083
|
/**
|
|
6153
7084
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6192,11 +7123,11 @@ var BaseAddon = class {
|
|
|
6192
7123
|
});
|
|
6193
7124
|
}
|
|
6194
7125
|
if (sections.length === 0) return null;
|
|
6195
|
-
const projected = await this.
|
|
7126
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6196
7127
|
return hydrateSchema({
|
|
6197
7128
|
...schema,
|
|
6198
7129
|
sections
|
|
6199
|
-
}, projected);
|
|
7130
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6200
7131
|
}
|
|
6201
7132
|
/**
|
|
6202
7133
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6209,12 +7140,50 @@ var BaseAddon = class {
|
|
|
6209
7140
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6210
7141
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6211
7142
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7143
|
+
*
|
|
7144
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7145
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7146
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7147
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7148
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7149
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6212
7150
|
*/
|
|
6213
7151
|
async resolveGlobalStore(nodeId, cap) {
|
|
6214
7152
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7153
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7154
|
+
}
|
|
7155
|
+
projectForNode(store, nodeId, cap) {
|
|
6215
7156
|
const keys = this.perNodeKeys(cap);
|
|
6216
7157
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6217
|
-
return keys.size > 0 ? projectStore(
|
|
7158
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7159
|
+
}
|
|
7160
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7161
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7162
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7163
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7164
|
+
}
|
|
7165
|
+
/**
|
|
7166
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7167
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7168
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7169
|
+
* its value.
|
|
7170
|
+
*/
|
|
7171
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7172
|
+
const secrets = this._ctx?.secrets;
|
|
7173
|
+
const merged = {
|
|
7174
|
+
...stored,
|
|
7175
|
+
...overlay
|
|
7176
|
+
};
|
|
7177
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7178
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7179
|
+
unresolved: "keep-marker",
|
|
7180
|
+
ownedBy: secrets.owner
|
|
7181
|
+
});
|
|
7182
|
+
for (const key of Object.keys(overlay)) {
|
|
7183
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7184
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7185
|
+
}
|
|
7186
|
+
return merged;
|
|
6218
7187
|
}
|
|
6219
7188
|
/**
|
|
6220
7189
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6250,18 +7219,58 @@ var BaseAddon = class {
|
|
|
6250
7219
|
value: result.value[key]
|
|
6251
7220
|
};
|
|
6252
7221
|
}
|
|
7222
|
+
/**
|
|
7223
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7224
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7225
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7226
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7227
|
+
* writing back what it read is not (D787).
|
|
7228
|
+
*/
|
|
7229
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7230
|
+
this._operatorWriteDepth++;
|
|
7231
|
+
try {
|
|
7232
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7233
|
+
} finally {
|
|
7234
|
+
this._operatorWriteDepth--;
|
|
7235
|
+
}
|
|
7236
|
+
}
|
|
6253
7237
|
async updateGlobalSettings(patch, nodeId) {
|
|
7238
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7239
|
+
}
|
|
7240
|
+
/**
|
|
7241
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7242
|
+
*
|
|
7243
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7244
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7245
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7246
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7247
|
+
*/
|
|
7248
|
+
async clearSecrets(keys, nodeId) {
|
|
7249
|
+
const tree = this.addonSecretTree();
|
|
7250
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7251
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7252
|
+
const patch = {};
|
|
7253
|
+
for (const key of keys) {
|
|
7254
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7255
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7256
|
+
}
|
|
7257
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7258
|
+
}
|
|
7259
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6254
7260
|
const keys = this.perNodeKeys();
|
|
6255
7261
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6256
7262
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6257
|
-
const barePatch = patch;
|
|
6258
7263
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6259
|
-
|
|
7264
|
+
const handle = this._secretSettings;
|
|
7265
|
+
if (handle !== null) {
|
|
7266
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7267
|
+
if (!changed) return;
|
|
7268
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6260
7269
|
if (target !== localNode) return;
|
|
6261
7270
|
await this.resolveConfig();
|
|
6262
7271
|
await this.onConfigChanged();
|
|
6263
7272
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6264
|
-
this.maybeAutoRestart(
|
|
7273
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6265
7274
|
}
|
|
6266
7275
|
/**
|
|
6267
7276
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6286,7 +7295,7 @@ var BaseAddon = class {
|
|
|
6286
7295
|
* time to return its response before the addon is torn down and
|
|
6287
7296
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6288
7297
|
*/
|
|
6289
|
-
maybeAutoRestart(
|
|
7298
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6290
7299
|
if (!schema) return;
|
|
6291
7300
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6292
7301
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6294,13 +7303,13 @@ var BaseAddon = class {
|
|
|
6294
7303
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6295
7304
|
}
|
|
6296
7305
|
if (restartKeys.size === 0) return;
|
|
6297
|
-
if (!
|
|
7306
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6298
7307
|
const ctx = this._ctx;
|
|
6299
7308
|
if (!ctx) return;
|
|
6300
7309
|
const addonId = ctx.id;
|
|
6301
7310
|
setImmediate(() => {
|
|
6302
7311
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6303
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7312
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6304
7313
|
}).catch((err) => {
|
|
6305
7314
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6306
7315
|
});
|
|
@@ -6309,7 +7318,7 @@ var BaseAddon = class {
|
|
|
6309
7318
|
async getDeviceSettings(deviceId) {
|
|
6310
7319
|
const schema = this.deviceSettingsSchema();
|
|
6311
7320
|
if (!schema) return { sections: [] };
|
|
6312
|
-
return hydrateSchema(schema, await this.
|
|
7321
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6313
7322
|
}
|
|
6314
7323
|
async updateDeviceSettings(deviceId, patch) {
|
|
6315
7324
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6439,7 +7448,7 @@ var BaseAddon = class {
|
|
|
6439
7448
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6440
7449
|
*/
|
|
6441
7450
|
async resolveConfig() {
|
|
6442
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7451
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6443
7452
|
const perNode = this.perNodeKeys();
|
|
6444
7453
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6445
7454
|
const resolved = { ...this.defaults };
|
|
@@ -6464,7 +7473,7 @@ var BaseAddon = class {
|
|
|
6464
7473
|
key,
|
|
6465
7474
|
schema,
|
|
6466
7475
|
fallback,
|
|
6467
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7476
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6468
7477
|
write: async (patch) => {
|
|
6469
7478
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6470
7479
|
},
|
|
@@ -6481,7 +7490,7 @@ var BaseAddon = class {
|
|
|
6481
7490
|
key,
|
|
6482
7491
|
schema,
|
|
6483
7492
|
fallback,
|
|
6484
|
-
read: async () => await this.
|
|
7493
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6485
7494
|
write: async (patch) => {
|
|
6486
7495
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6487
7496
|
},
|
|
@@ -6493,6 +7502,87 @@ var BaseAddon = class {
|
|
|
6493
7502
|
} })
|
|
6494
7503
|
});
|
|
6495
7504
|
}
|
|
7505
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7506
|
+
addonSecretTree() {
|
|
7507
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7508
|
+
return this._addonSecretTree;
|
|
7509
|
+
}
|
|
7510
|
+
deviceSecretTree() {
|
|
7511
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7512
|
+
return this._deviceSecretTree;
|
|
7513
|
+
}
|
|
7514
|
+
/**
|
|
7515
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7516
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7517
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7518
|
+
* than start on an empty credential.
|
|
7519
|
+
*/
|
|
7520
|
+
get unresolvedSecrets() {
|
|
7521
|
+
return this._unresolvedSecrets;
|
|
7522
|
+
}
|
|
7523
|
+
/**
|
|
7524
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7525
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7526
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7527
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7528
|
+
* ever written back from here.
|
|
7529
|
+
*/
|
|
7530
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7531
|
+
const secrets = this._ctx?.secrets;
|
|
7532
|
+
if (secrets === void 0) return blob;
|
|
7533
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7534
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7535
|
+
if (refs.length === 0) {
|
|
7536
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7537
|
+
return blob;
|
|
7538
|
+
}
|
|
7539
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7540
|
+
if (trackForConfig) {
|
|
7541
|
+
this._unresolvedSecrets = unresolved;
|
|
7542
|
+
if (unresolved.length > 0) {
|
|
7543
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7544
|
+
ref: u.ref,
|
|
7545
|
+
reason: u.reason
|
|
7546
|
+
})) } });
|
|
7547
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7548
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7549
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7550
|
+
}
|
|
7551
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7552
|
+
}
|
|
7553
|
+
return value;
|
|
7554
|
+
}
|
|
7555
|
+
/**
|
|
7556
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7557
|
+
* keychain the context's own view is already raw.
|
|
7558
|
+
*/
|
|
7559
|
+
rawSettings() {
|
|
7560
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7561
|
+
}
|
|
7562
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7563
|
+
logUnresolvedRead(unresolved) {
|
|
7564
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7565
|
+
if (fresh.length === 0) return;
|
|
7566
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7567
|
+
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) => ({
|
|
7568
|
+
ref: u.ref,
|
|
7569
|
+
reason: u.reason
|
|
7570
|
+
})) } });
|
|
7571
|
+
}
|
|
7572
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7573
|
+
scheduleSecretReresolve(delayMs) {
|
|
7574
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7575
|
+
if (this[timerOf] !== null) return;
|
|
7576
|
+
const timer = setTimeout(() => {
|
|
7577
|
+
this[timerOf] = null;
|
|
7578
|
+
if (this._ctx === null) return;
|
|
7579
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7580
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7581
|
+
});
|
|
7582
|
+
}, delayMs);
|
|
7583
|
+
timer.unref?.();
|
|
7584
|
+
this[timerOf] = timer;
|
|
7585
|
+
}
|
|
6496
7586
|
/**
|
|
6497
7587
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6498
7588
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6505,7 +7595,7 @@ var BaseAddon = class {
|
|
|
6505
7595
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6506
7596
|
*/
|
|
6507
7597
|
async readAddonStoreWithRetry() {
|
|
6508
|
-
const settings = this.
|
|
7598
|
+
const settings = this.rawSettings();
|
|
6509
7599
|
if (!settings) return {};
|
|
6510
7600
|
const delaysMs = [
|
|
6511
7601
|
150,
|
|
@@ -7068,6 +8158,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7068
8158
|
kind: "mutation",
|
|
7069
8159
|
auth: "admin"
|
|
7070
8160
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8161
|
+
function defOf(schema) {
|
|
8162
|
+
return schema._zod?.def ?? {};
|
|
8163
|
+
}
|
|
8164
|
+
function declaredHere(schema) {
|
|
8165
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8166
|
+
}
|
|
8167
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8168
|
+
var WRAPPERS = new Set([
|
|
8169
|
+
"optional",
|
|
8170
|
+
"nullable",
|
|
8171
|
+
"default",
|
|
8172
|
+
"prefault",
|
|
8173
|
+
"catch",
|
|
8174
|
+
"readonly",
|
|
8175
|
+
"nonoptional"
|
|
8176
|
+
]);
|
|
8177
|
+
/**
|
|
8178
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8179
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8180
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8181
|
+
* `.transform` on `in`).
|
|
8182
|
+
*/
|
|
8183
|
+
function layersOf(schema) {
|
|
8184
|
+
const out = [];
|
|
8185
|
+
const queue = [schema];
|
|
8186
|
+
while (queue.length > 0) {
|
|
8187
|
+
const s = queue.shift();
|
|
8188
|
+
if (!s || out.includes(s)) continue;
|
|
8189
|
+
out.push(s);
|
|
8190
|
+
const def = defOf(s);
|
|
8191
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8192
|
+
if (def.type === "pipe") {
|
|
8193
|
+
if (def.in) queue.push(def.in);
|
|
8194
|
+
if (def.out) queue.push(def.out);
|
|
8195
|
+
}
|
|
8196
|
+
}
|
|
8197
|
+
return out;
|
|
8198
|
+
}
|
|
8199
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8200
|
+
function isZodSecret(schema) {
|
|
8201
|
+
return layersOf(schema).some(declaredHere);
|
|
8202
|
+
}
|
|
8203
|
+
/**
|
|
8204
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8205
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8206
|
+
* object or array is reported as one path and not descended into — everything
|
|
8207
|
+
* under it is secret.
|
|
8208
|
+
*/
|
|
8209
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8210
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8211
|
+
const paths = [];
|
|
8212
|
+
for (const layer of layersOf(schema)) {
|
|
8213
|
+
const def = defOf(layer);
|
|
8214
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8215
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8216
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8217
|
+
else if (def.type === "intersection") {
|
|
8218
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8219
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8220
|
+
}
|
|
8221
|
+
}
|
|
8222
|
+
return [...new Set(paths)];
|
|
8223
|
+
}
|
|
7071
8224
|
//#endregion
|
|
7072
8225
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7073
8226
|
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
|
|
@@ -11104,7 +12529,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11104
12529
|
"authenticated",
|
|
11105
12530
|
"admin"
|
|
11106
12531
|
]).optional(),
|
|
11107
|
-
description: string().optional()
|
|
12532
|
+
description: string().optional(),
|
|
12533
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12534
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11108
12535
|
});
|
|
11109
12536
|
/**
|
|
11110
12537
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11809,6 +13236,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11809
13236
|
lastError: string().optional()
|
|
11810
13237
|
});
|
|
11811
13238
|
/**
|
|
13239
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13240
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13241
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13242
|
+
* with it off — which restores without a key.
|
|
13243
|
+
*/
|
|
13244
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13245
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13246
|
+
scheme: string(),
|
|
13247
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13248
|
+
keyId: string()
|
|
13249
|
+
});
|
|
13250
|
+
/**
|
|
13251
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13252
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13253
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13254
|
+
*/
|
|
13255
|
+
var BackupEncryptionStatusSchema = object({
|
|
13256
|
+
enabled: boolean(),
|
|
13257
|
+
active: object({
|
|
13258
|
+
keyId: string(),
|
|
13259
|
+
publicKey: string(),
|
|
13260
|
+
createdAt: number()
|
|
13261
|
+
}).nullable(),
|
|
13262
|
+
/** Every key ever set up, newest first. */
|
|
13263
|
+
keys: array(object({
|
|
13264
|
+
keyId: string(),
|
|
13265
|
+
createdAt: number(),
|
|
13266
|
+
retiredAt: number().nullable()
|
|
13267
|
+
})).readonly()
|
|
13268
|
+
});
|
|
13269
|
+
/**
|
|
11812
13270
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11813
13271
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11814
13272
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11820,7 +13278,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11820
13278
|
sizeBytes: number(),
|
|
11821
13279
|
label: string().optional(),
|
|
11822
13280
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11823
|
-
locations: array(string()).readonly()
|
|
13281
|
+
locations: array(string()).readonly(),
|
|
13282
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13283
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11824
13284
|
});
|
|
11825
13285
|
var BackupEntrySchema = object({
|
|
11826
13286
|
id: string(),
|
|
@@ -11829,7 +13289,8 @@ var BackupEntrySchema = object({
|
|
|
11829
13289
|
label: string().optional(),
|
|
11830
13290
|
createdAt: number(),
|
|
11831
13291
|
sizeBytes: number(),
|
|
11832
|
-
locations: array(string()).optional()
|
|
13292
|
+
locations: array(string()).optional(),
|
|
13293
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11833
13294
|
});
|
|
11834
13295
|
var ArchiveEntrySchema = object({
|
|
11835
13296
|
path: string(),
|
|
@@ -12018,10 +13479,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12018
13479
|
* this list and skips entries whose path doesn't start with
|
|
12019
13480
|
* any of them.
|
|
12020
13481
|
*/
|
|
12021
|
-
locations: array(string()).optional()
|
|
13482
|
+
locations: array(string()).optional(),
|
|
13483
|
+
/**
|
|
13484
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13485
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13486
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13487
|
+
* is refused before the archive is downloaded.
|
|
13488
|
+
*/
|
|
13489
|
+
backupSecretKey: string().optional()
|
|
12022
13490
|
}), _void(), {
|
|
12023
13491
|
kind: "mutation",
|
|
12024
13492
|
auth: "admin"
|
|
13493
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13494
|
+
keyId: string(),
|
|
13495
|
+
secretKey: string(),
|
|
13496
|
+
publicKey: string(),
|
|
13497
|
+
createdAt: number(),
|
|
13498
|
+
replacedKeyId: string().nullable()
|
|
13499
|
+
}), {
|
|
13500
|
+
kind: "mutation",
|
|
13501
|
+
auth: "admin"
|
|
13502
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13503
|
+
kind: "mutation",
|
|
13504
|
+
auth: "admin"
|
|
13505
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13506
|
+
valid: boolean(),
|
|
13507
|
+
keyId: string().nullable(),
|
|
13508
|
+
/** The hub knows this key (active or retired). */
|
|
13509
|
+
known: boolean(),
|
|
13510
|
+
/** It is the key new archives are encrypted to. */
|
|
13511
|
+
active: boolean(),
|
|
13512
|
+
error: string().optional()
|
|
13513
|
+
}), {
|
|
13514
|
+
kind: "mutation",
|
|
13515
|
+
auth: "admin"
|
|
12025
13516
|
}), method(object({
|
|
12026
13517
|
destinationId: string(),
|
|
12027
13518
|
backupId: string()
|
|
@@ -13747,7 +15238,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13747
15238
|
stepId: string(),
|
|
13748
15239
|
entry: ModelCatalogEntrySchema
|
|
13749
15240
|
});
|
|
13750
|
-
|
|
15241
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15242
|
+
var ModelBundleFileSchema = object({
|
|
15243
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15244
|
+
path: string().min(1),
|
|
15245
|
+
bytes: number().int().nonnegative(),
|
|
15246
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15247
|
+
});
|
|
15248
|
+
var ImportModelBundleInputSchema = object({
|
|
15249
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15250
|
+
addonId: string(),
|
|
15251
|
+
stepId: string().min(1),
|
|
15252
|
+
/**
|
|
15253
|
+
* The catalog rows to register, complete, every format URL already
|
|
15254
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15255
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15256
|
+
*/
|
|
15257
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15258
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15259
|
+
bundle: object({
|
|
15260
|
+
ticket: PeerBytesTicketSchema,
|
|
15261
|
+
bytes: number().int().positive(),
|
|
15262
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15263
|
+
}),
|
|
15264
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15265
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15266
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15267
|
+
distribute: boolean()
|
|
15268
|
+
});
|
|
15269
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15270
|
+
kind: literal("imported"),
|
|
15271
|
+
modelIds: array(string()).readonly(),
|
|
15272
|
+
distributed: array(object({
|
|
15273
|
+
modelId: string(),
|
|
15274
|
+
nodeId: string(),
|
|
15275
|
+
format: _enum(MODEL_FORMATS),
|
|
15276
|
+
ok: boolean(),
|
|
15277
|
+
error: string().optional()
|
|
15278
|
+
})).readonly()
|
|
15279
|
+
}), object({
|
|
15280
|
+
kind: literal("refused"),
|
|
15281
|
+
reason: _enum([
|
|
15282
|
+
"transfer-failed",
|
|
15283
|
+
"checksum-mismatch",
|
|
15284
|
+
"bundle-mismatch",
|
|
15285
|
+
"invalid-entry",
|
|
15286
|
+
"id-taken"
|
|
15287
|
+
]),
|
|
15288
|
+
detail: string()
|
|
15289
|
+
})]);
|
|
15290
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15291
|
+
kind: "mutation",
|
|
15292
|
+
auth: "admin",
|
|
15293
|
+
timeoutMs: 30 * 6e4
|
|
15294
|
+
});
|
|
13751
15295
|
/**
|
|
13752
15296
|
* Query filter for settings-store collections.
|
|
13753
15297
|
*/
|
|
@@ -14130,6 +15674,253 @@ id: union([string(), number()]) }), {
|
|
|
14130
15674
|
kind: "mutation",
|
|
14131
15675
|
auth: "admin"
|
|
14132
15676
|
});
|
|
15677
|
+
/**
|
|
15678
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15679
|
+
*
|
|
15680
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15681
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15682
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15683
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15684
|
+
* against the CALLER, never against anything the caller claims.
|
|
15685
|
+
*
|
|
15686
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15687
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15688
|
+
* connection, the agent from its child's connection carried in
|
|
15689
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15690
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15691
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15692
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15693
|
+
* runner is the same OS user): see the threat model in
|
|
15694
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15695
|
+
*
|
|
15696
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15697
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15698
|
+
* floors every method to admin anyway (D240).
|
|
15699
|
+
*
|
|
15700
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15701
|
+
*/
|
|
15702
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15703
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15704
|
+
"key-missing",
|
|
15705
|
+
"wrong-key",
|
|
15706
|
+
"key-file-unreadable",
|
|
15707
|
+
"store-unavailable",
|
|
15708
|
+
"not-initialized",
|
|
15709
|
+
"decrypt-failed"
|
|
15710
|
+
]);
|
|
15711
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15712
|
+
state: literal("locked"),
|
|
15713
|
+
reason: KeychainUnavailableReasonSchema
|
|
15714
|
+
})]);
|
|
15715
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15716
|
+
object({
|
|
15717
|
+
kind: literal("value"),
|
|
15718
|
+
value: string(),
|
|
15719
|
+
version: number().int()
|
|
15720
|
+
}),
|
|
15721
|
+
object({ kind: literal("missing") }),
|
|
15722
|
+
object({
|
|
15723
|
+
kind: literal("unavailable"),
|
|
15724
|
+
reason: KeychainUnavailableReasonSchema
|
|
15725
|
+
}),
|
|
15726
|
+
object({ kind: literal("forbidden") })
|
|
15727
|
+
]);
|
|
15728
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15729
|
+
/** Metadata of one stored value — never the value. */
|
|
15730
|
+
var KeychainSecretMetaSchema = object({
|
|
15731
|
+
ref: string(),
|
|
15732
|
+
owner: string(),
|
|
15733
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15734
|
+
scope: string(),
|
|
15735
|
+
fieldPath: string(),
|
|
15736
|
+
version: number().int(),
|
|
15737
|
+
createdAt: number(),
|
|
15738
|
+
updatedAt: number(),
|
|
15739
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15740
|
+
updatedBy: string(),
|
|
15741
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15742
|
+
lastReadAt: number().nullable()
|
|
15743
|
+
});
|
|
15744
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15745
|
+
method(object({
|
|
15746
|
+
ref: string().min(1),
|
|
15747
|
+
value: string().min(1)
|
|
15748
|
+
}), object({
|
|
15749
|
+
ref: string(),
|
|
15750
|
+
version: number().int()
|
|
15751
|
+
}), {
|
|
15752
|
+
kind: "mutation",
|
|
15753
|
+
auth: "admin"
|
|
15754
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15755
|
+
kind: "mutation",
|
|
15756
|
+
auth: "admin"
|
|
15757
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15758
|
+
var KeychainKeySourceSchema = object({
|
|
15759
|
+
kind: _enum([
|
|
15760
|
+
"config-file",
|
|
15761
|
+
"previous-config-file",
|
|
15762
|
+
"platform",
|
|
15763
|
+
"default-file"
|
|
15764
|
+
]),
|
|
15765
|
+
/** File sources only — a path is not a secret. */
|
|
15766
|
+
path: string().optional(),
|
|
15767
|
+
/**
|
|
15768
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15769
|
+
* next to the database it protects (the default file). The page warns.
|
|
15770
|
+
*/
|
|
15771
|
+
sharesBackupWithDatabase: boolean()
|
|
15772
|
+
});
|
|
15773
|
+
/**
|
|
15774
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15775
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15776
|
+
*/
|
|
15777
|
+
var KeychainResetRecordSchema = object({
|
|
15778
|
+
id: string(),
|
|
15779
|
+
at: number(),
|
|
15780
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15781
|
+
actor: string(),
|
|
15782
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15783
|
+
lockedReason: string().nullable(),
|
|
15784
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15785
|
+
archived: number().int(),
|
|
15786
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15787
|
+
archivedCollection: string().nullable(),
|
|
15788
|
+
/**
|
|
15789
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15790
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15791
|
+
*/
|
|
15792
|
+
archivedKeysCollection: string().nullable(),
|
|
15793
|
+
/**
|
|
15794
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15795
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15796
|
+
* agent forever (D797).
|
|
15797
|
+
*/
|
|
15798
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15799
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15800
|
+
acknowledgedAt: number().nullable()
|
|
15801
|
+
});
|
|
15802
|
+
var KeychainStatusSchema = object({
|
|
15803
|
+
keychain: KeychainStateSchema,
|
|
15804
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15805
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15806
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15807
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15808
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15809
|
+
fingerprint: string().nullable(),
|
|
15810
|
+
activeKeyId: string().nullable(),
|
|
15811
|
+
/**
|
|
15812
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15813
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15814
|
+
*/
|
|
15815
|
+
rotationPending: boolean(),
|
|
15816
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15817
|
+
retiredWraps: number().int(),
|
|
15818
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15819
|
+
secretCount: number().int(),
|
|
15820
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15821
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15822
|
+
});
|
|
15823
|
+
/**
|
|
15824
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15825
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15826
|
+
* never reported as an orphan (and never deleted as one).
|
|
15827
|
+
*/
|
|
15828
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15829
|
+
"in-use",
|
|
15830
|
+
"orphan",
|
|
15831
|
+
"unknown"
|
|
15832
|
+
]);
|
|
15833
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15834
|
+
var KeychainAuditActionSchema = _enum([
|
|
15835
|
+
"put",
|
|
15836
|
+
"delete",
|
|
15837
|
+
"reveal",
|
|
15838
|
+
"rotate-master-key",
|
|
15839
|
+
"purge-retired-keys",
|
|
15840
|
+
"download-recovery-key",
|
|
15841
|
+
"delete-orphans",
|
|
15842
|
+
"reset",
|
|
15843
|
+
"acknowledge-reset",
|
|
15844
|
+
"initialize"
|
|
15845
|
+
]);
|
|
15846
|
+
var KeychainAuditEntrySchema = object({
|
|
15847
|
+
id: string(),
|
|
15848
|
+
at: number(),
|
|
15849
|
+
action: KeychainAuditActionSchema,
|
|
15850
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15851
|
+
actor: string(),
|
|
15852
|
+
ref: string().nullable(),
|
|
15853
|
+
detail: string().nullable()
|
|
15854
|
+
});
|
|
15855
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15856
|
+
/**
|
|
15857
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15858
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15859
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15860
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15861
|
+
*/
|
|
15862
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15863
|
+
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({
|
|
15864
|
+
value: string(),
|
|
15865
|
+
version: number().int()
|
|
15866
|
+
}), {
|
|
15867
|
+
kind: "mutation",
|
|
15868
|
+
auth: "admin",
|
|
15869
|
+
caller: "required"
|
|
15870
|
+
}), method(object({
|
|
15871
|
+
name: SystemHeldSecretNameSchema,
|
|
15872
|
+
value: string().min(16)
|
|
15873
|
+
}), object({
|
|
15874
|
+
ref: string(),
|
|
15875
|
+
version: number().int()
|
|
15876
|
+
}), {
|
|
15877
|
+
kind: "mutation",
|
|
15878
|
+
auth: "admin",
|
|
15879
|
+
caller: "required"
|
|
15880
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15881
|
+
deleted: array(string()).readonly(),
|
|
15882
|
+
kept: array(object({
|
|
15883
|
+
ref: string(),
|
|
15884
|
+
usage: KeychainSecretUsageSchema
|
|
15885
|
+
})).readonly()
|
|
15886
|
+
}), {
|
|
15887
|
+
kind: "mutation",
|
|
15888
|
+
auth: "admin",
|
|
15889
|
+
caller: "required"
|
|
15890
|
+
}), method(object({}), object({
|
|
15891
|
+
fingerprint: string(),
|
|
15892
|
+
keySource: KeychainKeySourceSchema
|
|
15893
|
+
}), {
|
|
15894
|
+
kind: "mutation",
|
|
15895
|
+
auth: "admin",
|
|
15896
|
+
caller: "required"
|
|
15897
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15898
|
+
kind: "mutation",
|
|
15899
|
+
auth: "admin",
|
|
15900
|
+
caller: "required"
|
|
15901
|
+
}), method(object({}), object({
|
|
15902
|
+
key: string(),
|
|
15903
|
+
fingerprint: string(),
|
|
15904
|
+
keySource: KeychainKeySourceSchema
|
|
15905
|
+
}), {
|
|
15906
|
+
kind: "mutation",
|
|
15907
|
+
auth: "admin",
|
|
15908
|
+
caller: "required"
|
|
15909
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15910
|
+
archivedCollection: string().nullable(),
|
|
15911
|
+
archived: number().int()
|
|
15912
|
+
}), {
|
|
15913
|
+
kind: "mutation",
|
|
15914
|
+
auth: "admin",
|
|
15915
|
+
caller: "required"
|
|
15916
|
+
}), method(object({}), object({
|
|
15917
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15918
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15919
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15920
|
+
kind: "mutation",
|
|
15921
|
+
auth: "admin",
|
|
15922
|
+
caller: "required"
|
|
15923
|
+
});
|
|
14133
15924
|
method(_void(), object({
|
|
14134
15925
|
id: string(),
|
|
14135
15926
|
name: string(),
|
|
@@ -15355,7 +17146,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15355
17146
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15356
17147
|
var DevicePersistConfigPayloadSchema = object({
|
|
15357
17148
|
deviceId: number(),
|
|
15358
|
-
data: record(string(), unknown())
|
|
17149
|
+
data: record(string(), unknown()),
|
|
17150
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17151
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17152
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17153
|
+
secretConfigPaths: array(string()).optional()
|
|
15359
17154
|
});
|
|
15360
17155
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15361
17156
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -16958,7 +18753,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16958
18753
|
* `login-method` — collection cap through which auth addons contribute
|
|
16959
18754
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16960
18755
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16961
|
-
* every auth addon (OIDC,
|
|
18756
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
16962
18757
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16963
18758
|
* procedure aggregates them for the unauthenticated login page.
|
|
16964
18759
|
*
|
|
@@ -16966,8 +18761,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16966
18761
|
*
|
|
16967
18762
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
16968
18763
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16969
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
16970
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18764
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16971
18765
|
* login page needs NO change.
|
|
16972
18766
|
*
|
|
16973
18767
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -16986,8 +18780,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16986
18780
|
* decision.
|
|
16987
18781
|
*
|
|
16988
18782
|
* Every contribution carries a `stage`:
|
|
16989
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
16990
|
-
*
|
|
18783
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18784
|
+
* buttons; a usernameless passkey).
|
|
16991
18785
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16992
18786
|
* returned `factors` (passkey-as-2FA today).
|
|
16993
18787
|
*
|
|
@@ -17014,7 +18808,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17014
18808
|
* The provider names an external identity a signed-in user can link to
|
|
17015
18809
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
17016
18810
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17017
|
-
* whatever their id. Absent / false — a login button only
|
|
18811
|
+
* whatever their id. Absent / false — a login button only.
|
|
17018
18812
|
*/
|
|
17019
18813
|
linkable: boolean().optional()
|
|
17020
18814
|
}),
|
|
@@ -20869,8 +22663,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20869
22663
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20870
22664
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20871
22665
|
* distinction was only ever used to route role-specific procedures
|
|
20872
|
-
* which we no longer have.
|
|
20873
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22666
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20874
22667
|
* with `isAdmin: false` + an explicit scope list.
|
|
20875
22668
|
*/
|
|
20876
22669
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22372,8 +24165,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22372
24165
|
]);
|
|
22373
24166
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22374
24167
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22375
|
-
/**
|
|
22376
|
-
|
|
24168
|
+
/**
|
|
24169
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24170
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24171
|
+
*
|
|
24172
|
+
* - `operator` — drawn by hand.
|
|
24173
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24174
|
+
* model, or a larger teacher model).
|
|
24175
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24176
|
+
* back from the track store (never a re-run).
|
|
24177
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24178
|
+
*/
|
|
24179
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24180
|
+
"operator",
|
|
24181
|
+
"assist",
|
|
24182
|
+
"pipeline",
|
|
24183
|
+
"llm"
|
|
24184
|
+
]);
|
|
22377
24185
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22378
24186
|
var RetrainBboxSchema = object({
|
|
22379
24187
|
x: number(),
|
|
@@ -22391,7 +24199,8 @@ var RetrainBboxSchema = object({
|
|
|
22391
24199
|
*/
|
|
22392
24200
|
var RetrainAnnotationSchema = object({
|
|
22393
24201
|
id: string(),
|
|
22394
|
-
|
|
24202
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24203
|
+
trackId: string().optional(),
|
|
22395
24204
|
deviceId: number(),
|
|
22396
24205
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22397
24206
|
mediaKey: string(),
|
|
@@ -22440,13 +24249,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22440
24249
|
* fail, whatever became of the original. */
|
|
22441
24250
|
copied: boolean()
|
|
22442
24251
|
});
|
|
24252
|
+
/**
|
|
24253
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24254
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24255
|
+
* box recorded on the source media row when there is one, else the track
|
|
24256
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24257
|
+
* until the operator confirms it.
|
|
24258
|
+
*/
|
|
24259
|
+
var RetrainPipelineBoxSchema = object({
|
|
24260
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24261
|
+
bbox: RetrainBboxSchema,
|
|
24262
|
+
macroClass: RetrainMacroClassSchema,
|
|
24263
|
+
label: string().optional(),
|
|
24264
|
+
subLabel: string().optional(),
|
|
24265
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24266
|
+
score: number().optional(),
|
|
24267
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24268
|
+
modelId: string().optional(),
|
|
24269
|
+
trackId: string(),
|
|
24270
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24271
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24272
|
+
basis: _enum(["subject-box", "position"]),
|
|
24273
|
+
deltaMs: number()
|
|
24274
|
+
});
|
|
24275
|
+
/**
|
|
24276
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24277
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24278
|
+
* track at all.
|
|
24279
|
+
*/
|
|
24280
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22443
24281
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22444
24282
|
var RetrainFrameSchema = object({
|
|
22445
24283
|
frameId: string(),
|
|
22446
24284
|
deviceId: number(),
|
|
22447
|
-
|
|
22448
|
-
/**
|
|
22449
|
-
|
|
24285
|
+
origin: RetrainFrameOriginSchema,
|
|
24286
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24287
|
+
trackId: string().optional(),
|
|
24288
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24289
|
+
* Absent on a recording still. */
|
|
24290
|
+
sourceMediaId: number().int().optional(),
|
|
24291
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24292
|
+
epochMs: number().optional(),
|
|
22450
24293
|
sourceKind: MediaFileKindEnum,
|
|
22451
24294
|
sizeBytes: number().int(),
|
|
22452
24295
|
width: number().int(),
|
|
@@ -22457,7 +24300,12 @@ var RetrainFrameSchema = object({
|
|
|
22457
24300
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22458
24301
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22459
24302
|
* a false positive. */
|
|
22460
|
-
complete: boolean()
|
|
24303
|
+
complete: boolean(),
|
|
24304
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24305
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24306
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24307
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24308
|
+
collectionIds: array(string()).readonly().optional()
|
|
22461
24309
|
});
|
|
22462
24310
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22463
24311
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22488,6 +24336,11 @@ var RetrainFrameListSchema = object({
|
|
|
22488
24336
|
var RetrainExportFilterSchema = object({
|
|
22489
24337
|
deviceIds: array(number()).optional(),
|
|
22490
24338
|
frameIds: array(string()).max(2e4).optional(),
|
|
24339
|
+
/** Only frames in at least one of these named collections. */
|
|
24340
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24341
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24342
|
+
* unknown id selects nothing. */
|
|
24343
|
+
datasetVersionId: string().optional(),
|
|
22491
24344
|
batchId: string().optional(),
|
|
22492
24345
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22493
24346
|
completeOnly: boolean().optional()
|
|
@@ -22552,6 +24405,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22552
24405
|
reason: string(),
|
|
22553
24406
|
detail: string().optional()
|
|
22554
24407
|
})]);
|
|
24408
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24409
|
+
var RetrainCollectionSchema = object({
|
|
24410
|
+
id: string(),
|
|
24411
|
+
name: string(),
|
|
24412
|
+
createdAt: number(),
|
|
24413
|
+
frameCount: number().int()
|
|
24414
|
+
});
|
|
24415
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24416
|
+
kind: literal("created"),
|
|
24417
|
+
collection: RetrainCollectionSchema
|
|
24418
|
+
}), object({
|
|
24419
|
+
kind: literal("refused"),
|
|
24420
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24421
|
+
})]);
|
|
24422
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24423
|
+
kind: literal("renamed"),
|
|
24424
|
+
collection: RetrainCollectionSchema
|
|
24425
|
+
}), object({
|
|
24426
|
+
kind: literal("refused"),
|
|
24427
|
+
reason: _enum([
|
|
24428
|
+
"empty-name",
|
|
24429
|
+
"duplicate-name",
|
|
24430
|
+
"unknown-collection"
|
|
24431
|
+
])
|
|
24432
|
+
})]);
|
|
24433
|
+
/**
|
|
24434
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24435
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24436
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24437
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24438
|
+
*/
|
|
24439
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24440
|
+
kind: literal("added"),
|
|
24441
|
+
collectionId: string(),
|
|
24442
|
+
frame: RetrainFrameSchema,
|
|
24443
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24444
|
+
reused: boolean()
|
|
24445
|
+
}), object({
|
|
24446
|
+
kind: literal("refused"),
|
|
24447
|
+
reason: _enum([
|
|
24448
|
+
"unknown-collection",
|
|
24449
|
+
"still-unavailable",
|
|
24450
|
+
"still-busy",
|
|
24451
|
+
"unreadable-image",
|
|
24452
|
+
"write-failed"
|
|
24453
|
+
]),
|
|
24454
|
+
detail: string().optional()
|
|
24455
|
+
})]);
|
|
24456
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24457
|
+
var RetrainAssistProfileSchema = object({
|
|
24458
|
+
id: string(),
|
|
24459
|
+
name: string(),
|
|
24460
|
+
model: string(),
|
|
24461
|
+
kind: string(),
|
|
24462
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24463
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24464
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24465
|
+
leavesHouse: boolean()
|
|
24466
|
+
});
|
|
24467
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24468
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24469
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24470
|
+
var RetrainLlmReviewSchema = object({
|
|
24471
|
+
/** The `ref` the page sent the box under. */
|
|
24472
|
+
ref: string(),
|
|
24473
|
+
verdict: _enum([
|
|
24474
|
+
"confirmed",
|
|
24475
|
+
"wrong-class",
|
|
24476
|
+
"not-an-object",
|
|
24477
|
+
"uncertain"
|
|
24478
|
+
]),
|
|
24479
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24480
|
+
reason: string()
|
|
24481
|
+
});
|
|
24482
|
+
/**
|
|
24483
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24484
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24485
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24486
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24487
|
+
*/
|
|
24488
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24489
|
+
kind: literal("proposed"),
|
|
24490
|
+
profileId: string(),
|
|
24491
|
+
model: string(),
|
|
24492
|
+
/** The frame was sent outside the house for this answer. */
|
|
24493
|
+
leftHouse: boolean(),
|
|
24494
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24495
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24496
|
+
rejected: number().int()
|
|
24497
|
+
}), object({
|
|
24498
|
+
kind: literal("refused"),
|
|
24499
|
+
reason: _enum([
|
|
24500
|
+
"unknown-frame",
|
|
24501
|
+
"unreadable-frame",
|
|
24502
|
+
"unknown-profile",
|
|
24503
|
+
"profile-disabled",
|
|
24504
|
+
"no-vision",
|
|
24505
|
+
"cloud-not-confirmed",
|
|
24506
|
+
"llm-error",
|
|
24507
|
+
"malformed-answer"
|
|
24508
|
+
]),
|
|
24509
|
+
detail: string().optional()
|
|
24510
|
+
})]);
|
|
24511
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24512
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24513
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24514
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24515
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24516
|
+
});
|
|
24517
|
+
/** The counts a dataset is judged by. */
|
|
24518
|
+
var RetrainDatasetStatsSchema = object({
|
|
24519
|
+
frames: number().int(),
|
|
24520
|
+
completeFrames: number().int(),
|
|
24521
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24522
|
+
completeness: number(),
|
|
24523
|
+
/** Boxes to learn (model errors excluded). */
|
|
24524
|
+
subjects: number().int(),
|
|
24525
|
+
modelErrors: number().int(),
|
|
24526
|
+
/** Complete frames with no subject. */
|
|
24527
|
+
hardNegatives: number().int(),
|
|
24528
|
+
/** Subjects per class × camera × day/night. */
|
|
24529
|
+
cells: array(object({
|
|
24530
|
+
macroClass: string(),
|
|
24531
|
+
deviceId: number(),
|
|
24532
|
+
lighting: _enum([
|
|
24533
|
+
"day",
|
|
24534
|
+
"night",
|
|
24535
|
+
"unknown"
|
|
24536
|
+
]),
|
|
24537
|
+
subjects: number().int(),
|
|
24538
|
+
frames: number().int()
|
|
24539
|
+
})).readonly(),
|
|
24540
|
+
cameras: array(object({
|
|
24541
|
+
deviceId: number(),
|
|
24542
|
+
frames: number().int(),
|
|
24543
|
+
completeFrames: number().int()
|
|
24544
|
+
})).readonly()
|
|
24545
|
+
});
|
|
24546
|
+
/** An immutable dataset version, without its frame list. */
|
|
24547
|
+
var RetrainDatasetVersionSchema = object({
|
|
24548
|
+
id: string(),
|
|
24549
|
+
name: string(),
|
|
24550
|
+
createdAt: number(),
|
|
24551
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24552
|
+
layout: RetrainExportLayoutSchema,
|
|
24553
|
+
completeOnly: boolean(),
|
|
24554
|
+
frameCount: number().int(),
|
|
24555
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24556
|
+
annotationHash: string(),
|
|
24557
|
+
/** The export manifest schema the version was cut under. */
|
|
24558
|
+
manifestSchema: string(),
|
|
24559
|
+
stats: RetrainDatasetStatsSchema
|
|
24560
|
+
});
|
|
24561
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24562
|
+
kind: literal("created"),
|
|
24563
|
+
version: RetrainDatasetVersionSchema
|
|
24564
|
+
}), object({
|
|
24565
|
+
kind: literal("refused"),
|
|
24566
|
+
reason: _enum([
|
|
24567
|
+
"empty-name",
|
|
24568
|
+
"duplicate-name",
|
|
24569
|
+
"no-frames"
|
|
24570
|
+
])
|
|
24571
|
+
})]);
|
|
22555
24572
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22556
24573
|
var RetrainTransitionResultSchema = object({
|
|
22557
24574
|
trackId: string(),
|
|
@@ -23269,7 +25286,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23269
25286
|
auth: "admin"
|
|
23270
25287
|
}), method(object({
|
|
23271
25288
|
deviceId: number(),
|
|
23272
|
-
trackId: string(),
|
|
25289
|
+
trackId: string().optional(),
|
|
23273
25290
|
frameId: string()
|
|
23274
25291
|
}), object({
|
|
23275
25292
|
removed: boolean(),
|
|
@@ -23286,7 +25303,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23286
25303
|
auth: "admin"
|
|
23287
25304
|
}), method(object({
|
|
23288
25305
|
deviceId: number(),
|
|
23289
|
-
|
|
25306
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25307
|
+
trackId: string().optional(),
|
|
23290
25308
|
frameId: string(),
|
|
23291
25309
|
subject: RetrainAssistSubjectSchema,
|
|
23292
25310
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23294,12 +25312,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23294
25312
|
}), RetrainAssistResultSchema, {
|
|
23295
25313
|
kind: "mutation",
|
|
23296
25314
|
auth: "admin"
|
|
23297
|
-
}), method(object({
|
|
25315
|
+
}), method(object({
|
|
25316
|
+
trackId: string().optional(),
|
|
25317
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25318
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23298
25319
|
kind: "query",
|
|
23299
25320
|
auth: "admin"
|
|
23300
25321
|
}), method(object({
|
|
23301
25322
|
deviceId: number(),
|
|
23302
|
-
|
|
25323
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25324
|
+
trackId: string().optional(),
|
|
23303
25325
|
frameId: string(),
|
|
23304
25326
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23305
25327
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23322,7 +25344,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23322
25344
|
auth: "admin"
|
|
23323
25345
|
}), method(object({
|
|
23324
25346
|
deviceId: number(),
|
|
23325
|
-
trackId: string(),
|
|
25347
|
+
trackId: string().optional(),
|
|
23326
25348
|
frameId: string(),
|
|
23327
25349
|
complete: boolean()
|
|
23328
25350
|
}), RetrainFrameSchema, {
|
|
@@ -23336,6 +25358,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23336
25358
|
kind: "mutation",
|
|
23337
25359
|
auth: "admin",
|
|
23338
25360
|
timeoutMs: 60 * 6e4
|
|
25361
|
+
}), method(object({
|
|
25362
|
+
filter: RetrainExportFilterSchema,
|
|
25363
|
+
layout: RetrainExportLayoutSchema
|
|
25364
|
+
}), object({
|
|
25365
|
+
ticket: PeerBytesTicketSchema,
|
|
25366
|
+
frames: number().int(),
|
|
25367
|
+
annotations: number().int()
|
|
25368
|
+
}), {
|
|
25369
|
+
kind: "mutation",
|
|
25370
|
+
auth: "admin",
|
|
25371
|
+
timeoutMs: 12e4
|
|
25372
|
+
}), method(object({
|
|
25373
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25374
|
+
completeOnly: boolean().optional()
|
|
25375
|
+
}), RetrainDatasetStatsSchema, {
|
|
25376
|
+
kind: "query",
|
|
25377
|
+
auth: "admin"
|
|
25378
|
+
}), method(object({
|
|
25379
|
+
name: string().max(120),
|
|
25380
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25381
|
+
layout: RetrainExportLayoutSchema,
|
|
25382
|
+
completeOnly: boolean()
|
|
25383
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25384
|
+
kind: "mutation",
|
|
25385
|
+
auth: "admin",
|
|
25386
|
+
timeoutMs: 12e4
|
|
25387
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25388
|
+
kind: "query",
|
|
25389
|
+
auth: "admin"
|
|
25390
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25391
|
+
kind: "mutation",
|
|
25392
|
+
auth: "admin"
|
|
25393
|
+
}), method(object({ id: string() }), object({
|
|
25394
|
+
found: boolean(),
|
|
25395
|
+
annotationHash: string(),
|
|
25396
|
+
matches: boolean(),
|
|
25397
|
+
missingFrames: number().int()
|
|
25398
|
+
}), {
|
|
25399
|
+
kind: "query",
|
|
25400
|
+
auth: "admin",
|
|
25401
|
+
timeoutMs: 12e4
|
|
25402
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25403
|
+
kind: "query",
|
|
25404
|
+
auth: "admin"
|
|
25405
|
+
}), method(object({
|
|
25406
|
+
deviceId: number(),
|
|
25407
|
+
trackId: string().optional(),
|
|
25408
|
+
frameId: string(),
|
|
25409
|
+
profileId: string(),
|
|
25410
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25411
|
+
boxes: array(object({
|
|
25412
|
+
ref: string(),
|
|
25413
|
+
bbox: RetrainBboxSchema,
|
|
25414
|
+
macroClass: RetrainMacroClassSchema,
|
|
25415
|
+
label: string().optional()
|
|
25416
|
+
})).max(50),
|
|
25417
|
+
allowCloud: boolean()
|
|
25418
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25419
|
+
kind: "mutation",
|
|
25420
|
+
auth: "admin",
|
|
25421
|
+
timeoutMs: 18e4
|
|
25422
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25423
|
+
kind: "mutation",
|
|
25424
|
+
auth: "admin"
|
|
25425
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25426
|
+
kind: "query",
|
|
25427
|
+
auth: "admin"
|
|
25428
|
+
}), method(object({
|
|
25429
|
+
id: string(),
|
|
25430
|
+
name: string().max(120)
|
|
25431
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25432
|
+
kind: "mutation",
|
|
25433
|
+
auth: "admin"
|
|
25434
|
+
}), method(object({ id: string() }), object({
|
|
25435
|
+
deleted: boolean(),
|
|
25436
|
+
removedFrames: number().int()
|
|
25437
|
+
}), {
|
|
25438
|
+
kind: "mutation",
|
|
25439
|
+
auth: "admin"
|
|
25440
|
+
}), method(object({
|
|
25441
|
+
collectionId: string(),
|
|
25442
|
+
deviceId: number(),
|
|
25443
|
+
epochMs: number()
|
|
25444
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25445
|
+
kind: "mutation",
|
|
25446
|
+
auth: "admin",
|
|
25447
|
+
timeoutMs: 6e4
|
|
25448
|
+
}), method(object({
|
|
25449
|
+
collectionId: string(),
|
|
25450
|
+
frameIds: array(string()).min(1).max(500)
|
|
25451
|
+
}), object({
|
|
25452
|
+
added: number().int(),
|
|
25453
|
+
alreadyMember: number().int(),
|
|
25454
|
+
unknownFrameIds: array(string()).readonly()
|
|
25455
|
+
}), {
|
|
25456
|
+
kind: "mutation",
|
|
25457
|
+
auth: "admin"
|
|
25458
|
+
}), method(object({
|
|
25459
|
+
collectionId: string(),
|
|
25460
|
+
frameId: string()
|
|
25461
|
+
}), object({
|
|
25462
|
+
removed: boolean(),
|
|
25463
|
+
deletedFrame: boolean()
|
|
25464
|
+
}), {
|
|
25465
|
+
kind: "mutation",
|
|
25466
|
+
auth: "admin"
|
|
25467
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25468
|
+
kind: "query",
|
|
25469
|
+
auth: "admin"
|
|
23339
25470
|
}), method(object({
|
|
23340
25471
|
/** Which of the three event tables owns the row. */
|
|
23341
25472
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23959,13 +26090,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23959
26090
|
object({
|
|
23960
26091
|
kind: literal("no-family-build"),
|
|
23961
26092
|
format: ModelFormatSchema$1
|
|
26093
|
+
}),
|
|
26094
|
+
object({
|
|
26095
|
+
kind: literal("kept-custom-pin"),
|
|
26096
|
+
modelId: string(),
|
|
26097
|
+
deviceKey: string()
|
|
23962
26098
|
})
|
|
23963
26099
|
]);
|
|
26100
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26101
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26102
|
+
/**
|
|
26103
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26104
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26105
|
+
*/
|
|
26106
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26107
|
+
kind: literal("node-benchmark"),
|
|
26108
|
+
resultId: string(),
|
|
26109
|
+
measuredAtMs: number()
|
|
26110
|
+
})]);
|
|
23964
26111
|
var DeviceModelChoiceSchema = object({
|
|
23965
26112
|
modelId: string(),
|
|
23966
26113
|
p50Ms: number(),
|
|
23967
26114
|
fps: number(),
|
|
23968
26115
|
measured: boolean(),
|
|
26116
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26117
|
+
source: LatencySourceSchema.optional(),
|
|
23969
26118
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23970
26119
|
capacitySessions: number(),
|
|
23971
26120
|
personRecall: number()
|
|
@@ -23976,6 +26125,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23976
26125
|
enabled: boolean(),
|
|
23977
26126
|
available: boolean(),
|
|
23978
26127
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26128
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26129
|
+
kept: KeptReasonSchema.optional(),
|
|
23979
26130
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23980
26131
|
});
|
|
23981
26132
|
var NodeRecommendationSchema = object({
|
|
@@ -24029,6 +26180,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24029
26180
|
kind: literal("coral-enabled"),
|
|
24030
26181
|
nodeId: string(),
|
|
24031
26182
|
deviceKey: string()
|
|
26183
|
+
}),
|
|
26184
|
+
object({
|
|
26185
|
+
kind: literal("custom-pin-kept"),
|
|
26186
|
+
nodeId: string(),
|
|
26187
|
+
deviceKey: string().nullable(),
|
|
26188
|
+
deviceId: number().nullable(),
|
|
26189
|
+
modelId: string()
|
|
26190
|
+
}),
|
|
26191
|
+
object({
|
|
26192
|
+
kind: literal("custom-registry-unreadable"),
|
|
26193
|
+
error: string()
|
|
24032
26194
|
})
|
|
24033
26195
|
]);
|
|
24034
26196
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24207,13 +26369,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24207
26369
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24208
26370
|
});
|
|
24209
26371
|
/**
|
|
24210
|
-
* Where the node and device shares come from (D750, D755).
|
|
24211
|
-
* - `
|
|
24212
|
-
*
|
|
24213
|
-
*
|
|
24214
|
-
*
|
|
24215
|
-
*
|
|
24216
|
-
*
|
|
26372
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26373
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26374
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26375
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26376
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26377
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26378
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26379
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24217
26380
|
* - `manual` — the operator's stored sliders.
|
|
24218
26381
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24219
26382
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24262,6 +26425,362 @@ var EffectiveSharesSchema = object({
|
|
|
24262
26425
|
nodeWeights: record(string(), number()),
|
|
24263
26426
|
deviceWeights: record(string(), record(string(), number()))
|
|
24264
26427
|
});
|
|
26428
|
+
/**
|
|
26429
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26430
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26431
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26432
|
+
* shares read.
|
|
26433
|
+
*
|
|
26434
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26435
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26436
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26437
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26438
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26439
|
+
*
|
|
26440
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26441
|
+
* cross a process at frame rate, D9):
|
|
26442
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26443
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26444
|
+
* interval;
|
|
26445
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26446
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26447
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26448
|
+
* CPU, RAM or the event loop give out.
|
|
26449
|
+
*/
|
|
26450
|
+
/** Defaults and bounds, one place. */
|
|
26451
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26452
|
+
fpsPerStream: 10,
|
|
26453
|
+
budgetMinutes: 45,
|
|
26454
|
+
minBudgetMinutes: 10,
|
|
26455
|
+
maxBudgetMinutes: 120,
|
|
26456
|
+
/** A result older than this no longer beats the table. */
|
|
26457
|
+
staleAfterDays: 30,
|
|
26458
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26459
|
+
settleSec: 5,
|
|
26460
|
+
/** Accounted window per ramp step. */
|
|
26461
|
+
measureSec: 20,
|
|
26462
|
+
/** Longest the drain may take before the run is refused. */
|
|
26463
|
+
drainTimeoutSec: 120,
|
|
26464
|
+
/** Candidate models per device in one run. */
|
|
26465
|
+
maxModelsPerDevice: 6
|
|
26466
|
+
};
|
|
26467
|
+
/** The two measurements a run can make. */
|
|
26468
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26469
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26470
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26471
|
+
deviceKey: string().min(1),
|
|
26472
|
+
/**
|
|
26473
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26474
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26475
|
+
*/
|
|
26476
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26477
|
+
});
|
|
26478
|
+
/** What the operator confirmed. */
|
|
26479
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26480
|
+
nodeId: string().min(1),
|
|
26481
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26482
|
+
/** Which measurements run. At least one. */
|
|
26483
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26484
|
+
/**
|
|
26485
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26486
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26487
|
+
* detector always runs.
|
|
26488
|
+
*/
|
|
26489
|
+
steps: array(string().min(1)).default([]),
|
|
26490
|
+
/** Offered rate of one stream / session. */
|
|
26491
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26492
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26493
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26494
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26495
|
+
keepDownloadedModels: boolean().default(false),
|
|
26496
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26497
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26498
|
+
});
|
|
26499
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26500
|
+
kind: _enum([
|
|
26501
|
+
"benchmark-active",
|
|
26502
|
+
"node-offline",
|
|
26503
|
+
"unknown-device",
|
|
26504
|
+
"no-phase",
|
|
26505
|
+
"insufficient-headroom"
|
|
26506
|
+
]),
|
|
26507
|
+
detail: string(),
|
|
26508
|
+
overridable: boolean()
|
|
26509
|
+
});
|
|
26510
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26511
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26512
|
+
deviceId: number(),
|
|
26513
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26514
|
+
placedOnNode: boolean(),
|
|
26515
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26516
|
+
pinnedToNode: boolean()
|
|
26517
|
+
});
|
|
26518
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26519
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26520
|
+
deviceId: number(),
|
|
26521
|
+
reason: literal("only-frame-source")
|
|
26522
|
+
});
|
|
26523
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26524
|
+
nodeId: string(),
|
|
26525
|
+
online: boolean(),
|
|
26526
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26527
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26528
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26529
|
+
estimatedDurationMs: number(),
|
|
26530
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26531
|
+
budgetMs: number(),
|
|
26532
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26533
|
+
steps: array(string()).readonly(),
|
|
26534
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26535
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26536
|
+
headroom: object({
|
|
26537
|
+
sessionsNow: number(),
|
|
26538
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26539
|
+
}),
|
|
26540
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26541
|
+
canStart: boolean()
|
|
26542
|
+
});
|
|
26543
|
+
/** Where the measuring runner is. */
|
|
26544
|
+
var NodeBenchProgressSchema = object({
|
|
26545
|
+
phase: _enum([
|
|
26546
|
+
"preparing",
|
|
26547
|
+
"device",
|
|
26548
|
+
"pipeline",
|
|
26549
|
+
"cleanup"
|
|
26550
|
+
]),
|
|
26551
|
+
deviceKey: string().nullable(),
|
|
26552
|
+
modelId: string().nullable(),
|
|
26553
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26554
|
+
load: number().nullable(),
|
|
26555
|
+
cellsDone: number(),
|
|
26556
|
+
cellsTotal: number(),
|
|
26557
|
+
message: string()
|
|
26558
|
+
});
|
|
26559
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26560
|
+
var NodeBenchLimitSchema = _enum([
|
|
26561
|
+
"p95",
|
|
26562
|
+
"drops",
|
|
26563
|
+
"errors",
|
|
26564
|
+
"stall",
|
|
26565
|
+
"cpu",
|
|
26566
|
+
"ram",
|
|
26567
|
+
"none"
|
|
26568
|
+
]);
|
|
26569
|
+
var NodeBenchRampStepSchema = object({
|
|
26570
|
+
load: number(),
|
|
26571
|
+
pass: boolean(),
|
|
26572
|
+
p95Ms: number(),
|
|
26573
|
+
dropRatio: number(),
|
|
26574
|
+
/** Completed frames per second over the accounted window. */
|
|
26575
|
+
fps: number(),
|
|
26576
|
+
cpuPct: number().nullable(),
|
|
26577
|
+
ramFreePct: number().nullable(),
|
|
26578
|
+
failReasons: array(string()).readonly()
|
|
26579
|
+
});
|
|
26580
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26581
|
+
phase: literal("device"),
|
|
26582
|
+
deviceKey: string(),
|
|
26583
|
+
modelId: string(),
|
|
26584
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26585
|
+
p50Ms: number(),
|
|
26586
|
+
p95Ms: number(),
|
|
26587
|
+
p99Ms: number(),
|
|
26588
|
+
/** Frames per second sustained at the last passing step. */
|
|
26589
|
+
fps: number(),
|
|
26590
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26591
|
+
kMax: number(),
|
|
26592
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26593
|
+
/** First call (model load + warm-up). */
|
|
26594
|
+
warmupMs: number(),
|
|
26595
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26596
|
+
}), object({
|
|
26597
|
+
phase: literal("pipeline"),
|
|
26598
|
+
deviceKey: string(),
|
|
26599
|
+
modelId: string(),
|
|
26600
|
+
steps: array(string()).readonly(),
|
|
26601
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26602
|
+
maxSessions: number(),
|
|
26603
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26604
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26605
|
+
stepsFired: array(string()).readonly(),
|
|
26606
|
+
warmupMs: number(),
|
|
26607
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26608
|
+
})]);
|
|
26609
|
+
/**
|
|
26610
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26611
|
+
* the node no longer beats the table.
|
|
26612
|
+
*/
|
|
26613
|
+
var NodeBenchFingerprintSchema = object({
|
|
26614
|
+
pipelineVersion: string().nullable(),
|
|
26615
|
+
cpuModel: string().nullable(),
|
|
26616
|
+
ramGb: number().nullable(),
|
|
26617
|
+
os: string().nullable(),
|
|
26618
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26619
|
+
pools: record(string(), object({
|
|
26620
|
+
runtime: string(),
|
|
26621
|
+
numWorkers: number(),
|
|
26622
|
+
concurrency: number(),
|
|
26623
|
+
batchMode: string()
|
|
26624
|
+
})).default({})
|
|
26625
|
+
});
|
|
26626
|
+
/** The frames the run used. */
|
|
26627
|
+
var NodeBenchClipSchema = object({
|
|
26628
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26629
|
+
id: string(),
|
|
26630
|
+
revision: string().nullable(),
|
|
26631
|
+
frames: number(),
|
|
26632
|
+
width: number(),
|
|
26633
|
+
height: number()
|
|
26634
|
+
});
|
|
26635
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26636
|
+
runId: string().min(1),
|
|
26637
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26638
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26639
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26640
|
+
steps: array(string()).default([]),
|
|
26641
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26642
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26643
|
+
deadlineAtMs: number(),
|
|
26644
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26645
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26646
|
+
keepDownloadedModels: boolean().default(false)
|
|
26647
|
+
});
|
|
26648
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26649
|
+
"running",
|
|
26650
|
+
"done",
|
|
26651
|
+
"failed",
|
|
26652
|
+
"aborted"
|
|
26653
|
+
]);
|
|
26654
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26655
|
+
runId: string(),
|
|
26656
|
+
nodeId: string(),
|
|
26657
|
+
state: NodeBenchRunnerStateSchema,
|
|
26658
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26659
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26660
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26661
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26662
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26663
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26664
|
+
activeCameraIds: array(number()).readonly(),
|
|
26665
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26666
|
+
deletedModels: array(string()).readonly(),
|
|
26667
|
+
error: string().nullable(),
|
|
26668
|
+
startedAtMs: number(),
|
|
26669
|
+
finishedAtMs: number().nullable()
|
|
26670
|
+
});
|
|
26671
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26672
|
+
"draining",
|
|
26673
|
+
"measuring",
|
|
26674
|
+
"restoring",
|
|
26675
|
+
"done",
|
|
26676
|
+
"failed",
|
|
26677
|
+
"aborted"
|
|
26678
|
+
]);
|
|
26679
|
+
/** Why a run ended. */
|
|
26680
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26681
|
+
"completed",
|
|
26682
|
+
"operator-abort",
|
|
26683
|
+
"deadline",
|
|
26684
|
+
"node-lost",
|
|
26685
|
+
"runner-lost",
|
|
26686
|
+
"hub-restart",
|
|
26687
|
+
"drain-timeout",
|
|
26688
|
+
"failed"
|
|
26689
|
+
]);
|
|
26690
|
+
var NodeBenchmarkRunSchema = object({
|
|
26691
|
+
runId: string(),
|
|
26692
|
+
nodeId: string(),
|
|
26693
|
+
state: NodeBenchmarkStateSchema,
|
|
26694
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26695
|
+
startedAtMs: number(),
|
|
26696
|
+
deadlineAtMs: number(),
|
|
26697
|
+
finishedAtMs: number().nullable(),
|
|
26698
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26699
|
+
error: string().nullable(),
|
|
26700
|
+
/** Cameras moved off the node for the run. */
|
|
26701
|
+
moved: array(number()).readonly(),
|
|
26702
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26703
|
+
staying: array(number()).readonly(),
|
|
26704
|
+
/** Something else ran on the node's pools during the run. */
|
|
26705
|
+
contaminated: boolean(),
|
|
26706
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26707
|
+
resultIds: array(string()).readonly()
|
|
26708
|
+
});
|
|
26709
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26710
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26711
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26712
|
+
modeNodeId: string().nullable(),
|
|
26713
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26714
|
+
});
|
|
26715
|
+
/**
|
|
26716
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26717
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26718
|
+
* ends, never by anyone else.
|
|
26719
|
+
*/
|
|
26720
|
+
var NodeBenchmarkResultSchema = object({
|
|
26721
|
+
id: string(),
|
|
26722
|
+
runId: string(),
|
|
26723
|
+
nodeId: string(),
|
|
26724
|
+
cell: NodeBenchCellSchema,
|
|
26725
|
+
fpsPerStream: number(),
|
|
26726
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26727
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26728
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26729
|
+
contaminated: boolean(),
|
|
26730
|
+
stayingCameras: array(number()).readonly(),
|
|
26731
|
+
/** The run ended early; the cell itself completed. */
|
|
26732
|
+
partialRun: boolean(),
|
|
26733
|
+
measuredAtMs: number()
|
|
26734
|
+
});
|
|
26735
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26736
|
+
nodeId: string().optional(),
|
|
26737
|
+
deviceKey: string().optional()
|
|
26738
|
+
});
|
|
26739
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26740
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26741
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26742
|
+
standing: _enum([
|
|
26743
|
+
"fresh",
|
|
26744
|
+
"stale",
|
|
26745
|
+
"superseded"
|
|
26746
|
+
]),
|
|
26747
|
+
staleWhy: _enum([
|
|
26748
|
+
"age",
|
|
26749
|
+
"runtime",
|
|
26750
|
+
"pool-tuning"
|
|
26751
|
+
]).nullable()
|
|
26752
|
+
});
|
|
26753
|
+
object({
|
|
26754
|
+
runId: string(),
|
|
26755
|
+
nodeId: string(),
|
|
26756
|
+
startedAtMs: number(),
|
|
26757
|
+
deadlineAtMs: number(),
|
|
26758
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26759
|
+
moved: array(number()).readonly(),
|
|
26760
|
+
staying: array(number()).readonly()
|
|
26761
|
+
});
|
|
26762
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26763
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26764
|
+
nodeId: string(),
|
|
26765
|
+
reachable: boolean(),
|
|
26766
|
+
devices: array(object({
|
|
26767
|
+
deviceKey: string(),
|
|
26768
|
+
enabled: boolean(),
|
|
26769
|
+
available: boolean(),
|
|
26770
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26771
|
+
suggested: array(string()).readonly(),
|
|
26772
|
+
/** Every root detector the device has a build for. */
|
|
26773
|
+
all: array(string()).readonly(),
|
|
26774
|
+
/** The model the device runs now, when pinned. */
|
|
26775
|
+
currentModelId: string().nullable()
|
|
26776
|
+
})).readonly(),
|
|
26777
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26778
|
+
steps: array(object({
|
|
26779
|
+
id: string(),
|
|
26780
|
+
name: string(),
|
|
26781
|
+
slot: string()
|
|
26782
|
+
})).readonly()
|
|
26783
|
+
});
|
|
24265
26784
|
object({
|
|
24266
26785
|
activeCameras: number(),
|
|
24267
26786
|
throttledCameras: number(),
|
|
@@ -25390,7 +27909,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25390
27909
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25391
27910
|
deviceId: number(),
|
|
25392
27911
|
trackId: string()
|
|
25393
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27912
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27913
|
+
accepted: literal(true),
|
|
27914
|
+
runId: string()
|
|
27915
|
+
}), {
|
|
27916
|
+
kind: "mutation",
|
|
27917
|
+
auth: "admin"
|
|
27918
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27919
|
+
kind: "mutation",
|
|
27920
|
+
auth: "admin"
|
|
27921
|
+
});
|
|
25394
27922
|
var CameraPipelineConfigSchema = object({
|
|
25395
27923
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25396
27924
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26029,6 +28557,21 @@ method(object({
|
|
|
26029
28557
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26030
28558
|
kind: "mutation",
|
|
26031
28559
|
auth: "admin"
|
|
28560
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28561
|
+
kind: literal("started"),
|
|
28562
|
+
runId: string()
|
|
28563
|
+
}), object({
|
|
28564
|
+
kind: literal("refused"),
|
|
28565
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28566
|
+
})]), {
|
|
28567
|
+
kind: "mutation",
|
|
28568
|
+
auth: "admin"
|
|
28569
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28570
|
+
kind: "mutation",
|
|
28571
|
+
auth: "admin"
|
|
28572
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28573
|
+
kind: "mutation",
|
|
28574
|
+
auth: "admin"
|
|
26032
28575
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26033
28576
|
deviceId: number(),
|
|
26034
28577
|
addonId: string(),
|
|
@@ -26434,8 +28977,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26434
28977
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26435
28978
|
*
|
|
26436
28979
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26437
|
-
* one for transactional / one for notifications). Consumers (
|
|
26438
|
-
*
|
|
28980
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28981
|
+
* addons, …) walk the collection and pick the first
|
|
26439
28982
|
* ready provider OR target a specific addonId.
|
|
26440
28983
|
*
|
|
26441
28984
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26718,7 +29261,7 @@ targets: array(object({
|
|
|
26718
29261
|
};
|
|
26719
29262
|
/**
|
|
26720
29263
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26721
|
-
* providers (OIDC, SAML,
|
|
29264
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26722
29265
|
* carrying the post-callback claims before redirecting back to
|
|
26723
29266
|
* `/api/auth/sso/finish`.
|
|
26724
29267
|
*
|
|
@@ -26781,7 +29324,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26781
29324
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26782
29325
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26783
29326
|
*/
|
|
26784
|
-
issuer: string().optional()
|
|
29327
|
+
issuer: string().optional(),
|
|
29328
|
+
/**
|
|
29329
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29330
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29331
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29332
|
+
* any other browser.
|
|
29333
|
+
*/
|
|
29334
|
+
browserBinding: string().optional()
|
|
26785
29335
|
});
|
|
26786
29336
|
method(object({
|
|
26787
29337
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32248,6 +34798,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32248
34798
|
enabled: boolean().optional(),
|
|
32249
34799
|
info: record(string(), unknown()).optional(),
|
|
32250
34800
|
settings: record(string(), unknown()).optional(),
|
|
34801
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34802
|
+
* the keychain, not the table (D787). */
|
|
34803
|
+
secretKeys: array(string()).optional(),
|
|
32251
34804
|
skipRestart: boolean().optional()
|
|
32252
34805
|
});
|
|
32253
34806
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32271,7 +34824,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32271
34824
|
auth: "admin"
|
|
32272
34825
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32273
34826
|
id: string(),
|
|
32274
|
-
settings: record(string(), unknown())
|
|
34827
|
+
settings: record(string(), unknown()),
|
|
34828
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34829
|
+
secretKeys: array(string()).optional()
|
|
32275
34830
|
}), object({ success: boolean() }), {
|
|
32276
34831
|
kind: "mutation",
|
|
32277
34832
|
auth: "admin"
|
|
@@ -39043,16 +41598,6 @@ var ApiKeySummarySchema = object({
|
|
|
39043
41598
|
createdAt: number(),
|
|
39044
41599
|
lastUsedAt: number().optional()
|
|
39045
41600
|
});
|
|
39046
|
-
var CreateApiKeyInputSchema = object({
|
|
39047
|
-
label: string(),
|
|
39048
|
-
isAdmin: boolean().default(false),
|
|
39049
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39050
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39051
|
-
});
|
|
39052
|
-
var CreateApiKeyResultSchema = object({
|
|
39053
|
-
token: string(),
|
|
39054
|
-
record: ApiKeySummarySchema
|
|
39055
|
-
});
|
|
39056
41601
|
var ScopedTokenSummarySchema = object({
|
|
39057
41602
|
id: string(),
|
|
39058
41603
|
userId: string(),
|
|
@@ -39151,17 +41696,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39151
41696
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39152
41697
|
kind: "mutation",
|
|
39153
41698
|
access: "view"
|
|
39154
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39155
|
-
kind: "mutation",
|
|
39156
|
-
auth: "admin",
|
|
39157
|
-
access: "create"
|
|
39158
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41699
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39159
41700
|
kind: "mutation",
|
|
39160
41701
|
auth: "admin",
|
|
39161
41702
|
access: "delete"
|
|
39162
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39163
|
-
kind: "mutation",
|
|
39164
|
-
access: "view"
|
|
39165
41703
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39166
41704
|
kind: "mutation",
|
|
39167
41705
|
auth: "admin",
|
|
@@ -39235,15 +41773,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39235
41773
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39236
41774
|
userId: string(),
|
|
39237
41775
|
issuer: string()
|
|
39238
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39239
|
-
userId: string(),
|
|
39240
|
-
issuer: string().min(1),
|
|
39241
|
-
label: string().optional()
|
|
39242
|
-
}), object({ success: literal(true) }), {
|
|
39243
|
-
kind: "mutation",
|
|
39244
|
-
auth: "admin",
|
|
39245
|
-
access: "create"
|
|
39246
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41776
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39247
41777
|
kind: "mutation",
|
|
39248
41778
|
auth: "admin",
|
|
39249
41779
|
access: "delete"
|
|
@@ -39948,6 +42478,451 @@ var zoneRulesCapability = {
|
|
|
39948
42478
|
*/
|
|
39949
42479
|
durability: "restored"
|
|
39950
42480
|
};
|
|
42481
|
+
/**
|
|
42482
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42483
|
+
*
|
|
42484
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42485
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42486
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42487
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42488
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42489
|
+
* manifest entry and nothing else.
|
|
42490
|
+
*
|
|
42491
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42492
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42493
|
+
* Every method is `admin`: these spend money.
|
|
42494
|
+
*
|
|
42495
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42496
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42497
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42498
|
+
*
|
|
42499
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42500
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42501
|
+
* ticket the provider mints (D613).
|
|
42502
|
+
*/
|
|
42503
|
+
var TrainingGpuOptionSchema = object({
|
|
42504
|
+
id: string(),
|
|
42505
|
+
label: string(),
|
|
42506
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42507
|
+
usdPerHour: number().nonnegative(),
|
|
42508
|
+
vramGb: number().nonnegative()
|
|
42509
|
+
});
|
|
42510
|
+
var TrainingRegionOptionSchema = object({
|
|
42511
|
+
/** `''` = any region (the provider's choice). */
|
|
42512
|
+
id: string(),
|
|
42513
|
+
label: string(),
|
|
42514
|
+
priceMultiplier: number().positive()
|
|
42515
|
+
});
|
|
42516
|
+
/**
|
|
42517
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42518
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42519
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42520
|
+
*/
|
|
42521
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42522
|
+
gpuType: string(),
|
|
42523
|
+
region: string(),
|
|
42524
|
+
costCapUsd: number().nonnegative(),
|
|
42525
|
+
maxRuntimeSec: number().int().positive(),
|
|
42526
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42527
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42528
|
+
});
|
|
42529
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42530
|
+
addonId: string(),
|
|
42531
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42532
|
+
kind: string(),
|
|
42533
|
+
label: string(),
|
|
42534
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42535
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42536
|
+
maxDatasetBytes: number().int().positive(),
|
|
42537
|
+
maxRuntimeSec: number().int().positive(),
|
|
42538
|
+
freeTierNote: string().optional(),
|
|
42539
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42540
|
+
dataResidencyNote: string(),
|
|
42541
|
+
/** Credentials are present — never the values. */
|
|
42542
|
+
configured: boolean(),
|
|
42543
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42544
|
+
});
|
|
42545
|
+
var TrainingCredentialCheckSchema = object({
|
|
42546
|
+
ok: boolean(),
|
|
42547
|
+
/** Workspace / account name, when the provider says. */
|
|
42548
|
+
account: string().optional(),
|
|
42549
|
+
reason: _enum([
|
|
42550
|
+
"missing",
|
|
42551
|
+
"invalid",
|
|
42552
|
+
"forbidden",
|
|
42553
|
+
"network",
|
|
42554
|
+
"quota"
|
|
42555
|
+
]).optional(),
|
|
42556
|
+
detail: string().optional()
|
|
42557
|
+
});
|
|
42558
|
+
var ProviderJobStateSchema = _enum([
|
|
42559
|
+
"pending",
|
|
42560
|
+
"starting",
|
|
42561
|
+
"running",
|
|
42562
|
+
"succeeded",
|
|
42563
|
+
"failed",
|
|
42564
|
+
"cancelled",
|
|
42565
|
+
"lost"
|
|
42566
|
+
]);
|
|
42567
|
+
var ProviderJobStatusSchema = object({
|
|
42568
|
+
jobKey: string(),
|
|
42569
|
+
providerJobId: string().optional(),
|
|
42570
|
+
state: ProviderJobStateSchema,
|
|
42571
|
+
startedAt: number().optional(),
|
|
42572
|
+
endedAt: number().optional(),
|
|
42573
|
+
exitCode: number().int().optional(),
|
|
42574
|
+
failureReason: string().optional(),
|
|
42575
|
+
gpuType: string(),
|
|
42576
|
+
region: string().optional(),
|
|
42577
|
+
billedSeconds: number().nonnegative(),
|
|
42578
|
+
costUsd: number().nonnegative(),
|
|
42579
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42580
|
+
costIsEstimate: boolean(),
|
|
42581
|
+
lastFetchedAt: number()
|
|
42582
|
+
});
|
|
42583
|
+
/**
|
|
42584
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42585
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42586
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42587
|
+
* in `result.json`.
|
|
42588
|
+
*/
|
|
42589
|
+
var TrainerSourceRefSchema = object({
|
|
42590
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42591
|
+
repo: string().min(1),
|
|
42592
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42593
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42594
|
+
});
|
|
42595
|
+
var JobRef = {
|
|
42596
|
+
addonId: string(),
|
|
42597
|
+
jobKey: string().uuid()
|
|
42598
|
+
};
|
|
42599
|
+
var TrainingLogLineSchema = object({
|
|
42600
|
+
ts: number(),
|
|
42601
|
+
text: string()
|
|
42602
|
+
});
|
|
42603
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42604
|
+
kind: "mutation",
|
|
42605
|
+
auth: "admin",
|
|
42606
|
+
timeoutMs: 3e4
|
|
42607
|
+
}), method(object({
|
|
42608
|
+
addonId: string(),
|
|
42609
|
+
gpuType: string(),
|
|
42610
|
+
region: string(),
|
|
42611
|
+
datasetBytes: number().int().nonnegative(),
|
|
42612
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42613
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42614
|
+
}), object({
|
|
42615
|
+
usdLow: number().nonnegative(),
|
|
42616
|
+
usdHigh: number().nonnegative(),
|
|
42617
|
+
notes: array(string()).readonly()
|
|
42618
|
+
}), { auth: "admin" }), method(object({
|
|
42619
|
+
...JobRef,
|
|
42620
|
+
ticket: PeerBytesTicketSchema
|
|
42621
|
+
}), object({
|
|
42622
|
+
bytes: number().int().nonnegative(),
|
|
42623
|
+
sha256: string()
|
|
42624
|
+
}), {
|
|
42625
|
+
kind: "mutation",
|
|
42626
|
+
auth: "admin",
|
|
42627
|
+
timeoutMs: 120 * 6e4
|
|
42628
|
+
}), method(object({
|
|
42629
|
+
...JobRef,
|
|
42630
|
+
trainer: TrainerSourceRefSchema,
|
|
42631
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42632
|
+
gpuType: string(),
|
|
42633
|
+
region: string(),
|
|
42634
|
+
maxRuntimeSec: number().int().positive()
|
|
42635
|
+
}), ProviderJobStatusSchema, {
|
|
42636
|
+
kind: "mutation",
|
|
42637
|
+
auth: "admin",
|
|
42638
|
+
timeoutMs: 30 * 6e4
|
|
42639
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42640
|
+
auth: "admin",
|
|
42641
|
+
timeoutMs: 6e4
|
|
42642
|
+
}), method(object({
|
|
42643
|
+
...JobRef,
|
|
42644
|
+
cursor: string().optional(),
|
|
42645
|
+
max: number().int().min(1).max(500)
|
|
42646
|
+
}), object({
|
|
42647
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42648
|
+
cursor: string()
|
|
42649
|
+
}), {
|
|
42650
|
+
auth: "admin",
|
|
42651
|
+
timeoutMs: 6e4
|
|
42652
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42653
|
+
kind: "mutation",
|
|
42654
|
+
auth: "admin",
|
|
42655
|
+
timeoutMs: 6e4
|
|
42656
|
+
}), method(object(JobRef), object({
|
|
42657
|
+
found: boolean(),
|
|
42658
|
+
text: string().optional()
|
|
42659
|
+
}), {
|
|
42660
|
+
kind: "mutation",
|
|
42661
|
+
auth: "admin",
|
|
42662
|
+
timeoutMs: 5 * 6e4
|
|
42663
|
+
}), method(object({
|
|
42664
|
+
...JobRef,
|
|
42665
|
+
path: _enum(["bundle.tar"])
|
|
42666
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42667
|
+
kind: "mutation",
|
|
42668
|
+
auth: "admin",
|
|
42669
|
+
timeoutMs: 5 * 6e4
|
|
42670
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42671
|
+
kind: "mutation",
|
|
42672
|
+
auth: "admin",
|
|
42673
|
+
timeoutMs: 5 * 6e4
|
|
42674
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42675
|
+
auth: "admin",
|
|
42676
|
+
timeoutMs: 2 * 6e4
|
|
42677
|
+
});
|
|
42678
|
+
/**
|
|
42679
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42680
|
+
* provided by `addon-training`.
|
|
42681
|
+
*
|
|
42682
|
+
* It owns what every provider must agree on, written once:
|
|
42683
|
+
*
|
|
42684
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42685
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42686
|
+
* the export plan) and reaches this store through the five row methods
|
|
42687
|
+
* below, so the Retrain page and the export did not change.
|
|
42688
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42689
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42690
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42691
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42692
|
+
* rollback. Nothing is ever registered automatically.
|
|
42693
|
+
*
|
|
42694
|
+
* Every method is `admin`.
|
|
42695
|
+
*/
|
|
42696
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42697
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42698
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42699
|
+
var TrainingBaseModelSchema = object({
|
|
42700
|
+
modelId: string(),
|
|
42701
|
+
label: string(),
|
|
42702
|
+
weights: string(),
|
|
42703
|
+
imgsz: number().int(),
|
|
42704
|
+
baselineOnnxUrl: string(),
|
|
42705
|
+
baselineFloors: record(string(), number()),
|
|
42706
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42707
|
+
recommended: boolean()
|
|
42708
|
+
});
|
|
42709
|
+
var TrainingPresetSchema = _enum([
|
|
42710
|
+
"quick",
|
|
42711
|
+
"standard",
|
|
42712
|
+
"thorough"
|
|
42713
|
+
]);
|
|
42714
|
+
var TrainingJobRequestSchema = object({
|
|
42715
|
+
datasetVersionId: string().min(1),
|
|
42716
|
+
/** The `training-provider` addon that runs it. */
|
|
42717
|
+
addonId: string().min(1),
|
|
42718
|
+
gpuType: string().min(1),
|
|
42719
|
+
region: string(),
|
|
42720
|
+
baseModelId: string().min(1),
|
|
42721
|
+
preset: TrainingPresetSchema,
|
|
42722
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42723
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42724
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42725
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42726
|
+
});
|
|
42727
|
+
var TrainingSplitPlanSchema = object({
|
|
42728
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42729
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42730
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42731
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42732
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42733
|
+
trainSubjects: number().int()
|
|
42734
|
+
});
|
|
42735
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42736
|
+
"unknown-dataset",
|
|
42737
|
+
"unknown-provider",
|
|
42738
|
+
"provider-not-configured",
|
|
42739
|
+
"unknown-base-model",
|
|
42740
|
+
"unknown-gpu",
|
|
42741
|
+
"dataset-too-large",
|
|
42742
|
+
"no-training-subjects",
|
|
42743
|
+
"job-already-running"
|
|
42744
|
+
]);
|
|
42745
|
+
var TrainingJobPlanSchema = object({
|
|
42746
|
+
refusal: object({
|
|
42747
|
+
reason: TrainingRefusalReasonSchema,
|
|
42748
|
+
detail: string()
|
|
42749
|
+
}).nullable(),
|
|
42750
|
+
warnings: array(string()).readonly(),
|
|
42751
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42752
|
+
estimate: object({
|
|
42753
|
+
datasetBytes: number().int(),
|
|
42754
|
+
uploadMinutesAt20Mbps: number(),
|
|
42755
|
+
gpuSecondsLow: number(),
|
|
42756
|
+
gpuSecondsHigh: number(),
|
|
42757
|
+
usdLow: number(),
|
|
42758
|
+
usdHigh: number(),
|
|
42759
|
+
notes: array(string()).readonly()
|
|
42760
|
+
}).nullable(),
|
|
42761
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42762
|
+
defaults: object({
|
|
42763
|
+
maxCostUsd: number(),
|
|
42764
|
+
maxRuntimeSec: number().int()
|
|
42765
|
+
}).nullable(),
|
|
42766
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42767
|
+
dataNotice: string()
|
|
42768
|
+
});
|
|
42769
|
+
/**
|
|
42770
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42771
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42772
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42773
|
+
* result lives after the operator acted on it.
|
|
42774
|
+
*/
|
|
42775
|
+
var TrainingJobStateSchema = _enum([
|
|
42776
|
+
"uploading",
|
|
42777
|
+
"submitted",
|
|
42778
|
+
"starting",
|
|
42779
|
+
"running",
|
|
42780
|
+
"collecting",
|
|
42781
|
+
"ready",
|
|
42782
|
+
"registered",
|
|
42783
|
+
"canary",
|
|
42784
|
+
"failed",
|
|
42785
|
+
"cancelling",
|
|
42786
|
+
"cancelled",
|
|
42787
|
+
"lost",
|
|
42788
|
+
"expired",
|
|
42789
|
+
"discarded"
|
|
42790
|
+
]);
|
|
42791
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42792
|
+
"cost-cap",
|
|
42793
|
+
"runtime-cap",
|
|
42794
|
+
"upload-failed",
|
|
42795
|
+
"submit-failed",
|
|
42796
|
+
"trainer-failed",
|
|
42797
|
+
"result-invalid",
|
|
42798
|
+
"checksum-mismatch",
|
|
42799
|
+
"fetch-failed",
|
|
42800
|
+
"provider-error",
|
|
42801
|
+
"hub-restart-during-upload"
|
|
42802
|
+
]);
|
|
42803
|
+
var TrainingProgressPointSchema = object({
|
|
42804
|
+
epoch: number().int(),
|
|
42805
|
+
map50: number().nullable(),
|
|
42806
|
+
map50_95: number().nullable()
|
|
42807
|
+
});
|
|
42808
|
+
var TrainingCanarySchema = object({
|
|
42809
|
+
deviceIds: array(number().int()).readonly(),
|
|
42810
|
+
since: number(),
|
|
42811
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42812
|
+
previous: array(object({
|
|
42813
|
+
deviceId: number().int(),
|
|
42814
|
+
nodeId: string(),
|
|
42815
|
+
deviceKey: string(),
|
|
42816
|
+
patch: object({
|
|
42817
|
+
modelId: string().optional(),
|
|
42818
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42819
|
+
}).nullable()
|
|
42820
|
+
})).readonly()
|
|
42821
|
+
});
|
|
42822
|
+
var TrainingJobSchema = object({
|
|
42823
|
+
id: string(),
|
|
42824
|
+
idempotencyKey: string(),
|
|
42825
|
+
name: string(),
|
|
42826
|
+
createdAt: number(),
|
|
42827
|
+
updatedAt: number(),
|
|
42828
|
+
state: TrainingJobStateSchema,
|
|
42829
|
+
stage: TrainingStageSchema.nullable(),
|
|
42830
|
+
failure: object({
|
|
42831
|
+
reason: TrainingFailureReasonSchema,
|
|
42832
|
+
stage: string().nullable(),
|
|
42833
|
+
detail: string()
|
|
42834
|
+
}).nullable(),
|
|
42835
|
+
request: TrainingJobRequestSchema,
|
|
42836
|
+
maxCostUsd: number().nonnegative(),
|
|
42837
|
+
maxRuntimeSec: number().int().positive(),
|
|
42838
|
+
trainer: TrainerSourceRefSchema,
|
|
42839
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42840
|
+
dataset: object({
|
|
42841
|
+
bytes: number().int(),
|
|
42842
|
+
sha256: string(),
|
|
42843
|
+
uploadedAt: number()
|
|
42844
|
+
}).nullable(),
|
|
42845
|
+
split: TrainingSplitPlanSchema,
|
|
42846
|
+
provider: object({
|
|
42847
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42848
|
+
providerJobId: string().nullable(),
|
|
42849
|
+
startedAt: number().nullable(),
|
|
42850
|
+
endedAt: number().nullable(),
|
|
42851
|
+
billedSeconds: number(),
|
|
42852
|
+
costUsd: number(),
|
|
42853
|
+
costIsEstimate: boolean(),
|
|
42854
|
+
lastPolledAt: number().nullable()
|
|
42855
|
+
}),
|
|
42856
|
+
progress: object({
|
|
42857
|
+
epoch: number().int().nullable(),
|
|
42858
|
+
epochs: number().int().nullable(),
|
|
42859
|
+
etaSec: number().nullable(),
|
|
42860
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42861
|
+
}),
|
|
42862
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42863
|
+
logTail: array(string()).readonly(),
|
|
42864
|
+
logCursor: string().nullable(),
|
|
42865
|
+
artifacts: object({
|
|
42866
|
+
bundleBytes: number().int(),
|
|
42867
|
+
bundleSha256: string(),
|
|
42868
|
+
fetchedAt: number(),
|
|
42869
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42870
|
+
expiresAt: number()
|
|
42871
|
+
}).nullable(),
|
|
42872
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42873
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42874
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42875
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42876
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42877
|
+
registeredModelIds: array(string()).readonly(),
|
|
42878
|
+
canary: TrainingCanarySchema.nullable()
|
|
42879
|
+
});
|
|
42880
|
+
var IdInput = object({ id: string().min(1) });
|
|
42881
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42882
|
+
kind: "mutation",
|
|
42883
|
+
auth: "admin"
|
|
42884
|
+
}), 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() }), {
|
|
42885
|
+
kind: "mutation",
|
|
42886
|
+
auth: "admin"
|
|
42887
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42888
|
+
auth: "admin",
|
|
42889
|
+
timeoutMs: 6e4
|
|
42890
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42891
|
+
name: string().min(1).max(120),
|
|
42892
|
+
maxCostUsd: number().positive(),
|
|
42893
|
+
maxRuntimeSec: number().int().positive(),
|
|
42894
|
+
idempotencyKey: string().min(8).max(80)
|
|
42895
|
+
}), discriminatedUnion("kind", [object({
|
|
42896
|
+
kind: literal("started"),
|
|
42897
|
+
job: TrainingJobSchema
|
|
42898
|
+
}), object({
|
|
42899
|
+
kind: literal("refused"),
|
|
42900
|
+
reason: TrainingRefusalReasonSchema,
|
|
42901
|
+
detail: string()
|
|
42902
|
+
})]), {
|
|
42903
|
+
kind: "mutation",
|
|
42904
|
+
auth: "admin",
|
|
42905
|
+
timeoutMs: 12e4
|
|
42906
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42907
|
+
kind: "mutation",
|
|
42908
|
+
auth: "admin",
|
|
42909
|
+
timeoutMs: 12e4
|
|
42910
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42911
|
+
kind: "mutation",
|
|
42912
|
+
auth: "admin",
|
|
42913
|
+
timeoutMs: 30 * 6e4
|
|
42914
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42915
|
+
kind: "mutation",
|
|
42916
|
+
auth: "admin",
|
|
42917
|
+
timeoutMs: 12e4
|
|
42918
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42919
|
+
kind: "mutation",
|
|
42920
|
+
auth: "admin",
|
|
42921
|
+
timeoutMs: 12e4
|
|
42922
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42923
|
+
kind: "mutation",
|
|
42924
|
+
auth: "admin"
|
|
42925
|
+
});
|
|
39951
42926
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39952
42927
|
Object.freeze({
|
|
39953
42928
|
person: .5,
|
|
@@ -40434,7 +43409,8 @@ var BaseDevice = class {
|
|
|
40434
43409
|
this.role = options.role;
|
|
40435
43410
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40436
43411
|
const seedData = ctx.persistedConfig ?? {};
|
|
40437
|
-
|
|
43412
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
43413
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40438
43414
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40439
43415
|
tags: {
|
|
40440
43416
|
deviceId: ctx.id,
|
|
@@ -42095,6 +45071,12 @@ Object.freeze({
|
|
|
42095
45071
|
addonId: null,
|
|
42096
45072
|
access: "create"
|
|
42097
45073
|
},
|
|
45074
|
+
"backup.checkBackupKey": {
|
|
45075
|
+
capName: "backup",
|
|
45076
|
+
capScope: "system",
|
|
45077
|
+
addonId: null,
|
|
45078
|
+
access: "create"
|
|
45079
|
+
},
|
|
42098
45080
|
"backup.delete": {
|
|
42099
45081
|
capName: "backup",
|
|
42100
45082
|
capScope: "system",
|
|
@@ -42107,6 +45089,18 @@ Object.freeze({
|
|
|
42107
45089
|
addonId: null,
|
|
42108
45090
|
access: "delete"
|
|
42109
45091
|
},
|
|
45092
|
+
"backup.disableEncryption": {
|
|
45093
|
+
capName: "backup",
|
|
45094
|
+
capScope: "system",
|
|
45095
|
+
addonId: null,
|
|
45096
|
+
access: "create"
|
|
45097
|
+
},
|
|
45098
|
+
"backup.getEncryption": {
|
|
45099
|
+
capName: "backup",
|
|
45100
|
+
capScope: "system",
|
|
45101
|
+
addonId: null,
|
|
45102
|
+
access: "view"
|
|
45103
|
+
},
|
|
42110
45104
|
"backup.getEntries": {
|
|
42111
45105
|
capName: "backup",
|
|
42112
45106
|
capScope: "system",
|
|
@@ -42161,6 +45155,12 @@ Object.freeze({
|
|
|
42161
45155
|
addonId: null,
|
|
42162
45156
|
access: "create"
|
|
42163
45157
|
},
|
|
45158
|
+
"backup.setupEncryption": {
|
|
45159
|
+
capName: "backup",
|
|
45160
|
+
capScope: "system",
|
|
45161
|
+
addonId: null,
|
|
45162
|
+
access: "create"
|
|
45163
|
+
},
|
|
42164
45164
|
"backup.trigger": {
|
|
42165
45165
|
capName: "backup",
|
|
42166
45166
|
capScope: "system",
|
|
@@ -42713,6 +45713,12 @@ Object.freeze({
|
|
|
42713
45713
|
addonId: null,
|
|
42714
45714
|
access: "create"
|
|
42715
45715
|
},
|
|
45716
|
+
"customModelRegistry.importModelBundle": {
|
|
45717
|
+
capName: "custom-model-registry",
|
|
45718
|
+
capScope: "system",
|
|
45719
|
+
addonId: null,
|
|
45720
|
+
access: "create"
|
|
45721
|
+
},
|
|
42716
45722
|
"customModelRegistry.listModels": {
|
|
42717
45723
|
capName: "custom-model-registry",
|
|
42718
45724
|
capScope: "system",
|
|
@@ -44123,6 +47129,108 @@ Object.freeze({
|
|
|
44123
47129
|
addonId: null,
|
|
44124
47130
|
access: "create"
|
|
44125
47131
|
},
|
|
47132
|
+
"keychain.delete": {
|
|
47133
|
+
capName: "keychain",
|
|
47134
|
+
capScope: "system",
|
|
47135
|
+
addonId: null,
|
|
47136
|
+
access: "delete"
|
|
47137
|
+
},
|
|
47138
|
+
"keychain.getState": {
|
|
47139
|
+
capName: "keychain",
|
|
47140
|
+
capScope: "system",
|
|
47141
|
+
addonId: null,
|
|
47142
|
+
access: "view"
|
|
47143
|
+
},
|
|
47144
|
+
"keychain.listMeta": {
|
|
47145
|
+
capName: "keychain",
|
|
47146
|
+
capScope: "system",
|
|
47147
|
+
addonId: null,
|
|
47148
|
+
access: "view"
|
|
47149
|
+
},
|
|
47150
|
+
"keychain.put": {
|
|
47151
|
+
capName: "keychain",
|
|
47152
|
+
capScope: "system",
|
|
47153
|
+
addonId: null,
|
|
47154
|
+
access: "create"
|
|
47155
|
+
},
|
|
47156
|
+
"keychain.resolve": {
|
|
47157
|
+
capName: "keychain",
|
|
47158
|
+
capScope: "system",
|
|
47159
|
+
addonId: null,
|
|
47160
|
+
access: "view"
|
|
47161
|
+
},
|
|
47162
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47163
|
+
capName: "keychain-admin",
|
|
47164
|
+
capScope: "system",
|
|
47165
|
+
addonId: null,
|
|
47166
|
+
access: "create"
|
|
47167
|
+
},
|
|
47168
|
+
"keychainAdmin.deleteOrphans": {
|
|
47169
|
+
capName: "keychain-admin",
|
|
47170
|
+
capScope: "system",
|
|
47171
|
+
addonId: null,
|
|
47172
|
+
access: "delete"
|
|
47173
|
+
},
|
|
47174
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47175
|
+
capName: "keychain-admin",
|
|
47176
|
+
capScope: "system",
|
|
47177
|
+
addonId: null,
|
|
47178
|
+
access: "create"
|
|
47179
|
+
},
|
|
47180
|
+
"keychainAdmin.listAudit": {
|
|
47181
|
+
capName: "keychain-admin",
|
|
47182
|
+
capScope: "system",
|
|
47183
|
+
addonId: null,
|
|
47184
|
+
access: "view"
|
|
47185
|
+
},
|
|
47186
|
+
"keychainAdmin.listSecrets": {
|
|
47187
|
+
capName: "keychain-admin",
|
|
47188
|
+
capScope: "system",
|
|
47189
|
+
addonId: null,
|
|
47190
|
+
access: "view"
|
|
47191
|
+
},
|
|
47192
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47193
|
+
capName: "keychain-admin",
|
|
47194
|
+
capScope: "system",
|
|
47195
|
+
addonId: null,
|
|
47196
|
+
access: "delete"
|
|
47197
|
+
},
|
|
47198
|
+
"keychainAdmin.resetKeychain": {
|
|
47199
|
+
capName: "keychain-admin",
|
|
47200
|
+
capScope: "system",
|
|
47201
|
+
addonId: null,
|
|
47202
|
+
access: "delete"
|
|
47203
|
+
},
|
|
47204
|
+
"keychainAdmin.resetReport": {
|
|
47205
|
+
capName: "keychain-admin",
|
|
47206
|
+
capScope: "system",
|
|
47207
|
+
addonId: null,
|
|
47208
|
+
access: "delete"
|
|
47209
|
+
},
|
|
47210
|
+
"keychainAdmin.reveal": {
|
|
47211
|
+
capName: "keychain-admin",
|
|
47212
|
+
capScope: "system",
|
|
47213
|
+
addonId: null,
|
|
47214
|
+
access: "create"
|
|
47215
|
+
},
|
|
47216
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47217
|
+
capName: "keychain-admin",
|
|
47218
|
+
capScope: "system",
|
|
47219
|
+
addonId: null,
|
|
47220
|
+
access: "create"
|
|
47221
|
+
},
|
|
47222
|
+
"keychainAdmin.setSystemSecret": {
|
|
47223
|
+
capName: "keychain-admin",
|
|
47224
|
+
capScope: "system",
|
|
47225
|
+
addonId: null,
|
|
47226
|
+
access: "create"
|
|
47227
|
+
},
|
|
47228
|
+
"keychainAdmin.status": {
|
|
47229
|
+
capName: "keychain-admin",
|
|
47230
|
+
capScope: "system",
|
|
47231
|
+
addonId: null,
|
|
47232
|
+
access: "view"
|
|
47233
|
+
},
|
|
44126
47234
|
"lawnMowerControl.dock": {
|
|
44127
47235
|
capName: "lawn-mower-control",
|
|
44128
47236
|
capScope: "device",
|
|
@@ -45497,6 +48605,18 @@ Object.freeze({
|
|
|
45497
48605
|
addonId: null,
|
|
45498
48606
|
access: "create"
|
|
45499
48607
|
},
|
|
48608
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48609
|
+
capName: "pipeline-analytics",
|
|
48610
|
+
capScope: "device",
|
|
48611
|
+
addonId: null,
|
|
48612
|
+
access: "create"
|
|
48613
|
+
},
|
|
48614
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48615
|
+
capName: "pipeline-analytics",
|
|
48616
|
+
capScope: "device",
|
|
48617
|
+
addonId: null,
|
|
48618
|
+
access: "create"
|
|
48619
|
+
},
|
|
45500
48620
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45501
48621
|
capName: "pipeline-analytics",
|
|
45502
48622
|
capScope: "device",
|
|
@@ -45545,12 +48665,36 @@ Object.freeze({
|
|
|
45545
48665
|
addonId: null,
|
|
45546
48666
|
access: "view"
|
|
45547
48667
|
},
|
|
48668
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48669
|
+
capName: "pipeline-analytics",
|
|
48670
|
+
capScope: "device",
|
|
48671
|
+
addonId: null,
|
|
48672
|
+
access: "create"
|
|
48673
|
+
},
|
|
48674
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48675
|
+
capName: "pipeline-analytics",
|
|
48676
|
+
capScope: "device",
|
|
48677
|
+
addonId: null,
|
|
48678
|
+
access: "create"
|
|
48679
|
+
},
|
|
45548
48680
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45549
48681
|
capName: "pipeline-analytics",
|
|
45550
48682
|
capScope: "device",
|
|
45551
48683
|
addonId: null,
|
|
45552
48684
|
access: "delete"
|
|
45553
48685
|
},
|
|
48686
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48687
|
+
capName: "pipeline-analytics",
|
|
48688
|
+
capScope: "device",
|
|
48689
|
+
addonId: null,
|
|
48690
|
+
access: "delete"
|
|
48691
|
+
},
|
|
48692
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48693
|
+
capName: "pipeline-analytics",
|
|
48694
|
+
capScope: "device",
|
|
48695
|
+
addonId: null,
|
|
48696
|
+
access: "delete"
|
|
48697
|
+
},
|
|
45554
48698
|
"pipelineAnalytics.deleteTracks": {
|
|
45555
48699
|
capName: "pipeline-analytics",
|
|
45556
48700
|
capScope: "device",
|
|
@@ -45755,6 +48899,30 @@ Object.freeze({
|
|
|
45755
48899
|
addonId: null,
|
|
45756
48900
|
access: "view"
|
|
45757
48901
|
},
|
|
48902
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48903
|
+
capName: "pipeline-analytics",
|
|
48904
|
+
capScope: "device",
|
|
48905
|
+
addonId: null,
|
|
48906
|
+
access: "view"
|
|
48907
|
+
},
|
|
48908
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48909
|
+
capName: "pipeline-analytics",
|
|
48910
|
+
capScope: "device",
|
|
48911
|
+
addonId: null,
|
|
48912
|
+
access: "view"
|
|
48913
|
+
},
|
|
48914
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
48915
|
+
capName: "pipeline-analytics",
|
|
48916
|
+
capScope: "device",
|
|
48917
|
+
addonId: null,
|
|
48918
|
+
access: "view"
|
|
48919
|
+
},
|
|
48920
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48921
|
+
capName: "pipeline-analytics",
|
|
48922
|
+
capScope: "device",
|
|
48923
|
+
addonId: null,
|
|
48924
|
+
access: "view"
|
|
48925
|
+
},
|
|
45758
48926
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45759
48927
|
capName: "pipeline-analytics",
|
|
45760
48928
|
capScope: "device",
|
|
@@ -45785,6 +48953,12 @@ Object.freeze({
|
|
|
45785
48953
|
addonId: null,
|
|
45786
48954
|
access: "view"
|
|
45787
48955
|
},
|
|
48956
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48957
|
+
capName: "pipeline-analytics",
|
|
48958
|
+
capScope: "device",
|
|
48959
|
+
addonId: null,
|
|
48960
|
+
access: "create"
|
|
48961
|
+
},
|
|
45788
48962
|
"pipelineAnalytics.ownersWithMedia": {
|
|
45789
48963
|
capName: "pipeline-analytics",
|
|
45790
48964
|
capScope: "device",
|
|
@@ -45797,12 +48971,24 @@ Object.freeze({
|
|
|
45797
48971
|
addonId: null,
|
|
45798
48972
|
access: "create"
|
|
45799
48973
|
},
|
|
48974
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48975
|
+
capName: "pipeline-analytics",
|
|
48976
|
+
capScope: "device",
|
|
48977
|
+
addonId: null,
|
|
48978
|
+
access: "view"
|
|
48979
|
+
},
|
|
45800
48980
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
45801
48981
|
capName: "pipeline-analytics",
|
|
45802
48982
|
capScope: "device",
|
|
45803
48983
|
addonId: null,
|
|
45804
48984
|
access: "create"
|
|
45805
48985
|
},
|
|
48986
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
48987
|
+
capName: "pipeline-analytics",
|
|
48988
|
+
capScope: "device",
|
|
48989
|
+
addonId: null,
|
|
48990
|
+
access: "create"
|
|
48991
|
+
},
|
|
45806
48992
|
"pipelineAnalytics.pruneEvents": {
|
|
45807
48993
|
capName: "pipeline-analytics",
|
|
45808
48994
|
capScope: "device",
|
|
@@ -45857,6 +49043,18 @@ Object.freeze({
|
|
|
45857
49043
|
addonId: null,
|
|
45858
49044
|
access: "create"
|
|
45859
49045
|
},
|
|
49046
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49047
|
+
capName: "pipeline-analytics",
|
|
49048
|
+
capScope: "device",
|
|
49049
|
+
addonId: null,
|
|
49050
|
+
access: "delete"
|
|
49051
|
+
},
|
|
49052
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49053
|
+
capName: "pipeline-analytics",
|
|
49054
|
+
capScope: "device",
|
|
49055
|
+
addonId: null,
|
|
49056
|
+
access: "create"
|
|
49057
|
+
},
|
|
45860
49058
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45861
49059
|
capName: "pipeline-analytics",
|
|
45862
49060
|
capScope: "device",
|
|
@@ -45917,6 +49115,12 @@ Object.freeze({
|
|
|
45917
49115
|
addonId: null,
|
|
45918
49116
|
access: "create"
|
|
45919
49117
|
},
|
|
49118
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49119
|
+
capName: "pipeline-analytics",
|
|
49120
|
+
capScope: "device",
|
|
49121
|
+
addonId: null,
|
|
49122
|
+
access: "view"
|
|
49123
|
+
},
|
|
45920
49124
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
45921
49125
|
capName: "pipeline-analytics",
|
|
45922
49126
|
capScope: "device",
|
|
@@ -46145,6 +49349,12 @@ Object.freeze({
|
|
|
46145
49349
|
addonId: null,
|
|
46146
49350
|
access: "view"
|
|
46147
49351
|
},
|
|
49352
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
49353
|
+
capName: "pipeline-orchestrator",
|
|
49354
|
+
capScope: "system",
|
|
49355
|
+
addonId: null,
|
|
49356
|
+
access: "create"
|
|
49357
|
+
},
|
|
46148
49358
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46149
49359
|
capName: "pipeline-orchestrator",
|
|
46150
49360
|
capScope: "system",
|
|
@@ -46169,6 +49379,12 @@ Object.freeze({
|
|
|
46169
49379
|
addonId: null,
|
|
46170
49380
|
access: "create"
|
|
46171
49381
|
},
|
|
49382
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
49383
|
+
capName: "pipeline-orchestrator",
|
|
49384
|
+
capScope: "system",
|
|
49385
|
+
addonId: null,
|
|
49386
|
+
access: "delete"
|
|
49387
|
+
},
|
|
46172
49388
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46173
49389
|
capName: "pipeline-orchestrator",
|
|
46174
49390
|
capScope: "system",
|
|
@@ -46277,6 +49493,24 @@ Object.freeze({
|
|
|
46277
49493
|
addonId: null,
|
|
46278
49494
|
access: "view"
|
|
46279
49495
|
},
|
|
49496
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
49497
|
+
capName: "pipeline-orchestrator",
|
|
49498
|
+
capScope: "system",
|
|
49499
|
+
addonId: null,
|
|
49500
|
+
access: "view"
|
|
49501
|
+
},
|
|
49502
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
49503
|
+
capName: "pipeline-orchestrator",
|
|
49504
|
+
capScope: "system",
|
|
49505
|
+
addonId: null,
|
|
49506
|
+
access: "view"
|
|
49507
|
+
},
|
|
49508
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
49509
|
+
capName: "pipeline-orchestrator",
|
|
49510
|
+
capScope: "system",
|
|
49511
|
+
addonId: null,
|
|
49512
|
+
access: "view"
|
|
49513
|
+
},
|
|
46280
49514
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46281
49515
|
capName: "pipeline-orchestrator",
|
|
46282
49516
|
capScope: "system",
|
|
@@ -46319,6 +49553,12 @@ Object.freeze({
|
|
|
46319
49553
|
addonId: null,
|
|
46320
49554
|
access: "view"
|
|
46321
49555
|
},
|
|
49556
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49557
|
+
capName: "pipeline-orchestrator",
|
|
49558
|
+
capScope: "system",
|
|
49559
|
+
addonId: null,
|
|
49560
|
+
access: "view"
|
|
49561
|
+
},
|
|
46322
49562
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46323
49563
|
capName: "pipeline-orchestrator",
|
|
46324
49564
|
capScope: "system",
|
|
@@ -46463,6 +49703,12 @@ Object.freeze({
|
|
|
46463
49703
|
addonId: null,
|
|
46464
49704
|
access: "create"
|
|
46465
49705
|
},
|
|
49706
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49707
|
+
capName: "pipeline-orchestrator",
|
|
49708
|
+
capScope: "system",
|
|
49709
|
+
addonId: null,
|
|
49710
|
+
access: "create"
|
|
49711
|
+
},
|
|
46466
49712
|
"pipelineOrchestrator.suggestShares": {
|
|
46467
49713
|
capName: "pipeline-orchestrator",
|
|
46468
49714
|
capScope: "system",
|
|
@@ -46481,6 +49727,12 @@ Object.freeze({
|
|
|
46481
49727
|
addonId: null,
|
|
46482
49728
|
access: "create"
|
|
46483
49729
|
},
|
|
49730
|
+
"pipelineRunner.abortNodeBench": {
|
|
49731
|
+
capName: "pipeline-runner",
|
|
49732
|
+
capScope: "system",
|
|
49733
|
+
addonId: null,
|
|
49734
|
+
access: "create"
|
|
49735
|
+
},
|
|
46484
49736
|
"pipelineRunner.attachCamera": {
|
|
46485
49737
|
capName: "pipeline-runner",
|
|
46486
49738
|
capScope: "system",
|
|
@@ -46529,6 +49781,12 @@ Object.freeze({
|
|
|
46529
49781
|
addonId: null,
|
|
46530
49782
|
access: "view"
|
|
46531
49783
|
},
|
|
49784
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49785
|
+
capName: "pipeline-runner",
|
|
49786
|
+
capScope: "system",
|
|
49787
|
+
addonId: null,
|
|
49788
|
+
access: "view"
|
|
49789
|
+
},
|
|
46532
49790
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46533
49791
|
capName: "pipeline-runner",
|
|
46534
49792
|
capScope: "system",
|
|
@@ -46571,6 +49829,12 @@ Object.freeze({
|
|
|
46571
49829
|
addonId: null,
|
|
46572
49830
|
access: "create"
|
|
46573
49831
|
},
|
|
49832
|
+
"pipelineRunner.startNodeBench": {
|
|
49833
|
+
capName: "pipeline-runner",
|
|
49834
|
+
capScope: "system",
|
|
49835
|
+
addonId: null,
|
|
49836
|
+
access: "create"
|
|
49837
|
+
},
|
|
46574
49838
|
"plateGallery.assignPlate": {
|
|
46575
49839
|
capName: "plate-gallery",
|
|
46576
49840
|
capScope: "system",
|
|
@@ -48233,6 +51497,174 @@ Object.freeze({
|
|
|
48233
51497
|
addonId: null,
|
|
48234
51498
|
access: "view"
|
|
48235
51499
|
},
|
|
51500
|
+
"training.canaryResult": {
|
|
51501
|
+
capName: "training",
|
|
51502
|
+
capScope: "system",
|
|
51503
|
+
addonId: null,
|
|
51504
|
+
access: "create"
|
|
51505
|
+
},
|
|
51506
|
+
"training.cancelJob": {
|
|
51507
|
+
capName: "training",
|
|
51508
|
+
capScope: "system",
|
|
51509
|
+
addonId: null,
|
|
51510
|
+
access: "create"
|
|
51511
|
+
},
|
|
51512
|
+
"training.discardResult": {
|
|
51513
|
+
capName: "training",
|
|
51514
|
+
capScope: "system",
|
|
51515
|
+
addonId: null,
|
|
51516
|
+
access: "create"
|
|
51517
|
+
},
|
|
51518
|
+
"training.findDatasetVersionIdByName": {
|
|
51519
|
+
capName: "training",
|
|
51520
|
+
capScope: "system",
|
|
51521
|
+
addonId: null,
|
|
51522
|
+
access: "view"
|
|
51523
|
+
},
|
|
51524
|
+
"training.getDatasetVersion": {
|
|
51525
|
+
capName: "training",
|
|
51526
|
+
capScope: "system",
|
|
51527
|
+
addonId: null,
|
|
51528
|
+
access: "view"
|
|
51529
|
+
},
|
|
51530
|
+
"training.getJob": {
|
|
51531
|
+
capName: "training",
|
|
51532
|
+
capScope: "system",
|
|
51533
|
+
addonId: null,
|
|
51534
|
+
access: "view"
|
|
51535
|
+
},
|
|
51536
|
+
"training.getJobResult": {
|
|
51537
|
+
capName: "training",
|
|
51538
|
+
capScope: "system",
|
|
51539
|
+
addonId: null,
|
|
51540
|
+
access: "view"
|
|
51541
|
+
},
|
|
51542
|
+
"training.listBaseModels": {
|
|
51543
|
+
capName: "training",
|
|
51544
|
+
capScope: "system",
|
|
51545
|
+
addonId: null,
|
|
51546
|
+
access: "view"
|
|
51547
|
+
},
|
|
51548
|
+
"training.listDatasetVersions": {
|
|
51549
|
+
capName: "training",
|
|
51550
|
+
capScope: "system",
|
|
51551
|
+
addonId: null,
|
|
51552
|
+
access: "view"
|
|
51553
|
+
},
|
|
51554
|
+
"training.listJobs": {
|
|
51555
|
+
capName: "training",
|
|
51556
|
+
capScope: "system",
|
|
51557
|
+
addonId: null,
|
|
51558
|
+
access: "view"
|
|
51559
|
+
},
|
|
51560
|
+
"training.planJob": {
|
|
51561
|
+
capName: "training",
|
|
51562
|
+
capScope: "system",
|
|
51563
|
+
addonId: null,
|
|
51564
|
+
access: "view"
|
|
51565
|
+
},
|
|
51566
|
+
"training.putDatasetVersion": {
|
|
51567
|
+
capName: "training",
|
|
51568
|
+
capScope: "system",
|
|
51569
|
+
addonId: null,
|
|
51570
|
+
access: "create"
|
|
51571
|
+
},
|
|
51572
|
+
"training.registerResult": {
|
|
51573
|
+
capName: "training",
|
|
51574
|
+
capScope: "system",
|
|
51575
|
+
addonId: null,
|
|
51576
|
+
access: "create"
|
|
51577
|
+
},
|
|
51578
|
+
"training.removeDatasetVersion": {
|
|
51579
|
+
capName: "training",
|
|
51580
|
+
capScope: "system",
|
|
51581
|
+
addonId: null,
|
|
51582
|
+
access: "delete"
|
|
51583
|
+
},
|
|
51584
|
+
"training.rollbackCanary": {
|
|
51585
|
+
capName: "training",
|
|
51586
|
+
capScope: "system",
|
|
51587
|
+
addonId: null,
|
|
51588
|
+
access: "create"
|
|
51589
|
+
},
|
|
51590
|
+
"training.startJob": {
|
|
51591
|
+
capName: "training",
|
|
51592
|
+
capScope: "system",
|
|
51593
|
+
addonId: null,
|
|
51594
|
+
access: "create"
|
|
51595
|
+
},
|
|
51596
|
+
"trainingProvider.cancelJob": {
|
|
51597
|
+
capName: "training-provider",
|
|
51598
|
+
capScope: "system",
|
|
51599
|
+
addonId: null,
|
|
51600
|
+
access: "create"
|
|
51601
|
+
},
|
|
51602
|
+
"trainingProvider.cleanupJob": {
|
|
51603
|
+
capName: "training-provider",
|
|
51604
|
+
capScope: "system",
|
|
51605
|
+
addonId: null,
|
|
51606
|
+
access: "create"
|
|
51607
|
+
},
|
|
51608
|
+
"trainingProvider.describe": {
|
|
51609
|
+
capName: "training-provider",
|
|
51610
|
+
capScope: "system",
|
|
51611
|
+
addonId: null,
|
|
51612
|
+
access: "view"
|
|
51613
|
+
},
|
|
51614
|
+
"trainingProvider.estimateJob": {
|
|
51615
|
+
capName: "training-provider",
|
|
51616
|
+
capScope: "system",
|
|
51617
|
+
addonId: null,
|
|
51618
|
+
access: "view"
|
|
51619
|
+
},
|
|
51620
|
+
"trainingProvider.getJob": {
|
|
51621
|
+
capName: "training-provider",
|
|
51622
|
+
capScope: "system",
|
|
51623
|
+
addonId: null,
|
|
51624
|
+
access: "view"
|
|
51625
|
+
},
|
|
51626
|
+
"trainingProvider.listJobEvents": {
|
|
51627
|
+
capName: "training-provider",
|
|
51628
|
+
capScope: "system",
|
|
51629
|
+
addonId: null,
|
|
51630
|
+
access: "view"
|
|
51631
|
+
},
|
|
51632
|
+
"trainingProvider.listJobs": {
|
|
51633
|
+
capName: "training-provider",
|
|
51634
|
+
capScope: "system",
|
|
51635
|
+
addonId: null,
|
|
51636
|
+
access: "view"
|
|
51637
|
+
},
|
|
51638
|
+
"trainingProvider.offerArtifact": {
|
|
51639
|
+
capName: "training-provider",
|
|
51640
|
+
capScope: "system",
|
|
51641
|
+
addonId: null,
|
|
51642
|
+
access: "create"
|
|
51643
|
+
},
|
|
51644
|
+
"trainingProvider.readResult": {
|
|
51645
|
+
capName: "training-provider",
|
|
51646
|
+
capScope: "system",
|
|
51647
|
+
addonId: null,
|
|
51648
|
+
access: "create"
|
|
51649
|
+
},
|
|
51650
|
+
"trainingProvider.submitJob": {
|
|
51651
|
+
capName: "training-provider",
|
|
51652
|
+
capScope: "system",
|
|
51653
|
+
addonId: null,
|
|
51654
|
+
access: "create"
|
|
51655
|
+
},
|
|
51656
|
+
"trainingProvider.uploadDataset": {
|
|
51657
|
+
capName: "training-provider",
|
|
51658
|
+
capScope: "system",
|
|
51659
|
+
addonId: null,
|
|
51660
|
+
access: "create"
|
|
51661
|
+
},
|
|
51662
|
+
"trainingProvider.validateCredentials": {
|
|
51663
|
+
capName: "training-provider",
|
|
51664
|
+
capScope: "system",
|
|
51665
|
+
addonId: null,
|
|
51666
|
+
access: "create"
|
|
51667
|
+
},
|
|
48236
51668
|
"turnProvider.getTurnServers": {
|
|
48237
51669
|
capName: "turn-provider",
|
|
48238
51670
|
capScope: "system",
|
|
@@ -48257,12 +51689,6 @@ Object.freeze({
|
|
|
48257
51689
|
addonId: null,
|
|
48258
51690
|
access: "create"
|
|
48259
51691
|
},
|
|
48260
|
-
"userManagement.createApiKey": {
|
|
48261
|
-
capName: "user-management",
|
|
48262
|
-
capScope: "system",
|
|
48263
|
-
addonId: null,
|
|
48264
|
-
access: "create"
|
|
48265
|
-
},
|
|
48266
51692
|
"userManagement.createScopedToken": {
|
|
48267
51693
|
capName: "user-management",
|
|
48268
51694
|
capScope: "system",
|
|
@@ -48299,12 +51725,6 @@ Object.freeze({
|
|
|
48299
51725
|
addonId: null,
|
|
48300
51726
|
access: "view"
|
|
48301
51727
|
},
|
|
48302
|
-
"userManagement.linkExternalIdentity": {
|
|
48303
|
-
capName: "user-management",
|
|
48304
|
-
capScope: "system",
|
|
48305
|
-
addonId: null,
|
|
48306
|
-
access: "create"
|
|
48307
|
-
},
|
|
48308
51728
|
"userManagement.listApiKeys": {
|
|
48309
51729
|
capName: "user-management",
|
|
48310
51730
|
capScope: "system",
|
|
@@ -48407,12 +51827,6 @@ Object.freeze({
|
|
|
48407
51827
|
addonId: null,
|
|
48408
51828
|
access: "create"
|
|
48409
51829
|
},
|
|
48410
|
-
"userManagement.validateApiKey": {
|
|
48411
|
-
capName: "user-management",
|
|
48412
|
-
capScope: "system",
|
|
48413
|
-
addonId: null,
|
|
48414
|
-
access: "view"
|
|
48415
|
-
},
|
|
48416
51830
|
"userManagement.validateCredentials": {
|
|
48417
51831
|
capName: "user-management",
|
|
48418
51832
|
capScope: "system",
|
|
@@ -51566,6 +54980,11 @@ Object.freeze({
|
|
|
51566
54980
|
form: "single",
|
|
51567
54981
|
optional: false
|
|
51568
54982
|
}],
|
|
54983
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
54984
|
+
name: "deviceId",
|
|
54985
|
+
form: "single",
|
|
54986
|
+
optional: false
|
|
54987
|
+
}],
|
|
51569
54988
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51570
54989
|
name: "deviceId",
|
|
51571
54990
|
form: "single",
|
|
@@ -51756,6 +55175,11 @@ Object.freeze({
|
|
|
51756
55175
|
form: "single",
|
|
51757
55176
|
optional: false
|
|
51758
55177
|
}],
|
|
55178
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55179
|
+
name: "deviceId",
|
|
55180
|
+
form: "single",
|
|
55181
|
+
optional: false
|
|
55182
|
+
}],
|
|
51759
55183
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51760
55184
|
name: "deviceId",
|
|
51761
55185
|
form: "single",
|
|
@@ -52582,6 +56006,11 @@ Object.freeze({
|
|
|
52582
56006
|
form: "single",
|
|
52583
56007
|
optional: false
|
|
52584
56008
|
}],
|
|
56009
|
+
"training.canaryResult": [{
|
|
56010
|
+
name: "deviceIds",
|
|
56011
|
+
form: "array",
|
|
56012
|
+
optional: false
|
|
56013
|
+
}],
|
|
52585
56014
|
"update.getStatus": [{
|
|
52586
56015
|
name: "deviceId",
|
|
52587
56016
|
form: "single",
|
|
@@ -53884,7 +57313,12 @@ var CREDENTIAL_PARAM_PATTERNS = [
|
|
|
53884
57313
|
/^bearer$/i,
|
|
53885
57314
|
/^api[_-]?key$/i,
|
|
53886
57315
|
/^access[_-]?token$/i,
|
|
53887
|
-
/^refresh[_-]?token$/i
|
|
57316
|
+
/^refresh[_-]?token$/i,
|
|
57317
|
+
/^bridge$/i,
|
|
57318
|
+
/^code$/i,
|
|
57319
|
+
/^state$/i,
|
|
57320
|
+
/^challenge$/i,
|
|
57321
|
+
/^link$/i
|
|
53888
57322
|
];
|
|
53889
57323
|
function isCredentialParam(name) {
|
|
53890
57324
|
return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
|
|
@@ -53906,6 +57340,10 @@ function isCredentialParam(name) {
|
|
|
53906
57340
|
* are NOT masked (those are entity references, not credentials).
|
|
53907
57341
|
*/
|
|
53908
57342
|
function maskUrlCredentials(rawUrl) {
|
|
57343
|
+
if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
|
|
57344
|
+
const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
|
|
57345
|
+
return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
|
|
57346
|
+
}
|
|
53909
57347
|
try {
|
|
53910
57348
|
const u = new URL(rawUrl);
|
|
53911
57349
|
let touched = false;
|