@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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import net from "node:net";
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -78,6 +78,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
78
78
|
*/
|
|
79
79
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
80
80
|
/**
|
|
81
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
82
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
83
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
84
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
85
|
+
*/
|
|
86
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
87
|
+
/**
|
|
81
88
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
82
89
|
* transitions from `failed` back to `healthy` (typically via the
|
|
83
90
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5370,7 +5377,7 @@ var ZodIssueCode = {
|
|
|
5370
5377
|
var ZodFirstPartyTypeKind;
|
|
5371
5378
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5372
5379
|
//#endregion
|
|
5373
|
-
//#region ../types/dist/sleep-
|
|
5380
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5374
5381
|
/**
|
|
5375
5382
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5376
5383
|
* window to float samples (D455).
|
|
@@ -5449,6 +5456,97 @@ function buildAlawTable() {
|
|
|
5449
5456
|
}
|
|
5450
5457
|
buildUlawTable();
|
|
5451
5458
|
buildAlawTable();
|
|
5459
|
+
/** Is this field's stored value a credential? */
|
|
5460
|
+
function isSecretConfigField(field) {
|
|
5461
|
+
if (field.type === "password") return true;
|
|
5462
|
+
return "secret" in field && field.secret === true;
|
|
5463
|
+
}
|
|
5464
|
+
/**
|
|
5465
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5466
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5467
|
+
*/
|
|
5468
|
+
function isKeychainStoredField(field) {
|
|
5469
|
+
if (!isSecretConfigField(field)) return false;
|
|
5470
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5471
|
+
return !("storage" in field && field.storage === "inline");
|
|
5472
|
+
}
|
|
5473
|
+
/**
|
|
5474
|
+
* What a settings blob holds where a secret used to be.
|
|
5475
|
+
*
|
|
5476
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5477
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5478
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5479
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5480
|
+
*
|
|
5481
|
+
* The same shapes travel to and from the admin UI:
|
|
5482
|
+
*
|
|
5483
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5484
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5485
|
+
* value is set, never the value.
|
|
5486
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5487
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5488
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5489
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5490
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5491
|
+
*
|
|
5492
|
+
* Pure and browser-safe.
|
|
5493
|
+
*/
|
|
5494
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5495
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5496
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5497
|
+
function isRecord$2(value) {
|
|
5498
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5499
|
+
}
|
|
5500
|
+
function makeSecretMarker(ref) {
|
|
5501
|
+
return {
|
|
5502
|
+
$secret: ref,
|
|
5503
|
+
v: 1
|
|
5504
|
+
};
|
|
5505
|
+
}
|
|
5506
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5507
|
+
function isSecretMarker(value) {
|
|
5508
|
+
if (!isRecord$2(value)) return false;
|
|
5509
|
+
const ref = value["$secret"];
|
|
5510
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5511
|
+
}
|
|
5512
|
+
function isSecretClear(value) {
|
|
5513
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5514
|
+
}
|
|
5515
|
+
/**
|
|
5516
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5517
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5518
|
+
* survives this function.
|
|
5519
|
+
*/
|
|
5520
|
+
function toSecretFieldView(stored) {
|
|
5521
|
+
if (isSecretMarker(stored)) return {
|
|
5522
|
+
$secret: stored.$secret,
|
|
5523
|
+
v: 1,
|
|
5524
|
+
set: true
|
|
5525
|
+
};
|
|
5526
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5527
|
+
$secret: null,
|
|
5528
|
+
v: 1,
|
|
5529
|
+
set: true,
|
|
5530
|
+
inline: true
|
|
5531
|
+
};
|
|
5532
|
+
return null;
|
|
5533
|
+
}
|
|
5534
|
+
/**
|
|
5535
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5536
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5537
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5538
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5539
|
+
*/
|
|
5540
|
+
function classifySecretWrite(incoming) {
|
|
5541
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5542
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5543
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5544
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5545
|
+
return {
|
|
5546
|
+
kind: "set",
|
|
5547
|
+
value: incoming
|
|
5548
|
+
};
|
|
5549
|
+
}
|
|
5452
5550
|
Object.fromEntries([
|
|
5453
5551
|
{
|
|
5454
5552
|
id: "overview",
|
|
@@ -5620,33 +5718,19 @@ Object.fromEntries([
|
|
|
5620
5718
|
function isValuelessField(field) {
|
|
5621
5719
|
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
|
|
5622
5720
|
}
|
|
5623
|
-
|
|
5624
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5625
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5626
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5627
|
-
*
|
|
5628
|
-
* For each leaf field:
|
|
5629
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5630
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5631
|
-
*
|
|
5632
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5633
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5634
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5635
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5636
|
-
*/
|
|
5637
|
-
function hydrateSchema(schema, values) {
|
|
5721
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5638
5722
|
return {
|
|
5639
5723
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5640
5724
|
sections: schema.sections.map((section) => ({
|
|
5641
5725
|
...section,
|
|
5642
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5726
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5643
5727
|
}))
|
|
5644
5728
|
};
|
|
5645
5729
|
}
|
|
5646
|
-
function hydrateField(field, values) {
|
|
5730
|
+
function hydrateField(field, values, options) {
|
|
5647
5731
|
if (isValuelessField(field)) return field;
|
|
5648
5732
|
if (field.type === "group") {
|
|
5649
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5733
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5650
5734
|
return {
|
|
5651
5735
|
...field,
|
|
5652
5736
|
fields: hydratedChildren
|
|
@@ -5655,7 +5739,7 @@ function hydrateField(field, values) {
|
|
|
5655
5739
|
if (field.type === "sub-tabs") {
|
|
5656
5740
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5657
5741
|
...tab,
|
|
5658
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5742
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5659
5743
|
}));
|
|
5660
5744
|
return {
|
|
5661
5745
|
...field,
|
|
@@ -5665,6 +5749,33 @@ function hydrateField(field, values) {
|
|
|
5665
5749
|
const key = field.key;
|
|
5666
5750
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5667
5751
|
const defaultValue = field.default;
|
|
5752
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5753
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5754
|
+
...field,
|
|
5755
|
+
value: toSecretFieldView(storedValue)
|
|
5756
|
+
};
|
|
5757
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5758
|
+
...field,
|
|
5759
|
+
value: null
|
|
5760
|
+
};
|
|
5761
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5762
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5763
|
+
if (secretItemKeys.length > 0) {
|
|
5764
|
+
const rows = storedValue.map((row) => {
|
|
5765
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5766
|
+
const out = { ...row };
|
|
5767
|
+
for (const k of secretItemKeys) {
|
|
5768
|
+
const v = Reflect.get(row, k);
|
|
5769
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5770
|
+
}
|
|
5771
|
+
return out;
|
|
5772
|
+
});
|
|
5773
|
+
return {
|
|
5774
|
+
...field,
|
|
5775
|
+
value: rows
|
|
5776
|
+
};
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5668
5779
|
if (field.multiple) {
|
|
5669
5780
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5670
5781
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5907,6 +6018,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5907
6018
|
}
|
|
5908
6019
|
return out;
|
|
5909
6020
|
}
|
|
6021
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6022
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6023
|
+
function globalSecretScope() {
|
|
6024
|
+
return GLOBAL_SCOPE;
|
|
6025
|
+
}
|
|
6026
|
+
function encodeSegment(value) {
|
|
6027
|
+
return encodeURIComponent(value);
|
|
6028
|
+
}
|
|
6029
|
+
function decodeSegment(value) {
|
|
6030
|
+
try {
|
|
6031
|
+
return decodeURIComponent(value);
|
|
6032
|
+
} catch {
|
|
6033
|
+
return null;
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
/**
|
|
6037
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6038
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6039
|
+
* `providers[authentik].clientSecret`.
|
|
6040
|
+
*/
|
|
6041
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6042
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6043
|
+
}
|
|
6044
|
+
function parseScope(segments) {
|
|
6045
|
+
switch (segments[0]) {
|
|
6046
|
+
case "global": return {
|
|
6047
|
+
scope: GLOBAL_SCOPE,
|
|
6048
|
+
used: 1
|
|
6049
|
+
};
|
|
6050
|
+
case "node": {
|
|
6051
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6052
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6053
|
+
scope: {
|
|
6054
|
+
kind: "node",
|
|
6055
|
+
nodeId
|
|
6056
|
+
},
|
|
6057
|
+
used: 2
|
|
6058
|
+
};
|
|
6059
|
+
}
|
|
6060
|
+
case "device": {
|
|
6061
|
+
const raw = segments[1];
|
|
6062
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6063
|
+
return {
|
|
6064
|
+
scope: {
|
|
6065
|
+
kind: "device",
|
|
6066
|
+
deviceId: Number(raw)
|
|
6067
|
+
},
|
|
6068
|
+
used: 2
|
|
6069
|
+
};
|
|
6070
|
+
}
|
|
6071
|
+
case "integration": {
|
|
6072
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6073
|
+
return id === null || id.length === 0 ? null : {
|
|
6074
|
+
scope: {
|
|
6075
|
+
kind: "integration",
|
|
6076
|
+
integrationId: id
|
|
6077
|
+
},
|
|
6078
|
+
used: 2
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
case "row": {
|
|
6082
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6083
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6084
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6085
|
+
return {
|
|
6086
|
+
scope: {
|
|
6087
|
+
kind: "row",
|
|
6088
|
+
collection,
|
|
6089
|
+
rowId
|
|
6090
|
+
},
|
|
6091
|
+
used: 3
|
|
6092
|
+
};
|
|
6093
|
+
}
|
|
6094
|
+
default: return null;
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6098
|
+
function parseSecretRef(ref) {
|
|
6099
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6100
|
+
const segments = ref.slice(9).split("/");
|
|
6101
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6102
|
+
if (owner === null || owner.length === 0) return null;
|
|
6103
|
+
const parsed = parseScope(segments.slice(1));
|
|
6104
|
+
if (parsed === null) return null;
|
|
6105
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6106
|
+
if (fieldPath.length === 0) return null;
|
|
6107
|
+
return {
|
|
6108
|
+
owner,
|
|
6109
|
+
scope: parsed.scope,
|
|
6110
|
+
fieldPath
|
|
6111
|
+
};
|
|
6112
|
+
}
|
|
6113
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6114
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6115
|
+
fieldPath;
|
|
6116
|
+
constructor(fieldPath, cause) {
|
|
6117
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6118
|
+
this.fieldPath = fieldPath;
|
|
6119
|
+
this.name = "KeychainWriteRefusedError";
|
|
6120
|
+
}
|
|
6121
|
+
};
|
|
6122
|
+
var KEEP = { kind: "keep" };
|
|
6123
|
+
function isRecord$1(value) {
|
|
6124
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6125
|
+
}
|
|
6126
|
+
function defaultMintId() {
|
|
6127
|
+
return globalThis.crypto.randomUUID();
|
|
6128
|
+
}
|
|
6129
|
+
/** Every marker ref anywhere under `value`. */
|
|
6130
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6131
|
+
if (isSecretMarker(value)) {
|
|
6132
|
+
out.push(value.$secret);
|
|
6133
|
+
return out;
|
|
6134
|
+
}
|
|
6135
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6136
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6137
|
+
return out;
|
|
6138
|
+
}
|
|
6139
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6140
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6141
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6142
|
+
}
|
|
6143
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6144
|
+
const intent = classifySecretWrite(incoming);
|
|
6145
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6146
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6147
|
+
if (intent.kind === "keep") return KEEP;
|
|
6148
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6149
|
+
if (intent.kind === "clear") {
|
|
6150
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6151
|
+
return {
|
|
6152
|
+
kind: "value",
|
|
6153
|
+
value: null
|
|
6154
|
+
};
|
|
6155
|
+
}
|
|
6156
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6157
|
+
kind: "value",
|
|
6158
|
+
value: stored
|
|
6159
|
+
};
|
|
6160
|
+
try {
|
|
6161
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6162
|
+
} catch (err) {
|
|
6163
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6164
|
+
}
|
|
6165
|
+
return {
|
|
6166
|
+
kind: "value",
|
|
6167
|
+
value: makeSecretMarker(ref)
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6171
|
+
function applyMember(out, key, result, storedParent) {
|
|
6172
|
+
if (result.kind === "value") {
|
|
6173
|
+
out[key] = result.value;
|
|
6174
|
+
return;
|
|
6175
|
+
}
|
|
6176
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6177
|
+
else delete out[key];
|
|
6178
|
+
}
|
|
6179
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6180
|
+
const out = { ...incoming };
|
|
6181
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6182
|
+
return out;
|
|
6183
|
+
}
|
|
6184
|
+
function rowId(row, idKey) {
|
|
6185
|
+
const raw = row[idKey];
|
|
6186
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6187
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6188
|
+
return null;
|
|
6189
|
+
}
|
|
6190
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6191
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6192
|
+
if (!Array.isArray(incoming)) {
|
|
6193
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6194
|
+
return {
|
|
6195
|
+
kind: "value",
|
|
6196
|
+
value: incoming
|
|
6197
|
+
};
|
|
6198
|
+
}
|
|
6199
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6200
|
+
for (const row of storedRows) {
|
|
6201
|
+
const id = rowId(row, node.idKey);
|
|
6202
|
+
if (id !== null) storedById.set(id, row);
|
|
6203
|
+
}
|
|
6204
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6205
|
+
const rows = [];
|
|
6206
|
+
for (const row of incoming) {
|
|
6207
|
+
if (!isRecord$1(row)) {
|
|
6208
|
+
rows.push(row);
|
|
6209
|
+
continue;
|
|
6210
|
+
}
|
|
6211
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6212
|
+
kept.add(id);
|
|
6213
|
+
const withId = {
|
|
6214
|
+
...row,
|
|
6215
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6216
|
+
};
|
|
6217
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6218
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6219
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6220
|
+
}
|
|
6221
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6222
|
+
return {
|
|
6223
|
+
kind: "value",
|
|
6224
|
+
value: rows
|
|
6225
|
+
};
|
|
6226
|
+
}
|
|
6227
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6228
|
+
switch (node.kind) {
|
|
6229
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6230
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6231
|
+
case "object": {
|
|
6232
|
+
if (!isRecord$1(incoming)) {
|
|
6233
|
+
if (incoming === void 0) return KEEP;
|
|
6234
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6235
|
+
return {
|
|
6236
|
+
kind: "value",
|
|
6237
|
+
value: incoming
|
|
6238
|
+
};
|
|
6239
|
+
}
|
|
6240
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6241
|
+
return {
|
|
6242
|
+
kind: "value",
|
|
6243
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6249
|
+
function splitNodeKey(key) {
|
|
6250
|
+
const at = key.indexOf("@");
|
|
6251
|
+
return at <= 0 ? {
|
|
6252
|
+
base: key,
|
|
6253
|
+
nodeId: null
|
|
6254
|
+
} : {
|
|
6255
|
+
base: key.slice(0, at),
|
|
6256
|
+
nodeId: key.slice(at + 1)
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6260
|
+
async function transformSecretWrite(input) {
|
|
6261
|
+
const deletes = [];
|
|
6262
|
+
const base = {
|
|
6263
|
+
secrets: input.secrets,
|
|
6264
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6265
|
+
deletes,
|
|
6266
|
+
operatorWrite: input.operatorWrite === true
|
|
6267
|
+
};
|
|
6268
|
+
const out = {};
|
|
6269
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6270
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6271
|
+
const node = input.tree.get(baseKey);
|
|
6272
|
+
if (node === void 0) {
|
|
6273
|
+
out[key] = incoming;
|
|
6274
|
+
continue;
|
|
6275
|
+
}
|
|
6276
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6277
|
+
kind: "node",
|
|
6278
|
+
nodeId
|
|
6279
|
+
} : input.scope ?? globalSecretScope();
|
|
6280
|
+
const result = await writeNode({
|
|
6281
|
+
...base,
|
|
6282
|
+
scope
|
|
6283
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6284
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6285
|
+
}
|
|
6286
|
+
return {
|
|
6287
|
+
patch: out,
|
|
6288
|
+
afterWrite: async () => {
|
|
6289
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6290
|
+
try {
|
|
6291
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6292
|
+
return { orphaned: [] };
|
|
6293
|
+
} catch {
|
|
6294
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
};
|
|
6298
|
+
}
|
|
6299
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6300
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6301
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6302
|
+
}
|
|
6303
|
+
/**
|
|
6304
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6305
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6306
|
+
*/
|
|
6307
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6308
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6309
|
+
const owner = options.ownedBy;
|
|
6310
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6311
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6312
|
+
if (refs.length === 0) return {
|
|
6313
|
+
value,
|
|
6314
|
+
unresolved: []
|
|
6315
|
+
};
|
|
6316
|
+
const answers = await secrets.resolve(refs);
|
|
6317
|
+
const unresolved = [];
|
|
6318
|
+
for (const ref of new Set(refs)) {
|
|
6319
|
+
const answer = answers[ref];
|
|
6320
|
+
if (answer === void 0) unresolved.push({
|
|
6321
|
+
ref,
|
|
6322
|
+
reason: "not-initialized"
|
|
6323
|
+
});
|
|
6324
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6325
|
+
ref,
|
|
6326
|
+
reason: answer.reason
|
|
6327
|
+
});
|
|
6328
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6329
|
+
ref,
|
|
6330
|
+
reason: answer.kind
|
|
6331
|
+
});
|
|
6332
|
+
}
|
|
6333
|
+
const substitute = (v) => {
|
|
6334
|
+
if (isSecretMarker(v)) {
|
|
6335
|
+
if (!inScope(v.$secret)) return {
|
|
6336
|
+
keep: true,
|
|
6337
|
+
value: v
|
|
6338
|
+
};
|
|
6339
|
+
const answer = answers[v.$secret];
|
|
6340
|
+
if (answer?.kind === "value") return {
|
|
6341
|
+
keep: true,
|
|
6342
|
+
value: answer.value
|
|
6343
|
+
};
|
|
6344
|
+
return keepMarker ? {
|
|
6345
|
+
keep: true,
|
|
6346
|
+
value: v
|
|
6347
|
+
} : {
|
|
6348
|
+
keep: false,
|
|
6349
|
+
value: void 0
|
|
6350
|
+
};
|
|
6351
|
+
}
|
|
6352
|
+
if (Array.isArray(v)) {
|
|
6353
|
+
const items = [];
|
|
6354
|
+
for (const item of v) {
|
|
6355
|
+
const s = substitute(item);
|
|
6356
|
+
if (s.keep) items.push(s.value);
|
|
6357
|
+
}
|
|
6358
|
+
return {
|
|
6359
|
+
keep: true,
|
|
6360
|
+
value: items
|
|
6361
|
+
};
|
|
6362
|
+
}
|
|
6363
|
+
if (isRecord$1(v)) {
|
|
6364
|
+
const out = {};
|
|
6365
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6366
|
+
const s = substitute(child);
|
|
6367
|
+
if (s.keep) out[k] = s.value;
|
|
6368
|
+
}
|
|
6369
|
+
return {
|
|
6370
|
+
keep: true,
|
|
6371
|
+
value: out
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
return {
|
|
6375
|
+
keep: true,
|
|
6376
|
+
value: v
|
|
6377
|
+
};
|
|
6378
|
+
};
|
|
6379
|
+
return {
|
|
6380
|
+
value: substitute(value).value,
|
|
6381
|
+
unresolved
|
|
6382
|
+
};
|
|
6383
|
+
}
|
|
6384
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6385
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6386
|
+
ref;
|
|
6387
|
+
reason;
|
|
6388
|
+
constructor(ref, reason) {
|
|
6389
|
+
super(`secret ${ref} was not replaced: its stored value cannot be read right now (${reason}), and an addon may not overwrite a secret it cannot see. Nothing was written.`);
|
|
6390
|
+
this.ref = ref;
|
|
6391
|
+
this.reason = reason;
|
|
6392
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6393
|
+
}
|
|
6394
|
+
};
|
|
6395
|
+
function isRecord(value) {
|
|
6396
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6397
|
+
}
|
|
6398
|
+
function resolvedValue(pass, marker) {
|
|
6399
|
+
const answer = pass.answers[marker.$secret];
|
|
6400
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6401
|
+
}
|
|
6402
|
+
async function atMarker(pass, incoming, stored) {
|
|
6403
|
+
if (incoming === null) return stored;
|
|
6404
|
+
if (typeof incoming !== "string") return incoming;
|
|
6405
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6406
|
+
const intent = classifySecretWrite(incoming);
|
|
6407
|
+
if (intent.kind !== "set") return stored;
|
|
6408
|
+
const ref = stored.$secret;
|
|
6409
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6410
|
+
const answer = pass.answers[ref];
|
|
6411
|
+
if ((answer === void 0 || answer.kind === "unavailable" || answer.kind === "forbidden") && !pass.operatorWrite) throw new SecretOverwriteRefusedError(ref, answer === void 0 ? "not-initialized" : answer.kind === "unavailable" ? answer.reason : answer.kind);
|
|
6412
|
+
try {
|
|
6413
|
+
await pass.secrets.put(ref, intent.value);
|
|
6414
|
+
} catch (err) {
|
|
6415
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6416
|
+
}
|
|
6417
|
+
pass.changedRefs.push(ref);
|
|
6418
|
+
return stored;
|
|
6419
|
+
}
|
|
6420
|
+
function inArray(pass, incoming, stored) {
|
|
6421
|
+
return incoming.map((item, index) => {
|
|
6422
|
+
const twin = stored[index];
|
|
6423
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6424
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6425
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6426
|
+
return item;
|
|
6427
|
+
});
|
|
6428
|
+
}
|
|
6429
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6430
|
+
const out = { ...incoming };
|
|
6431
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6432
|
+
const twin = stored[key];
|
|
6433
|
+
if (isSecretMarker(twin)) {
|
|
6434
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6435
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6436
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6437
|
+
}
|
|
6438
|
+
return out;
|
|
6439
|
+
}
|
|
6440
|
+
async function walk(pass, incoming, stored) {
|
|
6441
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6442
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6443
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6444
|
+
const out = { ...incoming };
|
|
6445
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6446
|
+
return out;
|
|
6447
|
+
}
|
|
6448
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6449
|
+
async function restoreUnchangedSecrets(input) {
|
|
6450
|
+
const refs = [];
|
|
6451
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6452
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6453
|
+
if (owned.length === 0) return {
|
|
6454
|
+
patch: input.patch,
|
|
6455
|
+
changedRefs: []
|
|
6456
|
+
};
|
|
6457
|
+
const pass = {
|
|
6458
|
+
secrets: input.secrets,
|
|
6459
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6460
|
+
operatorWrite: input.operatorWrite,
|
|
6461
|
+
changedRefs: []
|
|
6462
|
+
};
|
|
6463
|
+
const out = {};
|
|
6464
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6465
|
+
return {
|
|
6466
|
+
patch: out,
|
|
6467
|
+
changedRefs: pass.changedRefs
|
|
6468
|
+
};
|
|
6469
|
+
}
|
|
6470
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6471
|
+
function isJsonEqual(a, b) {
|
|
6472
|
+
if (Object.is(a, b)) return true;
|
|
6473
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6474
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6475
|
+
const keys = Object.keys(a);
|
|
6476
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6477
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6478
|
+
}
|
|
6479
|
+
return false;
|
|
6480
|
+
}
|
|
6481
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6482
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6483
|
+
const out = {};
|
|
6484
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6485
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6486
|
+
out[key] = value;
|
|
6487
|
+
}
|
|
6488
|
+
return out;
|
|
6489
|
+
}
|
|
6490
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6491
|
+
function markerKeysOf(blob, owner) {
|
|
6492
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6493
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6494
|
+
return keys;
|
|
6495
|
+
}
|
|
6496
|
+
function nodeFromStored(value, owner) {
|
|
6497
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6498
|
+
if (!isRecord(value)) return null;
|
|
6499
|
+
const children = /* @__PURE__ */ new Map();
|
|
6500
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6501
|
+
const node = nodeFromStored(child, owner);
|
|
6502
|
+
if (node !== null) children.set(key, node);
|
|
6503
|
+
}
|
|
6504
|
+
return children.size > 0 ? {
|
|
6505
|
+
kind: "object",
|
|
6506
|
+
children
|
|
6507
|
+
} : null;
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6511
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6512
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6513
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6514
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6515
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6516
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6517
|
+
* over.
|
|
6518
|
+
*/
|
|
6519
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6520
|
+
const added = /* @__PURE__ */ new Map();
|
|
6521
|
+
for (const key of keys) {
|
|
6522
|
+
const at = key.indexOf("@");
|
|
6523
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6524
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6525
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6526
|
+
if (node !== null) added.set(base, node);
|
|
6527
|
+
}
|
|
6528
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6529
|
+
}
|
|
6530
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6531
|
+
async function readStoredAddonBlob(raw) {
|
|
6532
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6533
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6534
|
+
const result = await threeWay.call(raw);
|
|
6535
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6536
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6537
|
+
}
|
|
6538
|
+
function touchesTree(tree, patch) {
|
|
6539
|
+
if (tree.size === 0) return false;
|
|
6540
|
+
for (const key of Object.keys(patch)) {
|
|
6541
|
+
const at = key.indexOf("@");
|
|
6542
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6543
|
+
}
|
|
6544
|
+
return false;
|
|
6545
|
+
}
|
|
6546
|
+
/**
|
|
6547
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6548
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6549
|
+
*/
|
|
6550
|
+
var MarkerKeyIndex = class {
|
|
6551
|
+
owner;
|
|
6552
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6553
|
+
constructor(owner) {
|
|
6554
|
+
this.owner = owner;
|
|
6555
|
+
}
|
|
6556
|
+
seen(store, blob) {
|
|
6557
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6558
|
+
}
|
|
6559
|
+
wrote(store, patch) {
|
|
6560
|
+
const keys = this.byStore.get(store);
|
|
6561
|
+
if (keys === void 0) return;
|
|
6562
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6563
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6564
|
+
else keys.delete(key);
|
|
6565
|
+
}
|
|
6566
|
+
mayHoldMarkers(store, patch) {
|
|
6567
|
+
const keys = this.byStore.get(store);
|
|
6568
|
+
if (keys === void 0) return true;
|
|
6569
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6570
|
+
}
|
|
6571
|
+
};
|
|
6572
|
+
function createHandle(raw, opts) {
|
|
6573
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6574
|
+
const serialize = (key, fn) => {
|
|
6575
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6576
|
+
const tail = next.catch(() => void 0);
|
|
6577
|
+
chains.set(key, tail);
|
|
6578
|
+
tail.then(() => {
|
|
6579
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6580
|
+
});
|
|
6581
|
+
return next;
|
|
6582
|
+
};
|
|
6583
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6584
|
+
const resolveRead = async (store, blob) => {
|
|
6585
|
+
index.seen(store, blob);
|
|
6586
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6587
|
+
unresolved: "keep-marker",
|
|
6588
|
+
ownedBy: opts.secrets.owner
|
|
6589
|
+
});
|
|
6590
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6591
|
+
return value;
|
|
6592
|
+
};
|
|
6593
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6594
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6595
|
+
await rawWrite(patch);
|
|
6596
|
+
index.wrote(store, patch);
|
|
6597
|
+
return { changed: true };
|
|
6598
|
+
}
|
|
6599
|
+
return serialize(store, async () => {
|
|
6600
|
+
const stored = await readStored();
|
|
6601
|
+
index.seen(store, stored);
|
|
6602
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6603
|
+
const restored = await restoreUnchangedSecrets({
|
|
6604
|
+
patch,
|
|
6605
|
+
stored,
|
|
6606
|
+
secrets: opts.secrets,
|
|
6607
|
+
operatorWrite
|
|
6608
|
+
});
|
|
6609
|
+
const result = await transformSecretWrite({
|
|
6610
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6611
|
+
secrets: opts.secrets,
|
|
6612
|
+
patch: restored.patch,
|
|
6613
|
+
stored,
|
|
6614
|
+
...scope !== void 0 ? { scope } : {},
|
|
6615
|
+
operatorWrite
|
|
6616
|
+
});
|
|
6617
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6618
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6619
|
+
if (wroteBlob) {
|
|
6620
|
+
await rawWrite(effective);
|
|
6621
|
+
index.wrote(store, effective);
|
|
6622
|
+
}
|
|
6623
|
+
const { orphaned } = await result.afterWrite();
|
|
6624
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6625
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6626
|
+
});
|
|
6627
|
+
};
|
|
6628
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6629
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6630
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6631
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6632
|
+
const overrides = {
|
|
6633
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6634
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6635
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6636
|
+
return result.kind === "value" ? {
|
|
6637
|
+
kind: "value",
|
|
6638
|
+
value: await resolveRead("addon", result.value)
|
|
6639
|
+
} : result;
|
|
6640
|
+
} } : {},
|
|
6641
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6642
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6643
|
+
if (result.kind !== "present") return result;
|
|
6644
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6645
|
+
unresolved: "keep-marker",
|
|
6646
|
+
ownedBy: opts.secrets.owner
|
|
6647
|
+
});
|
|
6648
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6649
|
+
return {
|
|
6650
|
+
kind: "present",
|
|
6651
|
+
value: value[key]
|
|
6652
|
+
};
|
|
6653
|
+
} } : {},
|
|
6654
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6655
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6656
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6657
|
+
const out = /* @__PURE__ */ new Map();
|
|
6658
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6659
|
+
return out;
|
|
6660
|
+
} } : {},
|
|
6661
|
+
writeAddonStore: async (patch) => {
|
|
6662
|
+
await writeAddon(patch);
|
|
6663
|
+
},
|
|
6664
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6665
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6666
|
+
kind: "device",
|
|
6667
|
+
deviceId
|
|
6668
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6669
|
+
}
|
|
6670
|
+
};
|
|
6671
|
+
return {
|
|
6672
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6673
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6674
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6675
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6676
|
+
} }),
|
|
6677
|
+
raw: {
|
|
6678
|
+
readAddonStore: async () => {
|
|
6679
|
+
const blob = await raw.readAddonStore();
|
|
6680
|
+
index.seen("addon", blob);
|
|
6681
|
+
return blob;
|
|
6682
|
+
},
|
|
6683
|
+
readDeviceStore: async (deviceId) => {
|
|
6684
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6685
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6686
|
+
return blob;
|
|
6687
|
+
}
|
|
6688
|
+
},
|
|
6689
|
+
writeAddonStore: writeAddon
|
|
6690
|
+
};
|
|
6691
|
+
}
|
|
6692
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6693
|
+
function createSecretAwareContext(context, opts) {
|
|
6694
|
+
const raw = context.settings;
|
|
6695
|
+
if (raw === void 0) return {
|
|
6696
|
+
context,
|
|
6697
|
+
handle: null
|
|
6698
|
+
};
|
|
6699
|
+
const handle = createHandle(raw, opts);
|
|
6700
|
+
return {
|
|
6701
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6702
|
+
if (prop === "settings") return handle.settings;
|
|
6703
|
+
return Reflect.get(target, prop, receiver);
|
|
6704
|
+
} }),
|
|
6705
|
+
handle
|
|
6706
|
+
};
|
|
6707
|
+
}
|
|
6708
|
+
var LEAF = { kind: "leaf" };
|
|
6709
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6710
|
+
function collectFields(fields, out) {
|
|
6711
|
+
for (const field of fields) {
|
|
6712
|
+
if (field.type === "group") {
|
|
6713
|
+
collectFields(field.fields, out);
|
|
6714
|
+
continue;
|
|
6715
|
+
}
|
|
6716
|
+
if (field.type === "sub-tabs") {
|
|
6717
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6718
|
+
continue;
|
|
6719
|
+
}
|
|
6720
|
+
if (field.type === "editable-array") {
|
|
6721
|
+
const item = /* @__PURE__ */ new Map();
|
|
6722
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6723
|
+
if (item.size > 0) out.set(field.key, {
|
|
6724
|
+
kind: "array",
|
|
6725
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6726
|
+
item
|
|
6727
|
+
});
|
|
6728
|
+
continue;
|
|
6729
|
+
}
|
|
6730
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6731
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6732
|
+
}
|
|
6733
|
+
}
|
|
6734
|
+
/** The secret tree a settings schema declares. */
|
|
6735
|
+
function secretTreeFromSchema(schema) {
|
|
6736
|
+
const out = /* @__PURE__ */ new Map();
|
|
6737
|
+
if (schema === null) return out;
|
|
6738
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6739
|
+
return out;
|
|
6740
|
+
}
|
|
6741
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6742
|
+
function parseSecretStatePath(path) {
|
|
6743
|
+
const segments = [];
|
|
6744
|
+
for (const raw of path.split(".")) {
|
|
6745
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6746
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6747
|
+
segments.push(m[2] !== void 0 ? {
|
|
6748
|
+
key: m[1],
|
|
6749
|
+
idKey: m[2]
|
|
6750
|
+
} : { key: m[1] });
|
|
6751
|
+
}
|
|
6752
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6753
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6754
|
+
return segments;
|
|
6755
|
+
}
|
|
6756
|
+
function insert(into, segments) {
|
|
6757
|
+
const [head, ...rest] = segments;
|
|
6758
|
+
if (head === void 0) return;
|
|
6759
|
+
if (rest.length === 0) {
|
|
6760
|
+
into.set(head.key, LEAF);
|
|
6761
|
+
return;
|
|
6762
|
+
}
|
|
6763
|
+
const existing = into.get(head.key);
|
|
6764
|
+
if (head.idKey !== void 0) {
|
|
6765
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6766
|
+
insert(item, rest);
|
|
6767
|
+
into.set(head.key, {
|
|
6768
|
+
kind: "array",
|
|
6769
|
+
idKey: head.idKey,
|
|
6770
|
+
item
|
|
6771
|
+
});
|
|
6772
|
+
return;
|
|
6773
|
+
}
|
|
6774
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6775
|
+
insert(children, rest);
|
|
6776
|
+
into.set(head.key, {
|
|
6777
|
+
kind: "object",
|
|
6778
|
+
children
|
|
6779
|
+
});
|
|
6780
|
+
}
|
|
6781
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6782
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6783
|
+
if (paths.length === 0) return tree;
|
|
6784
|
+
const out = new Map(tree);
|
|
6785
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6786
|
+
return out;
|
|
6787
|
+
}
|
|
6788
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6789
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6790
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6791
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6792
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5910
6793
|
/**
|
|
5911
6794
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5912
6795
|
*
|
|
@@ -5976,6 +6859,33 @@ var BaseAddon = class {
|
|
|
5976
6859
|
settingsStoreReady = false;
|
|
5977
6860
|
/** Default config values. Provided via constructor. */
|
|
5978
6861
|
defaults;
|
|
6862
|
+
/**
|
|
6863
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6864
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6865
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6866
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6867
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6868
|
+
*/
|
|
6869
|
+
secretStatePaths = [];
|
|
6870
|
+
_addonSecretTree = null;
|
|
6871
|
+
_deviceSecretTree = null;
|
|
6872
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6873
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6874
|
+
_unresolvedSecrets = [];
|
|
6875
|
+
_secretRetryTimer = null;
|
|
6876
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6877
|
+
_secretChangeTimer = null;
|
|
6878
|
+
_secretChangeUnsub = null;
|
|
6879
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6880
|
+
_operatorWriteDepth = 0;
|
|
6881
|
+
/**
|
|
6882
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6883
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6884
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6885
|
+
*/
|
|
6886
|
+
_secretSettings = null;
|
|
6887
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6888
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
5979
6889
|
constructor(defaults) {
|
|
5980
6890
|
this.defaults = defaults;
|
|
5981
6891
|
this._config = { ...defaults };
|
|
@@ -6011,8 +6921,26 @@ var BaseAddon = class {
|
|
|
6011
6921
|
return this._config;
|
|
6012
6922
|
}
|
|
6013
6923
|
async initialize(context) {
|
|
6014
|
-
|
|
6924
|
+
const secrets = context.secrets;
|
|
6925
|
+
if (secrets !== void 0) {
|
|
6926
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6927
|
+
secrets,
|
|
6928
|
+
addonTree: () => this.addonSecretTree(),
|
|
6929
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6930
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6931
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6932
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6933
|
+
});
|
|
6934
|
+
this._ctx = wrapped;
|
|
6935
|
+
this._secretSettings = handle;
|
|
6936
|
+
} else {
|
|
6937
|
+
this._ctx = context;
|
|
6938
|
+
this._secretSettings = null;
|
|
6939
|
+
}
|
|
6015
6940
|
await this.resolveConfig();
|
|
6941
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6942
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6943
|
+
});
|
|
6016
6944
|
const result = await this.onInitialize();
|
|
6017
6945
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6018
6946
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6045,6 +6973,12 @@ var BaseAddon = class {
|
|
|
6045
6973
|
*/
|
|
6046
6974
|
async onHubReachable() {}
|
|
6047
6975
|
async shutdown() {
|
|
6976
|
+
this._secretChangeUnsub?.();
|
|
6977
|
+
this._secretChangeUnsub = null;
|
|
6978
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6979
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6980
|
+
this._secretRetryTimer = null;
|
|
6981
|
+
this._secretChangeTimer = null;
|
|
6048
6982
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6049
6983
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6050
6984
|
await this.onShutdown();
|
|
@@ -6119,11 +7053,8 @@ var BaseAddon = class {
|
|
|
6119
7053
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6120
7054
|
const schema = this.globalSettingsSchema(cap);
|
|
6121
7055
|
if (!schema) return { sections: [] };
|
|
6122
|
-
const projected = await this.
|
|
6123
|
-
return hydrateSchema(schema, overlay ? {
|
|
6124
|
-
...projected,
|
|
6125
|
-
...overlay
|
|
6126
|
-
} : projected);
|
|
7056
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7057
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6127
7058
|
}
|
|
6128
7059
|
/**
|
|
6129
7060
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6168,11 +7099,11 @@ var BaseAddon = class {
|
|
|
6168
7099
|
});
|
|
6169
7100
|
}
|
|
6170
7101
|
if (sections.length === 0) return null;
|
|
6171
|
-
const projected = await this.
|
|
7102
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6172
7103
|
return hydrateSchema({
|
|
6173
7104
|
...schema,
|
|
6174
7105
|
sections
|
|
6175
|
-
}, projected);
|
|
7106
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6176
7107
|
}
|
|
6177
7108
|
/**
|
|
6178
7109
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6185,12 +7116,50 @@ var BaseAddon = class {
|
|
|
6185
7116
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6186
7117
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6187
7118
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7119
|
+
*
|
|
7120
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7121
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7122
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7123
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7124
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7125
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6188
7126
|
*/
|
|
6189
7127
|
async resolveGlobalStore(nodeId, cap) {
|
|
6190
7128
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7129
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7130
|
+
}
|
|
7131
|
+
projectForNode(store, nodeId, cap) {
|
|
6191
7132
|
const keys = this.perNodeKeys(cap);
|
|
6192
7133
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6193
|
-
return keys.size > 0 ? projectStore(
|
|
7134
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7135
|
+
}
|
|
7136
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7137
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7138
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7139
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7140
|
+
}
|
|
7141
|
+
/**
|
|
7142
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7143
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7144
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7145
|
+
* its value.
|
|
7146
|
+
*/
|
|
7147
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7148
|
+
const secrets = this._ctx?.secrets;
|
|
7149
|
+
const merged = {
|
|
7150
|
+
...stored,
|
|
7151
|
+
...overlay
|
|
7152
|
+
};
|
|
7153
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7154
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7155
|
+
unresolved: "keep-marker",
|
|
7156
|
+
ownedBy: secrets.owner
|
|
7157
|
+
});
|
|
7158
|
+
for (const key of Object.keys(overlay)) {
|
|
7159
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7160
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7161
|
+
}
|
|
7162
|
+
return merged;
|
|
6194
7163
|
}
|
|
6195
7164
|
/**
|
|
6196
7165
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6226,18 +7195,58 @@ var BaseAddon = class {
|
|
|
6226
7195
|
value: result.value[key]
|
|
6227
7196
|
};
|
|
6228
7197
|
}
|
|
7198
|
+
/**
|
|
7199
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7200
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7201
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7202
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7203
|
+
* writing back what it read is not (D787).
|
|
7204
|
+
*/
|
|
7205
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7206
|
+
this._operatorWriteDepth++;
|
|
7207
|
+
try {
|
|
7208
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7209
|
+
} finally {
|
|
7210
|
+
this._operatorWriteDepth--;
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
6229
7213
|
async updateGlobalSettings(patch, nodeId) {
|
|
7214
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7215
|
+
}
|
|
7216
|
+
/**
|
|
7217
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7218
|
+
*
|
|
7219
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7220
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7221
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7222
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7223
|
+
*/
|
|
7224
|
+
async clearSecrets(keys, nodeId) {
|
|
7225
|
+
const tree = this.addonSecretTree();
|
|
7226
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7227
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7228
|
+
const patch = {};
|
|
7229
|
+
for (const key of keys) {
|
|
7230
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7231
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7232
|
+
}
|
|
7233
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7234
|
+
}
|
|
7235
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6230
7236
|
const keys = this.perNodeKeys();
|
|
6231
7237
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6232
7238
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6233
|
-
const barePatch = patch;
|
|
6234
7239
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6235
|
-
|
|
7240
|
+
const handle = this._secretSettings;
|
|
7241
|
+
if (handle !== null) {
|
|
7242
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7243
|
+
if (!changed) return;
|
|
7244
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6236
7245
|
if (target !== localNode) return;
|
|
6237
7246
|
await this.resolveConfig();
|
|
6238
7247
|
await this.onConfigChanged();
|
|
6239
7248
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6240
|
-
this.maybeAutoRestart(
|
|
7249
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6241
7250
|
}
|
|
6242
7251
|
/**
|
|
6243
7252
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6262,7 +7271,7 @@ var BaseAddon = class {
|
|
|
6262
7271
|
* time to return its response before the addon is torn down and
|
|
6263
7272
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6264
7273
|
*/
|
|
6265
|
-
maybeAutoRestart(
|
|
7274
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6266
7275
|
if (!schema) return;
|
|
6267
7276
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6268
7277
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6270,13 +7279,13 @@ var BaseAddon = class {
|
|
|
6270
7279
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6271
7280
|
}
|
|
6272
7281
|
if (restartKeys.size === 0) return;
|
|
6273
|
-
if (!
|
|
7282
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6274
7283
|
const ctx = this._ctx;
|
|
6275
7284
|
if (!ctx) return;
|
|
6276
7285
|
const addonId = ctx.id;
|
|
6277
7286
|
setImmediate(() => {
|
|
6278
7287
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6279
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7288
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6280
7289
|
}).catch((err) => {
|
|
6281
7290
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6282
7291
|
});
|
|
@@ -6285,7 +7294,7 @@ var BaseAddon = class {
|
|
|
6285
7294
|
async getDeviceSettings(deviceId) {
|
|
6286
7295
|
const schema = this.deviceSettingsSchema();
|
|
6287
7296
|
if (!schema) return { sections: [] };
|
|
6288
|
-
return hydrateSchema(schema, await this.
|
|
7297
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6289
7298
|
}
|
|
6290
7299
|
async updateDeviceSettings(deviceId, patch) {
|
|
6291
7300
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6415,7 +7424,7 @@ var BaseAddon = class {
|
|
|
6415
7424
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6416
7425
|
*/
|
|
6417
7426
|
async resolveConfig() {
|
|
6418
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7427
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6419
7428
|
const perNode = this.perNodeKeys();
|
|
6420
7429
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6421
7430
|
const resolved = { ...this.defaults };
|
|
@@ -6440,7 +7449,7 @@ var BaseAddon = class {
|
|
|
6440
7449
|
key,
|
|
6441
7450
|
schema,
|
|
6442
7451
|
fallback,
|
|
6443
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7452
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6444
7453
|
write: async (patch) => {
|
|
6445
7454
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6446
7455
|
},
|
|
@@ -6457,7 +7466,7 @@ var BaseAddon = class {
|
|
|
6457
7466
|
key,
|
|
6458
7467
|
schema,
|
|
6459
7468
|
fallback,
|
|
6460
|
-
read: async () => await this.
|
|
7469
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6461
7470
|
write: async (patch) => {
|
|
6462
7471
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6463
7472
|
},
|
|
@@ -6469,6 +7478,87 @@ var BaseAddon = class {
|
|
|
6469
7478
|
} })
|
|
6470
7479
|
});
|
|
6471
7480
|
}
|
|
7481
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7482
|
+
addonSecretTree() {
|
|
7483
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7484
|
+
return this._addonSecretTree;
|
|
7485
|
+
}
|
|
7486
|
+
deviceSecretTree() {
|
|
7487
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7488
|
+
return this._deviceSecretTree;
|
|
7489
|
+
}
|
|
7490
|
+
/**
|
|
7491
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7492
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7493
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7494
|
+
* than start on an empty credential.
|
|
7495
|
+
*/
|
|
7496
|
+
get unresolvedSecrets() {
|
|
7497
|
+
return this._unresolvedSecrets;
|
|
7498
|
+
}
|
|
7499
|
+
/**
|
|
7500
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7501
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7502
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7503
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7504
|
+
* ever written back from here.
|
|
7505
|
+
*/
|
|
7506
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7507
|
+
const secrets = this._ctx?.secrets;
|
|
7508
|
+
if (secrets === void 0) return blob;
|
|
7509
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7510
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7511
|
+
if (refs.length === 0) {
|
|
7512
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7513
|
+
return blob;
|
|
7514
|
+
}
|
|
7515
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7516
|
+
if (trackForConfig) {
|
|
7517
|
+
this._unresolvedSecrets = unresolved;
|
|
7518
|
+
if (unresolved.length > 0) {
|
|
7519
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7520
|
+
ref: u.ref,
|
|
7521
|
+
reason: u.reason
|
|
7522
|
+
})) } });
|
|
7523
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7524
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7525
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7526
|
+
}
|
|
7527
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7528
|
+
}
|
|
7529
|
+
return value;
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7533
|
+
* keychain the context's own view is already raw.
|
|
7534
|
+
*/
|
|
7535
|
+
rawSettings() {
|
|
7536
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7537
|
+
}
|
|
7538
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7539
|
+
logUnresolvedRead(unresolved) {
|
|
7540
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7541
|
+
if (fresh.length === 0) return;
|
|
7542
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7543
|
+
this._ctx?.logger?.warn?.("settings read: a stored secret is unavailable — it reads as its marker, not as a value", { meta: { secrets: fresh.map((u) => ({
|
|
7544
|
+
ref: u.ref,
|
|
7545
|
+
reason: u.reason
|
|
7546
|
+
})) } });
|
|
7547
|
+
}
|
|
7548
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7549
|
+
scheduleSecretReresolve(delayMs) {
|
|
7550
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7551
|
+
if (this[timerOf] !== null) return;
|
|
7552
|
+
const timer = setTimeout(() => {
|
|
7553
|
+
this[timerOf] = null;
|
|
7554
|
+
if (this._ctx === null) return;
|
|
7555
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7556
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7557
|
+
});
|
|
7558
|
+
}, delayMs);
|
|
7559
|
+
timer.unref?.();
|
|
7560
|
+
this[timerOf] = timer;
|
|
7561
|
+
}
|
|
6472
7562
|
/**
|
|
6473
7563
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6474
7564
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6481,7 +7571,7 @@ var BaseAddon = class {
|
|
|
6481
7571
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6482
7572
|
*/
|
|
6483
7573
|
async readAddonStoreWithRetry() {
|
|
6484
|
-
const settings = this.
|
|
7574
|
+
const settings = this.rawSettings();
|
|
6485
7575
|
if (!settings) return {};
|
|
6486
7576
|
const delaysMs = [
|
|
6487
7577
|
150,
|
|
@@ -7044,6 +8134,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7044
8134
|
kind: "mutation",
|
|
7045
8135
|
auth: "admin"
|
|
7046
8136
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8137
|
+
function defOf(schema) {
|
|
8138
|
+
return schema._zod?.def ?? {};
|
|
8139
|
+
}
|
|
8140
|
+
function declaredHere(schema) {
|
|
8141
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8142
|
+
}
|
|
8143
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8144
|
+
var WRAPPERS = new Set([
|
|
8145
|
+
"optional",
|
|
8146
|
+
"nullable",
|
|
8147
|
+
"default",
|
|
8148
|
+
"prefault",
|
|
8149
|
+
"catch",
|
|
8150
|
+
"readonly",
|
|
8151
|
+
"nonoptional"
|
|
8152
|
+
]);
|
|
8153
|
+
/**
|
|
8154
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8155
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8156
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8157
|
+
* `.transform` on `in`).
|
|
8158
|
+
*/
|
|
8159
|
+
function layersOf(schema) {
|
|
8160
|
+
const out = [];
|
|
8161
|
+
const queue = [schema];
|
|
8162
|
+
while (queue.length > 0) {
|
|
8163
|
+
const s = queue.shift();
|
|
8164
|
+
if (!s || out.includes(s)) continue;
|
|
8165
|
+
out.push(s);
|
|
8166
|
+
const def = defOf(s);
|
|
8167
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8168
|
+
if (def.type === "pipe") {
|
|
8169
|
+
if (def.in) queue.push(def.in);
|
|
8170
|
+
if (def.out) queue.push(def.out);
|
|
8171
|
+
}
|
|
8172
|
+
}
|
|
8173
|
+
return out;
|
|
8174
|
+
}
|
|
8175
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8176
|
+
function isZodSecret(schema) {
|
|
8177
|
+
return layersOf(schema).some(declaredHere);
|
|
8178
|
+
}
|
|
8179
|
+
/**
|
|
8180
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8181
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8182
|
+
* object or array is reported as one path and not descended into — everything
|
|
8183
|
+
* under it is secret.
|
|
8184
|
+
*/
|
|
8185
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8186
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8187
|
+
const paths = [];
|
|
8188
|
+
for (const layer of layersOf(schema)) {
|
|
8189
|
+
const def = defOf(layer);
|
|
8190
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8191
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8192
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8193
|
+
else if (def.type === "intersection") {
|
|
8194
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8195
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
return [...new Set(paths)];
|
|
8199
|
+
}
|
|
7047
8200
|
//#endregion
|
|
7048
8201
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7049
8202
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -8721,6 +9874,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8721
9874
|
fetchedAt: number()
|
|
8722
9875
|
});
|
|
8723
9876
|
/**
|
|
9877
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9878
|
+
* gets back (cloud training, D805+).
|
|
9879
|
+
*
|
|
9880
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9881
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9882
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9883
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9884
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9885
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9886
|
+
* change there, in the same piece of work.
|
|
9887
|
+
*
|
|
9888
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9889
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9890
|
+
*/
|
|
9891
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9892
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9893
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9894
|
+
var TrainingExportSchema = _enum([
|
|
9895
|
+
"onnx",
|
|
9896
|
+
"openvino-fp16",
|
|
9897
|
+
"openvino-int8",
|
|
9898
|
+
"coreml-fp16"
|
|
9899
|
+
]);
|
|
9900
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9901
|
+
object({
|
|
9902
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9903
|
+
jobKey: string().uuid(),
|
|
9904
|
+
target: object({
|
|
9905
|
+
kind: literal("detector"),
|
|
9906
|
+
step: literal("object-detection")
|
|
9907
|
+
}),
|
|
9908
|
+
base: object({
|
|
9909
|
+
modelId: string().min(1),
|
|
9910
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9911
|
+
weights: string().min(1),
|
|
9912
|
+
imgsz: number().int().positive()
|
|
9913
|
+
}),
|
|
9914
|
+
baseline: object({
|
|
9915
|
+
modelId: string().min(1),
|
|
9916
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9917
|
+
onnxUrl: string().url(),
|
|
9918
|
+
imgsz: number().int().positive(),
|
|
9919
|
+
floors: FloorsSchema
|
|
9920
|
+
}),
|
|
9921
|
+
dataset: object({
|
|
9922
|
+
versionId: string().min(1),
|
|
9923
|
+
annotationHash: string(),
|
|
9924
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9925
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9926
|
+
}),
|
|
9927
|
+
split: object({
|
|
9928
|
+
holdoutCameras: array(number().int()),
|
|
9929
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9930
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9931
|
+
valFraction: number().min(0).max(.5),
|
|
9932
|
+
seed: number().int()
|
|
9933
|
+
}),
|
|
9934
|
+
hyper: object({
|
|
9935
|
+
epochs: number().int().positive(),
|
|
9936
|
+
batch: number().int().positive(),
|
|
9937
|
+
lr0: number().positive(),
|
|
9938
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9939
|
+
freeze: number().int().nonnegative(),
|
|
9940
|
+
patience: number().int().nonnegative(),
|
|
9941
|
+
seed: number().int()
|
|
9942
|
+
}),
|
|
9943
|
+
replay: object({
|
|
9944
|
+
source: literal("coco2017"),
|
|
9945
|
+
count: number().int().nonnegative()
|
|
9946
|
+
}),
|
|
9947
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9948
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9949
|
+
floors: object({
|
|
9950
|
+
minSupport: number().int().positive(),
|
|
9951
|
+
clamp: number().min(0).max(1)
|
|
9952
|
+
}),
|
|
9953
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9954
|
+
catalog: object({
|
|
9955
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9956
|
+
name: string().min(1).max(160)
|
|
9957
|
+
})
|
|
9958
|
+
});
|
|
9959
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9960
|
+
var TrainingResultFileSchema = object({
|
|
9961
|
+
path: string().min(1),
|
|
9962
|
+
bytes: number().int().nonnegative(),
|
|
9963
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9964
|
+
format: _enum([
|
|
9965
|
+
"onnx",
|
|
9966
|
+
"openvino",
|
|
9967
|
+
"coreml",
|
|
9968
|
+
"pt"
|
|
9969
|
+
]),
|
|
9970
|
+
variant: _enum(["base", "int8"])
|
|
9971
|
+
});
|
|
9972
|
+
var DraftFormatSchema = object({
|
|
9973
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9974
|
+
url: string().min(1),
|
|
9975
|
+
sizeMB: number().nonnegative(),
|
|
9976
|
+
isDirectory: boolean().optional(),
|
|
9977
|
+
files: array(string()).optional(),
|
|
9978
|
+
runtimes: array(literal("python")).optional(),
|
|
9979
|
+
revision: string().min(1)
|
|
9980
|
+
});
|
|
9981
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9982
|
+
var TrainingCatalogDraftSchema = object({
|
|
9983
|
+
id: string().min(1),
|
|
9984
|
+
name: string().min(1),
|
|
9985
|
+
description: string(),
|
|
9986
|
+
labels: array(unknown()),
|
|
9987
|
+
inputSize: object({
|
|
9988
|
+
width: number().int().positive(),
|
|
9989
|
+
height: number().int().positive()
|
|
9990
|
+
}),
|
|
9991
|
+
preprocessMode: literal("letterbox"),
|
|
9992
|
+
defaultClassFloors: FloorsSchema,
|
|
9993
|
+
formats: object({
|
|
9994
|
+
onnx: DraftFormatSchema.optional(),
|
|
9995
|
+
openvino: DraftFormatSchema.optional(),
|
|
9996
|
+
coreml: DraftFormatSchema.optional()
|
|
9997
|
+
})
|
|
9998
|
+
});
|
|
9999
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10000
|
+
var TrainingEvalClassSchema = object({
|
|
10001
|
+
positives: number().int(),
|
|
10002
|
+
floor: number().nullable(),
|
|
10003
|
+
tp: number().int(),
|
|
10004
|
+
fp: number().int(),
|
|
10005
|
+
fn: number().int(),
|
|
10006
|
+
precision: number().nullable(),
|
|
10007
|
+
recall: number().nullable(),
|
|
10008
|
+
ap50: number().nullable(),
|
|
10009
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10010
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10011
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10012
|
+
smallFound: number().int().optional(),
|
|
10013
|
+
smallTotal: number().int().optional()
|
|
10014
|
+
}).passthrough();
|
|
10015
|
+
var TrainingEvalReportSchema = object({
|
|
10016
|
+
frames: number().int(),
|
|
10017
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10018
|
+
}).passthrough();
|
|
10019
|
+
/**
|
|
10020
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10021
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10022
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10023
|
+
*/
|
|
10024
|
+
var TrainingResultSchema = object({
|
|
10025
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10026
|
+
jobKey: string(),
|
|
10027
|
+
status: _enum(["succeeded", "failed"]),
|
|
10028
|
+
error: object({
|
|
10029
|
+
stage: string(),
|
|
10030
|
+
code: string(),
|
|
10031
|
+
message: string()
|
|
10032
|
+
}).nullable(),
|
|
10033
|
+
trainer: object({
|
|
10034
|
+
version: string(),
|
|
10035
|
+
revision: string()
|
|
10036
|
+
}),
|
|
10037
|
+
toolchain: record(string(), string().nullable()),
|
|
10038
|
+
dataset: object({
|
|
10039
|
+
versionId: string(),
|
|
10040
|
+
annotationHash: string(),
|
|
10041
|
+
sha256: string(),
|
|
10042
|
+
frames: object({
|
|
10043
|
+
train: number().int(),
|
|
10044
|
+
val: number().int(),
|
|
10045
|
+
holdout: number().int()
|
|
10046
|
+
}),
|
|
10047
|
+
holdoutCameras: array(number().int()),
|
|
10048
|
+
replayImages: number().int()
|
|
10049
|
+
}).optional(),
|
|
10050
|
+
training: object({
|
|
10051
|
+
epochsRun: number().int(),
|
|
10052
|
+
bestEpoch: number().int(),
|
|
10053
|
+
bestMap50: number(),
|
|
10054
|
+
bestMap50_95: number(),
|
|
10055
|
+
seconds: number()
|
|
10056
|
+
}).optional(),
|
|
10057
|
+
evaluation: object({
|
|
10058
|
+
holdoutFrames: number().int(),
|
|
10059
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10060
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10061
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10062
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10063
|
+
map50: record(string(), number().nullable())
|
|
10064
|
+
}).optional(),
|
|
10065
|
+
floors: object({
|
|
10066
|
+
baseline: FloorsSchema,
|
|
10067
|
+
candidate: FloorsSchema,
|
|
10068
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10069
|
+
notes: array(string())
|
|
10070
|
+
}).optional(),
|
|
10071
|
+
int8: object({
|
|
10072
|
+
kept: boolean(),
|
|
10073
|
+
map50Fp16: number().nullable(),
|
|
10074
|
+
map50Int8: number().nullable(),
|
|
10075
|
+
reason: string().nullable()
|
|
10076
|
+
}).optional(),
|
|
10077
|
+
exportsDropped: array(object({
|
|
10078
|
+
export: string(),
|
|
10079
|
+
reason: string()
|
|
10080
|
+
})).optional(),
|
|
10081
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10082
|
+
bundle: object({
|
|
10083
|
+
path: literal("bundle.tar"),
|
|
10084
|
+
bytes: number().int().nonnegative(),
|
|
10085
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10086
|
+
}).nullable().optional(),
|
|
10087
|
+
catalogDraft: object({
|
|
10088
|
+
base: TrainingCatalogDraftSchema,
|
|
10089
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10090
|
+
}).nullable().optional(),
|
|
10091
|
+
licence: string()
|
|
10092
|
+
});
|
|
10093
|
+
var TrainingStageSchema = _enum([
|
|
10094
|
+
"prepare",
|
|
10095
|
+
"replay",
|
|
10096
|
+
"train",
|
|
10097
|
+
"eval",
|
|
10098
|
+
"export",
|
|
10099
|
+
"package"
|
|
10100
|
+
]);
|
|
10101
|
+
var EventBase = {
|
|
10102
|
+
v: literal(1),
|
|
10103
|
+
ts: number()
|
|
10104
|
+
};
|
|
10105
|
+
discriminatedUnion("type", [
|
|
10106
|
+
object({
|
|
10107
|
+
...EventBase,
|
|
10108
|
+
type: literal("stage"),
|
|
10109
|
+
stage: TrainingStageSchema
|
|
10110
|
+
}),
|
|
10111
|
+
object({
|
|
10112
|
+
...EventBase,
|
|
10113
|
+
type: literal("epoch"),
|
|
10114
|
+
epoch: number().int(),
|
|
10115
|
+
epochs: number().int(),
|
|
10116
|
+
boxLoss: number().nullable().optional(),
|
|
10117
|
+
map50: number().nullable().optional(),
|
|
10118
|
+
map50_95: number().nullable().optional(),
|
|
10119
|
+
etaSec: number().nullable().optional()
|
|
10120
|
+
}),
|
|
10121
|
+
object({
|
|
10122
|
+
...EventBase,
|
|
10123
|
+
type: literal("metric"),
|
|
10124
|
+
name: string(),
|
|
10125
|
+
value: number()
|
|
10126
|
+
}),
|
|
10127
|
+
object({
|
|
10128
|
+
...EventBase,
|
|
10129
|
+
type: literal("artifact"),
|
|
10130
|
+
path: string(),
|
|
10131
|
+
bytes: number(),
|
|
10132
|
+
sha256: string()
|
|
10133
|
+
}),
|
|
10134
|
+
object({
|
|
10135
|
+
...EventBase,
|
|
10136
|
+
type: literal("done"),
|
|
10137
|
+
status: _enum(["succeeded", "failed"]),
|
|
10138
|
+
resultSha256: string().nullable().optional()
|
|
10139
|
+
}),
|
|
10140
|
+
object({
|
|
10141
|
+
...EventBase,
|
|
10142
|
+
type: literal("error"),
|
|
10143
|
+
stage: string(),
|
|
10144
|
+
code: string(),
|
|
10145
|
+
message: string()
|
|
10146
|
+
})
|
|
10147
|
+
]);
|
|
10148
|
+
/**
|
|
8724
10149
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8725
10150
|
*
|
|
8726
10151
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11080,7 +12505,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11080
12505
|
"authenticated",
|
|
11081
12506
|
"admin"
|
|
11082
12507
|
]).optional(),
|
|
11083
|
-
description: string().optional()
|
|
12508
|
+
description: string().optional(),
|
|
12509
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12510
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11084
12511
|
});
|
|
11085
12512
|
/**
|
|
11086
12513
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11785,6 +13212,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11785
13212
|
lastError: string().optional()
|
|
11786
13213
|
});
|
|
11787
13214
|
/**
|
|
13215
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13216
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13217
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13218
|
+
* with it off — which restores without a key.
|
|
13219
|
+
*/
|
|
13220
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13221
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13222
|
+
scheme: string(),
|
|
13223
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13224
|
+
keyId: string()
|
|
13225
|
+
});
|
|
13226
|
+
/**
|
|
13227
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13228
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13229
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13230
|
+
*/
|
|
13231
|
+
var BackupEncryptionStatusSchema = object({
|
|
13232
|
+
enabled: boolean(),
|
|
13233
|
+
active: object({
|
|
13234
|
+
keyId: string(),
|
|
13235
|
+
publicKey: string(),
|
|
13236
|
+
createdAt: number()
|
|
13237
|
+
}).nullable(),
|
|
13238
|
+
/** Every key ever set up, newest first. */
|
|
13239
|
+
keys: array(object({
|
|
13240
|
+
keyId: string(),
|
|
13241
|
+
createdAt: number(),
|
|
13242
|
+
retiredAt: number().nullable()
|
|
13243
|
+
})).readonly()
|
|
13244
|
+
});
|
|
13245
|
+
/**
|
|
11788
13246
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11789
13247
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11790
13248
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11796,7 +13254,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11796
13254
|
sizeBytes: number(),
|
|
11797
13255
|
label: string().optional(),
|
|
11798
13256
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11799
|
-
locations: array(string()).readonly()
|
|
13257
|
+
locations: array(string()).readonly(),
|
|
13258
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13259
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11800
13260
|
});
|
|
11801
13261
|
var BackupEntrySchema = object({
|
|
11802
13262
|
id: string(),
|
|
@@ -11805,7 +13265,8 @@ var BackupEntrySchema = object({
|
|
|
11805
13265
|
label: string().optional(),
|
|
11806
13266
|
createdAt: number(),
|
|
11807
13267
|
sizeBytes: number(),
|
|
11808
|
-
locations: array(string()).optional()
|
|
13268
|
+
locations: array(string()).optional(),
|
|
13269
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11809
13270
|
});
|
|
11810
13271
|
var ArchiveEntrySchema = object({
|
|
11811
13272
|
path: string(),
|
|
@@ -11994,10 +13455,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
11994
13455
|
* this list and skips entries whose path doesn't start with
|
|
11995
13456
|
* any of them.
|
|
11996
13457
|
*/
|
|
11997
|
-
locations: array(string()).optional()
|
|
13458
|
+
locations: array(string()).optional(),
|
|
13459
|
+
/**
|
|
13460
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13461
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13462
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13463
|
+
* is refused before the archive is downloaded.
|
|
13464
|
+
*/
|
|
13465
|
+
backupSecretKey: string().optional()
|
|
11998
13466
|
}), _void(), {
|
|
11999
13467
|
kind: "mutation",
|
|
12000
13468
|
auth: "admin"
|
|
13469
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13470
|
+
keyId: string(),
|
|
13471
|
+
secretKey: string(),
|
|
13472
|
+
publicKey: string(),
|
|
13473
|
+
createdAt: number(),
|
|
13474
|
+
replacedKeyId: string().nullable()
|
|
13475
|
+
}), {
|
|
13476
|
+
kind: "mutation",
|
|
13477
|
+
auth: "admin"
|
|
13478
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13479
|
+
kind: "mutation",
|
|
13480
|
+
auth: "admin"
|
|
13481
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13482
|
+
valid: boolean(),
|
|
13483
|
+
keyId: string().nullable(),
|
|
13484
|
+
/** The hub knows this key (active or retired). */
|
|
13485
|
+
known: boolean(),
|
|
13486
|
+
/** It is the key new archives are encrypted to. */
|
|
13487
|
+
active: boolean(),
|
|
13488
|
+
error: string().optional()
|
|
13489
|
+
}), {
|
|
13490
|
+
kind: "mutation",
|
|
13491
|
+
auth: "admin"
|
|
12001
13492
|
}), method(object({
|
|
12002
13493
|
destinationId: string(),
|
|
12003
13494
|
backupId: string()
|
|
@@ -13723,7 +15214,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13723
15214
|
stepId: string(),
|
|
13724
15215
|
entry: ModelCatalogEntrySchema
|
|
13725
15216
|
});
|
|
13726
|
-
|
|
15217
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15218
|
+
var ModelBundleFileSchema = object({
|
|
15219
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15220
|
+
path: string().min(1),
|
|
15221
|
+
bytes: number().int().nonnegative(),
|
|
15222
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15223
|
+
});
|
|
15224
|
+
var ImportModelBundleInputSchema = object({
|
|
15225
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15226
|
+
addonId: string(),
|
|
15227
|
+
stepId: string().min(1),
|
|
15228
|
+
/**
|
|
15229
|
+
* The catalog rows to register, complete, every format URL already
|
|
15230
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15231
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15232
|
+
*/
|
|
15233
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15234
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15235
|
+
bundle: object({
|
|
15236
|
+
ticket: PeerBytesTicketSchema,
|
|
15237
|
+
bytes: number().int().positive(),
|
|
15238
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15239
|
+
}),
|
|
15240
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15241
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15242
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15243
|
+
distribute: boolean()
|
|
15244
|
+
});
|
|
15245
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15246
|
+
kind: literal("imported"),
|
|
15247
|
+
modelIds: array(string()).readonly(),
|
|
15248
|
+
distributed: array(object({
|
|
15249
|
+
modelId: string(),
|
|
15250
|
+
nodeId: string(),
|
|
15251
|
+
format: _enum(MODEL_FORMATS),
|
|
15252
|
+
ok: boolean(),
|
|
15253
|
+
error: string().optional()
|
|
15254
|
+
})).readonly()
|
|
15255
|
+
}), object({
|
|
15256
|
+
kind: literal("refused"),
|
|
15257
|
+
reason: _enum([
|
|
15258
|
+
"transfer-failed",
|
|
15259
|
+
"checksum-mismatch",
|
|
15260
|
+
"bundle-mismatch",
|
|
15261
|
+
"invalid-entry",
|
|
15262
|
+
"id-taken"
|
|
15263
|
+
]),
|
|
15264
|
+
detail: string()
|
|
15265
|
+
})]);
|
|
15266
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15267
|
+
kind: "mutation",
|
|
15268
|
+
auth: "admin",
|
|
15269
|
+
timeoutMs: 30 * 6e4
|
|
15270
|
+
});
|
|
13727
15271
|
/**
|
|
13728
15272
|
* Query filter for settings-store collections.
|
|
13729
15273
|
*/
|
|
@@ -14106,6 +15650,253 @@ id: union([string(), number()]) }), {
|
|
|
14106
15650
|
kind: "mutation",
|
|
14107
15651
|
auth: "admin"
|
|
14108
15652
|
});
|
|
15653
|
+
/**
|
|
15654
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15655
|
+
*
|
|
15656
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15657
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15658
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15659
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15660
|
+
* against the CALLER, never against anything the caller claims.
|
|
15661
|
+
*
|
|
15662
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15663
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15664
|
+
* connection, the agent from its child's connection carried in
|
|
15665
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15666
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15667
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15668
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15669
|
+
* runner is the same OS user): see the threat model in
|
|
15670
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15671
|
+
*
|
|
15672
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15673
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15674
|
+
* floors every method to admin anyway (D240).
|
|
15675
|
+
*
|
|
15676
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15677
|
+
*/
|
|
15678
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15679
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15680
|
+
"key-missing",
|
|
15681
|
+
"wrong-key",
|
|
15682
|
+
"key-file-unreadable",
|
|
15683
|
+
"store-unavailable",
|
|
15684
|
+
"not-initialized",
|
|
15685
|
+
"decrypt-failed"
|
|
15686
|
+
]);
|
|
15687
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15688
|
+
state: literal("locked"),
|
|
15689
|
+
reason: KeychainUnavailableReasonSchema
|
|
15690
|
+
})]);
|
|
15691
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15692
|
+
object({
|
|
15693
|
+
kind: literal("value"),
|
|
15694
|
+
value: string(),
|
|
15695
|
+
version: number().int()
|
|
15696
|
+
}),
|
|
15697
|
+
object({ kind: literal("missing") }),
|
|
15698
|
+
object({
|
|
15699
|
+
kind: literal("unavailable"),
|
|
15700
|
+
reason: KeychainUnavailableReasonSchema
|
|
15701
|
+
}),
|
|
15702
|
+
object({ kind: literal("forbidden") })
|
|
15703
|
+
]);
|
|
15704
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15705
|
+
/** Metadata of one stored value — never the value. */
|
|
15706
|
+
var KeychainSecretMetaSchema = object({
|
|
15707
|
+
ref: string(),
|
|
15708
|
+
owner: string(),
|
|
15709
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15710
|
+
scope: string(),
|
|
15711
|
+
fieldPath: string(),
|
|
15712
|
+
version: number().int(),
|
|
15713
|
+
createdAt: number(),
|
|
15714
|
+
updatedAt: number(),
|
|
15715
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15716
|
+
updatedBy: string(),
|
|
15717
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15718
|
+
lastReadAt: number().nullable()
|
|
15719
|
+
});
|
|
15720
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15721
|
+
method(object({
|
|
15722
|
+
ref: string().min(1),
|
|
15723
|
+
value: string().min(1)
|
|
15724
|
+
}), object({
|
|
15725
|
+
ref: string(),
|
|
15726
|
+
version: number().int()
|
|
15727
|
+
}), {
|
|
15728
|
+
kind: "mutation",
|
|
15729
|
+
auth: "admin"
|
|
15730
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15731
|
+
kind: "mutation",
|
|
15732
|
+
auth: "admin"
|
|
15733
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15734
|
+
var KeychainKeySourceSchema = object({
|
|
15735
|
+
kind: _enum([
|
|
15736
|
+
"config-file",
|
|
15737
|
+
"previous-config-file",
|
|
15738
|
+
"platform",
|
|
15739
|
+
"default-file"
|
|
15740
|
+
]),
|
|
15741
|
+
/** File sources only — a path is not a secret. */
|
|
15742
|
+
path: string().optional(),
|
|
15743
|
+
/**
|
|
15744
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15745
|
+
* next to the database it protects (the default file). The page warns.
|
|
15746
|
+
*/
|
|
15747
|
+
sharesBackupWithDatabase: boolean()
|
|
15748
|
+
});
|
|
15749
|
+
/**
|
|
15750
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15751
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15752
|
+
*/
|
|
15753
|
+
var KeychainResetRecordSchema = object({
|
|
15754
|
+
id: string(),
|
|
15755
|
+
at: number(),
|
|
15756
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15757
|
+
actor: string(),
|
|
15758
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15759
|
+
lockedReason: string().nullable(),
|
|
15760
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15761
|
+
archived: number().int(),
|
|
15762
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15763
|
+
archivedCollection: string().nullable(),
|
|
15764
|
+
/**
|
|
15765
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15766
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15767
|
+
*/
|
|
15768
|
+
archivedKeysCollection: string().nullable(),
|
|
15769
|
+
/**
|
|
15770
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15771
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15772
|
+
* agent forever (D797).
|
|
15773
|
+
*/
|
|
15774
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15775
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15776
|
+
acknowledgedAt: number().nullable()
|
|
15777
|
+
});
|
|
15778
|
+
var KeychainStatusSchema = object({
|
|
15779
|
+
keychain: KeychainStateSchema,
|
|
15780
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15781
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15782
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15783
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15784
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15785
|
+
fingerprint: string().nullable(),
|
|
15786
|
+
activeKeyId: string().nullable(),
|
|
15787
|
+
/**
|
|
15788
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15789
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15790
|
+
*/
|
|
15791
|
+
rotationPending: boolean(),
|
|
15792
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15793
|
+
retiredWraps: number().int(),
|
|
15794
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15795
|
+
secretCount: number().int(),
|
|
15796
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15797
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15798
|
+
});
|
|
15799
|
+
/**
|
|
15800
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15801
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15802
|
+
* never reported as an orphan (and never deleted as one).
|
|
15803
|
+
*/
|
|
15804
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15805
|
+
"in-use",
|
|
15806
|
+
"orphan",
|
|
15807
|
+
"unknown"
|
|
15808
|
+
]);
|
|
15809
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15810
|
+
var KeychainAuditActionSchema = _enum([
|
|
15811
|
+
"put",
|
|
15812
|
+
"delete",
|
|
15813
|
+
"reveal",
|
|
15814
|
+
"rotate-master-key",
|
|
15815
|
+
"purge-retired-keys",
|
|
15816
|
+
"download-recovery-key",
|
|
15817
|
+
"delete-orphans",
|
|
15818
|
+
"reset",
|
|
15819
|
+
"acknowledge-reset",
|
|
15820
|
+
"initialize"
|
|
15821
|
+
]);
|
|
15822
|
+
var KeychainAuditEntrySchema = object({
|
|
15823
|
+
id: string(),
|
|
15824
|
+
at: number(),
|
|
15825
|
+
action: KeychainAuditActionSchema,
|
|
15826
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15827
|
+
actor: string(),
|
|
15828
|
+
ref: string().nullable(),
|
|
15829
|
+
detail: string().nullable()
|
|
15830
|
+
});
|
|
15831
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15832
|
+
/**
|
|
15833
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15834
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15835
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15836
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15837
|
+
*/
|
|
15838
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15839
|
+
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({
|
|
15840
|
+
value: string(),
|
|
15841
|
+
version: number().int()
|
|
15842
|
+
}), {
|
|
15843
|
+
kind: "mutation",
|
|
15844
|
+
auth: "admin",
|
|
15845
|
+
caller: "required"
|
|
15846
|
+
}), method(object({
|
|
15847
|
+
name: SystemHeldSecretNameSchema,
|
|
15848
|
+
value: string().min(16)
|
|
15849
|
+
}), object({
|
|
15850
|
+
ref: string(),
|
|
15851
|
+
version: number().int()
|
|
15852
|
+
}), {
|
|
15853
|
+
kind: "mutation",
|
|
15854
|
+
auth: "admin",
|
|
15855
|
+
caller: "required"
|
|
15856
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15857
|
+
deleted: array(string()).readonly(),
|
|
15858
|
+
kept: array(object({
|
|
15859
|
+
ref: string(),
|
|
15860
|
+
usage: KeychainSecretUsageSchema
|
|
15861
|
+
})).readonly()
|
|
15862
|
+
}), {
|
|
15863
|
+
kind: "mutation",
|
|
15864
|
+
auth: "admin",
|
|
15865
|
+
caller: "required"
|
|
15866
|
+
}), method(object({}), object({
|
|
15867
|
+
fingerprint: string(),
|
|
15868
|
+
keySource: KeychainKeySourceSchema
|
|
15869
|
+
}), {
|
|
15870
|
+
kind: "mutation",
|
|
15871
|
+
auth: "admin",
|
|
15872
|
+
caller: "required"
|
|
15873
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15874
|
+
kind: "mutation",
|
|
15875
|
+
auth: "admin",
|
|
15876
|
+
caller: "required"
|
|
15877
|
+
}), method(object({}), object({
|
|
15878
|
+
key: string(),
|
|
15879
|
+
fingerprint: string(),
|
|
15880
|
+
keySource: KeychainKeySourceSchema
|
|
15881
|
+
}), {
|
|
15882
|
+
kind: "mutation",
|
|
15883
|
+
auth: "admin",
|
|
15884
|
+
caller: "required"
|
|
15885
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15886
|
+
archivedCollection: string().nullable(),
|
|
15887
|
+
archived: number().int()
|
|
15888
|
+
}), {
|
|
15889
|
+
kind: "mutation",
|
|
15890
|
+
auth: "admin",
|
|
15891
|
+
caller: "required"
|
|
15892
|
+
}), method(object({}), object({
|
|
15893
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15894
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15895
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15896
|
+
kind: "mutation",
|
|
15897
|
+
auth: "admin",
|
|
15898
|
+
caller: "required"
|
|
15899
|
+
});
|
|
14109
15900
|
method(_void(), object({
|
|
14110
15901
|
id: string(),
|
|
14111
15902
|
name: string(),
|
|
@@ -15331,7 +17122,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15331
17122
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15332
17123
|
var DevicePersistConfigPayloadSchema = object({
|
|
15333
17124
|
deviceId: number(),
|
|
15334
|
-
data: record(string(), unknown())
|
|
17125
|
+
data: record(string(), unknown()),
|
|
17126
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17127
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17128
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17129
|
+
secretConfigPaths: array(string()).optional()
|
|
15335
17130
|
});
|
|
15336
17131
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15337
17132
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -16934,7 +18729,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16934
18729
|
* `login-method` — collection cap through which auth addons contribute
|
|
16935
18730
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16936
18731
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16937
|
-
* every auth addon (OIDC,
|
|
18732
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
16938
18733
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16939
18734
|
* procedure aggregates them for the unauthenticated login page.
|
|
16940
18735
|
*
|
|
@@ -16942,8 +18737,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16942
18737
|
*
|
|
16943
18738
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
16944
18739
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16945
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
16946
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18740
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16947
18741
|
* login page needs NO change.
|
|
16948
18742
|
*
|
|
16949
18743
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -16962,8 +18756,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16962
18756
|
* decision.
|
|
16963
18757
|
*
|
|
16964
18758
|
* Every contribution carries a `stage`:
|
|
16965
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
16966
|
-
*
|
|
18759
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18760
|
+
* buttons; a usernameless passkey).
|
|
16967
18761
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16968
18762
|
* returned `factors` (passkey-as-2FA today).
|
|
16969
18763
|
*
|
|
@@ -16990,7 +18784,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
16990
18784
|
* The provider names an external identity a signed-in user can link to
|
|
16991
18785
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
16992
18786
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
16993
|
-
* whatever their id. Absent / false — a login button only
|
|
18787
|
+
* whatever their id. Absent / false — a login button only.
|
|
16994
18788
|
*/
|
|
16995
18789
|
linkable: boolean().optional()
|
|
16996
18790
|
}),
|
|
@@ -20845,8 +22639,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20845
22639
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20846
22640
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20847
22641
|
* distinction was only ever used to route role-specific procedures
|
|
20848
|
-
* which we no longer have.
|
|
20849
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22642
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20850
22643
|
* with `isAdmin: false` + an explicit scope list.
|
|
20851
22644
|
*/
|
|
20852
22645
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22348,8 +24141,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22348
24141
|
]);
|
|
22349
24142
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22350
24143
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22351
|
-
/**
|
|
22352
|
-
|
|
24144
|
+
/**
|
|
24145
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24146
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24147
|
+
*
|
|
24148
|
+
* - `operator` — drawn by hand.
|
|
24149
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24150
|
+
* model, or a larger teacher model).
|
|
24151
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24152
|
+
* back from the track store (never a re-run).
|
|
24153
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24154
|
+
*/
|
|
24155
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24156
|
+
"operator",
|
|
24157
|
+
"assist",
|
|
24158
|
+
"pipeline",
|
|
24159
|
+
"llm"
|
|
24160
|
+
]);
|
|
22353
24161
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22354
24162
|
var RetrainBboxSchema = object({
|
|
22355
24163
|
x: number(),
|
|
@@ -22367,7 +24175,8 @@ var RetrainBboxSchema = object({
|
|
|
22367
24175
|
*/
|
|
22368
24176
|
var RetrainAnnotationSchema = object({
|
|
22369
24177
|
id: string(),
|
|
22370
|
-
|
|
24178
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24179
|
+
trackId: string().optional(),
|
|
22371
24180
|
deviceId: number(),
|
|
22372
24181
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22373
24182
|
mediaKey: string(),
|
|
@@ -22416,13 +24225,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22416
24225
|
* fail, whatever became of the original. */
|
|
22417
24226
|
copied: boolean()
|
|
22418
24227
|
});
|
|
24228
|
+
/**
|
|
24229
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24230
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24231
|
+
* box recorded on the source media row when there is one, else the track
|
|
24232
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24233
|
+
* until the operator confirms it.
|
|
24234
|
+
*/
|
|
24235
|
+
var RetrainPipelineBoxSchema = object({
|
|
24236
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24237
|
+
bbox: RetrainBboxSchema,
|
|
24238
|
+
macroClass: RetrainMacroClassSchema,
|
|
24239
|
+
label: string().optional(),
|
|
24240
|
+
subLabel: string().optional(),
|
|
24241
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24242
|
+
score: number().optional(),
|
|
24243
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24244
|
+
modelId: string().optional(),
|
|
24245
|
+
trackId: string(),
|
|
24246
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24247
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24248
|
+
basis: _enum(["subject-box", "position"]),
|
|
24249
|
+
deltaMs: number()
|
|
24250
|
+
});
|
|
24251
|
+
/**
|
|
24252
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24253
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24254
|
+
* track at all.
|
|
24255
|
+
*/
|
|
24256
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22419
24257
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22420
24258
|
var RetrainFrameSchema = object({
|
|
22421
24259
|
frameId: string(),
|
|
22422
24260
|
deviceId: number(),
|
|
22423
|
-
|
|
22424
|
-
/**
|
|
22425
|
-
|
|
24261
|
+
origin: RetrainFrameOriginSchema,
|
|
24262
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24263
|
+
trackId: string().optional(),
|
|
24264
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24265
|
+
* Absent on a recording still. */
|
|
24266
|
+
sourceMediaId: number().int().optional(),
|
|
24267
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24268
|
+
epochMs: number().optional(),
|
|
22426
24269
|
sourceKind: MediaFileKindEnum,
|
|
22427
24270
|
sizeBytes: number().int(),
|
|
22428
24271
|
width: number().int(),
|
|
@@ -22433,7 +24276,12 @@ var RetrainFrameSchema = object({
|
|
|
22433
24276
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22434
24277
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22435
24278
|
* a false positive. */
|
|
22436
|
-
complete: boolean()
|
|
24279
|
+
complete: boolean(),
|
|
24280
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24281
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24282
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24283
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24284
|
+
collectionIds: array(string()).readonly().optional()
|
|
22437
24285
|
});
|
|
22438
24286
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22439
24287
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22464,6 +24312,11 @@ var RetrainFrameListSchema = object({
|
|
|
22464
24312
|
var RetrainExportFilterSchema = object({
|
|
22465
24313
|
deviceIds: array(number()).optional(),
|
|
22466
24314
|
frameIds: array(string()).max(2e4).optional(),
|
|
24315
|
+
/** Only frames in at least one of these named collections. */
|
|
24316
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24317
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
24318
|
+
* unknown id selects nothing. */
|
|
24319
|
+
datasetVersionId: string().optional(),
|
|
22467
24320
|
batchId: string().optional(),
|
|
22468
24321
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22469
24322
|
completeOnly: boolean().optional()
|
|
@@ -22528,6 +24381,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22528
24381
|
reason: string(),
|
|
22529
24382
|
detail: string().optional()
|
|
22530
24383
|
})]);
|
|
24384
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24385
|
+
var RetrainCollectionSchema = object({
|
|
24386
|
+
id: string(),
|
|
24387
|
+
name: string(),
|
|
24388
|
+
createdAt: number(),
|
|
24389
|
+
frameCount: number().int()
|
|
24390
|
+
});
|
|
24391
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24392
|
+
kind: literal("created"),
|
|
24393
|
+
collection: RetrainCollectionSchema
|
|
24394
|
+
}), object({
|
|
24395
|
+
kind: literal("refused"),
|
|
24396
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24397
|
+
})]);
|
|
24398
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24399
|
+
kind: literal("renamed"),
|
|
24400
|
+
collection: RetrainCollectionSchema
|
|
24401
|
+
}), object({
|
|
24402
|
+
kind: literal("refused"),
|
|
24403
|
+
reason: _enum([
|
|
24404
|
+
"empty-name",
|
|
24405
|
+
"duplicate-name",
|
|
24406
|
+
"unknown-collection"
|
|
24407
|
+
])
|
|
24408
|
+
})]);
|
|
24409
|
+
/**
|
|
24410
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24411
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24412
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24413
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24414
|
+
*/
|
|
24415
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24416
|
+
kind: literal("added"),
|
|
24417
|
+
collectionId: string(),
|
|
24418
|
+
frame: RetrainFrameSchema,
|
|
24419
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24420
|
+
reused: boolean()
|
|
24421
|
+
}), object({
|
|
24422
|
+
kind: literal("refused"),
|
|
24423
|
+
reason: _enum([
|
|
24424
|
+
"unknown-collection",
|
|
24425
|
+
"still-unavailable",
|
|
24426
|
+
"still-busy",
|
|
24427
|
+
"unreadable-image",
|
|
24428
|
+
"write-failed"
|
|
24429
|
+
]),
|
|
24430
|
+
detail: string().optional()
|
|
24431
|
+
})]);
|
|
24432
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24433
|
+
var RetrainAssistProfileSchema = object({
|
|
24434
|
+
id: string(),
|
|
24435
|
+
name: string(),
|
|
24436
|
+
model: string(),
|
|
24437
|
+
kind: string(),
|
|
24438
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24439
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24440
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24441
|
+
leavesHouse: boolean()
|
|
24442
|
+
});
|
|
24443
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24444
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24445
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24446
|
+
var RetrainLlmReviewSchema = object({
|
|
24447
|
+
/** The `ref` the page sent the box under. */
|
|
24448
|
+
ref: string(),
|
|
24449
|
+
verdict: _enum([
|
|
24450
|
+
"confirmed",
|
|
24451
|
+
"wrong-class",
|
|
24452
|
+
"not-an-object",
|
|
24453
|
+
"uncertain"
|
|
24454
|
+
]),
|
|
24455
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24456
|
+
reason: string()
|
|
24457
|
+
});
|
|
24458
|
+
/**
|
|
24459
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24460
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24461
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24462
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24463
|
+
*/
|
|
24464
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24465
|
+
kind: literal("proposed"),
|
|
24466
|
+
profileId: string(),
|
|
24467
|
+
model: string(),
|
|
24468
|
+
/** The frame was sent outside the house for this answer. */
|
|
24469
|
+
leftHouse: boolean(),
|
|
24470
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24471
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24472
|
+
rejected: number().int()
|
|
24473
|
+
}), object({
|
|
24474
|
+
kind: literal("refused"),
|
|
24475
|
+
reason: _enum([
|
|
24476
|
+
"unknown-frame",
|
|
24477
|
+
"unreadable-frame",
|
|
24478
|
+
"unknown-profile",
|
|
24479
|
+
"profile-disabled",
|
|
24480
|
+
"no-vision",
|
|
24481
|
+
"cloud-not-confirmed",
|
|
24482
|
+
"llm-error",
|
|
24483
|
+
"malformed-answer"
|
|
24484
|
+
]),
|
|
24485
|
+
detail: string().optional()
|
|
24486
|
+
})]);
|
|
24487
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24488
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24489
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24490
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24491
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24492
|
+
});
|
|
24493
|
+
/** The counts a dataset is judged by. */
|
|
24494
|
+
var RetrainDatasetStatsSchema = object({
|
|
24495
|
+
frames: number().int(),
|
|
24496
|
+
completeFrames: number().int(),
|
|
24497
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24498
|
+
completeness: number(),
|
|
24499
|
+
/** Boxes to learn (model errors excluded). */
|
|
24500
|
+
subjects: number().int(),
|
|
24501
|
+
modelErrors: number().int(),
|
|
24502
|
+
/** Complete frames with no subject. */
|
|
24503
|
+
hardNegatives: number().int(),
|
|
24504
|
+
/** Subjects per class × camera × day/night. */
|
|
24505
|
+
cells: array(object({
|
|
24506
|
+
macroClass: string(),
|
|
24507
|
+
deviceId: number(),
|
|
24508
|
+
lighting: _enum([
|
|
24509
|
+
"day",
|
|
24510
|
+
"night",
|
|
24511
|
+
"unknown"
|
|
24512
|
+
]),
|
|
24513
|
+
subjects: number().int(),
|
|
24514
|
+
frames: number().int()
|
|
24515
|
+
})).readonly(),
|
|
24516
|
+
cameras: array(object({
|
|
24517
|
+
deviceId: number(),
|
|
24518
|
+
frames: number().int(),
|
|
24519
|
+
completeFrames: number().int()
|
|
24520
|
+
})).readonly()
|
|
24521
|
+
});
|
|
24522
|
+
/** An immutable dataset version, without its frame list. */
|
|
24523
|
+
var RetrainDatasetVersionSchema = object({
|
|
24524
|
+
id: string(),
|
|
24525
|
+
name: string(),
|
|
24526
|
+
createdAt: number(),
|
|
24527
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24528
|
+
layout: RetrainExportLayoutSchema,
|
|
24529
|
+
completeOnly: boolean(),
|
|
24530
|
+
frameCount: number().int(),
|
|
24531
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24532
|
+
annotationHash: string(),
|
|
24533
|
+
/** The export manifest schema the version was cut under. */
|
|
24534
|
+
manifestSchema: string(),
|
|
24535
|
+
stats: RetrainDatasetStatsSchema
|
|
24536
|
+
});
|
|
24537
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24538
|
+
kind: literal("created"),
|
|
24539
|
+
version: RetrainDatasetVersionSchema
|
|
24540
|
+
}), object({
|
|
24541
|
+
kind: literal("refused"),
|
|
24542
|
+
reason: _enum([
|
|
24543
|
+
"empty-name",
|
|
24544
|
+
"duplicate-name",
|
|
24545
|
+
"no-frames"
|
|
24546
|
+
])
|
|
24547
|
+
})]);
|
|
22531
24548
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22532
24549
|
var RetrainTransitionResultSchema = object({
|
|
22533
24550
|
trackId: string(),
|
|
@@ -23245,7 +25262,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23245
25262
|
auth: "admin"
|
|
23246
25263
|
}), method(object({
|
|
23247
25264
|
deviceId: number(),
|
|
23248
|
-
trackId: string(),
|
|
25265
|
+
trackId: string().optional(),
|
|
23249
25266
|
frameId: string()
|
|
23250
25267
|
}), object({
|
|
23251
25268
|
removed: boolean(),
|
|
@@ -23262,7 +25279,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23262
25279
|
auth: "admin"
|
|
23263
25280
|
}), method(object({
|
|
23264
25281
|
deviceId: number(),
|
|
23265
|
-
|
|
25282
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25283
|
+
trackId: string().optional(),
|
|
23266
25284
|
frameId: string(),
|
|
23267
25285
|
subject: RetrainAssistSubjectSchema,
|
|
23268
25286
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23270,12 +25288,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23270
25288
|
}), RetrainAssistResultSchema, {
|
|
23271
25289
|
kind: "mutation",
|
|
23272
25290
|
auth: "admin"
|
|
23273
|
-
}), method(object({
|
|
25291
|
+
}), method(object({
|
|
25292
|
+
trackId: string().optional(),
|
|
25293
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25294
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23274
25295
|
kind: "query",
|
|
23275
25296
|
auth: "admin"
|
|
23276
25297
|
}), method(object({
|
|
23277
25298
|
deviceId: number(),
|
|
23278
|
-
|
|
25299
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25300
|
+
trackId: string().optional(),
|
|
23279
25301
|
frameId: string(),
|
|
23280
25302
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23281
25303
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23298,7 +25320,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23298
25320
|
auth: "admin"
|
|
23299
25321
|
}), method(object({
|
|
23300
25322
|
deviceId: number(),
|
|
23301
|
-
trackId: string(),
|
|
25323
|
+
trackId: string().optional(),
|
|
23302
25324
|
frameId: string(),
|
|
23303
25325
|
complete: boolean()
|
|
23304
25326
|
}), RetrainFrameSchema, {
|
|
@@ -23312,6 +25334,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23312
25334
|
kind: "mutation",
|
|
23313
25335
|
auth: "admin",
|
|
23314
25336
|
timeoutMs: 60 * 6e4
|
|
25337
|
+
}), method(object({
|
|
25338
|
+
filter: RetrainExportFilterSchema,
|
|
25339
|
+
layout: RetrainExportLayoutSchema
|
|
25340
|
+
}), object({
|
|
25341
|
+
ticket: PeerBytesTicketSchema,
|
|
25342
|
+
frames: number().int(),
|
|
25343
|
+
annotations: number().int()
|
|
25344
|
+
}), {
|
|
25345
|
+
kind: "mutation",
|
|
25346
|
+
auth: "admin",
|
|
25347
|
+
timeoutMs: 12e4
|
|
25348
|
+
}), method(object({
|
|
25349
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25350
|
+
completeOnly: boolean().optional()
|
|
25351
|
+
}), RetrainDatasetStatsSchema, {
|
|
25352
|
+
kind: "query",
|
|
25353
|
+
auth: "admin"
|
|
25354
|
+
}), method(object({
|
|
25355
|
+
name: string().max(120),
|
|
25356
|
+
selection: RetrainDatasetSelectionSchema,
|
|
25357
|
+
layout: RetrainExportLayoutSchema,
|
|
25358
|
+
completeOnly: boolean()
|
|
25359
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25360
|
+
kind: "mutation",
|
|
25361
|
+
auth: "admin",
|
|
25362
|
+
timeoutMs: 12e4
|
|
25363
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25364
|
+
kind: "query",
|
|
25365
|
+
auth: "admin"
|
|
25366
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25367
|
+
kind: "mutation",
|
|
25368
|
+
auth: "admin"
|
|
25369
|
+
}), method(object({ id: string() }), object({
|
|
25370
|
+
found: boolean(),
|
|
25371
|
+
annotationHash: string(),
|
|
25372
|
+
matches: boolean(),
|
|
25373
|
+
missingFrames: number().int()
|
|
25374
|
+
}), {
|
|
25375
|
+
kind: "query",
|
|
25376
|
+
auth: "admin",
|
|
25377
|
+
timeoutMs: 12e4
|
|
25378
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25379
|
+
kind: "query",
|
|
25380
|
+
auth: "admin"
|
|
25381
|
+
}), method(object({
|
|
25382
|
+
deviceId: number(),
|
|
25383
|
+
trackId: string().optional(),
|
|
25384
|
+
frameId: string(),
|
|
25385
|
+
profileId: string(),
|
|
25386
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25387
|
+
boxes: array(object({
|
|
25388
|
+
ref: string(),
|
|
25389
|
+
bbox: RetrainBboxSchema,
|
|
25390
|
+
macroClass: RetrainMacroClassSchema,
|
|
25391
|
+
label: string().optional()
|
|
25392
|
+
})).max(50),
|
|
25393
|
+
allowCloud: boolean()
|
|
25394
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25395
|
+
kind: "mutation",
|
|
25396
|
+
auth: "admin",
|
|
25397
|
+
timeoutMs: 18e4
|
|
25398
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25399
|
+
kind: "mutation",
|
|
25400
|
+
auth: "admin"
|
|
25401
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25402
|
+
kind: "query",
|
|
25403
|
+
auth: "admin"
|
|
25404
|
+
}), method(object({
|
|
25405
|
+
id: string(),
|
|
25406
|
+
name: string().max(120)
|
|
25407
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25408
|
+
kind: "mutation",
|
|
25409
|
+
auth: "admin"
|
|
25410
|
+
}), method(object({ id: string() }), object({
|
|
25411
|
+
deleted: boolean(),
|
|
25412
|
+
removedFrames: number().int()
|
|
25413
|
+
}), {
|
|
25414
|
+
kind: "mutation",
|
|
25415
|
+
auth: "admin"
|
|
25416
|
+
}), method(object({
|
|
25417
|
+
collectionId: string(),
|
|
25418
|
+
deviceId: number(),
|
|
25419
|
+
epochMs: number()
|
|
25420
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25421
|
+
kind: "mutation",
|
|
25422
|
+
auth: "admin",
|
|
25423
|
+
timeoutMs: 6e4
|
|
25424
|
+
}), method(object({
|
|
25425
|
+
collectionId: string(),
|
|
25426
|
+
frameIds: array(string()).min(1).max(500)
|
|
25427
|
+
}), object({
|
|
25428
|
+
added: number().int(),
|
|
25429
|
+
alreadyMember: number().int(),
|
|
25430
|
+
unknownFrameIds: array(string()).readonly()
|
|
25431
|
+
}), {
|
|
25432
|
+
kind: "mutation",
|
|
25433
|
+
auth: "admin"
|
|
25434
|
+
}), method(object({
|
|
25435
|
+
collectionId: string(),
|
|
25436
|
+
frameId: string()
|
|
25437
|
+
}), object({
|
|
25438
|
+
removed: boolean(),
|
|
25439
|
+
deletedFrame: boolean()
|
|
25440
|
+
}), {
|
|
25441
|
+
kind: "mutation",
|
|
25442
|
+
auth: "admin"
|
|
25443
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25444
|
+
kind: "query",
|
|
25445
|
+
auth: "admin"
|
|
23315
25446
|
}), method(object({
|
|
23316
25447
|
/** Which of the three event tables owns the row. */
|
|
23317
25448
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23935,13 +26066,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23935
26066
|
object({
|
|
23936
26067
|
kind: literal("no-family-build"),
|
|
23937
26068
|
format: ModelFormatSchema$1
|
|
26069
|
+
}),
|
|
26070
|
+
object({
|
|
26071
|
+
kind: literal("kept-custom-pin"),
|
|
26072
|
+
modelId: string(),
|
|
26073
|
+
deviceKey: string()
|
|
23938
26074
|
})
|
|
23939
26075
|
]);
|
|
26076
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26077
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26078
|
+
/**
|
|
26079
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26080
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26081
|
+
*/
|
|
26082
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26083
|
+
kind: literal("node-benchmark"),
|
|
26084
|
+
resultId: string(),
|
|
26085
|
+
measuredAtMs: number()
|
|
26086
|
+
})]);
|
|
23940
26087
|
var DeviceModelChoiceSchema = object({
|
|
23941
26088
|
modelId: string(),
|
|
23942
26089
|
p50Ms: number(),
|
|
23943
26090
|
fps: number(),
|
|
23944
26091
|
measured: boolean(),
|
|
26092
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26093
|
+
source: LatencySourceSchema.optional(),
|
|
23945
26094
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23946
26095
|
capacitySessions: number(),
|
|
23947
26096
|
personRecall: number()
|
|
@@ -23952,6 +26101,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23952
26101
|
enabled: boolean(),
|
|
23953
26102
|
available: boolean(),
|
|
23954
26103
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26104
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26105
|
+
kept: KeptReasonSchema.optional(),
|
|
23955
26106
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23956
26107
|
});
|
|
23957
26108
|
var NodeRecommendationSchema = object({
|
|
@@ -24005,6 +26156,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24005
26156
|
kind: literal("coral-enabled"),
|
|
24006
26157
|
nodeId: string(),
|
|
24007
26158
|
deviceKey: string()
|
|
26159
|
+
}),
|
|
26160
|
+
object({
|
|
26161
|
+
kind: literal("custom-pin-kept"),
|
|
26162
|
+
nodeId: string(),
|
|
26163
|
+
deviceKey: string().nullable(),
|
|
26164
|
+
deviceId: number().nullable(),
|
|
26165
|
+
modelId: string()
|
|
26166
|
+
}),
|
|
26167
|
+
object({
|
|
26168
|
+
kind: literal("custom-registry-unreadable"),
|
|
26169
|
+
error: string()
|
|
24008
26170
|
})
|
|
24009
26171
|
]);
|
|
24010
26172
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24183,13 +26345,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24183
26345
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24184
26346
|
});
|
|
24185
26347
|
/**
|
|
24186
|
-
* Where the node and device shares come from (D750, D755).
|
|
24187
|
-
* - `
|
|
24188
|
-
*
|
|
24189
|
-
*
|
|
24190
|
-
*
|
|
24191
|
-
*
|
|
24192
|
-
*
|
|
26348
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26349
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26350
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26351
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26352
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26353
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26354
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26355
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24193
26356
|
* - `manual` — the operator's stored sliders.
|
|
24194
26357
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24195
26358
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24238,6 +26401,362 @@ var EffectiveSharesSchema = object({
|
|
|
24238
26401
|
nodeWeights: record(string(), number()),
|
|
24239
26402
|
deviceWeights: record(string(), record(string(), number()))
|
|
24240
26403
|
});
|
|
26404
|
+
/**
|
|
26405
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26406
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26407
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26408
|
+
* shares read.
|
|
26409
|
+
*
|
|
26410
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26411
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26412
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26413
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26414
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26415
|
+
*
|
|
26416
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26417
|
+
* cross a process at frame rate, D9):
|
|
26418
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26419
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26420
|
+
* interval;
|
|
26421
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26422
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26423
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26424
|
+
* CPU, RAM or the event loop give out.
|
|
26425
|
+
*/
|
|
26426
|
+
/** Defaults and bounds, one place. */
|
|
26427
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26428
|
+
fpsPerStream: 10,
|
|
26429
|
+
budgetMinutes: 45,
|
|
26430
|
+
minBudgetMinutes: 10,
|
|
26431
|
+
maxBudgetMinutes: 120,
|
|
26432
|
+
/** A result older than this no longer beats the table. */
|
|
26433
|
+
staleAfterDays: 30,
|
|
26434
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26435
|
+
settleSec: 5,
|
|
26436
|
+
/** Accounted window per ramp step. */
|
|
26437
|
+
measureSec: 20,
|
|
26438
|
+
/** Longest the drain may take before the run is refused. */
|
|
26439
|
+
drainTimeoutSec: 120,
|
|
26440
|
+
/** Candidate models per device in one run. */
|
|
26441
|
+
maxModelsPerDevice: 6
|
|
26442
|
+
};
|
|
26443
|
+
/** The two measurements a run can make. */
|
|
26444
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26445
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26446
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26447
|
+
deviceKey: string().min(1),
|
|
26448
|
+
/**
|
|
26449
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26450
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26451
|
+
*/
|
|
26452
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26453
|
+
});
|
|
26454
|
+
/** What the operator confirmed. */
|
|
26455
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26456
|
+
nodeId: string().min(1),
|
|
26457
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26458
|
+
/** Which measurements run. At least one. */
|
|
26459
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26460
|
+
/**
|
|
26461
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26462
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26463
|
+
* detector always runs.
|
|
26464
|
+
*/
|
|
26465
|
+
steps: array(string().min(1)).default([]),
|
|
26466
|
+
/** Offered rate of one stream / session. */
|
|
26467
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26468
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26469
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26470
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26471
|
+
keepDownloadedModels: boolean().default(false),
|
|
26472
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26473
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26474
|
+
});
|
|
26475
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26476
|
+
kind: _enum([
|
|
26477
|
+
"benchmark-active",
|
|
26478
|
+
"node-offline",
|
|
26479
|
+
"unknown-device",
|
|
26480
|
+
"no-phase",
|
|
26481
|
+
"insufficient-headroom"
|
|
26482
|
+
]),
|
|
26483
|
+
detail: string(),
|
|
26484
|
+
overridable: boolean()
|
|
26485
|
+
});
|
|
26486
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26487
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26488
|
+
deviceId: number(),
|
|
26489
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26490
|
+
placedOnNode: boolean(),
|
|
26491
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26492
|
+
pinnedToNode: boolean()
|
|
26493
|
+
});
|
|
26494
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26495
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26496
|
+
deviceId: number(),
|
|
26497
|
+
reason: literal("only-frame-source")
|
|
26498
|
+
});
|
|
26499
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26500
|
+
nodeId: string(),
|
|
26501
|
+
online: boolean(),
|
|
26502
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26503
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26504
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26505
|
+
estimatedDurationMs: number(),
|
|
26506
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26507
|
+
budgetMs: number(),
|
|
26508
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26509
|
+
steps: array(string()).readonly(),
|
|
26510
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26511
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26512
|
+
headroom: object({
|
|
26513
|
+
sessionsNow: number(),
|
|
26514
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26515
|
+
}),
|
|
26516
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26517
|
+
canStart: boolean()
|
|
26518
|
+
});
|
|
26519
|
+
/** Where the measuring runner is. */
|
|
26520
|
+
var NodeBenchProgressSchema = object({
|
|
26521
|
+
phase: _enum([
|
|
26522
|
+
"preparing",
|
|
26523
|
+
"device",
|
|
26524
|
+
"pipeline",
|
|
26525
|
+
"cleanup"
|
|
26526
|
+
]),
|
|
26527
|
+
deviceKey: string().nullable(),
|
|
26528
|
+
modelId: string().nullable(),
|
|
26529
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26530
|
+
load: number().nullable(),
|
|
26531
|
+
cellsDone: number(),
|
|
26532
|
+
cellsTotal: number(),
|
|
26533
|
+
message: string()
|
|
26534
|
+
});
|
|
26535
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26536
|
+
var NodeBenchLimitSchema = _enum([
|
|
26537
|
+
"p95",
|
|
26538
|
+
"drops",
|
|
26539
|
+
"errors",
|
|
26540
|
+
"stall",
|
|
26541
|
+
"cpu",
|
|
26542
|
+
"ram",
|
|
26543
|
+
"none"
|
|
26544
|
+
]);
|
|
26545
|
+
var NodeBenchRampStepSchema = object({
|
|
26546
|
+
load: number(),
|
|
26547
|
+
pass: boolean(),
|
|
26548
|
+
p95Ms: number(),
|
|
26549
|
+
dropRatio: number(),
|
|
26550
|
+
/** Completed frames per second over the accounted window. */
|
|
26551
|
+
fps: number(),
|
|
26552
|
+
cpuPct: number().nullable(),
|
|
26553
|
+
ramFreePct: number().nullable(),
|
|
26554
|
+
failReasons: array(string()).readonly()
|
|
26555
|
+
});
|
|
26556
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26557
|
+
phase: literal("device"),
|
|
26558
|
+
deviceKey: string(),
|
|
26559
|
+
modelId: string(),
|
|
26560
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26561
|
+
p50Ms: number(),
|
|
26562
|
+
p95Ms: number(),
|
|
26563
|
+
p99Ms: number(),
|
|
26564
|
+
/** Frames per second sustained at the last passing step. */
|
|
26565
|
+
fps: number(),
|
|
26566
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26567
|
+
kMax: number(),
|
|
26568
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26569
|
+
/** First call (model load + warm-up). */
|
|
26570
|
+
warmupMs: number(),
|
|
26571
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26572
|
+
}), object({
|
|
26573
|
+
phase: literal("pipeline"),
|
|
26574
|
+
deviceKey: string(),
|
|
26575
|
+
modelId: string(),
|
|
26576
|
+
steps: array(string()).readonly(),
|
|
26577
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26578
|
+
maxSessions: number(),
|
|
26579
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26580
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26581
|
+
stepsFired: array(string()).readonly(),
|
|
26582
|
+
warmupMs: number(),
|
|
26583
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26584
|
+
})]);
|
|
26585
|
+
/**
|
|
26586
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26587
|
+
* the node no longer beats the table.
|
|
26588
|
+
*/
|
|
26589
|
+
var NodeBenchFingerprintSchema = object({
|
|
26590
|
+
pipelineVersion: string().nullable(),
|
|
26591
|
+
cpuModel: string().nullable(),
|
|
26592
|
+
ramGb: number().nullable(),
|
|
26593
|
+
os: string().nullable(),
|
|
26594
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26595
|
+
pools: record(string(), object({
|
|
26596
|
+
runtime: string(),
|
|
26597
|
+
numWorkers: number(),
|
|
26598
|
+
concurrency: number(),
|
|
26599
|
+
batchMode: string()
|
|
26600
|
+
})).default({})
|
|
26601
|
+
});
|
|
26602
|
+
/** The frames the run used. */
|
|
26603
|
+
var NodeBenchClipSchema = object({
|
|
26604
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26605
|
+
id: string(),
|
|
26606
|
+
revision: string().nullable(),
|
|
26607
|
+
frames: number(),
|
|
26608
|
+
width: number(),
|
|
26609
|
+
height: number()
|
|
26610
|
+
});
|
|
26611
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26612
|
+
runId: string().min(1),
|
|
26613
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26614
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26615
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26616
|
+
steps: array(string()).default([]),
|
|
26617
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26618
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26619
|
+
deadlineAtMs: number(),
|
|
26620
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26621
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26622
|
+
keepDownloadedModels: boolean().default(false)
|
|
26623
|
+
});
|
|
26624
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26625
|
+
"running",
|
|
26626
|
+
"done",
|
|
26627
|
+
"failed",
|
|
26628
|
+
"aborted"
|
|
26629
|
+
]);
|
|
26630
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26631
|
+
runId: string(),
|
|
26632
|
+
nodeId: string(),
|
|
26633
|
+
state: NodeBenchRunnerStateSchema,
|
|
26634
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26635
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26636
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26637
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26638
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26639
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26640
|
+
activeCameraIds: array(number()).readonly(),
|
|
26641
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26642
|
+
deletedModels: array(string()).readonly(),
|
|
26643
|
+
error: string().nullable(),
|
|
26644
|
+
startedAtMs: number(),
|
|
26645
|
+
finishedAtMs: number().nullable()
|
|
26646
|
+
});
|
|
26647
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26648
|
+
"draining",
|
|
26649
|
+
"measuring",
|
|
26650
|
+
"restoring",
|
|
26651
|
+
"done",
|
|
26652
|
+
"failed",
|
|
26653
|
+
"aborted"
|
|
26654
|
+
]);
|
|
26655
|
+
/** Why a run ended. */
|
|
26656
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26657
|
+
"completed",
|
|
26658
|
+
"operator-abort",
|
|
26659
|
+
"deadline",
|
|
26660
|
+
"node-lost",
|
|
26661
|
+
"runner-lost",
|
|
26662
|
+
"hub-restart",
|
|
26663
|
+
"drain-timeout",
|
|
26664
|
+
"failed"
|
|
26665
|
+
]);
|
|
26666
|
+
var NodeBenchmarkRunSchema = object({
|
|
26667
|
+
runId: string(),
|
|
26668
|
+
nodeId: string(),
|
|
26669
|
+
state: NodeBenchmarkStateSchema,
|
|
26670
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26671
|
+
startedAtMs: number(),
|
|
26672
|
+
deadlineAtMs: number(),
|
|
26673
|
+
finishedAtMs: number().nullable(),
|
|
26674
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26675
|
+
error: string().nullable(),
|
|
26676
|
+
/** Cameras moved off the node for the run. */
|
|
26677
|
+
moved: array(number()).readonly(),
|
|
26678
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26679
|
+
staying: array(number()).readonly(),
|
|
26680
|
+
/** Something else ran on the node's pools during the run. */
|
|
26681
|
+
contaminated: boolean(),
|
|
26682
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26683
|
+
resultIds: array(string()).readonly()
|
|
26684
|
+
});
|
|
26685
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26686
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26687
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26688
|
+
modeNodeId: string().nullable(),
|
|
26689
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26690
|
+
});
|
|
26691
|
+
/**
|
|
26692
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26693
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26694
|
+
* ends, never by anyone else.
|
|
26695
|
+
*/
|
|
26696
|
+
var NodeBenchmarkResultSchema = object({
|
|
26697
|
+
id: string(),
|
|
26698
|
+
runId: string(),
|
|
26699
|
+
nodeId: string(),
|
|
26700
|
+
cell: NodeBenchCellSchema,
|
|
26701
|
+
fpsPerStream: number(),
|
|
26702
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26703
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26704
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26705
|
+
contaminated: boolean(),
|
|
26706
|
+
stayingCameras: array(number()).readonly(),
|
|
26707
|
+
/** The run ended early; the cell itself completed. */
|
|
26708
|
+
partialRun: boolean(),
|
|
26709
|
+
measuredAtMs: number()
|
|
26710
|
+
});
|
|
26711
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26712
|
+
nodeId: string().optional(),
|
|
26713
|
+
deviceKey: string().optional()
|
|
26714
|
+
});
|
|
26715
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26716
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26717
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26718
|
+
standing: _enum([
|
|
26719
|
+
"fresh",
|
|
26720
|
+
"stale",
|
|
26721
|
+
"superseded"
|
|
26722
|
+
]),
|
|
26723
|
+
staleWhy: _enum([
|
|
26724
|
+
"age",
|
|
26725
|
+
"runtime",
|
|
26726
|
+
"pool-tuning"
|
|
26727
|
+
]).nullable()
|
|
26728
|
+
});
|
|
26729
|
+
object({
|
|
26730
|
+
runId: string(),
|
|
26731
|
+
nodeId: string(),
|
|
26732
|
+
startedAtMs: number(),
|
|
26733
|
+
deadlineAtMs: number(),
|
|
26734
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26735
|
+
moved: array(number()).readonly(),
|
|
26736
|
+
staying: array(number()).readonly()
|
|
26737
|
+
});
|
|
26738
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26739
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26740
|
+
nodeId: string(),
|
|
26741
|
+
reachable: boolean(),
|
|
26742
|
+
devices: array(object({
|
|
26743
|
+
deviceKey: string(),
|
|
26744
|
+
enabled: boolean(),
|
|
26745
|
+
available: boolean(),
|
|
26746
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26747
|
+
suggested: array(string()).readonly(),
|
|
26748
|
+
/** Every root detector the device has a build for. */
|
|
26749
|
+
all: array(string()).readonly(),
|
|
26750
|
+
/** The model the device runs now, when pinned. */
|
|
26751
|
+
currentModelId: string().nullable()
|
|
26752
|
+
})).readonly(),
|
|
26753
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26754
|
+
steps: array(object({
|
|
26755
|
+
id: string(),
|
|
26756
|
+
name: string(),
|
|
26757
|
+
slot: string()
|
|
26758
|
+
})).readonly()
|
|
26759
|
+
});
|
|
24241
26760
|
object({
|
|
24242
26761
|
activeCameras: number(),
|
|
24243
26762
|
throttledCameras: number(),
|
|
@@ -25366,7 +27885,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25366
27885
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25367
27886
|
deviceId: number(),
|
|
25368
27887
|
trackId: string()
|
|
25369
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27888
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27889
|
+
accepted: literal(true),
|
|
27890
|
+
runId: string()
|
|
27891
|
+
}), {
|
|
27892
|
+
kind: "mutation",
|
|
27893
|
+
auth: "admin"
|
|
27894
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27895
|
+
kind: "mutation",
|
|
27896
|
+
auth: "admin"
|
|
27897
|
+
});
|
|
25370
27898
|
var CameraPipelineConfigSchema = object({
|
|
25371
27899
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25372
27900
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26005,6 +28533,21 @@ method(object({
|
|
|
26005
28533
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26006
28534
|
kind: "mutation",
|
|
26007
28535
|
auth: "admin"
|
|
28536
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28537
|
+
kind: literal("started"),
|
|
28538
|
+
runId: string()
|
|
28539
|
+
}), object({
|
|
28540
|
+
kind: literal("refused"),
|
|
28541
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28542
|
+
})]), {
|
|
28543
|
+
kind: "mutation",
|
|
28544
|
+
auth: "admin"
|
|
28545
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28546
|
+
kind: "mutation",
|
|
28547
|
+
auth: "admin"
|
|
28548
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28549
|
+
kind: "mutation",
|
|
28550
|
+
auth: "admin"
|
|
26008
28551
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26009
28552
|
deviceId: number(),
|
|
26010
28553
|
addonId: string(),
|
|
@@ -26410,8 +28953,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26410
28953
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26411
28954
|
*
|
|
26412
28955
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26413
|
-
* one for transactional / one for notifications). Consumers (
|
|
26414
|
-
*
|
|
28956
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28957
|
+
* addons, …) walk the collection and pick the first
|
|
26415
28958
|
* ready provider OR target a specific addonId.
|
|
26416
28959
|
*
|
|
26417
28960
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26694,7 +29237,7 @@ targets: array(object({
|
|
|
26694
29237
|
};
|
|
26695
29238
|
/**
|
|
26696
29239
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26697
|
-
* providers (OIDC, SAML,
|
|
29240
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26698
29241
|
* carrying the post-callback claims before redirecting back to
|
|
26699
29242
|
* `/api/auth/sso/finish`.
|
|
26700
29243
|
*
|
|
@@ -26757,7 +29300,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26757
29300
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26758
29301
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26759
29302
|
*/
|
|
26760
|
-
issuer: string().optional()
|
|
29303
|
+
issuer: string().optional(),
|
|
29304
|
+
/**
|
|
29305
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29306
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29307
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29308
|
+
* any other browser.
|
|
29309
|
+
*/
|
|
29310
|
+
browserBinding: string().optional()
|
|
26761
29311
|
});
|
|
26762
29312
|
method(object({
|
|
26763
29313
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -32224,6 +34774,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32224
34774
|
enabled: boolean().optional(),
|
|
32225
34775
|
info: record(string(), unknown()).optional(),
|
|
32226
34776
|
settings: record(string(), unknown()).optional(),
|
|
34777
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34778
|
+
* the keychain, not the table (D787). */
|
|
34779
|
+
secretKeys: array(string()).optional(),
|
|
32227
34780
|
skipRestart: boolean().optional()
|
|
32228
34781
|
});
|
|
32229
34782
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32247,7 +34800,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32247
34800
|
auth: "admin"
|
|
32248
34801
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32249
34802
|
id: string(),
|
|
32250
|
-
settings: record(string(), unknown())
|
|
34803
|
+
settings: record(string(), unknown()),
|
|
34804
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34805
|
+
secretKeys: array(string()).optional()
|
|
32251
34806
|
}), object({ success: boolean() }), {
|
|
32252
34807
|
kind: "mutation",
|
|
32253
34808
|
auth: "admin"
|
|
@@ -39019,16 +41574,6 @@ var ApiKeySummarySchema = object({
|
|
|
39019
41574
|
createdAt: number(),
|
|
39020
41575
|
lastUsedAt: number().optional()
|
|
39021
41576
|
});
|
|
39022
|
-
var CreateApiKeyInputSchema = object({
|
|
39023
|
-
label: string(),
|
|
39024
|
-
isAdmin: boolean().default(false),
|
|
39025
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
39026
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
39027
|
-
});
|
|
39028
|
-
var CreateApiKeyResultSchema = object({
|
|
39029
|
-
token: string(),
|
|
39030
|
-
record: ApiKeySummarySchema
|
|
39031
|
-
});
|
|
39032
41577
|
var ScopedTokenSummarySchema = object({
|
|
39033
41578
|
id: string(),
|
|
39034
41579
|
userId: string(),
|
|
@@ -39127,17 +41672,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39127
41672
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
39128
41673
|
kind: "mutation",
|
|
39129
41674
|
access: "view"
|
|
39130
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
39131
|
-
kind: "mutation",
|
|
39132
|
-
auth: "admin",
|
|
39133
|
-
access: "create"
|
|
39134
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
41675
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39135
41676
|
kind: "mutation",
|
|
39136
41677
|
auth: "admin",
|
|
39137
41678
|
access: "delete"
|
|
39138
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
39139
|
-
kind: "mutation",
|
|
39140
|
-
access: "view"
|
|
39141
41679
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
39142
41680
|
kind: "mutation",
|
|
39143
41681
|
auth: "admin",
|
|
@@ -39211,15 +41749,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39211
41749
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
39212
41750
|
userId: string(),
|
|
39213
41751
|
issuer: string()
|
|
39214
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
39215
|
-
userId: string(),
|
|
39216
|
-
issuer: string().min(1),
|
|
39217
|
-
label: string().optional()
|
|
39218
|
-
}), object({ success: literal(true) }), {
|
|
39219
|
-
kind: "mutation",
|
|
39220
|
-
auth: "admin",
|
|
39221
|
-
access: "create"
|
|
39222
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41752
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39223
41753
|
kind: "mutation",
|
|
39224
41754
|
auth: "admin",
|
|
39225
41755
|
access: "delete"
|
|
@@ -39924,6 +42454,451 @@ var zoneRulesCapability = {
|
|
|
39924
42454
|
*/
|
|
39925
42455
|
durability: "restored"
|
|
39926
42456
|
};
|
|
42457
|
+
/**
|
|
42458
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
42459
|
+
*
|
|
42460
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
42461
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
42462
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
42463
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
42464
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
42465
|
+
* manifest entry and nothing else.
|
|
42466
|
+
*
|
|
42467
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
42468
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
42469
|
+
* Every method is `admin`: these spend money.
|
|
42470
|
+
*
|
|
42471
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
42472
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
42473
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
42474
|
+
*
|
|
42475
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
42476
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
42477
|
+
* ticket the provider mints (D613).
|
|
42478
|
+
*/
|
|
42479
|
+
var TrainingGpuOptionSchema = object({
|
|
42480
|
+
id: string(),
|
|
42481
|
+
label: string(),
|
|
42482
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
42483
|
+
usdPerHour: number().nonnegative(),
|
|
42484
|
+
vramGb: number().nonnegative()
|
|
42485
|
+
});
|
|
42486
|
+
var TrainingRegionOptionSchema = object({
|
|
42487
|
+
/** `''` = any region (the provider's choice). */
|
|
42488
|
+
id: string(),
|
|
42489
|
+
label: string(),
|
|
42490
|
+
priceMultiplier: number().positive()
|
|
42491
|
+
});
|
|
42492
|
+
/**
|
|
42493
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
42494
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
42495
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
42496
|
+
*/
|
|
42497
|
+
var TrainingProviderDefaultsSchema = object({
|
|
42498
|
+
gpuType: string(),
|
|
42499
|
+
region: string(),
|
|
42500
|
+
costCapUsd: number().nonnegative(),
|
|
42501
|
+
maxRuntimeSec: number().int().positive(),
|
|
42502
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
42503
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
42504
|
+
});
|
|
42505
|
+
var TrainingProviderDescriptorSchema = object({
|
|
42506
|
+
addonId: string(),
|
|
42507
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
42508
|
+
kind: string(),
|
|
42509
|
+
label: string(),
|
|
42510
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
42511
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
42512
|
+
maxDatasetBytes: number().int().positive(),
|
|
42513
|
+
maxRuntimeSec: number().int().positive(),
|
|
42514
|
+
freeTierNote: string().optional(),
|
|
42515
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
42516
|
+
dataResidencyNote: string(),
|
|
42517
|
+
/** Credentials are present — never the values. */
|
|
42518
|
+
configured: boolean(),
|
|
42519
|
+
defaults: TrainingProviderDefaultsSchema
|
|
42520
|
+
});
|
|
42521
|
+
var TrainingCredentialCheckSchema = object({
|
|
42522
|
+
ok: boolean(),
|
|
42523
|
+
/** Workspace / account name, when the provider says. */
|
|
42524
|
+
account: string().optional(),
|
|
42525
|
+
reason: _enum([
|
|
42526
|
+
"missing",
|
|
42527
|
+
"invalid",
|
|
42528
|
+
"forbidden",
|
|
42529
|
+
"network",
|
|
42530
|
+
"quota"
|
|
42531
|
+
]).optional(),
|
|
42532
|
+
detail: string().optional()
|
|
42533
|
+
});
|
|
42534
|
+
var ProviderJobStateSchema = _enum([
|
|
42535
|
+
"pending",
|
|
42536
|
+
"starting",
|
|
42537
|
+
"running",
|
|
42538
|
+
"succeeded",
|
|
42539
|
+
"failed",
|
|
42540
|
+
"cancelled",
|
|
42541
|
+
"lost"
|
|
42542
|
+
]);
|
|
42543
|
+
var ProviderJobStatusSchema = object({
|
|
42544
|
+
jobKey: string(),
|
|
42545
|
+
providerJobId: string().optional(),
|
|
42546
|
+
state: ProviderJobStateSchema,
|
|
42547
|
+
startedAt: number().optional(),
|
|
42548
|
+
endedAt: number().optional(),
|
|
42549
|
+
exitCode: number().int().optional(),
|
|
42550
|
+
failureReason: string().optional(),
|
|
42551
|
+
gpuType: string(),
|
|
42552
|
+
region: string().optional(),
|
|
42553
|
+
billedSeconds: number().nonnegative(),
|
|
42554
|
+
costUsd: number().nonnegative(),
|
|
42555
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
42556
|
+
costIsEstimate: boolean(),
|
|
42557
|
+
lastFetchedAt: number()
|
|
42558
|
+
});
|
|
42559
|
+
/**
|
|
42560
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
42561
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
42562
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
42563
|
+
* in `result.json`.
|
|
42564
|
+
*/
|
|
42565
|
+
var TrainerSourceRefSchema = object({
|
|
42566
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
42567
|
+
repo: string().min(1),
|
|
42568
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
42569
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
42570
|
+
});
|
|
42571
|
+
var JobRef = {
|
|
42572
|
+
addonId: string(),
|
|
42573
|
+
jobKey: string().uuid()
|
|
42574
|
+
};
|
|
42575
|
+
var TrainingLogLineSchema = object({
|
|
42576
|
+
ts: number(),
|
|
42577
|
+
text: string()
|
|
42578
|
+
});
|
|
42579
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
42580
|
+
kind: "mutation",
|
|
42581
|
+
auth: "admin",
|
|
42582
|
+
timeoutMs: 3e4
|
|
42583
|
+
}), method(object({
|
|
42584
|
+
addonId: string(),
|
|
42585
|
+
gpuType: string(),
|
|
42586
|
+
region: string(),
|
|
42587
|
+
datasetBytes: number().int().nonnegative(),
|
|
42588
|
+
gpuSecondsLow: number().nonnegative(),
|
|
42589
|
+
gpuSecondsHigh: number().nonnegative()
|
|
42590
|
+
}), object({
|
|
42591
|
+
usdLow: number().nonnegative(),
|
|
42592
|
+
usdHigh: number().nonnegative(),
|
|
42593
|
+
notes: array(string()).readonly()
|
|
42594
|
+
}), { auth: "admin" }), method(object({
|
|
42595
|
+
...JobRef,
|
|
42596
|
+
ticket: PeerBytesTicketSchema
|
|
42597
|
+
}), object({
|
|
42598
|
+
bytes: number().int().nonnegative(),
|
|
42599
|
+
sha256: string()
|
|
42600
|
+
}), {
|
|
42601
|
+
kind: "mutation",
|
|
42602
|
+
auth: "admin",
|
|
42603
|
+
timeoutMs: 120 * 6e4
|
|
42604
|
+
}), method(object({
|
|
42605
|
+
...JobRef,
|
|
42606
|
+
trainer: TrainerSourceRefSchema,
|
|
42607
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
42608
|
+
gpuType: string(),
|
|
42609
|
+
region: string(),
|
|
42610
|
+
maxRuntimeSec: number().int().positive()
|
|
42611
|
+
}), ProviderJobStatusSchema, {
|
|
42612
|
+
kind: "mutation",
|
|
42613
|
+
auth: "admin",
|
|
42614
|
+
timeoutMs: 30 * 6e4
|
|
42615
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
42616
|
+
auth: "admin",
|
|
42617
|
+
timeoutMs: 6e4
|
|
42618
|
+
}), method(object({
|
|
42619
|
+
...JobRef,
|
|
42620
|
+
cursor: string().optional(),
|
|
42621
|
+
max: number().int().min(1).max(500)
|
|
42622
|
+
}), object({
|
|
42623
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
42624
|
+
cursor: string()
|
|
42625
|
+
}), {
|
|
42626
|
+
auth: "admin",
|
|
42627
|
+
timeoutMs: 6e4
|
|
42628
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
42629
|
+
kind: "mutation",
|
|
42630
|
+
auth: "admin",
|
|
42631
|
+
timeoutMs: 6e4
|
|
42632
|
+
}), method(object(JobRef), object({
|
|
42633
|
+
found: boolean(),
|
|
42634
|
+
text: string().optional()
|
|
42635
|
+
}), {
|
|
42636
|
+
kind: "mutation",
|
|
42637
|
+
auth: "admin",
|
|
42638
|
+
timeoutMs: 5 * 6e4
|
|
42639
|
+
}), method(object({
|
|
42640
|
+
...JobRef,
|
|
42641
|
+
path: _enum(["bundle.tar"])
|
|
42642
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
42643
|
+
kind: "mutation",
|
|
42644
|
+
auth: "admin",
|
|
42645
|
+
timeoutMs: 5 * 6e4
|
|
42646
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
42647
|
+
kind: "mutation",
|
|
42648
|
+
auth: "admin",
|
|
42649
|
+
timeoutMs: 5 * 6e4
|
|
42650
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
42651
|
+
auth: "admin",
|
|
42652
|
+
timeoutMs: 2 * 6e4
|
|
42653
|
+
});
|
|
42654
|
+
/**
|
|
42655
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
42656
|
+
* provided by `addon-training`.
|
|
42657
|
+
*
|
|
42658
|
+
* It owns what every provider must agree on, written once:
|
|
42659
|
+
*
|
|
42660
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
42661
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
42662
|
+
* the export plan) and reaches this store through the five row methods
|
|
42663
|
+
* below, so the Retrain page and the export did not change.
|
|
42664
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
42665
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
42666
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
42667
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
42668
|
+
* rollback. Nothing is ever registered automatically.
|
|
42669
|
+
*
|
|
42670
|
+
* Every method is `admin`.
|
|
42671
|
+
*/
|
|
42672
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
42673
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
42674
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
42675
|
+
var TrainingBaseModelSchema = object({
|
|
42676
|
+
modelId: string(),
|
|
42677
|
+
label: string(),
|
|
42678
|
+
weights: string(),
|
|
42679
|
+
imgsz: number().int(),
|
|
42680
|
+
baselineOnnxUrl: string(),
|
|
42681
|
+
baselineFloors: record(string(), number()),
|
|
42682
|
+
/** The base the fleet runs most — the UI's default. */
|
|
42683
|
+
recommended: boolean()
|
|
42684
|
+
});
|
|
42685
|
+
var TrainingPresetSchema = _enum([
|
|
42686
|
+
"quick",
|
|
42687
|
+
"standard",
|
|
42688
|
+
"thorough"
|
|
42689
|
+
]);
|
|
42690
|
+
var TrainingJobRequestSchema = object({
|
|
42691
|
+
datasetVersionId: string().min(1),
|
|
42692
|
+
/** The `training-provider` addon that runs it. */
|
|
42693
|
+
addonId: string().min(1),
|
|
42694
|
+
gpuType: string().min(1),
|
|
42695
|
+
region: string(),
|
|
42696
|
+
baseModelId: string().min(1),
|
|
42697
|
+
preset: TrainingPresetSchema,
|
|
42698
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
42699
|
+
freeze: number().int().nonnegative().nullable(),
|
|
42700
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
42701
|
+
holdoutCameras: array(number().int()).nullable()
|
|
42702
|
+
});
|
|
42703
|
+
var TrainingSplitPlanSchema = object({
|
|
42704
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
42705
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
42706
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
42707
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
42708
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
42709
|
+
trainSubjects: number().int()
|
|
42710
|
+
});
|
|
42711
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
42712
|
+
"unknown-dataset",
|
|
42713
|
+
"unknown-provider",
|
|
42714
|
+
"provider-not-configured",
|
|
42715
|
+
"unknown-base-model",
|
|
42716
|
+
"unknown-gpu",
|
|
42717
|
+
"dataset-too-large",
|
|
42718
|
+
"no-training-subjects",
|
|
42719
|
+
"job-already-running"
|
|
42720
|
+
]);
|
|
42721
|
+
var TrainingJobPlanSchema = object({
|
|
42722
|
+
refusal: object({
|
|
42723
|
+
reason: TrainingRefusalReasonSchema,
|
|
42724
|
+
detail: string()
|
|
42725
|
+
}).nullable(),
|
|
42726
|
+
warnings: array(string()).readonly(),
|
|
42727
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
42728
|
+
estimate: object({
|
|
42729
|
+
datasetBytes: number().int(),
|
|
42730
|
+
uploadMinutesAt20Mbps: number(),
|
|
42731
|
+
gpuSecondsLow: number(),
|
|
42732
|
+
gpuSecondsHigh: number(),
|
|
42733
|
+
usdLow: number(),
|
|
42734
|
+
usdHigh: number(),
|
|
42735
|
+
notes: array(string()).readonly()
|
|
42736
|
+
}).nullable(),
|
|
42737
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
42738
|
+
defaults: object({
|
|
42739
|
+
maxCostUsd: number(),
|
|
42740
|
+
maxRuntimeSec: number().int()
|
|
42741
|
+
}).nullable(),
|
|
42742
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
42743
|
+
dataNotice: string()
|
|
42744
|
+
});
|
|
42745
|
+
/**
|
|
42746
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
42747
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
42748
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
42749
|
+
* result lives after the operator acted on it.
|
|
42750
|
+
*/
|
|
42751
|
+
var TrainingJobStateSchema = _enum([
|
|
42752
|
+
"uploading",
|
|
42753
|
+
"submitted",
|
|
42754
|
+
"starting",
|
|
42755
|
+
"running",
|
|
42756
|
+
"collecting",
|
|
42757
|
+
"ready",
|
|
42758
|
+
"registered",
|
|
42759
|
+
"canary",
|
|
42760
|
+
"failed",
|
|
42761
|
+
"cancelling",
|
|
42762
|
+
"cancelled",
|
|
42763
|
+
"lost",
|
|
42764
|
+
"expired",
|
|
42765
|
+
"discarded"
|
|
42766
|
+
]);
|
|
42767
|
+
var TrainingFailureReasonSchema = _enum([
|
|
42768
|
+
"cost-cap",
|
|
42769
|
+
"runtime-cap",
|
|
42770
|
+
"upload-failed",
|
|
42771
|
+
"submit-failed",
|
|
42772
|
+
"trainer-failed",
|
|
42773
|
+
"result-invalid",
|
|
42774
|
+
"checksum-mismatch",
|
|
42775
|
+
"fetch-failed",
|
|
42776
|
+
"provider-error",
|
|
42777
|
+
"hub-restart-during-upload"
|
|
42778
|
+
]);
|
|
42779
|
+
var TrainingProgressPointSchema = object({
|
|
42780
|
+
epoch: number().int(),
|
|
42781
|
+
map50: number().nullable(),
|
|
42782
|
+
map50_95: number().nullable()
|
|
42783
|
+
});
|
|
42784
|
+
var TrainingCanarySchema = object({
|
|
42785
|
+
deviceIds: array(number().int()).readonly(),
|
|
42786
|
+
since: number(),
|
|
42787
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
42788
|
+
previous: array(object({
|
|
42789
|
+
deviceId: number().int(),
|
|
42790
|
+
nodeId: string(),
|
|
42791
|
+
deviceKey: string(),
|
|
42792
|
+
patch: object({
|
|
42793
|
+
modelId: string().optional(),
|
|
42794
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
42795
|
+
}).nullable()
|
|
42796
|
+
})).readonly()
|
|
42797
|
+
});
|
|
42798
|
+
var TrainingJobSchema = object({
|
|
42799
|
+
id: string(),
|
|
42800
|
+
idempotencyKey: string(),
|
|
42801
|
+
name: string(),
|
|
42802
|
+
createdAt: number(),
|
|
42803
|
+
updatedAt: number(),
|
|
42804
|
+
state: TrainingJobStateSchema,
|
|
42805
|
+
stage: TrainingStageSchema.nullable(),
|
|
42806
|
+
failure: object({
|
|
42807
|
+
reason: TrainingFailureReasonSchema,
|
|
42808
|
+
stage: string().nullable(),
|
|
42809
|
+
detail: string()
|
|
42810
|
+
}).nullable(),
|
|
42811
|
+
request: TrainingJobRequestSchema,
|
|
42812
|
+
maxCostUsd: number().nonnegative(),
|
|
42813
|
+
maxRuntimeSec: number().int().positive(),
|
|
42814
|
+
trainer: TrainerSourceRefSchema,
|
|
42815
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
42816
|
+
dataset: object({
|
|
42817
|
+
bytes: number().int(),
|
|
42818
|
+
sha256: string(),
|
|
42819
|
+
uploadedAt: number()
|
|
42820
|
+
}).nullable(),
|
|
42821
|
+
split: TrainingSplitPlanSchema,
|
|
42822
|
+
provider: object({
|
|
42823
|
+
state: ProviderJobStateSchema.nullable(),
|
|
42824
|
+
providerJobId: string().nullable(),
|
|
42825
|
+
startedAt: number().nullable(),
|
|
42826
|
+
endedAt: number().nullable(),
|
|
42827
|
+
billedSeconds: number(),
|
|
42828
|
+
costUsd: number(),
|
|
42829
|
+
costIsEstimate: boolean(),
|
|
42830
|
+
lastPolledAt: number().nullable()
|
|
42831
|
+
}),
|
|
42832
|
+
progress: object({
|
|
42833
|
+
epoch: number().int().nullable(),
|
|
42834
|
+
epochs: number().int().nullable(),
|
|
42835
|
+
etaSec: number().nullable(),
|
|
42836
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
42837
|
+
}),
|
|
42838
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
42839
|
+
logTail: array(string()).readonly(),
|
|
42840
|
+
logCursor: string().nullable(),
|
|
42841
|
+
artifacts: object({
|
|
42842
|
+
bundleBytes: number().int(),
|
|
42843
|
+
bundleSha256: string(),
|
|
42844
|
+
fetchedAt: number(),
|
|
42845
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
42846
|
+
expiresAt: number()
|
|
42847
|
+
}).nullable(),
|
|
42848
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
42849
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
42850
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
42851
|
+
cloudCleanupDueAt: number().nullable(),
|
|
42852
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
42853
|
+
registeredModelIds: array(string()).readonly(),
|
|
42854
|
+
canary: TrainingCanarySchema.nullable()
|
|
42855
|
+
});
|
|
42856
|
+
var IdInput = object({ id: string().min(1) });
|
|
42857
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
42858
|
+
kind: "mutation",
|
|
42859
|
+
auth: "admin"
|
|
42860
|
+
}), 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() }), {
|
|
42861
|
+
kind: "mutation",
|
|
42862
|
+
auth: "admin"
|
|
42863
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
42864
|
+
auth: "admin",
|
|
42865
|
+
timeoutMs: 6e4
|
|
42866
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
42867
|
+
name: string().min(1).max(120),
|
|
42868
|
+
maxCostUsd: number().positive(),
|
|
42869
|
+
maxRuntimeSec: number().int().positive(),
|
|
42870
|
+
idempotencyKey: string().min(8).max(80)
|
|
42871
|
+
}), discriminatedUnion("kind", [object({
|
|
42872
|
+
kind: literal("started"),
|
|
42873
|
+
job: TrainingJobSchema
|
|
42874
|
+
}), object({
|
|
42875
|
+
kind: literal("refused"),
|
|
42876
|
+
reason: TrainingRefusalReasonSchema,
|
|
42877
|
+
detail: string()
|
|
42878
|
+
})]), {
|
|
42879
|
+
kind: "mutation",
|
|
42880
|
+
auth: "admin",
|
|
42881
|
+
timeoutMs: 12e4
|
|
42882
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
42883
|
+
kind: "mutation",
|
|
42884
|
+
auth: "admin",
|
|
42885
|
+
timeoutMs: 12e4
|
|
42886
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
42887
|
+
kind: "mutation",
|
|
42888
|
+
auth: "admin",
|
|
42889
|
+
timeoutMs: 30 * 6e4
|
|
42890
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
42891
|
+
kind: "mutation",
|
|
42892
|
+
auth: "admin",
|
|
42893
|
+
timeoutMs: 12e4
|
|
42894
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42895
|
+
kind: "mutation",
|
|
42896
|
+
auth: "admin",
|
|
42897
|
+
timeoutMs: 12e4
|
|
42898
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
42899
|
+
kind: "mutation",
|
|
42900
|
+
auth: "admin"
|
|
42901
|
+
});
|
|
39927
42902
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39928
42903
|
Object.freeze({
|
|
39929
42904
|
person: .5,
|
|
@@ -40410,7 +43385,8 @@ var BaseDevice = class {
|
|
|
40410
43385
|
this.role = options.role;
|
|
40411
43386
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40412
43387
|
const seedData = ctx.persistedConfig ?? {};
|
|
40413
|
-
|
|
43388
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
43389
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40414
43390
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40415
43391
|
tags: {
|
|
40416
43392
|
deviceId: ctx.id,
|
|
@@ -42071,6 +45047,12 @@ Object.freeze({
|
|
|
42071
45047
|
addonId: null,
|
|
42072
45048
|
access: "create"
|
|
42073
45049
|
},
|
|
45050
|
+
"backup.checkBackupKey": {
|
|
45051
|
+
capName: "backup",
|
|
45052
|
+
capScope: "system",
|
|
45053
|
+
addonId: null,
|
|
45054
|
+
access: "create"
|
|
45055
|
+
},
|
|
42074
45056
|
"backup.delete": {
|
|
42075
45057
|
capName: "backup",
|
|
42076
45058
|
capScope: "system",
|
|
@@ -42083,6 +45065,18 @@ Object.freeze({
|
|
|
42083
45065
|
addonId: null,
|
|
42084
45066
|
access: "delete"
|
|
42085
45067
|
},
|
|
45068
|
+
"backup.disableEncryption": {
|
|
45069
|
+
capName: "backup",
|
|
45070
|
+
capScope: "system",
|
|
45071
|
+
addonId: null,
|
|
45072
|
+
access: "create"
|
|
45073
|
+
},
|
|
45074
|
+
"backup.getEncryption": {
|
|
45075
|
+
capName: "backup",
|
|
45076
|
+
capScope: "system",
|
|
45077
|
+
addonId: null,
|
|
45078
|
+
access: "view"
|
|
45079
|
+
},
|
|
42086
45080
|
"backup.getEntries": {
|
|
42087
45081
|
capName: "backup",
|
|
42088
45082
|
capScope: "system",
|
|
@@ -42137,6 +45131,12 @@ Object.freeze({
|
|
|
42137
45131
|
addonId: null,
|
|
42138
45132
|
access: "create"
|
|
42139
45133
|
},
|
|
45134
|
+
"backup.setupEncryption": {
|
|
45135
|
+
capName: "backup",
|
|
45136
|
+
capScope: "system",
|
|
45137
|
+
addonId: null,
|
|
45138
|
+
access: "create"
|
|
45139
|
+
},
|
|
42140
45140
|
"backup.trigger": {
|
|
42141
45141
|
capName: "backup",
|
|
42142
45142
|
capScope: "system",
|
|
@@ -42689,6 +45689,12 @@ Object.freeze({
|
|
|
42689
45689
|
addonId: null,
|
|
42690
45690
|
access: "create"
|
|
42691
45691
|
},
|
|
45692
|
+
"customModelRegistry.importModelBundle": {
|
|
45693
|
+
capName: "custom-model-registry",
|
|
45694
|
+
capScope: "system",
|
|
45695
|
+
addonId: null,
|
|
45696
|
+
access: "create"
|
|
45697
|
+
},
|
|
42692
45698
|
"customModelRegistry.listModels": {
|
|
42693
45699
|
capName: "custom-model-registry",
|
|
42694
45700
|
capScope: "system",
|
|
@@ -44099,6 +47105,108 @@ Object.freeze({
|
|
|
44099
47105
|
addonId: null,
|
|
44100
47106
|
access: "create"
|
|
44101
47107
|
},
|
|
47108
|
+
"keychain.delete": {
|
|
47109
|
+
capName: "keychain",
|
|
47110
|
+
capScope: "system",
|
|
47111
|
+
addonId: null,
|
|
47112
|
+
access: "delete"
|
|
47113
|
+
},
|
|
47114
|
+
"keychain.getState": {
|
|
47115
|
+
capName: "keychain",
|
|
47116
|
+
capScope: "system",
|
|
47117
|
+
addonId: null,
|
|
47118
|
+
access: "view"
|
|
47119
|
+
},
|
|
47120
|
+
"keychain.listMeta": {
|
|
47121
|
+
capName: "keychain",
|
|
47122
|
+
capScope: "system",
|
|
47123
|
+
addonId: null,
|
|
47124
|
+
access: "view"
|
|
47125
|
+
},
|
|
47126
|
+
"keychain.put": {
|
|
47127
|
+
capName: "keychain",
|
|
47128
|
+
capScope: "system",
|
|
47129
|
+
addonId: null,
|
|
47130
|
+
access: "create"
|
|
47131
|
+
},
|
|
47132
|
+
"keychain.resolve": {
|
|
47133
|
+
capName: "keychain",
|
|
47134
|
+
capScope: "system",
|
|
47135
|
+
addonId: null,
|
|
47136
|
+
access: "view"
|
|
47137
|
+
},
|
|
47138
|
+
"keychainAdmin.acknowledgeReset": {
|
|
47139
|
+
capName: "keychain-admin",
|
|
47140
|
+
capScope: "system",
|
|
47141
|
+
addonId: null,
|
|
47142
|
+
access: "create"
|
|
47143
|
+
},
|
|
47144
|
+
"keychainAdmin.deleteOrphans": {
|
|
47145
|
+
capName: "keychain-admin",
|
|
47146
|
+
capScope: "system",
|
|
47147
|
+
addonId: null,
|
|
47148
|
+
access: "delete"
|
|
47149
|
+
},
|
|
47150
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
47151
|
+
capName: "keychain-admin",
|
|
47152
|
+
capScope: "system",
|
|
47153
|
+
addonId: null,
|
|
47154
|
+
access: "create"
|
|
47155
|
+
},
|
|
47156
|
+
"keychainAdmin.listAudit": {
|
|
47157
|
+
capName: "keychain-admin",
|
|
47158
|
+
capScope: "system",
|
|
47159
|
+
addonId: null,
|
|
47160
|
+
access: "view"
|
|
47161
|
+
},
|
|
47162
|
+
"keychainAdmin.listSecrets": {
|
|
47163
|
+
capName: "keychain-admin",
|
|
47164
|
+
capScope: "system",
|
|
47165
|
+
addonId: null,
|
|
47166
|
+
access: "view"
|
|
47167
|
+
},
|
|
47168
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
47169
|
+
capName: "keychain-admin",
|
|
47170
|
+
capScope: "system",
|
|
47171
|
+
addonId: null,
|
|
47172
|
+
access: "delete"
|
|
47173
|
+
},
|
|
47174
|
+
"keychainAdmin.resetKeychain": {
|
|
47175
|
+
capName: "keychain-admin",
|
|
47176
|
+
capScope: "system",
|
|
47177
|
+
addonId: null,
|
|
47178
|
+
access: "delete"
|
|
47179
|
+
},
|
|
47180
|
+
"keychainAdmin.resetReport": {
|
|
47181
|
+
capName: "keychain-admin",
|
|
47182
|
+
capScope: "system",
|
|
47183
|
+
addonId: null,
|
|
47184
|
+
access: "delete"
|
|
47185
|
+
},
|
|
47186
|
+
"keychainAdmin.reveal": {
|
|
47187
|
+
capName: "keychain-admin",
|
|
47188
|
+
capScope: "system",
|
|
47189
|
+
addonId: null,
|
|
47190
|
+
access: "create"
|
|
47191
|
+
},
|
|
47192
|
+
"keychainAdmin.rotateMasterKey": {
|
|
47193
|
+
capName: "keychain-admin",
|
|
47194
|
+
capScope: "system",
|
|
47195
|
+
addonId: null,
|
|
47196
|
+
access: "create"
|
|
47197
|
+
},
|
|
47198
|
+
"keychainAdmin.setSystemSecret": {
|
|
47199
|
+
capName: "keychain-admin",
|
|
47200
|
+
capScope: "system",
|
|
47201
|
+
addonId: null,
|
|
47202
|
+
access: "create"
|
|
47203
|
+
},
|
|
47204
|
+
"keychainAdmin.status": {
|
|
47205
|
+
capName: "keychain-admin",
|
|
47206
|
+
capScope: "system",
|
|
47207
|
+
addonId: null,
|
|
47208
|
+
access: "view"
|
|
47209
|
+
},
|
|
44102
47210
|
"lawnMowerControl.dock": {
|
|
44103
47211
|
capName: "lawn-mower-control",
|
|
44104
47212
|
capScope: "device",
|
|
@@ -45473,6 +48581,18 @@ Object.freeze({
|
|
|
45473
48581
|
addonId: null,
|
|
45474
48582
|
access: "create"
|
|
45475
48583
|
},
|
|
48584
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48585
|
+
capName: "pipeline-analytics",
|
|
48586
|
+
capScope: "device",
|
|
48587
|
+
addonId: null,
|
|
48588
|
+
access: "create"
|
|
48589
|
+
},
|
|
48590
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48591
|
+
capName: "pipeline-analytics",
|
|
48592
|
+
capScope: "device",
|
|
48593
|
+
addonId: null,
|
|
48594
|
+
access: "create"
|
|
48595
|
+
},
|
|
45476
48596
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45477
48597
|
capName: "pipeline-analytics",
|
|
45478
48598
|
capScope: "device",
|
|
@@ -45521,12 +48641,36 @@ Object.freeze({
|
|
|
45521
48641
|
addonId: null,
|
|
45522
48642
|
access: "view"
|
|
45523
48643
|
},
|
|
48644
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48645
|
+
capName: "pipeline-analytics",
|
|
48646
|
+
capScope: "device",
|
|
48647
|
+
addonId: null,
|
|
48648
|
+
access: "create"
|
|
48649
|
+
},
|
|
48650
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
48651
|
+
capName: "pipeline-analytics",
|
|
48652
|
+
capScope: "device",
|
|
48653
|
+
addonId: null,
|
|
48654
|
+
access: "create"
|
|
48655
|
+
},
|
|
45524
48656
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45525
48657
|
capName: "pipeline-analytics",
|
|
45526
48658
|
capScope: "device",
|
|
45527
48659
|
addonId: null,
|
|
45528
48660
|
access: "delete"
|
|
45529
48661
|
},
|
|
48662
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48663
|
+
capName: "pipeline-analytics",
|
|
48664
|
+
capScope: "device",
|
|
48665
|
+
addonId: null,
|
|
48666
|
+
access: "delete"
|
|
48667
|
+
},
|
|
48668
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
48669
|
+
capName: "pipeline-analytics",
|
|
48670
|
+
capScope: "device",
|
|
48671
|
+
addonId: null,
|
|
48672
|
+
access: "delete"
|
|
48673
|
+
},
|
|
45530
48674
|
"pipelineAnalytics.deleteTracks": {
|
|
45531
48675
|
capName: "pipeline-analytics",
|
|
45532
48676
|
capScope: "device",
|
|
@@ -45731,6 +48875,30 @@ Object.freeze({
|
|
|
45731
48875
|
addonId: null,
|
|
45732
48876
|
access: "view"
|
|
45733
48877
|
},
|
|
48878
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48879
|
+
capName: "pipeline-analytics",
|
|
48880
|
+
capScope: "device",
|
|
48881
|
+
addonId: null,
|
|
48882
|
+
access: "view"
|
|
48883
|
+
},
|
|
48884
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48885
|
+
capName: "pipeline-analytics",
|
|
48886
|
+
capScope: "device",
|
|
48887
|
+
addonId: null,
|
|
48888
|
+
access: "view"
|
|
48889
|
+
},
|
|
48890
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
48891
|
+
capName: "pipeline-analytics",
|
|
48892
|
+
capScope: "device",
|
|
48893
|
+
addonId: null,
|
|
48894
|
+
access: "view"
|
|
48895
|
+
},
|
|
48896
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
48897
|
+
capName: "pipeline-analytics",
|
|
48898
|
+
capScope: "device",
|
|
48899
|
+
addonId: null,
|
|
48900
|
+
access: "view"
|
|
48901
|
+
},
|
|
45734
48902
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45735
48903
|
capName: "pipeline-analytics",
|
|
45736
48904
|
capScope: "device",
|
|
@@ -45761,6 +48929,12 @@ Object.freeze({
|
|
|
45761
48929
|
addonId: null,
|
|
45762
48930
|
access: "view"
|
|
45763
48931
|
},
|
|
48932
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
48933
|
+
capName: "pipeline-analytics",
|
|
48934
|
+
capScope: "device",
|
|
48935
|
+
addonId: null,
|
|
48936
|
+
access: "create"
|
|
48937
|
+
},
|
|
45764
48938
|
"pipelineAnalytics.ownersWithMedia": {
|
|
45765
48939
|
capName: "pipeline-analytics",
|
|
45766
48940
|
capScope: "device",
|
|
@@ -45773,12 +48947,24 @@ Object.freeze({
|
|
|
45773
48947
|
addonId: null,
|
|
45774
48948
|
access: "create"
|
|
45775
48949
|
},
|
|
48950
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
48951
|
+
capName: "pipeline-analytics",
|
|
48952
|
+
capScope: "device",
|
|
48953
|
+
addonId: null,
|
|
48954
|
+
access: "view"
|
|
48955
|
+
},
|
|
45776
48956
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
45777
48957
|
capName: "pipeline-analytics",
|
|
45778
48958
|
capScope: "device",
|
|
45779
48959
|
addonId: null,
|
|
45780
48960
|
access: "create"
|
|
45781
48961
|
},
|
|
48962
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
48963
|
+
capName: "pipeline-analytics",
|
|
48964
|
+
capScope: "device",
|
|
48965
|
+
addonId: null,
|
|
48966
|
+
access: "create"
|
|
48967
|
+
},
|
|
45782
48968
|
"pipelineAnalytics.pruneEvents": {
|
|
45783
48969
|
capName: "pipeline-analytics",
|
|
45784
48970
|
capScope: "device",
|
|
@@ -45833,6 +49019,18 @@ Object.freeze({
|
|
|
45833
49019
|
addonId: null,
|
|
45834
49020
|
access: "create"
|
|
45835
49021
|
},
|
|
49022
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
49023
|
+
capName: "pipeline-analytics",
|
|
49024
|
+
capScope: "device",
|
|
49025
|
+
addonId: null,
|
|
49026
|
+
access: "delete"
|
|
49027
|
+
},
|
|
49028
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
49029
|
+
capName: "pipeline-analytics",
|
|
49030
|
+
capScope: "device",
|
|
49031
|
+
addonId: null,
|
|
49032
|
+
access: "create"
|
|
49033
|
+
},
|
|
45836
49034
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45837
49035
|
capName: "pipeline-analytics",
|
|
45838
49036
|
capScope: "device",
|
|
@@ -45893,6 +49091,12 @@ Object.freeze({
|
|
|
45893
49091
|
addonId: null,
|
|
45894
49092
|
access: "create"
|
|
45895
49093
|
},
|
|
49094
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
49095
|
+
capName: "pipeline-analytics",
|
|
49096
|
+
capScope: "device",
|
|
49097
|
+
addonId: null,
|
|
49098
|
+
access: "view"
|
|
49099
|
+
},
|
|
45896
49100
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
45897
49101
|
capName: "pipeline-analytics",
|
|
45898
49102
|
capScope: "device",
|
|
@@ -46121,6 +49325,12 @@ Object.freeze({
|
|
|
46121
49325
|
addonId: null,
|
|
46122
49326
|
access: "view"
|
|
46123
49327
|
},
|
|
49328
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
49329
|
+
capName: "pipeline-orchestrator",
|
|
49330
|
+
capScope: "system",
|
|
49331
|
+
addonId: null,
|
|
49332
|
+
access: "create"
|
|
49333
|
+
},
|
|
46124
49334
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46125
49335
|
capName: "pipeline-orchestrator",
|
|
46126
49336
|
capScope: "system",
|
|
@@ -46145,6 +49355,12 @@ Object.freeze({
|
|
|
46145
49355
|
addonId: null,
|
|
46146
49356
|
access: "create"
|
|
46147
49357
|
},
|
|
49358
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
49359
|
+
capName: "pipeline-orchestrator",
|
|
49360
|
+
capScope: "system",
|
|
49361
|
+
addonId: null,
|
|
49362
|
+
access: "delete"
|
|
49363
|
+
},
|
|
46148
49364
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46149
49365
|
capName: "pipeline-orchestrator",
|
|
46150
49366
|
capScope: "system",
|
|
@@ -46253,6 +49469,24 @@ Object.freeze({
|
|
|
46253
49469
|
addonId: null,
|
|
46254
49470
|
access: "view"
|
|
46255
49471
|
},
|
|
49472
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
49473
|
+
capName: "pipeline-orchestrator",
|
|
49474
|
+
capScope: "system",
|
|
49475
|
+
addonId: null,
|
|
49476
|
+
access: "view"
|
|
49477
|
+
},
|
|
49478
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
49479
|
+
capName: "pipeline-orchestrator",
|
|
49480
|
+
capScope: "system",
|
|
49481
|
+
addonId: null,
|
|
49482
|
+
access: "view"
|
|
49483
|
+
},
|
|
49484
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
49485
|
+
capName: "pipeline-orchestrator",
|
|
49486
|
+
capScope: "system",
|
|
49487
|
+
addonId: null,
|
|
49488
|
+
access: "view"
|
|
49489
|
+
},
|
|
46256
49490
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46257
49491
|
capName: "pipeline-orchestrator",
|
|
46258
49492
|
capScope: "system",
|
|
@@ -46295,6 +49529,12 @@ Object.freeze({
|
|
|
46295
49529
|
addonId: null,
|
|
46296
49530
|
access: "view"
|
|
46297
49531
|
},
|
|
49532
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49533
|
+
capName: "pipeline-orchestrator",
|
|
49534
|
+
capScope: "system",
|
|
49535
|
+
addonId: null,
|
|
49536
|
+
access: "view"
|
|
49537
|
+
},
|
|
46298
49538
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46299
49539
|
capName: "pipeline-orchestrator",
|
|
46300
49540
|
capScope: "system",
|
|
@@ -46439,6 +49679,12 @@ Object.freeze({
|
|
|
46439
49679
|
addonId: null,
|
|
46440
49680
|
access: "create"
|
|
46441
49681
|
},
|
|
49682
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49683
|
+
capName: "pipeline-orchestrator",
|
|
49684
|
+
capScope: "system",
|
|
49685
|
+
addonId: null,
|
|
49686
|
+
access: "create"
|
|
49687
|
+
},
|
|
46442
49688
|
"pipelineOrchestrator.suggestShares": {
|
|
46443
49689
|
capName: "pipeline-orchestrator",
|
|
46444
49690
|
capScope: "system",
|
|
@@ -46457,6 +49703,12 @@ Object.freeze({
|
|
|
46457
49703
|
addonId: null,
|
|
46458
49704
|
access: "create"
|
|
46459
49705
|
},
|
|
49706
|
+
"pipelineRunner.abortNodeBench": {
|
|
49707
|
+
capName: "pipeline-runner",
|
|
49708
|
+
capScope: "system",
|
|
49709
|
+
addonId: null,
|
|
49710
|
+
access: "create"
|
|
49711
|
+
},
|
|
46460
49712
|
"pipelineRunner.attachCamera": {
|
|
46461
49713
|
capName: "pipeline-runner",
|
|
46462
49714
|
capScope: "system",
|
|
@@ -46505,6 +49757,12 @@ Object.freeze({
|
|
|
46505
49757
|
addonId: null,
|
|
46506
49758
|
access: "view"
|
|
46507
49759
|
},
|
|
49760
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49761
|
+
capName: "pipeline-runner",
|
|
49762
|
+
capScope: "system",
|
|
49763
|
+
addonId: null,
|
|
49764
|
+
access: "view"
|
|
49765
|
+
},
|
|
46508
49766
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46509
49767
|
capName: "pipeline-runner",
|
|
46510
49768
|
capScope: "system",
|
|
@@ -46547,6 +49805,12 @@ Object.freeze({
|
|
|
46547
49805
|
addonId: null,
|
|
46548
49806
|
access: "create"
|
|
46549
49807
|
},
|
|
49808
|
+
"pipelineRunner.startNodeBench": {
|
|
49809
|
+
capName: "pipeline-runner",
|
|
49810
|
+
capScope: "system",
|
|
49811
|
+
addonId: null,
|
|
49812
|
+
access: "create"
|
|
49813
|
+
},
|
|
46550
49814
|
"plateGallery.assignPlate": {
|
|
46551
49815
|
capName: "plate-gallery",
|
|
46552
49816
|
capScope: "system",
|
|
@@ -48209,6 +51473,174 @@ Object.freeze({
|
|
|
48209
51473
|
addonId: null,
|
|
48210
51474
|
access: "view"
|
|
48211
51475
|
},
|
|
51476
|
+
"training.canaryResult": {
|
|
51477
|
+
capName: "training",
|
|
51478
|
+
capScope: "system",
|
|
51479
|
+
addonId: null,
|
|
51480
|
+
access: "create"
|
|
51481
|
+
},
|
|
51482
|
+
"training.cancelJob": {
|
|
51483
|
+
capName: "training",
|
|
51484
|
+
capScope: "system",
|
|
51485
|
+
addonId: null,
|
|
51486
|
+
access: "create"
|
|
51487
|
+
},
|
|
51488
|
+
"training.discardResult": {
|
|
51489
|
+
capName: "training",
|
|
51490
|
+
capScope: "system",
|
|
51491
|
+
addonId: null,
|
|
51492
|
+
access: "create"
|
|
51493
|
+
},
|
|
51494
|
+
"training.findDatasetVersionIdByName": {
|
|
51495
|
+
capName: "training",
|
|
51496
|
+
capScope: "system",
|
|
51497
|
+
addonId: null,
|
|
51498
|
+
access: "view"
|
|
51499
|
+
},
|
|
51500
|
+
"training.getDatasetVersion": {
|
|
51501
|
+
capName: "training",
|
|
51502
|
+
capScope: "system",
|
|
51503
|
+
addonId: null,
|
|
51504
|
+
access: "view"
|
|
51505
|
+
},
|
|
51506
|
+
"training.getJob": {
|
|
51507
|
+
capName: "training",
|
|
51508
|
+
capScope: "system",
|
|
51509
|
+
addonId: null,
|
|
51510
|
+
access: "view"
|
|
51511
|
+
},
|
|
51512
|
+
"training.getJobResult": {
|
|
51513
|
+
capName: "training",
|
|
51514
|
+
capScope: "system",
|
|
51515
|
+
addonId: null,
|
|
51516
|
+
access: "view"
|
|
51517
|
+
},
|
|
51518
|
+
"training.listBaseModels": {
|
|
51519
|
+
capName: "training",
|
|
51520
|
+
capScope: "system",
|
|
51521
|
+
addonId: null,
|
|
51522
|
+
access: "view"
|
|
51523
|
+
},
|
|
51524
|
+
"training.listDatasetVersions": {
|
|
51525
|
+
capName: "training",
|
|
51526
|
+
capScope: "system",
|
|
51527
|
+
addonId: null,
|
|
51528
|
+
access: "view"
|
|
51529
|
+
},
|
|
51530
|
+
"training.listJobs": {
|
|
51531
|
+
capName: "training",
|
|
51532
|
+
capScope: "system",
|
|
51533
|
+
addonId: null,
|
|
51534
|
+
access: "view"
|
|
51535
|
+
},
|
|
51536
|
+
"training.planJob": {
|
|
51537
|
+
capName: "training",
|
|
51538
|
+
capScope: "system",
|
|
51539
|
+
addonId: null,
|
|
51540
|
+
access: "view"
|
|
51541
|
+
},
|
|
51542
|
+
"training.putDatasetVersion": {
|
|
51543
|
+
capName: "training",
|
|
51544
|
+
capScope: "system",
|
|
51545
|
+
addonId: null,
|
|
51546
|
+
access: "create"
|
|
51547
|
+
},
|
|
51548
|
+
"training.registerResult": {
|
|
51549
|
+
capName: "training",
|
|
51550
|
+
capScope: "system",
|
|
51551
|
+
addonId: null,
|
|
51552
|
+
access: "create"
|
|
51553
|
+
},
|
|
51554
|
+
"training.removeDatasetVersion": {
|
|
51555
|
+
capName: "training",
|
|
51556
|
+
capScope: "system",
|
|
51557
|
+
addonId: null,
|
|
51558
|
+
access: "delete"
|
|
51559
|
+
},
|
|
51560
|
+
"training.rollbackCanary": {
|
|
51561
|
+
capName: "training",
|
|
51562
|
+
capScope: "system",
|
|
51563
|
+
addonId: null,
|
|
51564
|
+
access: "create"
|
|
51565
|
+
},
|
|
51566
|
+
"training.startJob": {
|
|
51567
|
+
capName: "training",
|
|
51568
|
+
capScope: "system",
|
|
51569
|
+
addonId: null,
|
|
51570
|
+
access: "create"
|
|
51571
|
+
},
|
|
51572
|
+
"trainingProvider.cancelJob": {
|
|
51573
|
+
capName: "training-provider",
|
|
51574
|
+
capScope: "system",
|
|
51575
|
+
addonId: null,
|
|
51576
|
+
access: "create"
|
|
51577
|
+
},
|
|
51578
|
+
"trainingProvider.cleanupJob": {
|
|
51579
|
+
capName: "training-provider",
|
|
51580
|
+
capScope: "system",
|
|
51581
|
+
addonId: null,
|
|
51582
|
+
access: "create"
|
|
51583
|
+
},
|
|
51584
|
+
"trainingProvider.describe": {
|
|
51585
|
+
capName: "training-provider",
|
|
51586
|
+
capScope: "system",
|
|
51587
|
+
addonId: null,
|
|
51588
|
+
access: "view"
|
|
51589
|
+
},
|
|
51590
|
+
"trainingProvider.estimateJob": {
|
|
51591
|
+
capName: "training-provider",
|
|
51592
|
+
capScope: "system",
|
|
51593
|
+
addonId: null,
|
|
51594
|
+
access: "view"
|
|
51595
|
+
},
|
|
51596
|
+
"trainingProvider.getJob": {
|
|
51597
|
+
capName: "training-provider",
|
|
51598
|
+
capScope: "system",
|
|
51599
|
+
addonId: null,
|
|
51600
|
+
access: "view"
|
|
51601
|
+
},
|
|
51602
|
+
"trainingProvider.listJobEvents": {
|
|
51603
|
+
capName: "training-provider",
|
|
51604
|
+
capScope: "system",
|
|
51605
|
+
addonId: null,
|
|
51606
|
+
access: "view"
|
|
51607
|
+
},
|
|
51608
|
+
"trainingProvider.listJobs": {
|
|
51609
|
+
capName: "training-provider",
|
|
51610
|
+
capScope: "system",
|
|
51611
|
+
addonId: null,
|
|
51612
|
+
access: "view"
|
|
51613
|
+
},
|
|
51614
|
+
"trainingProvider.offerArtifact": {
|
|
51615
|
+
capName: "training-provider",
|
|
51616
|
+
capScope: "system",
|
|
51617
|
+
addonId: null,
|
|
51618
|
+
access: "create"
|
|
51619
|
+
},
|
|
51620
|
+
"trainingProvider.readResult": {
|
|
51621
|
+
capName: "training-provider",
|
|
51622
|
+
capScope: "system",
|
|
51623
|
+
addonId: null,
|
|
51624
|
+
access: "create"
|
|
51625
|
+
},
|
|
51626
|
+
"trainingProvider.submitJob": {
|
|
51627
|
+
capName: "training-provider",
|
|
51628
|
+
capScope: "system",
|
|
51629
|
+
addonId: null,
|
|
51630
|
+
access: "create"
|
|
51631
|
+
},
|
|
51632
|
+
"trainingProvider.uploadDataset": {
|
|
51633
|
+
capName: "training-provider",
|
|
51634
|
+
capScope: "system",
|
|
51635
|
+
addonId: null,
|
|
51636
|
+
access: "create"
|
|
51637
|
+
},
|
|
51638
|
+
"trainingProvider.validateCredentials": {
|
|
51639
|
+
capName: "training-provider",
|
|
51640
|
+
capScope: "system",
|
|
51641
|
+
addonId: null,
|
|
51642
|
+
access: "create"
|
|
51643
|
+
},
|
|
48212
51644
|
"turnProvider.getTurnServers": {
|
|
48213
51645
|
capName: "turn-provider",
|
|
48214
51646
|
capScope: "system",
|
|
@@ -48233,12 +51665,6 @@ Object.freeze({
|
|
|
48233
51665
|
addonId: null,
|
|
48234
51666
|
access: "create"
|
|
48235
51667
|
},
|
|
48236
|
-
"userManagement.createApiKey": {
|
|
48237
|
-
capName: "user-management",
|
|
48238
|
-
capScope: "system",
|
|
48239
|
-
addonId: null,
|
|
48240
|
-
access: "create"
|
|
48241
|
-
},
|
|
48242
51668
|
"userManagement.createScopedToken": {
|
|
48243
51669
|
capName: "user-management",
|
|
48244
51670
|
capScope: "system",
|
|
@@ -48275,12 +51701,6 @@ Object.freeze({
|
|
|
48275
51701
|
addonId: null,
|
|
48276
51702
|
access: "view"
|
|
48277
51703
|
},
|
|
48278
|
-
"userManagement.linkExternalIdentity": {
|
|
48279
|
-
capName: "user-management",
|
|
48280
|
-
capScope: "system",
|
|
48281
|
-
addonId: null,
|
|
48282
|
-
access: "create"
|
|
48283
|
-
},
|
|
48284
51704
|
"userManagement.listApiKeys": {
|
|
48285
51705
|
capName: "user-management",
|
|
48286
51706
|
capScope: "system",
|
|
@@ -48383,12 +51803,6 @@ Object.freeze({
|
|
|
48383
51803
|
addonId: null,
|
|
48384
51804
|
access: "create"
|
|
48385
51805
|
},
|
|
48386
|
-
"userManagement.validateApiKey": {
|
|
48387
|
-
capName: "user-management",
|
|
48388
|
-
capScope: "system",
|
|
48389
|
-
addonId: null,
|
|
48390
|
-
access: "view"
|
|
48391
|
-
},
|
|
48392
51806
|
"userManagement.validateCredentials": {
|
|
48393
51807
|
capName: "user-management",
|
|
48394
51808
|
capScope: "system",
|
|
@@ -51542,6 +54956,11 @@ Object.freeze({
|
|
|
51542
54956
|
form: "single",
|
|
51543
54957
|
optional: false
|
|
51544
54958
|
}],
|
|
54959
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
54960
|
+
name: "deviceId",
|
|
54961
|
+
form: "single",
|
|
54962
|
+
optional: false
|
|
54963
|
+
}],
|
|
51545
54964
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51546
54965
|
name: "deviceId",
|
|
51547
54966
|
form: "single",
|
|
@@ -51732,6 +55151,11 @@ Object.freeze({
|
|
|
51732
55151
|
form: "single",
|
|
51733
55152
|
optional: false
|
|
51734
55153
|
}],
|
|
55154
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
55155
|
+
name: "deviceId",
|
|
55156
|
+
form: "single",
|
|
55157
|
+
optional: false
|
|
55158
|
+
}],
|
|
51735
55159
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51736
55160
|
name: "deviceId",
|
|
51737
55161
|
form: "single",
|
|
@@ -52558,6 +55982,11 @@ Object.freeze({
|
|
|
52558
55982
|
form: "single",
|
|
52559
55983
|
optional: false
|
|
52560
55984
|
}],
|
|
55985
|
+
"training.canaryResult": [{
|
|
55986
|
+
name: "deviceIds",
|
|
55987
|
+
form: "array",
|
|
55988
|
+
optional: false
|
|
55989
|
+
}],
|
|
52561
55990
|
"update.getStatus": [{
|
|
52562
55991
|
name: "deviceId",
|
|
52563
55992
|
form: "single",
|
|
@@ -53860,7 +57289,12 @@ var CREDENTIAL_PARAM_PATTERNS = [
|
|
|
53860
57289
|
/^bearer$/i,
|
|
53861
57290
|
/^api[_-]?key$/i,
|
|
53862
57291
|
/^access[_-]?token$/i,
|
|
53863
|
-
/^refresh[_-]?token$/i
|
|
57292
|
+
/^refresh[_-]?token$/i,
|
|
57293
|
+
/^bridge$/i,
|
|
57294
|
+
/^code$/i,
|
|
57295
|
+
/^state$/i,
|
|
57296
|
+
/^challenge$/i,
|
|
57297
|
+
/^link$/i
|
|
53864
57298
|
];
|
|
53865
57299
|
function isCredentialParam(name) {
|
|
53866
57300
|
return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
|
|
@@ -53882,6 +57316,10 @@ function isCredentialParam(name) {
|
|
|
53882
57316
|
* are NOT masked (those are entity references, not credentials).
|
|
53883
57317
|
*/
|
|
53884
57318
|
function maskUrlCredentials(rawUrl) {
|
|
57319
|
+
if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
|
|
57320
|
+
const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
|
|
57321
|
+
return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
|
|
57322
|
+
}
|
|
53885
57323
|
try {
|
|
53886
57324
|
const u = new URL(rawUrl);
|
|
53887
57325
|
let touched = false;
|