@camstack/addon-tailscale 1.2.119 → 1.2.121
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/{auth-key-file-Czokmvfx.js → auth-key-file-Bh3STbNm.js} +3490 -125
- package/dist/{auth-key-file-CVMhmHD4.mjs → auth-key-file-DZtXVeVu.mjs} +3490 -125
- package/dist/client/tailscale.addon.js +2 -5
- package/dist/client/tailscale.addon.mjs +2 -5
- package/dist/ingress/tailscale-ingress.addon.js +1 -1
- package/dist/ingress/tailscale-ingress.addon.mjs +1 -1
- package/package.json +3 -2
|
@@ -26,7 +26,7 @@ let node_os = require("node:os");
|
|
|
26
26
|
node_os = __toESM(node_os);
|
|
27
27
|
let node_path = require("node:path");
|
|
28
28
|
node_path = __toESM(node_path);
|
|
29
|
-
//#region ../types/dist/event-category-
|
|
29
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
30
30
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
31
31
|
EventCategory["SystemBoot"] = "system.boot";
|
|
32
32
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -105,6 +105,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
105
105
|
*/
|
|
106
106
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
107
107
|
/**
|
|
108
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
109
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
110
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
111
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
112
|
+
*/
|
|
113
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
114
|
+
/**
|
|
108
115
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
109
116
|
* transitions from `failed` back to `healthy` (typically via the
|
|
110
117
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5397,7 +5404,7 @@ var ZodIssueCode = {
|
|
|
5397
5404
|
var ZodFirstPartyTypeKind;
|
|
5398
5405
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5399
5406
|
//#endregion
|
|
5400
|
-
//#region ../types/dist/sleep-
|
|
5407
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5401
5408
|
/**
|
|
5402
5409
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5403
5410
|
* window to float samples (D455).
|
|
@@ -5476,6 +5483,97 @@ function buildAlawTable() {
|
|
|
5476
5483
|
}
|
|
5477
5484
|
buildUlawTable();
|
|
5478
5485
|
buildAlawTable();
|
|
5486
|
+
/** Is this field's stored value a credential? */
|
|
5487
|
+
function isSecretConfigField(field) {
|
|
5488
|
+
if (field.type === "password") return true;
|
|
5489
|
+
return "secret" in field && field.secret === true;
|
|
5490
|
+
}
|
|
5491
|
+
/**
|
|
5492
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5493
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5494
|
+
*/
|
|
5495
|
+
function isKeychainStoredField(field) {
|
|
5496
|
+
if (!isSecretConfigField(field)) return false;
|
|
5497
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5498
|
+
return !("storage" in field && field.storage === "inline");
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* What a settings blob holds where a secret used to be.
|
|
5502
|
+
*
|
|
5503
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5504
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5505
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5506
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5507
|
+
*
|
|
5508
|
+
* The same shapes travel to and from the admin UI:
|
|
5509
|
+
*
|
|
5510
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5511
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5512
|
+
* value is set, never the value.
|
|
5513
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5514
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5515
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5516
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5517
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5518
|
+
*
|
|
5519
|
+
* Pure and browser-safe.
|
|
5520
|
+
*/
|
|
5521
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5522
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5523
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5524
|
+
function isRecord$2(value) {
|
|
5525
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5526
|
+
}
|
|
5527
|
+
function makeSecretMarker(ref) {
|
|
5528
|
+
return {
|
|
5529
|
+
$secret: ref,
|
|
5530
|
+
v: 1
|
|
5531
|
+
};
|
|
5532
|
+
}
|
|
5533
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5534
|
+
function isSecretMarker(value) {
|
|
5535
|
+
if (!isRecord$2(value)) return false;
|
|
5536
|
+
const ref = value["$secret"];
|
|
5537
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5538
|
+
}
|
|
5539
|
+
function isSecretClear(value) {
|
|
5540
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5541
|
+
}
|
|
5542
|
+
/**
|
|
5543
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5544
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5545
|
+
* survives this function.
|
|
5546
|
+
*/
|
|
5547
|
+
function toSecretFieldView(stored) {
|
|
5548
|
+
if (isSecretMarker(stored)) return {
|
|
5549
|
+
$secret: stored.$secret,
|
|
5550
|
+
v: 1,
|
|
5551
|
+
set: true
|
|
5552
|
+
};
|
|
5553
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5554
|
+
$secret: null,
|
|
5555
|
+
v: 1,
|
|
5556
|
+
set: true,
|
|
5557
|
+
inline: true
|
|
5558
|
+
};
|
|
5559
|
+
return null;
|
|
5560
|
+
}
|
|
5561
|
+
/**
|
|
5562
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5563
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5564
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5565
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5566
|
+
*/
|
|
5567
|
+
function classifySecretWrite(incoming) {
|
|
5568
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5569
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5570
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5571
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5572
|
+
return {
|
|
5573
|
+
kind: "set",
|
|
5574
|
+
value: incoming
|
|
5575
|
+
};
|
|
5576
|
+
}
|
|
5479
5577
|
Object.fromEntries([
|
|
5480
5578
|
{
|
|
5481
5579
|
id: "overview",
|
|
@@ -5647,33 +5745,19 @@ Object.fromEntries([
|
|
|
5647
5745
|
function isValuelessField(field) {
|
|
5648
5746
|
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";
|
|
5649
5747
|
}
|
|
5650
|
-
|
|
5651
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5652
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5653
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5654
|
-
*
|
|
5655
|
-
* For each leaf field:
|
|
5656
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5657
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5658
|
-
*
|
|
5659
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5660
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5661
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5662
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5663
|
-
*/
|
|
5664
|
-
function hydrateSchema(schema, values) {
|
|
5748
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5665
5749
|
return {
|
|
5666
5750
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5667
5751
|
sections: schema.sections.map((section) => ({
|
|
5668
5752
|
...section,
|
|
5669
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5753
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5670
5754
|
}))
|
|
5671
5755
|
};
|
|
5672
5756
|
}
|
|
5673
|
-
function hydrateField(field, values) {
|
|
5757
|
+
function hydrateField(field, values, options) {
|
|
5674
5758
|
if (isValuelessField(field)) return field;
|
|
5675
5759
|
if (field.type === "group") {
|
|
5676
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5760
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5677
5761
|
return {
|
|
5678
5762
|
...field,
|
|
5679
5763
|
fields: hydratedChildren
|
|
@@ -5682,7 +5766,7 @@ function hydrateField(field, values) {
|
|
|
5682
5766
|
if (field.type === "sub-tabs") {
|
|
5683
5767
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5684
5768
|
...tab,
|
|
5685
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5769
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5686
5770
|
}));
|
|
5687
5771
|
return {
|
|
5688
5772
|
...field,
|
|
@@ -5692,6 +5776,33 @@ function hydrateField(field, values) {
|
|
|
5692
5776
|
const key = field.key;
|
|
5693
5777
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5694
5778
|
const defaultValue = field.default;
|
|
5779
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5780
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5781
|
+
...field,
|
|
5782
|
+
value: toSecretFieldView(storedValue)
|
|
5783
|
+
};
|
|
5784
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5785
|
+
...field,
|
|
5786
|
+
value: null
|
|
5787
|
+
};
|
|
5788
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5789
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5790
|
+
if (secretItemKeys.length > 0) {
|
|
5791
|
+
const rows = storedValue.map((row) => {
|
|
5792
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5793
|
+
const out = { ...row };
|
|
5794
|
+
for (const k of secretItemKeys) {
|
|
5795
|
+
const v = Reflect.get(row, k);
|
|
5796
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5797
|
+
}
|
|
5798
|
+
return out;
|
|
5799
|
+
});
|
|
5800
|
+
return {
|
|
5801
|
+
...field,
|
|
5802
|
+
value: rows
|
|
5803
|
+
};
|
|
5804
|
+
}
|
|
5805
|
+
}
|
|
5695
5806
|
if (field.multiple) {
|
|
5696
5807
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5697
5808
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5934,6 +6045,778 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5934
6045
|
}
|
|
5935
6046
|
return out;
|
|
5936
6047
|
}
|
|
6048
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6049
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6050
|
+
function globalSecretScope() {
|
|
6051
|
+
return GLOBAL_SCOPE;
|
|
6052
|
+
}
|
|
6053
|
+
function encodeSegment(value) {
|
|
6054
|
+
return encodeURIComponent(value);
|
|
6055
|
+
}
|
|
6056
|
+
function decodeSegment(value) {
|
|
6057
|
+
try {
|
|
6058
|
+
return decodeURIComponent(value);
|
|
6059
|
+
} catch {
|
|
6060
|
+
return null;
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
/**
|
|
6064
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6065
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6066
|
+
* `providers[authentik].clientSecret`.
|
|
6067
|
+
*/
|
|
6068
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6069
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6070
|
+
}
|
|
6071
|
+
function parseScope(segments) {
|
|
6072
|
+
switch (segments[0]) {
|
|
6073
|
+
case "global": return {
|
|
6074
|
+
scope: GLOBAL_SCOPE,
|
|
6075
|
+
used: 1
|
|
6076
|
+
};
|
|
6077
|
+
case "node": {
|
|
6078
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6079
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6080
|
+
scope: {
|
|
6081
|
+
kind: "node",
|
|
6082
|
+
nodeId
|
|
6083
|
+
},
|
|
6084
|
+
used: 2
|
|
6085
|
+
};
|
|
6086
|
+
}
|
|
6087
|
+
case "device": {
|
|
6088
|
+
const raw = segments[1];
|
|
6089
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6090
|
+
return {
|
|
6091
|
+
scope: {
|
|
6092
|
+
kind: "device",
|
|
6093
|
+
deviceId: Number(raw)
|
|
6094
|
+
},
|
|
6095
|
+
used: 2
|
|
6096
|
+
};
|
|
6097
|
+
}
|
|
6098
|
+
case "integration": {
|
|
6099
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6100
|
+
return id === null || id.length === 0 ? null : {
|
|
6101
|
+
scope: {
|
|
6102
|
+
kind: "integration",
|
|
6103
|
+
integrationId: id
|
|
6104
|
+
},
|
|
6105
|
+
used: 2
|
|
6106
|
+
};
|
|
6107
|
+
}
|
|
6108
|
+
case "row": {
|
|
6109
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6110
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6111
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6112
|
+
return {
|
|
6113
|
+
scope: {
|
|
6114
|
+
kind: "row",
|
|
6115
|
+
collection,
|
|
6116
|
+
rowId
|
|
6117
|
+
},
|
|
6118
|
+
used: 3
|
|
6119
|
+
};
|
|
6120
|
+
}
|
|
6121
|
+
default: return null;
|
|
6122
|
+
}
|
|
6123
|
+
}
|
|
6124
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6125
|
+
function parseSecretRef(ref) {
|
|
6126
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6127
|
+
const segments = ref.slice(9).split("/");
|
|
6128
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6129
|
+
if (owner === null || owner.length === 0) return null;
|
|
6130
|
+
const parsed = parseScope(segments.slice(1));
|
|
6131
|
+
if (parsed === null) return null;
|
|
6132
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6133
|
+
if (fieldPath.length === 0) return null;
|
|
6134
|
+
return {
|
|
6135
|
+
owner,
|
|
6136
|
+
scope: parsed.scope,
|
|
6137
|
+
fieldPath
|
|
6138
|
+
};
|
|
6139
|
+
}
|
|
6140
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6141
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6142
|
+
fieldPath;
|
|
6143
|
+
constructor(fieldPath, cause) {
|
|
6144
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6145
|
+
this.fieldPath = fieldPath;
|
|
6146
|
+
this.name = "KeychainWriteRefusedError";
|
|
6147
|
+
}
|
|
6148
|
+
};
|
|
6149
|
+
var KEEP = { kind: "keep" };
|
|
6150
|
+
function isRecord$1(value) {
|
|
6151
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6152
|
+
}
|
|
6153
|
+
function defaultMintId() {
|
|
6154
|
+
return globalThis.crypto.randomUUID();
|
|
6155
|
+
}
|
|
6156
|
+
/** Every marker ref anywhere under `value`. */
|
|
6157
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6158
|
+
if (isSecretMarker(value)) {
|
|
6159
|
+
out.push(value.$secret);
|
|
6160
|
+
return out;
|
|
6161
|
+
}
|
|
6162
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6163
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6164
|
+
return out;
|
|
6165
|
+
}
|
|
6166
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6167
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6168
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6169
|
+
}
|
|
6170
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6171
|
+
const intent = classifySecretWrite(incoming);
|
|
6172
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6173
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6174
|
+
if (intent.kind === "keep") return KEEP;
|
|
6175
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6176
|
+
if (intent.kind === "clear") {
|
|
6177
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6178
|
+
return {
|
|
6179
|
+
kind: "value",
|
|
6180
|
+
value: null
|
|
6181
|
+
};
|
|
6182
|
+
}
|
|
6183
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6184
|
+
kind: "value",
|
|
6185
|
+
value: stored
|
|
6186
|
+
};
|
|
6187
|
+
try {
|
|
6188
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6189
|
+
} catch (err) {
|
|
6190
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6191
|
+
}
|
|
6192
|
+
return {
|
|
6193
|
+
kind: "value",
|
|
6194
|
+
value: makeSecretMarker(ref)
|
|
6195
|
+
};
|
|
6196
|
+
}
|
|
6197
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6198
|
+
function applyMember(out, key, result, storedParent) {
|
|
6199
|
+
if (result.kind === "value") {
|
|
6200
|
+
out[key] = result.value;
|
|
6201
|
+
return;
|
|
6202
|
+
}
|
|
6203
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6204
|
+
else delete out[key];
|
|
6205
|
+
}
|
|
6206
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6207
|
+
const out = { ...incoming };
|
|
6208
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6209
|
+
return out;
|
|
6210
|
+
}
|
|
6211
|
+
function rowId(row, idKey) {
|
|
6212
|
+
const raw = row[idKey];
|
|
6213
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6214
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6215
|
+
return null;
|
|
6216
|
+
}
|
|
6217
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6218
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6219
|
+
if (!Array.isArray(incoming)) {
|
|
6220
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6221
|
+
return {
|
|
6222
|
+
kind: "value",
|
|
6223
|
+
value: incoming
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6227
|
+
for (const row of storedRows) {
|
|
6228
|
+
const id = rowId(row, node.idKey);
|
|
6229
|
+
if (id !== null) storedById.set(id, row);
|
|
6230
|
+
}
|
|
6231
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6232
|
+
const rows = [];
|
|
6233
|
+
for (const row of incoming) {
|
|
6234
|
+
if (!isRecord$1(row)) {
|
|
6235
|
+
rows.push(row);
|
|
6236
|
+
continue;
|
|
6237
|
+
}
|
|
6238
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6239
|
+
kept.add(id);
|
|
6240
|
+
const withId = {
|
|
6241
|
+
...row,
|
|
6242
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6243
|
+
};
|
|
6244
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6245
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6246
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6247
|
+
}
|
|
6248
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6249
|
+
return {
|
|
6250
|
+
kind: "value",
|
|
6251
|
+
value: rows
|
|
6252
|
+
};
|
|
6253
|
+
}
|
|
6254
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6255
|
+
switch (node.kind) {
|
|
6256
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6257
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6258
|
+
case "object": {
|
|
6259
|
+
if (!isRecord$1(incoming)) {
|
|
6260
|
+
if (incoming === void 0) return KEEP;
|
|
6261
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6262
|
+
return {
|
|
6263
|
+
kind: "value",
|
|
6264
|
+
value: incoming
|
|
6265
|
+
};
|
|
6266
|
+
}
|
|
6267
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6268
|
+
return {
|
|
6269
|
+
kind: "value",
|
|
6270
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6276
|
+
function splitNodeKey(key) {
|
|
6277
|
+
const at = key.indexOf("@");
|
|
6278
|
+
return at <= 0 ? {
|
|
6279
|
+
base: key,
|
|
6280
|
+
nodeId: null
|
|
6281
|
+
} : {
|
|
6282
|
+
base: key.slice(0, at),
|
|
6283
|
+
nodeId: key.slice(at + 1)
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6287
|
+
async function transformSecretWrite(input) {
|
|
6288
|
+
const deletes = [];
|
|
6289
|
+
const base = {
|
|
6290
|
+
secrets: input.secrets,
|
|
6291
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6292
|
+
deletes,
|
|
6293
|
+
operatorWrite: input.operatorWrite === true
|
|
6294
|
+
};
|
|
6295
|
+
const out = {};
|
|
6296
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6297
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6298
|
+
const node = input.tree.get(baseKey);
|
|
6299
|
+
if (node === void 0) {
|
|
6300
|
+
out[key] = incoming;
|
|
6301
|
+
continue;
|
|
6302
|
+
}
|
|
6303
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6304
|
+
kind: "node",
|
|
6305
|
+
nodeId
|
|
6306
|
+
} : input.scope ?? globalSecretScope();
|
|
6307
|
+
const result = await writeNode({
|
|
6308
|
+
...base,
|
|
6309
|
+
scope
|
|
6310
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6311
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6312
|
+
}
|
|
6313
|
+
return {
|
|
6314
|
+
patch: out,
|
|
6315
|
+
afterWrite: async () => {
|
|
6316
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6317
|
+
try {
|
|
6318
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6319
|
+
return { orphaned: [] };
|
|
6320
|
+
} catch {
|
|
6321
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
};
|
|
6325
|
+
}
|
|
6326
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6327
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6328
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6329
|
+
}
|
|
6330
|
+
/**
|
|
6331
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6332
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6333
|
+
*/
|
|
6334
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6335
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6336
|
+
const owner = options.ownedBy;
|
|
6337
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6338
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6339
|
+
if (refs.length === 0) return {
|
|
6340
|
+
value,
|
|
6341
|
+
unresolved: []
|
|
6342
|
+
};
|
|
6343
|
+
const answers = await secrets.resolve(refs);
|
|
6344
|
+
const unresolved = [];
|
|
6345
|
+
for (const ref of new Set(refs)) {
|
|
6346
|
+
const answer = answers[ref];
|
|
6347
|
+
if (answer === void 0) unresolved.push({
|
|
6348
|
+
ref,
|
|
6349
|
+
reason: "not-initialized"
|
|
6350
|
+
});
|
|
6351
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6352
|
+
ref,
|
|
6353
|
+
reason: answer.reason
|
|
6354
|
+
});
|
|
6355
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6356
|
+
ref,
|
|
6357
|
+
reason: answer.kind
|
|
6358
|
+
});
|
|
6359
|
+
}
|
|
6360
|
+
const substitute = (v) => {
|
|
6361
|
+
if (isSecretMarker(v)) {
|
|
6362
|
+
if (!inScope(v.$secret)) return {
|
|
6363
|
+
keep: true,
|
|
6364
|
+
value: v
|
|
6365
|
+
};
|
|
6366
|
+
const answer = answers[v.$secret];
|
|
6367
|
+
if (answer?.kind === "value") return {
|
|
6368
|
+
keep: true,
|
|
6369
|
+
value: answer.value
|
|
6370
|
+
};
|
|
6371
|
+
return keepMarker ? {
|
|
6372
|
+
keep: true,
|
|
6373
|
+
value: v
|
|
6374
|
+
} : {
|
|
6375
|
+
keep: false,
|
|
6376
|
+
value: void 0
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6379
|
+
if (Array.isArray(v)) {
|
|
6380
|
+
const items = [];
|
|
6381
|
+
for (const item of v) {
|
|
6382
|
+
const s = substitute(item);
|
|
6383
|
+
if (s.keep) items.push(s.value);
|
|
6384
|
+
}
|
|
6385
|
+
return {
|
|
6386
|
+
keep: true,
|
|
6387
|
+
value: items
|
|
6388
|
+
};
|
|
6389
|
+
}
|
|
6390
|
+
if (isRecord$1(v)) {
|
|
6391
|
+
const out = {};
|
|
6392
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6393
|
+
const s = substitute(child);
|
|
6394
|
+
if (s.keep) out[k] = s.value;
|
|
6395
|
+
}
|
|
6396
|
+
return {
|
|
6397
|
+
keep: true,
|
|
6398
|
+
value: out
|
|
6399
|
+
};
|
|
6400
|
+
}
|
|
6401
|
+
return {
|
|
6402
|
+
keep: true,
|
|
6403
|
+
value: v
|
|
6404
|
+
};
|
|
6405
|
+
};
|
|
6406
|
+
return {
|
|
6407
|
+
value: substitute(value).value,
|
|
6408
|
+
unresolved
|
|
6409
|
+
};
|
|
6410
|
+
}
|
|
6411
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6412
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6413
|
+
ref;
|
|
6414
|
+
reason;
|
|
6415
|
+
constructor(ref, reason) {
|
|
6416
|
+
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.`);
|
|
6417
|
+
this.ref = ref;
|
|
6418
|
+
this.reason = reason;
|
|
6419
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6420
|
+
}
|
|
6421
|
+
};
|
|
6422
|
+
function isRecord(value) {
|
|
6423
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6424
|
+
}
|
|
6425
|
+
function resolvedValue(pass, marker) {
|
|
6426
|
+
const answer = pass.answers[marker.$secret];
|
|
6427
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6428
|
+
}
|
|
6429
|
+
async function atMarker(pass, incoming, stored) {
|
|
6430
|
+
if (incoming === null) return stored;
|
|
6431
|
+
if (typeof incoming !== "string") return incoming;
|
|
6432
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6433
|
+
const intent = classifySecretWrite(incoming);
|
|
6434
|
+
if (intent.kind !== "set") return stored;
|
|
6435
|
+
const ref = stored.$secret;
|
|
6436
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6437
|
+
const answer = pass.answers[ref];
|
|
6438
|
+
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);
|
|
6439
|
+
try {
|
|
6440
|
+
await pass.secrets.put(ref, intent.value);
|
|
6441
|
+
} catch (err) {
|
|
6442
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6443
|
+
}
|
|
6444
|
+
pass.changedRefs.push(ref);
|
|
6445
|
+
return stored;
|
|
6446
|
+
}
|
|
6447
|
+
function inArray(pass, incoming, stored) {
|
|
6448
|
+
return incoming.map((item, index) => {
|
|
6449
|
+
const twin = stored[index];
|
|
6450
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6451
|
+
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6452
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6453
|
+
return item;
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6457
|
+
const out = { ...incoming };
|
|
6458
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6459
|
+
const twin = stored[key];
|
|
6460
|
+
if (isSecretMarker(twin)) {
|
|
6461
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6462
|
+
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6463
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6464
|
+
}
|
|
6465
|
+
return out;
|
|
6466
|
+
}
|
|
6467
|
+
async function walk(pass, incoming, stored) {
|
|
6468
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6469
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6470
|
+
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6471
|
+
const out = { ...incoming };
|
|
6472
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6473
|
+
return out;
|
|
6474
|
+
}
|
|
6475
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6476
|
+
async function restoreUnchangedSecrets(input) {
|
|
6477
|
+
const refs = [];
|
|
6478
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6479
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6480
|
+
if (owned.length === 0) return {
|
|
6481
|
+
patch: input.patch,
|
|
6482
|
+
changedRefs: []
|
|
6483
|
+
};
|
|
6484
|
+
const pass = {
|
|
6485
|
+
secrets: input.secrets,
|
|
6486
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6487
|
+
operatorWrite: input.operatorWrite,
|
|
6488
|
+
changedRefs: []
|
|
6489
|
+
};
|
|
6490
|
+
const out = {};
|
|
6491
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6492
|
+
return {
|
|
6493
|
+
patch: out,
|
|
6494
|
+
changedRefs: pass.changedRefs
|
|
6495
|
+
};
|
|
6496
|
+
}
|
|
6497
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6498
|
+
function isJsonEqual(a, b) {
|
|
6499
|
+
if (Object.is(a, b)) return true;
|
|
6500
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6501
|
+
if (isRecord(a) && isRecord(b)) {
|
|
6502
|
+
const keys = Object.keys(a);
|
|
6503
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6504
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6505
|
+
}
|
|
6506
|
+
return false;
|
|
6507
|
+
}
|
|
6508
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6509
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6510
|
+
const out = {};
|
|
6511
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6512
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6513
|
+
out[key] = value;
|
|
6514
|
+
}
|
|
6515
|
+
return out;
|
|
6516
|
+
}
|
|
6517
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6518
|
+
function markerKeysOf(blob, owner) {
|
|
6519
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6520
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6521
|
+
return keys;
|
|
6522
|
+
}
|
|
6523
|
+
function nodeFromStored(value, owner) {
|
|
6524
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6525
|
+
if (!isRecord(value)) return null;
|
|
6526
|
+
const children = /* @__PURE__ */ new Map();
|
|
6527
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6528
|
+
const node = nodeFromStored(child, owner);
|
|
6529
|
+
if (node !== null) children.set(key, node);
|
|
6530
|
+
}
|
|
6531
|
+
return children.size > 0 ? {
|
|
6532
|
+
kind: "object",
|
|
6533
|
+
children
|
|
6534
|
+
} : null;
|
|
6535
|
+
}
|
|
6536
|
+
/**
|
|
6537
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6538
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6539
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6540
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6541
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6542
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6543
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6544
|
+
* over.
|
|
6545
|
+
*/
|
|
6546
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6547
|
+
const added = /* @__PURE__ */ new Map();
|
|
6548
|
+
for (const key of keys) {
|
|
6549
|
+
const at = key.indexOf("@");
|
|
6550
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6551
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6552
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6553
|
+
if (node !== null) added.set(base, node);
|
|
6554
|
+
}
|
|
6555
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6556
|
+
}
|
|
6557
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6558
|
+
async function readStoredAddonBlob(raw) {
|
|
6559
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6560
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6561
|
+
const result = await threeWay.call(raw);
|
|
6562
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6563
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6564
|
+
}
|
|
6565
|
+
function touchesTree(tree, patch) {
|
|
6566
|
+
if (tree.size === 0) return false;
|
|
6567
|
+
for (const key of Object.keys(patch)) {
|
|
6568
|
+
const at = key.indexOf("@");
|
|
6569
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6570
|
+
}
|
|
6571
|
+
return false;
|
|
6572
|
+
}
|
|
6573
|
+
/**
|
|
6574
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6575
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6576
|
+
*/
|
|
6577
|
+
var MarkerKeyIndex = class {
|
|
6578
|
+
owner;
|
|
6579
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6580
|
+
constructor(owner) {
|
|
6581
|
+
this.owner = owner;
|
|
6582
|
+
}
|
|
6583
|
+
seen(store, blob) {
|
|
6584
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6585
|
+
}
|
|
6586
|
+
wrote(store, patch) {
|
|
6587
|
+
const keys = this.byStore.get(store);
|
|
6588
|
+
if (keys === void 0) return;
|
|
6589
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6590
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6591
|
+
else keys.delete(key);
|
|
6592
|
+
}
|
|
6593
|
+
mayHoldMarkers(store, patch) {
|
|
6594
|
+
const keys = this.byStore.get(store);
|
|
6595
|
+
if (keys === void 0) return true;
|
|
6596
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6597
|
+
}
|
|
6598
|
+
};
|
|
6599
|
+
function createHandle(raw, opts) {
|
|
6600
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6601
|
+
const serialize = (key, fn) => {
|
|
6602
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6603
|
+
const tail = next.catch(() => void 0);
|
|
6604
|
+
chains.set(key, tail);
|
|
6605
|
+
tail.then(() => {
|
|
6606
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6607
|
+
});
|
|
6608
|
+
return next;
|
|
6609
|
+
};
|
|
6610
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6611
|
+
const resolveRead = async (store, blob) => {
|
|
6612
|
+
index.seen(store, blob);
|
|
6613
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6614
|
+
unresolved: "keep-marker",
|
|
6615
|
+
ownedBy: opts.secrets.owner
|
|
6616
|
+
});
|
|
6617
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6618
|
+
return value;
|
|
6619
|
+
};
|
|
6620
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6621
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6622
|
+
await rawWrite(patch);
|
|
6623
|
+
index.wrote(store, patch);
|
|
6624
|
+
return { changed: true };
|
|
6625
|
+
}
|
|
6626
|
+
return serialize(store, async () => {
|
|
6627
|
+
const stored = await readStored();
|
|
6628
|
+
index.seen(store, stored);
|
|
6629
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6630
|
+
const restored = await restoreUnchangedSecrets({
|
|
6631
|
+
patch,
|
|
6632
|
+
stored,
|
|
6633
|
+
secrets: opts.secrets,
|
|
6634
|
+
operatorWrite
|
|
6635
|
+
});
|
|
6636
|
+
const result = await transformSecretWrite({
|
|
6637
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6638
|
+
secrets: opts.secrets,
|
|
6639
|
+
patch: restored.patch,
|
|
6640
|
+
stored,
|
|
6641
|
+
...scope !== void 0 ? { scope } : {},
|
|
6642
|
+
operatorWrite
|
|
6643
|
+
});
|
|
6644
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
6645
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
6646
|
+
if (wroteBlob) {
|
|
6647
|
+
await rawWrite(effective);
|
|
6648
|
+
index.wrote(store, effective);
|
|
6649
|
+
}
|
|
6650
|
+
const { orphaned } = await result.afterWrite();
|
|
6651
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6652
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6653
|
+
});
|
|
6654
|
+
};
|
|
6655
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6656
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6657
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6658
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6659
|
+
const overrides = {
|
|
6660
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6661
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
6662
|
+
const result = await readAddonStoreResult.call(raw);
|
|
6663
|
+
return result.kind === "value" ? {
|
|
6664
|
+
kind: "value",
|
|
6665
|
+
value: await resolveRead("addon", result.value)
|
|
6666
|
+
} : result;
|
|
6667
|
+
} } : {},
|
|
6668
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
6669
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
6670
|
+
if (result.kind !== "present") return result;
|
|
6671
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
6672
|
+
unresolved: "keep-marker",
|
|
6673
|
+
ownedBy: opts.secrets.owner
|
|
6674
|
+
});
|
|
6675
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6676
|
+
return {
|
|
6677
|
+
kind: "present",
|
|
6678
|
+
value: value[key]
|
|
6679
|
+
};
|
|
6680
|
+
} } : {},
|
|
6681
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6682
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
6683
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
6684
|
+
const out = /* @__PURE__ */ new Map();
|
|
6685
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6686
|
+
return out;
|
|
6687
|
+
} } : {},
|
|
6688
|
+
writeAddonStore: async (patch) => {
|
|
6689
|
+
await writeAddon(patch);
|
|
6690
|
+
},
|
|
6691
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
6692
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6693
|
+
kind: "device",
|
|
6694
|
+
deviceId
|
|
6695
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
6696
|
+
}
|
|
6697
|
+
};
|
|
6698
|
+
return {
|
|
6699
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
6700
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
6701
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6702
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6703
|
+
} }),
|
|
6704
|
+
raw: {
|
|
6705
|
+
readAddonStore: async () => {
|
|
6706
|
+
const blob = await raw.readAddonStore();
|
|
6707
|
+
index.seen("addon", blob);
|
|
6708
|
+
return blob;
|
|
6709
|
+
},
|
|
6710
|
+
readDeviceStore: async (deviceId) => {
|
|
6711
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
6712
|
+
index.seen(`device:${deviceId}`, blob);
|
|
6713
|
+
return blob;
|
|
6714
|
+
}
|
|
6715
|
+
},
|
|
6716
|
+
writeAddonStore: writeAddon
|
|
6717
|
+
};
|
|
6718
|
+
}
|
|
6719
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
6720
|
+
function createSecretAwareContext(context, opts) {
|
|
6721
|
+
const raw = context.settings;
|
|
6722
|
+
if (raw === void 0) return {
|
|
6723
|
+
context,
|
|
6724
|
+
handle: null
|
|
6725
|
+
};
|
|
6726
|
+
const handle = createHandle(raw, opts);
|
|
6727
|
+
return {
|
|
6728
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
6729
|
+
if (prop === "settings") return handle.settings;
|
|
6730
|
+
return Reflect.get(target, prop, receiver);
|
|
6731
|
+
} }),
|
|
6732
|
+
handle
|
|
6733
|
+
};
|
|
6734
|
+
}
|
|
6735
|
+
var LEAF = { kind: "leaf" };
|
|
6736
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6737
|
+
function collectFields(fields, out) {
|
|
6738
|
+
for (const field of fields) {
|
|
6739
|
+
if (field.type === "group") {
|
|
6740
|
+
collectFields(field.fields, out);
|
|
6741
|
+
continue;
|
|
6742
|
+
}
|
|
6743
|
+
if (field.type === "sub-tabs") {
|
|
6744
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6745
|
+
continue;
|
|
6746
|
+
}
|
|
6747
|
+
if (field.type === "editable-array") {
|
|
6748
|
+
const item = /* @__PURE__ */ new Map();
|
|
6749
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6750
|
+
if (item.size > 0) out.set(field.key, {
|
|
6751
|
+
kind: "array",
|
|
6752
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6753
|
+
item
|
|
6754
|
+
});
|
|
6755
|
+
continue;
|
|
6756
|
+
}
|
|
6757
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6758
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
/** The secret tree a settings schema declares. */
|
|
6762
|
+
function secretTreeFromSchema(schema) {
|
|
6763
|
+
const out = /* @__PURE__ */ new Map();
|
|
6764
|
+
if (schema === null) return out;
|
|
6765
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6766
|
+
return out;
|
|
6767
|
+
}
|
|
6768
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6769
|
+
function parseSecretStatePath(path) {
|
|
6770
|
+
const segments = [];
|
|
6771
|
+
for (const raw of path.split(".")) {
|
|
6772
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6773
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6774
|
+
segments.push(m[2] !== void 0 ? {
|
|
6775
|
+
key: m[1],
|
|
6776
|
+
idKey: m[2]
|
|
6777
|
+
} : { key: m[1] });
|
|
6778
|
+
}
|
|
6779
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6780
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6781
|
+
return segments;
|
|
6782
|
+
}
|
|
6783
|
+
function insert(into, segments) {
|
|
6784
|
+
const [head, ...rest] = segments;
|
|
6785
|
+
if (head === void 0) return;
|
|
6786
|
+
if (rest.length === 0) {
|
|
6787
|
+
into.set(head.key, LEAF);
|
|
6788
|
+
return;
|
|
6789
|
+
}
|
|
6790
|
+
const existing = into.get(head.key);
|
|
6791
|
+
if (head.idKey !== void 0) {
|
|
6792
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6793
|
+
insert(item, rest);
|
|
6794
|
+
into.set(head.key, {
|
|
6795
|
+
kind: "array",
|
|
6796
|
+
idKey: head.idKey,
|
|
6797
|
+
item
|
|
6798
|
+
});
|
|
6799
|
+
return;
|
|
6800
|
+
}
|
|
6801
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6802
|
+
insert(children, rest);
|
|
6803
|
+
into.set(head.key, {
|
|
6804
|
+
kind: "object",
|
|
6805
|
+
children
|
|
6806
|
+
});
|
|
6807
|
+
}
|
|
6808
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6809
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6810
|
+
if (paths.length === 0) return tree;
|
|
6811
|
+
const out = new Map(tree);
|
|
6812
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6813
|
+
return out;
|
|
6814
|
+
}
|
|
6815
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6816
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6817
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6818
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6819
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5937
6820
|
/**
|
|
5938
6821
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5939
6822
|
*
|
|
@@ -6003,6 +6886,33 @@ var BaseAddon = class {
|
|
|
6003
6886
|
settingsStoreReady = false;
|
|
6004
6887
|
/** Default config values. Provided via constructor. */
|
|
6005
6888
|
defaults;
|
|
6889
|
+
/**
|
|
6890
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6891
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6892
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6893
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6894
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6895
|
+
*/
|
|
6896
|
+
secretStatePaths = [];
|
|
6897
|
+
_addonSecretTree = null;
|
|
6898
|
+
_deviceSecretTree = null;
|
|
6899
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6900
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6901
|
+
_unresolvedSecrets = [];
|
|
6902
|
+
_secretRetryTimer = null;
|
|
6903
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6904
|
+
_secretChangeTimer = null;
|
|
6905
|
+
_secretChangeUnsub = null;
|
|
6906
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6907
|
+
_operatorWriteDepth = 0;
|
|
6908
|
+
/**
|
|
6909
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
6910
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
6911
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
6912
|
+
*/
|
|
6913
|
+
_secretSettings = null;
|
|
6914
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
6915
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6006
6916
|
constructor(defaults) {
|
|
6007
6917
|
this.defaults = defaults;
|
|
6008
6918
|
this._config = { ...defaults };
|
|
@@ -6038,8 +6948,26 @@ var BaseAddon = class {
|
|
|
6038
6948
|
return this._config;
|
|
6039
6949
|
}
|
|
6040
6950
|
async initialize(context) {
|
|
6041
|
-
|
|
6951
|
+
const secrets = context.secrets;
|
|
6952
|
+
if (secrets !== void 0) {
|
|
6953
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
6954
|
+
secrets,
|
|
6955
|
+
addonTree: () => this.addonSecretTree(),
|
|
6956
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6957
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6958
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
6959
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
6960
|
+
});
|
|
6961
|
+
this._ctx = wrapped;
|
|
6962
|
+
this._secretSettings = handle;
|
|
6963
|
+
} else {
|
|
6964
|
+
this._ctx = context;
|
|
6965
|
+
this._secretSettings = null;
|
|
6966
|
+
}
|
|
6042
6967
|
await this.resolveConfig();
|
|
6968
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6969
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6970
|
+
});
|
|
6043
6971
|
const result = await this.onInitialize();
|
|
6044
6972
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6045
6973
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6072,6 +7000,12 @@ var BaseAddon = class {
|
|
|
6072
7000
|
*/
|
|
6073
7001
|
async onHubReachable() {}
|
|
6074
7002
|
async shutdown() {
|
|
7003
|
+
this._secretChangeUnsub?.();
|
|
7004
|
+
this._secretChangeUnsub = null;
|
|
7005
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7006
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7007
|
+
this._secretRetryTimer = null;
|
|
7008
|
+
this._secretChangeTimer = null;
|
|
6075
7009
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6076
7010
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6077
7011
|
await this.onShutdown();
|
|
@@ -6146,11 +7080,8 @@ var BaseAddon = class {
|
|
|
6146
7080
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6147
7081
|
const schema = this.globalSettingsSchema(cap);
|
|
6148
7082
|
if (!schema) return { sections: [] };
|
|
6149
|
-
const projected = await this.
|
|
6150
|
-
return hydrateSchema(schema, overlay ? {
|
|
6151
|
-
...projected,
|
|
6152
|
-
...overlay
|
|
6153
|
-
} : projected);
|
|
7083
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7084
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
6154
7085
|
}
|
|
6155
7086
|
/**
|
|
6156
7087
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6195,11 +7126,11 @@ var BaseAddon = class {
|
|
|
6195
7126
|
});
|
|
6196
7127
|
}
|
|
6197
7128
|
if (sections.length === 0) return null;
|
|
6198
|
-
const projected = await this.
|
|
7129
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
6199
7130
|
return hydrateSchema({
|
|
6200
7131
|
...schema,
|
|
6201
7132
|
sections
|
|
6202
|
-
}, projected);
|
|
7133
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6203
7134
|
}
|
|
6204
7135
|
/**
|
|
6205
7136
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6212,12 +7143,50 @@ var BaseAddon = class {
|
|
|
6212
7143
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
6213
7144
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
6214
7145
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7146
|
+
*
|
|
7147
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7148
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7149
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7150
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7151
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7152
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
6215
7153
|
*/
|
|
6216
7154
|
async resolveGlobalStore(nodeId, cap) {
|
|
6217
7155
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7156
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7157
|
+
}
|
|
7158
|
+
projectForNode(store, nodeId, cap) {
|
|
6218
7159
|
const keys = this.perNodeKeys(cap);
|
|
6219
7160
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6220
|
-
return keys.size > 0 ? projectStore(
|
|
7161
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7162
|
+
}
|
|
7163
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7164
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7165
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7166
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7167
|
+
}
|
|
7168
|
+
/**
|
|
7169
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7170
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7171
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7172
|
+
* its value.
|
|
7173
|
+
*/
|
|
7174
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7175
|
+
const secrets = this._ctx?.secrets;
|
|
7176
|
+
const merged = {
|
|
7177
|
+
...stored,
|
|
7178
|
+
...overlay
|
|
7179
|
+
};
|
|
7180
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7181
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7182
|
+
unresolved: "keep-marker",
|
|
7183
|
+
ownedBy: secrets.owner
|
|
7184
|
+
});
|
|
7185
|
+
for (const key of Object.keys(overlay)) {
|
|
7186
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7187
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7188
|
+
}
|
|
7189
|
+
return merged;
|
|
6221
7190
|
}
|
|
6222
7191
|
/**
|
|
6223
7192
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -6253,18 +7222,58 @@ var BaseAddon = class {
|
|
|
6253
7222
|
value: result.value[key]
|
|
6254
7223
|
};
|
|
6255
7224
|
}
|
|
7225
|
+
/**
|
|
7226
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7227
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7228
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7229
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7230
|
+
* writing back what it read is not (D787).
|
|
7231
|
+
*/
|
|
7232
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7233
|
+
this._operatorWriteDepth++;
|
|
7234
|
+
try {
|
|
7235
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7236
|
+
} finally {
|
|
7237
|
+
this._operatorWriteDepth--;
|
|
7238
|
+
}
|
|
7239
|
+
}
|
|
6256
7240
|
async updateGlobalSettings(patch, nodeId) {
|
|
7241
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7242
|
+
}
|
|
7243
|
+
/**
|
|
7244
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7245
|
+
*
|
|
7246
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7247
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7248
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7249
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7250
|
+
*/
|
|
7251
|
+
async clearSecrets(keys, nodeId) {
|
|
7252
|
+
const tree = this.addonSecretTree();
|
|
7253
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7254
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7255
|
+
const patch = {};
|
|
7256
|
+
for (const key of keys) {
|
|
7257
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7258
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7259
|
+
}
|
|
7260
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7261
|
+
}
|
|
7262
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6257
7263
|
const keys = this.perNodeKeys();
|
|
6258
7264
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6259
7265
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6260
|
-
const barePatch = patch;
|
|
6261
7266
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6262
|
-
|
|
7267
|
+
const handle = this._secretSettings;
|
|
7268
|
+
if (handle !== null) {
|
|
7269
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7270
|
+
if (!changed) return;
|
|
7271
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6263
7272
|
if (target !== localNode) return;
|
|
6264
7273
|
await this.resolveConfig();
|
|
6265
7274
|
await this.onConfigChanged();
|
|
6266
7275
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6267
|
-
this.maybeAutoRestart(
|
|
7276
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6268
7277
|
}
|
|
6269
7278
|
/**
|
|
6270
7279
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6289,7 +7298,7 @@ var BaseAddon = class {
|
|
|
6289
7298
|
* time to return its response before the addon is torn down and
|
|
6290
7299
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6291
7300
|
*/
|
|
6292
|
-
maybeAutoRestart(
|
|
7301
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6293
7302
|
if (!schema) return;
|
|
6294
7303
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6295
7304
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6297,13 +7306,13 @@ var BaseAddon = class {
|
|
|
6297
7306
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6298
7307
|
}
|
|
6299
7308
|
if (restartKeys.size === 0) return;
|
|
6300
|
-
if (!
|
|
7309
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6301
7310
|
const ctx = this._ctx;
|
|
6302
7311
|
if (!ctx) return;
|
|
6303
7312
|
const addonId = ctx.id;
|
|
6304
7313
|
setImmediate(() => {
|
|
6305
7314
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6306
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7315
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6307
7316
|
}).catch((err) => {
|
|
6308
7317
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6309
7318
|
});
|
|
@@ -6312,7 +7321,7 @@ var BaseAddon = class {
|
|
|
6312
7321
|
async getDeviceSettings(deviceId) {
|
|
6313
7322
|
const schema = this.deviceSettingsSchema();
|
|
6314
7323
|
if (!schema) return { sections: [] };
|
|
6315
|
-
return hydrateSchema(schema, await this.
|
|
7324
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6316
7325
|
}
|
|
6317
7326
|
async updateDeviceSettings(deviceId, patch) {
|
|
6318
7327
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6442,7 +7451,7 @@ var BaseAddon = class {
|
|
|
6442
7451
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6443
7452
|
*/
|
|
6444
7453
|
async resolveConfig() {
|
|
6445
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7454
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6446
7455
|
const perNode = this.perNodeKeys();
|
|
6447
7456
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6448
7457
|
const resolved = { ...this.defaults };
|
|
@@ -6467,7 +7476,7 @@ var BaseAddon = class {
|
|
|
6467
7476
|
key,
|
|
6468
7477
|
schema,
|
|
6469
7478
|
fallback,
|
|
6470
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7479
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6471
7480
|
write: async (patch) => {
|
|
6472
7481
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6473
7482
|
},
|
|
@@ -6484,7 +7493,7 @@ var BaseAddon = class {
|
|
|
6484
7493
|
key,
|
|
6485
7494
|
schema,
|
|
6486
7495
|
fallback,
|
|
6487
|
-
read: async () => await this.
|
|
7496
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
6488
7497
|
write: async (patch) => {
|
|
6489
7498
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6490
7499
|
},
|
|
@@ -6496,6 +7505,87 @@ var BaseAddon = class {
|
|
|
6496
7505
|
} })
|
|
6497
7506
|
});
|
|
6498
7507
|
}
|
|
7508
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7509
|
+
addonSecretTree() {
|
|
7510
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7511
|
+
return this._addonSecretTree;
|
|
7512
|
+
}
|
|
7513
|
+
deviceSecretTree() {
|
|
7514
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7515
|
+
return this._deviceSecretTree;
|
|
7516
|
+
}
|
|
7517
|
+
/**
|
|
7518
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7519
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7520
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7521
|
+
* than start on an empty credential.
|
|
7522
|
+
*/
|
|
7523
|
+
get unresolvedSecrets() {
|
|
7524
|
+
return this._unresolvedSecrets;
|
|
7525
|
+
}
|
|
7526
|
+
/**
|
|
7527
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7528
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7529
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7530
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7531
|
+
* ever written back from here.
|
|
7532
|
+
*/
|
|
7533
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7534
|
+
const secrets = this._ctx?.secrets;
|
|
7535
|
+
if (secrets === void 0) return blob;
|
|
7536
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7537
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7538
|
+
if (refs.length === 0) {
|
|
7539
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7540
|
+
return blob;
|
|
7541
|
+
}
|
|
7542
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7543
|
+
if (trackForConfig) {
|
|
7544
|
+
this._unresolvedSecrets = unresolved;
|
|
7545
|
+
if (unresolved.length > 0) {
|
|
7546
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7547
|
+
ref: u.ref,
|
|
7548
|
+
reason: u.reason
|
|
7549
|
+
})) } });
|
|
7550
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7551
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7552
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7553
|
+
}
|
|
7554
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7555
|
+
}
|
|
7556
|
+
return value;
|
|
7557
|
+
}
|
|
7558
|
+
/**
|
|
7559
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7560
|
+
* keychain the context's own view is already raw.
|
|
7561
|
+
*/
|
|
7562
|
+
rawSettings() {
|
|
7563
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7564
|
+
}
|
|
7565
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7566
|
+
logUnresolvedRead(unresolved) {
|
|
7567
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7568
|
+
if (fresh.length === 0) return;
|
|
7569
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7570
|
+
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) => ({
|
|
7571
|
+
ref: u.ref,
|
|
7572
|
+
reason: u.reason
|
|
7573
|
+
})) } });
|
|
7574
|
+
}
|
|
7575
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7576
|
+
scheduleSecretReresolve(delayMs) {
|
|
7577
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7578
|
+
if (this[timerOf] !== null) return;
|
|
7579
|
+
const timer = setTimeout(() => {
|
|
7580
|
+
this[timerOf] = null;
|
|
7581
|
+
if (this._ctx === null) return;
|
|
7582
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7583
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7584
|
+
});
|
|
7585
|
+
}, delayMs);
|
|
7586
|
+
timer.unref?.();
|
|
7587
|
+
this[timerOf] = timer;
|
|
7588
|
+
}
|
|
6499
7589
|
/**
|
|
6500
7590
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6501
7591
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -6508,7 +7598,7 @@ var BaseAddon = class {
|
|
|
6508
7598
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
6509
7599
|
*/
|
|
6510
7600
|
async readAddonStoreWithRetry() {
|
|
6511
|
-
const settings = this.
|
|
7601
|
+
const settings = this.rawSettings();
|
|
6512
7602
|
if (!settings) return {};
|
|
6513
7603
|
const delaysMs = [
|
|
6514
7604
|
150,
|
|
@@ -8768,6 +9858,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
8768
9858
|
fetchedAt: number()
|
|
8769
9859
|
});
|
|
8770
9860
|
/**
|
|
9861
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
9862
|
+
* gets back (cloud training, D805+).
|
|
9863
|
+
*
|
|
9864
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
9865
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
9866
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
9867
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
9868
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
9869
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
9870
|
+
* change there, in the same piece of work.
|
|
9871
|
+
*
|
|
9872
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
9873
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
9874
|
+
*/
|
|
9875
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
9876
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
9877
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
9878
|
+
var TrainingExportSchema = _enum([
|
|
9879
|
+
"onnx",
|
|
9880
|
+
"openvino-fp16",
|
|
9881
|
+
"openvino-int8",
|
|
9882
|
+
"coreml-fp16"
|
|
9883
|
+
]);
|
|
9884
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
9885
|
+
object({
|
|
9886
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
9887
|
+
jobKey: string().uuid(),
|
|
9888
|
+
target: object({
|
|
9889
|
+
kind: literal("detector"),
|
|
9890
|
+
step: literal("object-detection")
|
|
9891
|
+
}),
|
|
9892
|
+
base: object({
|
|
9893
|
+
modelId: string().min(1),
|
|
9894
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
9895
|
+
weights: string().min(1),
|
|
9896
|
+
imgsz: number().int().positive()
|
|
9897
|
+
}),
|
|
9898
|
+
baseline: object({
|
|
9899
|
+
modelId: string().min(1),
|
|
9900
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
9901
|
+
onnxUrl: string().url(),
|
|
9902
|
+
imgsz: number().int().positive(),
|
|
9903
|
+
floors: FloorsSchema
|
|
9904
|
+
}),
|
|
9905
|
+
dataset: object({
|
|
9906
|
+
versionId: string().min(1),
|
|
9907
|
+
annotationHash: string(),
|
|
9908
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
9909
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
9910
|
+
}),
|
|
9911
|
+
split: object({
|
|
9912
|
+
holdoutCameras: array(number().int()),
|
|
9913
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
9914
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
9915
|
+
valFraction: number().min(0).max(.5),
|
|
9916
|
+
seed: number().int()
|
|
9917
|
+
}),
|
|
9918
|
+
hyper: object({
|
|
9919
|
+
epochs: number().int().positive(),
|
|
9920
|
+
batch: number().int().positive(),
|
|
9921
|
+
lr0: number().positive(),
|
|
9922
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
9923
|
+
freeze: number().int().nonnegative(),
|
|
9924
|
+
patience: number().int().nonnegative(),
|
|
9925
|
+
seed: number().int()
|
|
9926
|
+
}),
|
|
9927
|
+
replay: object({
|
|
9928
|
+
source: literal("coco2017"),
|
|
9929
|
+
count: number().int().nonnegative()
|
|
9930
|
+
}),
|
|
9931
|
+
exports: array(TrainingExportSchema).min(1),
|
|
9932
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
9933
|
+
floors: object({
|
|
9934
|
+
minSupport: number().int().positive(),
|
|
9935
|
+
clamp: number().min(0).max(1)
|
|
9936
|
+
}),
|
|
9937
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
9938
|
+
catalog: object({
|
|
9939
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
9940
|
+
name: string().min(1).max(160)
|
|
9941
|
+
})
|
|
9942
|
+
});
|
|
9943
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
9944
|
+
var TrainingResultFileSchema = object({
|
|
9945
|
+
path: string().min(1),
|
|
9946
|
+
bytes: number().int().nonnegative(),
|
|
9947
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
9948
|
+
format: _enum([
|
|
9949
|
+
"onnx",
|
|
9950
|
+
"openvino",
|
|
9951
|
+
"coreml",
|
|
9952
|
+
"pt"
|
|
9953
|
+
]),
|
|
9954
|
+
variant: _enum(["base", "int8"])
|
|
9955
|
+
});
|
|
9956
|
+
var DraftFormatSchema = object({
|
|
9957
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
9958
|
+
url: string().min(1),
|
|
9959
|
+
sizeMB: number().nonnegative(),
|
|
9960
|
+
isDirectory: boolean().optional(),
|
|
9961
|
+
files: array(string()).optional(),
|
|
9962
|
+
runtimes: array(literal("python")).optional(),
|
|
9963
|
+
revision: string().min(1)
|
|
9964
|
+
});
|
|
9965
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
9966
|
+
var TrainingCatalogDraftSchema = object({
|
|
9967
|
+
id: string().min(1),
|
|
9968
|
+
name: string().min(1),
|
|
9969
|
+
description: string(),
|
|
9970
|
+
labels: array(unknown()),
|
|
9971
|
+
inputSize: object({
|
|
9972
|
+
width: number().int().positive(),
|
|
9973
|
+
height: number().int().positive()
|
|
9974
|
+
}),
|
|
9975
|
+
preprocessMode: literal("letterbox"),
|
|
9976
|
+
defaultClassFloors: FloorsSchema,
|
|
9977
|
+
formats: object({
|
|
9978
|
+
onnx: DraftFormatSchema.optional(),
|
|
9979
|
+
openvino: DraftFormatSchema.optional(),
|
|
9980
|
+
coreml: DraftFormatSchema.optional()
|
|
9981
|
+
})
|
|
9982
|
+
});
|
|
9983
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
9984
|
+
var TrainingEvalClassSchema = object({
|
|
9985
|
+
positives: number().int(),
|
|
9986
|
+
floor: number().nullable(),
|
|
9987
|
+
tp: number().int(),
|
|
9988
|
+
fp: number().int(),
|
|
9989
|
+
fn: number().int(),
|
|
9990
|
+
precision: number().nullable(),
|
|
9991
|
+
recall: number().nullable(),
|
|
9992
|
+
ap50: number().nullable(),
|
|
9993
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
9994
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
9995
|
+
fpByCamera: record(string(), number()).optional(),
|
|
9996
|
+
smallFound: number().int().optional(),
|
|
9997
|
+
smallTotal: number().int().optional()
|
|
9998
|
+
}).passthrough();
|
|
9999
|
+
var TrainingEvalReportSchema = object({
|
|
10000
|
+
frames: number().int(),
|
|
10001
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10002
|
+
}).passthrough();
|
|
10003
|
+
/**
|
|
10004
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10005
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10006
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10007
|
+
*/
|
|
10008
|
+
var TrainingResultSchema = object({
|
|
10009
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10010
|
+
jobKey: string(),
|
|
10011
|
+
status: _enum(["succeeded", "failed"]),
|
|
10012
|
+
error: object({
|
|
10013
|
+
stage: string(),
|
|
10014
|
+
code: string(),
|
|
10015
|
+
message: string()
|
|
10016
|
+
}).nullable(),
|
|
10017
|
+
trainer: object({
|
|
10018
|
+
version: string(),
|
|
10019
|
+
revision: string()
|
|
10020
|
+
}),
|
|
10021
|
+
toolchain: record(string(), string().nullable()),
|
|
10022
|
+
dataset: object({
|
|
10023
|
+
versionId: string(),
|
|
10024
|
+
annotationHash: string(),
|
|
10025
|
+
sha256: string(),
|
|
10026
|
+
frames: object({
|
|
10027
|
+
train: number().int(),
|
|
10028
|
+
val: number().int(),
|
|
10029
|
+
holdout: number().int()
|
|
10030
|
+
}),
|
|
10031
|
+
holdoutCameras: array(number().int()),
|
|
10032
|
+
replayImages: number().int()
|
|
10033
|
+
}).optional(),
|
|
10034
|
+
training: object({
|
|
10035
|
+
epochsRun: number().int(),
|
|
10036
|
+
bestEpoch: number().int(),
|
|
10037
|
+
bestMap50: number(),
|
|
10038
|
+
bestMap50_95: number(),
|
|
10039
|
+
seconds: number()
|
|
10040
|
+
}).optional(),
|
|
10041
|
+
evaluation: object({
|
|
10042
|
+
holdoutFrames: number().int(),
|
|
10043
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10044
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10045
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10046
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10047
|
+
map50: record(string(), number().nullable())
|
|
10048
|
+
}).optional(),
|
|
10049
|
+
floors: object({
|
|
10050
|
+
baseline: FloorsSchema,
|
|
10051
|
+
candidate: FloorsSchema,
|
|
10052
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10053
|
+
notes: array(string())
|
|
10054
|
+
}).optional(),
|
|
10055
|
+
int8: object({
|
|
10056
|
+
kept: boolean(),
|
|
10057
|
+
map50Fp16: number().nullable(),
|
|
10058
|
+
map50Int8: number().nullable(),
|
|
10059
|
+
reason: string().nullable()
|
|
10060
|
+
}).optional(),
|
|
10061
|
+
exportsDropped: array(object({
|
|
10062
|
+
export: string(),
|
|
10063
|
+
reason: string()
|
|
10064
|
+
})).optional(),
|
|
10065
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10066
|
+
bundle: object({
|
|
10067
|
+
path: literal("bundle.tar"),
|
|
10068
|
+
bytes: number().int().nonnegative(),
|
|
10069
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10070
|
+
}).nullable().optional(),
|
|
10071
|
+
catalogDraft: object({
|
|
10072
|
+
base: TrainingCatalogDraftSchema,
|
|
10073
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10074
|
+
}).nullable().optional(),
|
|
10075
|
+
licence: string()
|
|
10076
|
+
});
|
|
10077
|
+
var TrainingStageSchema = _enum([
|
|
10078
|
+
"prepare",
|
|
10079
|
+
"replay",
|
|
10080
|
+
"train",
|
|
10081
|
+
"eval",
|
|
10082
|
+
"export",
|
|
10083
|
+
"package"
|
|
10084
|
+
]);
|
|
10085
|
+
var EventBase = {
|
|
10086
|
+
v: literal(1),
|
|
10087
|
+
ts: number()
|
|
10088
|
+
};
|
|
10089
|
+
discriminatedUnion("type", [
|
|
10090
|
+
object({
|
|
10091
|
+
...EventBase,
|
|
10092
|
+
type: literal("stage"),
|
|
10093
|
+
stage: TrainingStageSchema
|
|
10094
|
+
}),
|
|
10095
|
+
object({
|
|
10096
|
+
...EventBase,
|
|
10097
|
+
type: literal("epoch"),
|
|
10098
|
+
epoch: number().int(),
|
|
10099
|
+
epochs: number().int(),
|
|
10100
|
+
boxLoss: number().nullable().optional(),
|
|
10101
|
+
map50: number().nullable().optional(),
|
|
10102
|
+
map50_95: number().nullable().optional(),
|
|
10103
|
+
etaSec: number().nullable().optional()
|
|
10104
|
+
}),
|
|
10105
|
+
object({
|
|
10106
|
+
...EventBase,
|
|
10107
|
+
type: literal("metric"),
|
|
10108
|
+
name: string(),
|
|
10109
|
+
value: number()
|
|
10110
|
+
}),
|
|
10111
|
+
object({
|
|
10112
|
+
...EventBase,
|
|
10113
|
+
type: literal("artifact"),
|
|
10114
|
+
path: string(),
|
|
10115
|
+
bytes: number(),
|
|
10116
|
+
sha256: string()
|
|
10117
|
+
}),
|
|
10118
|
+
object({
|
|
10119
|
+
...EventBase,
|
|
10120
|
+
type: literal("done"),
|
|
10121
|
+
status: _enum(["succeeded", "failed"]),
|
|
10122
|
+
resultSha256: string().nullable().optional()
|
|
10123
|
+
}),
|
|
10124
|
+
object({
|
|
10125
|
+
...EventBase,
|
|
10126
|
+
type: literal("error"),
|
|
10127
|
+
stage: string(),
|
|
10128
|
+
code: string(),
|
|
10129
|
+
message: string()
|
|
10130
|
+
})
|
|
10131
|
+
]);
|
|
10132
|
+
/**
|
|
8771
10133
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
8772
10134
|
*
|
|
8773
10135
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -11095,7 +12457,9 @@ var AddonHttpRouteSchema = object({
|
|
|
11095
12457
|
"authenticated",
|
|
11096
12458
|
"admin"
|
|
11097
12459
|
]).optional(),
|
|
11098
|
-
description: string().optional()
|
|
12460
|
+
description: string().optional(),
|
|
12461
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
12462
|
+
rateLimit: _enum(["auth"]).optional()
|
|
11099
12463
|
});
|
|
11100
12464
|
/**
|
|
11101
12465
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -11800,6 +13164,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
11800
13164
|
lastError: string().optional()
|
|
11801
13165
|
});
|
|
11802
13166
|
/**
|
|
13167
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13168
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13169
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13170
|
+
* with it off — which restores without a key.
|
|
13171
|
+
*/
|
|
13172
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13173
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13174
|
+
scheme: string(),
|
|
13175
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13176
|
+
keyId: string()
|
|
13177
|
+
});
|
|
13178
|
+
/**
|
|
13179
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13180
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13181
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13182
|
+
*/
|
|
13183
|
+
var BackupEncryptionStatusSchema = object({
|
|
13184
|
+
enabled: boolean(),
|
|
13185
|
+
active: object({
|
|
13186
|
+
keyId: string(),
|
|
13187
|
+
publicKey: string(),
|
|
13188
|
+
createdAt: number()
|
|
13189
|
+
}).nullable(),
|
|
13190
|
+
/** Every key ever set up, newest first. */
|
|
13191
|
+
keys: array(object({
|
|
13192
|
+
keyId: string(),
|
|
13193
|
+
createdAt: number(),
|
|
13194
|
+
retiredAt: number().nullable()
|
|
13195
|
+
})).readonly()
|
|
13196
|
+
});
|
|
13197
|
+
/**
|
|
11803
13198
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
11804
13199
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
11805
13200
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -11811,7 +13206,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
11811
13206
|
sizeBytes: number(),
|
|
11812
13207
|
label: string().optional(),
|
|
11813
13208
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
11814
|
-
locations: array(string()).readonly()
|
|
13209
|
+
locations: array(string()).readonly(),
|
|
13210
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13211
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11815
13212
|
});
|
|
11816
13213
|
var BackupEntrySchema = object({
|
|
11817
13214
|
id: string(),
|
|
@@ -11820,7 +13217,8 @@ var BackupEntrySchema = object({
|
|
|
11820
13217
|
label: string().optional(),
|
|
11821
13218
|
createdAt: number(),
|
|
11822
13219
|
sizeBytes: number(),
|
|
11823
|
-
locations: array(string()).optional()
|
|
13220
|
+
locations: array(string()).optional(),
|
|
13221
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
11824
13222
|
});
|
|
11825
13223
|
var ArchiveEntrySchema = object({
|
|
11826
13224
|
path: string(),
|
|
@@ -12009,10 +13407,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
12009
13407
|
* this list and skips entries whose path doesn't start with
|
|
12010
13408
|
* any of them.
|
|
12011
13409
|
*/
|
|
12012
|
-
locations: array(string()).optional()
|
|
13410
|
+
locations: array(string()).optional(),
|
|
13411
|
+
/**
|
|
13412
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13413
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13414
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13415
|
+
* is refused before the archive is downloaded.
|
|
13416
|
+
*/
|
|
13417
|
+
backupSecretKey: string().optional()
|
|
12013
13418
|
}), _void(), {
|
|
12014
13419
|
kind: "mutation",
|
|
12015
13420
|
auth: "admin"
|
|
13421
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13422
|
+
keyId: string(),
|
|
13423
|
+
secretKey: string(),
|
|
13424
|
+
publicKey: string(),
|
|
13425
|
+
createdAt: number(),
|
|
13426
|
+
replacedKeyId: string().nullable()
|
|
13427
|
+
}), {
|
|
13428
|
+
kind: "mutation",
|
|
13429
|
+
auth: "admin"
|
|
13430
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
13431
|
+
kind: "mutation",
|
|
13432
|
+
auth: "admin"
|
|
13433
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
13434
|
+
valid: boolean(),
|
|
13435
|
+
keyId: string().nullable(),
|
|
13436
|
+
/** The hub knows this key (active or retired). */
|
|
13437
|
+
known: boolean(),
|
|
13438
|
+
/** It is the key new archives are encrypted to. */
|
|
13439
|
+
active: boolean(),
|
|
13440
|
+
error: string().optional()
|
|
13441
|
+
}), {
|
|
13442
|
+
kind: "mutation",
|
|
13443
|
+
auth: "admin"
|
|
12016
13444
|
}), method(object({
|
|
12017
13445
|
destinationId: string(),
|
|
12018
13446
|
backupId: string()
|
|
@@ -13636,7 +15064,60 @@ var CustomModelDescriptorSchema = object({
|
|
|
13636
15064
|
stepId: string(),
|
|
13637
15065
|
entry: ModelCatalogEntrySchema
|
|
13638
15066
|
});
|
|
13639
|
-
|
|
15067
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15068
|
+
var ModelBundleFileSchema = object({
|
|
15069
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15070
|
+
path: string().min(1),
|
|
15071
|
+
bytes: number().int().nonnegative(),
|
|
15072
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15073
|
+
});
|
|
15074
|
+
var ImportModelBundleInputSchema = object({
|
|
15075
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15076
|
+
addonId: string(),
|
|
15077
|
+
stepId: string().min(1),
|
|
15078
|
+
/**
|
|
15079
|
+
* The catalog rows to register, complete, every format URL already
|
|
15080
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15081
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15082
|
+
*/
|
|
15083
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15084
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15085
|
+
bundle: object({
|
|
15086
|
+
ticket: PeerBytesTicketSchema,
|
|
15087
|
+
bytes: number().int().positive(),
|
|
15088
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15089
|
+
}),
|
|
15090
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15091
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15092
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15093
|
+
distribute: boolean()
|
|
15094
|
+
});
|
|
15095
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15096
|
+
kind: literal("imported"),
|
|
15097
|
+
modelIds: array(string()).readonly(),
|
|
15098
|
+
distributed: array(object({
|
|
15099
|
+
modelId: string(),
|
|
15100
|
+
nodeId: string(),
|
|
15101
|
+
format: _enum(MODEL_FORMATS),
|
|
15102
|
+
ok: boolean(),
|
|
15103
|
+
error: string().optional()
|
|
15104
|
+
})).readonly()
|
|
15105
|
+
}), object({
|
|
15106
|
+
kind: literal("refused"),
|
|
15107
|
+
reason: _enum([
|
|
15108
|
+
"transfer-failed",
|
|
15109
|
+
"checksum-mismatch",
|
|
15110
|
+
"bundle-mismatch",
|
|
15111
|
+
"invalid-entry",
|
|
15112
|
+
"id-taken"
|
|
15113
|
+
]),
|
|
15114
|
+
detail: string()
|
|
15115
|
+
})]);
|
|
15116
|
+
method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }), method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15117
|
+
kind: "mutation",
|
|
15118
|
+
auth: "admin",
|
|
15119
|
+
timeoutMs: 30 * 6e4
|
|
15120
|
+
});
|
|
13640
15121
|
/**
|
|
13641
15122
|
* Query filter for settings-store collections.
|
|
13642
15123
|
*/
|
|
@@ -14019,6 +15500,253 @@ id: union([string(), number()]) }), {
|
|
|
14019
15500
|
kind: "mutation",
|
|
14020
15501
|
auth: "admin"
|
|
14021
15502
|
});
|
|
15503
|
+
/**
|
|
15504
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15505
|
+
*
|
|
15506
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15507
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15508
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15509
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15510
|
+
* against the CALLER, never against anything the caller claims.
|
|
15511
|
+
*
|
|
15512
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15513
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15514
|
+
* connection, the agent from its child's connection carried in
|
|
15515
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15516
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15517
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15518
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15519
|
+
* runner is the same OS user): see the threat model in
|
|
15520
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15521
|
+
*
|
|
15522
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15523
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15524
|
+
* floors every method to admin anyway (D240).
|
|
15525
|
+
*
|
|
15526
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15527
|
+
*/
|
|
15528
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15529
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15530
|
+
"key-missing",
|
|
15531
|
+
"wrong-key",
|
|
15532
|
+
"key-file-unreadable",
|
|
15533
|
+
"store-unavailable",
|
|
15534
|
+
"not-initialized",
|
|
15535
|
+
"decrypt-failed"
|
|
15536
|
+
]);
|
|
15537
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15538
|
+
state: literal("locked"),
|
|
15539
|
+
reason: KeychainUnavailableReasonSchema
|
|
15540
|
+
})]);
|
|
15541
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15542
|
+
object({
|
|
15543
|
+
kind: literal("value"),
|
|
15544
|
+
value: string(),
|
|
15545
|
+
version: number().int()
|
|
15546
|
+
}),
|
|
15547
|
+
object({ kind: literal("missing") }),
|
|
15548
|
+
object({
|
|
15549
|
+
kind: literal("unavailable"),
|
|
15550
|
+
reason: KeychainUnavailableReasonSchema
|
|
15551
|
+
}),
|
|
15552
|
+
object({ kind: literal("forbidden") })
|
|
15553
|
+
]);
|
|
15554
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15555
|
+
/** Metadata of one stored value — never the value. */
|
|
15556
|
+
var KeychainSecretMetaSchema = object({
|
|
15557
|
+
ref: string(),
|
|
15558
|
+
owner: string(),
|
|
15559
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15560
|
+
scope: string(),
|
|
15561
|
+
fieldPath: string(),
|
|
15562
|
+
version: number().int(),
|
|
15563
|
+
createdAt: number(),
|
|
15564
|
+
updatedAt: number(),
|
|
15565
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15566
|
+
updatedBy: string(),
|
|
15567
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15568
|
+
lastReadAt: number().nullable()
|
|
15569
|
+
});
|
|
15570
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15571
|
+
method(object({
|
|
15572
|
+
ref: string().min(1),
|
|
15573
|
+
value: string().min(1)
|
|
15574
|
+
}), object({
|
|
15575
|
+
ref: string(),
|
|
15576
|
+
version: number().int()
|
|
15577
|
+
}), {
|
|
15578
|
+
kind: "mutation",
|
|
15579
|
+
auth: "admin"
|
|
15580
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15581
|
+
kind: "mutation",
|
|
15582
|
+
auth: "admin"
|
|
15583
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15584
|
+
var KeychainKeySourceSchema = object({
|
|
15585
|
+
kind: _enum([
|
|
15586
|
+
"config-file",
|
|
15587
|
+
"previous-config-file",
|
|
15588
|
+
"platform",
|
|
15589
|
+
"default-file"
|
|
15590
|
+
]),
|
|
15591
|
+
/** File sources only — a path is not a secret. */
|
|
15592
|
+
path: string().optional(),
|
|
15593
|
+
/**
|
|
15594
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15595
|
+
* next to the database it protects (the default file). The page warns.
|
|
15596
|
+
*/
|
|
15597
|
+
sharesBackupWithDatabase: boolean()
|
|
15598
|
+
});
|
|
15599
|
+
/**
|
|
15600
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
15601
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
15602
|
+
*/
|
|
15603
|
+
var KeychainResetRecordSchema = object({
|
|
15604
|
+
id: string(),
|
|
15605
|
+
at: number(),
|
|
15606
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
15607
|
+
actor: string(),
|
|
15608
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
15609
|
+
lockedReason: string().nullable(),
|
|
15610
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
15611
|
+
archived: number().int(),
|
|
15612
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
15613
|
+
archivedCollection: string().nullable(),
|
|
15614
|
+
/**
|
|
15615
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
15616
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
15617
|
+
*/
|
|
15618
|
+
archivedKeysCollection: string().nullable(),
|
|
15619
|
+
/**
|
|
15620
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
15621
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
15622
|
+
* agent forever (D797).
|
|
15623
|
+
*/
|
|
15624
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
15625
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
15626
|
+
acknowledgedAt: number().nullable()
|
|
15627
|
+
});
|
|
15628
|
+
var KeychainStatusSchema = object({
|
|
15629
|
+
keychain: KeychainStateSchema,
|
|
15630
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15631
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15632
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15633
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15634
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15635
|
+
fingerprint: string().nullable(),
|
|
15636
|
+
activeKeyId: string().nullable(),
|
|
15637
|
+
/**
|
|
15638
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15639
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15640
|
+
*/
|
|
15641
|
+
rotationPending: boolean(),
|
|
15642
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15643
|
+
retiredWraps: number().int(),
|
|
15644
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15645
|
+
secretCount: number().int(),
|
|
15646
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
15647
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15648
|
+
});
|
|
15649
|
+
/**
|
|
15650
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15651
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15652
|
+
* never reported as an orphan (and never deleted as one).
|
|
15653
|
+
*/
|
|
15654
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15655
|
+
"in-use",
|
|
15656
|
+
"orphan",
|
|
15657
|
+
"unknown"
|
|
15658
|
+
]);
|
|
15659
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15660
|
+
var KeychainAuditActionSchema = _enum([
|
|
15661
|
+
"put",
|
|
15662
|
+
"delete",
|
|
15663
|
+
"reveal",
|
|
15664
|
+
"rotate-master-key",
|
|
15665
|
+
"purge-retired-keys",
|
|
15666
|
+
"download-recovery-key",
|
|
15667
|
+
"delete-orphans",
|
|
15668
|
+
"reset",
|
|
15669
|
+
"acknowledge-reset",
|
|
15670
|
+
"initialize"
|
|
15671
|
+
]);
|
|
15672
|
+
var KeychainAuditEntrySchema = object({
|
|
15673
|
+
id: string(),
|
|
15674
|
+
at: number(),
|
|
15675
|
+
action: KeychainAuditActionSchema,
|
|
15676
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15677
|
+
actor: string(),
|
|
15678
|
+
ref: string().nullable(),
|
|
15679
|
+
detail: string().nullable()
|
|
15680
|
+
});
|
|
15681
|
+
var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
|
|
15682
|
+
/**
|
|
15683
|
+
* Secrets the HUB itself holds (owner `system`) that no settings form shows:
|
|
15684
|
+
* `jwt-signing-key` — the session signing key (D797). It is always "in use",
|
|
15685
|
+
* never an orphan; it is generated on a fresh hub and replaced only through
|
|
15686
|
+
* {@link keychainAdminCapability.methods.setSystemSecret}.
|
|
15687
|
+
*/
|
|
15688
|
+
var SystemHeldSecretNameSchema = _enum(["jwt-signing-key"]);
|
|
15689
|
+
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({
|
|
15690
|
+
value: string(),
|
|
15691
|
+
version: number().int()
|
|
15692
|
+
}), {
|
|
15693
|
+
kind: "mutation",
|
|
15694
|
+
auth: "admin",
|
|
15695
|
+
caller: "required"
|
|
15696
|
+
}), method(object({
|
|
15697
|
+
name: SystemHeldSecretNameSchema,
|
|
15698
|
+
value: string().min(16)
|
|
15699
|
+
}), object({
|
|
15700
|
+
ref: string(),
|
|
15701
|
+
version: number().int()
|
|
15702
|
+
}), {
|
|
15703
|
+
kind: "mutation",
|
|
15704
|
+
auth: "admin",
|
|
15705
|
+
caller: "required"
|
|
15706
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15707
|
+
deleted: array(string()).readonly(),
|
|
15708
|
+
kept: array(object({
|
|
15709
|
+
ref: string(),
|
|
15710
|
+
usage: KeychainSecretUsageSchema
|
|
15711
|
+
})).readonly()
|
|
15712
|
+
}), {
|
|
15713
|
+
kind: "mutation",
|
|
15714
|
+
auth: "admin",
|
|
15715
|
+
caller: "required"
|
|
15716
|
+
}), method(object({}), object({
|
|
15717
|
+
fingerprint: string(),
|
|
15718
|
+
keySource: KeychainKeySourceSchema
|
|
15719
|
+
}), {
|
|
15720
|
+
kind: "mutation",
|
|
15721
|
+
auth: "admin",
|
|
15722
|
+
caller: "required"
|
|
15723
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15724
|
+
kind: "mutation",
|
|
15725
|
+
auth: "admin",
|
|
15726
|
+
caller: "required"
|
|
15727
|
+
}), method(object({}), object({
|
|
15728
|
+
key: string(),
|
|
15729
|
+
fingerprint: string(),
|
|
15730
|
+
keySource: KeychainKeySourceSchema
|
|
15731
|
+
}), {
|
|
15732
|
+
kind: "mutation",
|
|
15733
|
+
auth: "admin",
|
|
15734
|
+
caller: "required"
|
|
15735
|
+
}), method(object({ confirm: literal(KEYCHAIN_RESET_CONFIRMATION) }), object({
|
|
15736
|
+
archivedCollection: string().nullable(),
|
|
15737
|
+
archived: number().int()
|
|
15738
|
+
}), {
|
|
15739
|
+
kind: "mutation",
|
|
15740
|
+
auth: "admin",
|
|
15741
|
+
caller: "required"
|
|
15742
|
+
}), method(object({}), object({
|
|
15743
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
15744
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
15745
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
15746
|
+
kind: "mutation",
|
|
15747
|
+
auth: "admin",
|
|
15748
|
+
caller: "required"
|
|
15749
|
+
});
|
|
14022
15750
|
method(_void(), object({
|
|
14023
15751
|
id: string(),
|
|
14024
15752
|
name: string(),
|
|
@@ -15056,7 +16784,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15056
16784
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15057
16785
|
var DevicePersistConfigPayloadSchema = object({
|
|
15058
16786
|
deviceId: number(),
|
|
15059
|
-
data: record(string(), unknown())
|
|
16787
|
+
data: record(string(), unknown()),
|
|
16788
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16789
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16790
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16791
|
+
secretConfigPaths: array(string()).optional()
|
|
15060
16792
|
});
|
|
15061
16793
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15062
16794
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -16659,7 +18391,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16659
18391
|
* `login-method` — collection cap through which auth addons contribute
|
|
16660
18392
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16661
18393
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16662
|
-
* every auth addon (OIDC,
|
|
18394
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
16663
18395
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16664
18396
|
* procedure aggregates them for the unauthenticated login page.
|
|
16665
18397
|
*
|
|
@@ -16667,8 +18399,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16667
18399
|
*
|
|
16668
18400
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
16669
18401
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16670
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
16671
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18402
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16672
18403
|
* login page needs NO change.
|
|
16673
18404
|
*
|
|
16674
18405
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -16687,8 +18418,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
16687
18418
|
* decision.
|
|
16688
18419
|
*
|
|
16689
18420
|
* Every contribution carries a `stage`:
|
|
16690
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
16691
|
-
*
|
|
18421
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
18422
|
+
* buttons; a usernameless passkey).
|
|
16692
18423
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16693
18424
|
* returned `factors` (passkey-as-2FA today).
|
|
16694
18425
|
*
|
|
@@ -16715,7 +18446,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
16715
18446
|
* The provider names an external identity a signed-in user can link to
|
|
16716
18447
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
16717
18448
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
16718
|
-
* whatever their id. Absent / false — a login button only
|
|
18449
|
+
* whatever their id. Absent / false — a login button only.
|
|
16719
18450
|
*/
|
|
16720
18451
|
linkable: boolean().optional()
|
|
16721
18452
|
}),
|
|
@@ -20549,8 +22280,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20549
22280
|
* `super_admin` — collapsed onto the single boolean because every
|
|
20550
22281
|
* non-admin caller is governed by the same scope-check rules; the
|
|
20551
22282
|
* distinction was only ever used to route role-specific procedures
|
|
20552
|
-
* which we no longer have.
|
|
20553
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22283
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
20554
22284
|
* with `isAdmin: false` + an explicit scope list.
|
|
20555
22285
|
*/
|
|
20556
22286
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -22052,8 +23782,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22052
23782
|
]);
|
|
22053
23783
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22054
23784
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22055
|
-
/**
|
|
22056
|
-
|
|
23785
|
+
/**
|
|
23786
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23787
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23788
|
+
*
|
|
23789
|
+
* - `operator` — drawn by hand.
|
|
23790
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23791
|
+
* model, or a larger teacher model).
|
|
23792
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23793
|
+
* back from the track store (never a re-run).
|
|
23794
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23795
|
+
*/
|
|
23796
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23797
|
+
"operator",
|
|
23798
|
+
"assist",
|
|
23799
|
+
"pipeline",
|
|
23800
|
+
"llm"
|
|
23801
|
+
]);
|
|
22057
23802
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22058
23803
|
var RetrainBboxSchema = object({
|
|
22059
23804
|
x: number(),
|
|
@@ -22071,7 +23816,8 @@ var RetrainBboxSchema = object({
|
|
|
22071
23816
|
*/
|
|
22072
23817
|
var RetrainAnnotationSchema = object({
|
|
22073
23818
|
id: string(),
|
|
22074
|
-
|
|
23819
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23820
|
+
trackId: string().optional(),
|
|
22075
23821
|
deviceId: number(),
|
|
22076
23822
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22077
23823
|
mediaKey: string(),
|
|
@@ -22120,13 +23866,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22120
23866
|
* fail, whatever became of the original. */
|
|
22121
23867
|
copied: boolean()
|
|
22122
23868
|
});
|
|
23869
|
+
/**
|
|
23870
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23871
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23872
|
+
* box recorded on the source media row when there is one, else the track
|
|
23873
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23874
|
+
* until the operator confirms it.
|
|
23875
|
+
*/
|
|
23876
|
+
var RetrainPipelineBoxSchema = object({
|
|
23877
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23878
|
+
bbox: RetrainBboxSchema,
|
|
23879
|
+
macroClass: RetrainMacroClassSchema,
|
|
23880
|
+
label: string().optional(),
|
|
23881
|
+
subLabel: string().optional(),
|
|
23882
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23883
|
+
score: number().optional(),
|
|
23884
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23885
|
+
modelId: string().optional(),
|
|
23886
|
+
trackId: string(),
|
|
23887
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23888
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23889
|
+
basis: _enum(["subject-box", "position"]),
|
|
23890
|
+
deltaMs: number()
|
|
23891
|
+
});
|
|
23892
|
+
/**
|
|
23893
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23894
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23895
|
+
* track at all.
|
|
23896
|
+
*/
|
|
23897
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22123
23898
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22124
23899
|
var RetrainFrameSchema = object({
|
|
22125
23900
|
frameId: string(),
|
|
22126
23901
|
deviceId: number(),
|
|
22127
|
-
|
|
22128
|
-
/**
|
|
22129
|
-
|
|
23902
|
+
origin: RetrainFrameOriginSchema,
|
|
23903
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23904
|
+
trackId: string().optional(),
|
|
23905
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23906
|
+
* Absent on a recording still. */
|
|
23907
|
+
sourceMediaId: number().int().optional(),
|
|
23908
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23909
|
+
epochMs: number().optional(),
|
|
22130
23910
|
sourceKind: MediaFileKindEnum,
|
|
22131
23911
|
sizeBytes: number().int(),
|
|
22132
23912
|
width: number().int(),
|
|
@@ -22137,7 +23917,12 @@ var RetrainFrameSchema = object({
|
|
|
22137
23917
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22138
23918
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22139
23919
|
* a false positive. */
|
|
22140
|
-
complete: boolean()
|
|
23920
|
+
complete: boolean(),
|
|
23921
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23922
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23923
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23924
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23925
|
+
collectionIds: array(string()).readonly().optional()
|
|
22141
23926
|
});
|
|
22142
23927
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22143
23928
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22168,6 +23953,11 @@ var RetrainFrameListSchema = object({
|
|
|
22168
23953
|
var RetrainExportFilterSchema = object({
|
|
22169
23954
|
deviceIds: array(number()).optional(),
|
|
22170
23955
|
frameIds: array(string()).max(2e4).optional(),
|
|
23956
|
+
/** Only frames in at least one of these named collections. */
|
|
23957
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23958
|
+
/** Exactly the frames of this dataset version (and its completeOnly). An
|
|
23959
|
+
* unknown id selects nothing. */
|
|
23960
|
+
datasetVersionId: string().optional(),
|
|
22171
23961
|
batchId: string().optional(),
|
|
22172
23962
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22173
23963
|
completeOnly: boolean().optional()
|
|
@@ -22232,6 +24022,170 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22232
24022
|
reason: string(),
|
|
22233
24023
|
detail: string().optional()
|
|
22234
24024
|
})]);
|
|
24025
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24026
|
+
var RetrainCollectionSchema = object({
|
|
24027
|
+
id: string(),
|
|
24028
|
+
name: string(),
|
|
24029
|
+
createdAt: number(),
|
|
24030
|
+
frameCount: number().int()
|
|
24031
|
+
});
|
|
24032
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24033
|
+
kind: literal("created"),
|
|
24034
|
+
collection: RetrainCollectionSchema
|
|
24035
|
+
}), object({
|
|
24036
|
+
kind: literal("refused"),
|
|
24037
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24038
|
+
})]);
|
|
24039
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24040
|
+
kind: literal("renamed"),
|
|
24041
|
+
collection: RetrainCollectionSchema
|
|
24042
|
+
}), object({
|
|
24043
|
+
kind: literal("refused"),
|
|
24044
|
+
reason: _enum([
|
|
24045
|
+
"empty-name",
|
|
24046
|
+
"duplicate-name",
|
|
24047
|
+
"unknown-collection"
|
|
24048
|
+
])
|
|
24049
|
+
})]);
|
|
24050
|
+
/**
|
|
24051
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24052
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24053
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24054
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24055
|
+
*/
|
|
24056
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24057
|
+
kind: literal("added"),
|
|
24058
|
+
collectionId: string(),
|
|
24059
|
+
frame: RetrainFrameSchema,
|
|
24060
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24061
|
+
reused: boolean()
|
|
24062
|
+
}), object({
|
|
24063
|
+
kind: literal("refused"),
|
|
24064
|
+
reason: _enum([
|
|
24065
|
+
"unknown-collection",
|
|
24066
|
+
"still-unavailable",
|
|
24067
|
+
"still-busy",
|
|
24068
|
+
"unreadable-image",
|
|
24069
|
+
"write-failed"
|
|
24070
|
+
]),
|
|
24071
|
+
detail: string().optional()
|
|
24072
|
+
})]);
|
|
24073
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24074
|
+
var RetrainAssistProfileSchema = object({
|
|
24075
|
+
id: string(),
|
|
24076
|
+
name: string(),
|
|
24077
|
+
model: string(),
|
|
24078
|
+
kind: string(),
|
|
24079
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24080
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24081
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24082
|
+
leavesHouse: boolean()
|
|
24083
|
+
});
|
|
24084
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24085
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24086
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24087
|
+
var RetrainLlmReviewSchema = object({
|
|
24088
|
+
/** The `ref` the page sent the box under. */
|
|
24089
|
+
ref: string(),
|
|
24090
|
+
verdict: _enum([
|
|
24091
|
+
"confirmed",
|
|
24092
|
+
"wrong-class",
|
|
24093
|
+
"not-an-object",
|
|
24094
|
+
"uncertain"
|
|
24095
|
+
]),
|
|
24096
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24097
|
+
reason: string()
|
|
24098
|
+
});
|
|
24099
|
+
/**
|
|
24100
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24101
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24102
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24103
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24104
|
+
*/
|
|
24105
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24106
|
+
kind: literal("proposed"),
|
|
24107
|
+
profileId: string(),
|
|
24108
|
+
model: string(),
|
|
24109
|
+
/** The frame was sent outside the house for this answer. */
|
|
24110
|
+
leftHouse: boolean(),
|
|
24111
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24112
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24113
|
+
rejected: number().int()
|
|
24114
|
+
}), object({
|
|
24115
|
+
kind: literal("refused"),
|
|
24116
|
+
reason: _enum([
|
|
24117
|
+
"unknown-frame",
|
|
24118
|
+
"unreadable-frame",
|
|
24119
|
+
"unknown-profile",
|
|
24120
|
+
"profile-disabled",
|
|
24121
|
+
"no-vision",
|
|
24122
|
+
"cloud-not-confirmed",
|
|
24123
|
+
"llm-error",
|
|
24124
|
+
"malformed-answer"
|
|
24125
|
+
]),
|
|
24126
|
+
detail: string().optional()
|
|
24127
|
+
})]);
|
|
24128
|
+
/** What a dataset version is cut from. Every field narrows. */
|
|
24129
|
+
var RetrainDatasetSelectionSchema = object({
|
|
24130
|
+
deviceIds: array(number()).readonly().optional(),
|
|
24131
|
+
collectionIds: array(string()).max(200).readonly().optional(),
|
|
24132
|
+
frameIds: array(string()).max(2e4).readonly().optional()
|
|
24133
|
+
});
|
|
24134
|
+
/** The counts a dataset is judged by. */
|
|
24135
|
+
var RetrainDatasetStatsSchema = object({
|
|
24136
|
+
frames: number().int(),
|
|
24137
|
+
completeFrames: number().int(),
|
|
24138
|
+
/** `completeFrames / frames`, 0..1. */
|
|
24139
|
+
completeness: number(),
|
|
24140
|
+
/** Boxes to learn (model errors excluded). */
|
|
24141
|
+
subjects: number().int(),
|
|
24142
|
+
modelErrors: number().int(),
|
|
24143
|
+
/** Complete frames with no subject. */
|
|
24144
|
+
hardNegatives: number().int(),
|
|
24145
|
+
/** Subjects per class × camera × day/night. */
|
|
24146
|
+
cells: array(object({
|
|
24147
|
+
macroClass: string(),
|
|
24148
|
+
deviceId: number(),
|
|
24149
|
+
lighting: _enum([
|
|
24150
|
+
"day",
|
|
24151
|
+
"night",
|
|
24152
|
+
"unknown"
|
|
24153
|
+
]),
|
|
24154
|
+
subjects: number().int(),
|
|
24155
|
+
frames: number().int()
|
|
24156
|
+
})).readonly(),
|
|
24157
|
+
cameras: array(object({
|
|
24158
|
+
deviceId: number(),
|
|
24159
|
+
frames: number().int(),
|
|
24160
|
+
completeFrames: number().int()
|
|
24161
|
+
})).readonly()
|
|
24162
|
+
});
|
|
24163
|
+
/** An immutable dataset version, without its frame list. */
|
|
24164
|
+
var RetrainDatasetVersionSchema = object({
|
|
24165
|
+
id: string(),
|
|
24166
|
+
name: string(),
|
|
24167
|
+
createdAt: number(),
|
|
24168
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24169
|
+
layout: RetrainExportLayoutSchema,
|
|
24170
|
+
completeOnly: boolean(),
|
|
24171
|
+
frameCount: number().int(),
|
|
24172
|
+
/** sha256 of what the frames taught when the version was frozen. */
|
|
24173
|
+
annotationHash: string(),
|
|
24174
|
+
/** The export manifest schema the version was cut under. */
|
|
24175
|
+
manifestSchema: string(),
|
|
24176
|
+
stats: RetrainDatasetStatsSchema
|
|
24177
|
+
});
|
|
24178
|
+
var CreateRetrainDatasetVersionResultSchema = discriminatedUnion("kind", [object({
|
|
24179
|
+
kind: literal("created"),
|
|
24180
|
+
version: RetrainDatasetVersionSchema
|
|
24181
|
+
}), object({
|
|
24182
|
+
kind: literal("refused"),
|
|
24183
|
+
reason: _enum([
|
|
24184
|
+
"empty-name",
|
|
24185
|
+
"duplicate-name",
|
|
24186
|
+
"no-frames"
|
|
24187
|
+
])
|
|
24188
|
+
})]);
|
|
22235
24189
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22236
24190
|
var RetrainTransitionResultSchema = object({
|
|
22237
24191
|
trackId: string(),
|
|
@@ -22949,7 +24903,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22949
24903
|
auth: "admin"
|
|
22950
24904
|
}), method(object({
|
|
22951
24905
|
deviceId: number(),
|
|
22952
|
-
trackId: string(),
|
|
24906
|
+
trackId: string().optional(),
|
|
22953
24907
|
frameId: string()
|
|
22954
24908
|
}), object({
|
|
22955
24909
|
removed: boolean(),
|
|
@@ -22966,7 +24920,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22966
24920
|
auth: "admin"
|
|
22967
24921
|
}), method(object({
|
|
22968
24922
|
deviceId: number(),
|
|
22969
|
-
|
|
24923
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24924
|
+
trackId: string().optional(),
|
|
22970
24925
|
frameId: string(),
|
|
22971
24926
|
subject: RetrainAssistSubjectSchema,
|
|
22972
24927
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -22974,12 +24929,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22974
24929
|
}), RetrainAssistResultSchema, {
|
|
22975
24930
|
kind: "mutation",
|
|
22976
24931
|
auth: "admin"
|
|
22977
|
-
}), method(object({
|
|
24932
|
+
}), method(object({
|
|
24933
|
+
trackId: string().optional(),
|
|
24934
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24935
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
22978
24936
|
kind: "query",
|
|
22979
24937
|
auth: "admin"
|
|
22980
24938
|
}), method(object({
|
|
22981
24939
|
deviceId: number(),
|
|
22982
|
-
|
|
24940
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24941
|
+
trackId: string().optional(),
|
|
22983
24942
|
frameId: string(),
|
|
22984
24943
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
22985
24944
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23002,7 +24961,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23002
24961
|
auth: "admin"
|
|
23003
24962
|
}), method(object({
|
|
23004
24963
|
deviceId: number(),
|
|
23005
|
-
trackId: string(),
|
|
24964
|
+
trackId: string().optional(),
|
|
23006
24965
|
frameId: string(),
|
|
23007
24966
|
complete: boolean()
|
|
23008
24967
|
}), RetrainFrameSchema, {
|
|
@@ -23016,6 +24975,115 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23016
24975
|
kind: "mutation",
|
|
23017
24976
|
auth: "admin",
|
|
23018
24977
|
timeoutMs: 60 * 6e4
|
|
24978
|
+
}), method(object({
|
|
24979
|
+
filter: RetrainExportFilterSchema,
|
|
24980
|
+
layout: RetrainExportLayoutSchema
|
|
24981
|
+
}), object({
|
|
24982
|
+
ticket: PeerBytesTicketSchema,
|
|
24983
|
+
frames: number().int(),
|
|
24984
|
+
annotations: number().int()
|
|
24985
|
+
}), {
|
|
24986
|
+
kind: "mutation",
|
|
24987
|
+
auth: "admin",
|
|
24988
|
+
timeoutMs: 12e4
|
|
24989
|
+
}), method(object({
|
|
24990
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24991
|
+
completeOnly: boolean().optional()
|
|
24992
|
+
}), RetrainDatasetStatsSchema, {
|
|
24993
|
+
kind: "query",
|
|
24994
|
+
auth: "admin"
|
|
24995
|
+
}), method(object({
|
|
24996
|
+
name: string().max(120),
|
|
24997
|
+
selection: RetrainDatasetSelectionSchema,
|
|
24998
|
+
layout: RetrainExportLayoutSchema,
|
|
24999
|
+
completeOnly: boolean()
|
|
25000
|
+
}), CreateRetrainDatasetVersionResultSchema, {
|
|
25001
|
+
kind: "mutation",
|
|
25002
|
+
auth: "admin",
|
|
25003
|
+
timeoutMs: 12e4
|
|
25004
|
+
}), method(object({}), array(RetrainDatasetVersionSchema).readonly(), {
|
|
25005
|
+
kind: "query",
|
|
25006
|
+
auth: "admin"
|
|
25007
|
+
}), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
25008
|
+
kind: "mutation",
|
|
25009
|
+
auth: "admin"
|
|
25010
|
+
}), method(object({ id: string() }), object({
|
|
25011
|
+
found: boolean(),
|
|
25012
|
+
annotationHash: string(),
|
|
25013
|
+
matches: boolean(),
|
|
25014
|
+
missingFrames: number().int()
|
|
25015
|
+
}), {
|
|
25016
|
+
kind: "query",
|
|
25017
|
+
auth: "admin",
|
|
25018
|
+
timeoutMs: 12e4
|
|
25019
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25020
|
+
kind: "query",
|
|
25021
|
+
auth: "admin"
|
|
25022
|
+
}), method(object({
|
|
25023
|
+
deviceId: number(),
|
|
25024
|
+
trackId: string().optional(),
|
|
25025
|
+
frameId: string(),
|
|
25026
|
+
profileId: string(),
|
|
25027
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25028
|
+
boxes: array(object({
|
|
25029
|
+
ref: string(),
|
|
25030
|
+
bbox: RetrainBboxSchema,
|
|
25031
|
+
macroClass: RetrainMacroClassSchema,
|
|
25032
|
+
label: string().optional()
|
|
25033
|
+
})).max(50),
|
|
25034
|
+
allowCloud: boolean()
|
|
25035
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25036
|
+
kind: "mutation",
|
|
25037
|
+
auth: "admin",
|
|
25038
|
+
timeoutMs: 18e4
|
|
25039
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25040
|
+
kind: "mutation",
|
|
25041
|
+
auth: "admin"
|
|
25042
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25043
|
+
kind: "query",
|
|
25044
|
+
auth: "admin"
|
|
25045
|
+
}), method(object({
|
|
25046
|
+
id: string(),
|
|
25047
|
+
name: string().max(120)
|
|
25048
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25049
|
+
kind: "mutation",
|
|
25050
|
+
auth: "admin"
|
|
25051
|
+
}), method(object({ id: string() }), object({
|
|
25052
|
+
deleted: boolean(),
|
|
25053
|
+
removedFrames: number().int()
|
|
25054
|
+
}), {
|
|
25055
|
+
kind: "mutation",
|
|
25056
|
+
auth: "admin"
|
|
25057
|
+
}), method(object({
|
|
25058
|
+
collectionId: string(),
|
|
25059
|
+
deviceId: number(),
|
|
25060
|
+
epochMs: number()
|
|
25061
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25062
|
+
kind: "mutation",
|
|
25063
|
+
auth: "admin",
|
|
25064
|
+
timeoutMs: 6e4
|
|
25065
|
+
}), method(object({
|
|
25066
|
+
collectionId: string(),
|
|
25067
|
+
frameIds: array(string()).min(1).max(500)
|
|
25068
|
+
}), object({
|
|
25069
|
+
added: number().int(),
|
|
25070
|
+
alreadyMember: number().int(),
|
|
25071
|
+
unknownFrameIds: array(string()).readonly()
|
|
25072
|
+
}), {
|
|
25073
|
+
kind: "mutation",
|
|
25074
|
+
auth: "admin"
|
|
25075
|
+
}), method(object({
|
|
25076
|
+
collectionId: string(),
|
|
25077
|
+
frameId: string()
|
|
25078
|
+
}), object({
|
|
25079
|
+
removed: boolean(),
|
|
25080
|
+
deletedFrame: boolean()
|
|
25081
|
+
}), {
|
|
25082
|
+
kind: "mutation",
|
|
25083
|
+
auth: "admin"
|
|
25084
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
25085
|
+
kind: "query",
|
|
25086
|
+
auth: "admin"
|
|
23019
25087
|
}), method(object({
|
|
23020
25088
|
/** Which of the three event tables owns the row. */
|
|
23021
25089
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23639,13 +25707,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23639
25707
|
object({
|
|
23640
25708
|
kind: literal("no-family-build"),
|
|
23641
25709
|
format: ModelFormatSchema$1
|
|
25710
|
+
}),
|
|
25711
|
+
object({
|
|
25712
|
+
kind: literal("kept-custom-pin"),
|
|
25713
|
+
modelId: string(),
|
|
25714
|
+
deviceKey: string()
|
|
23642
25715
|
})
|
|
23643
25716
|
]);
|
|
25717
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25718
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25719
|
+
/**
|
|
25720
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25721
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25722
|
+
*/
|
|
25723
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25724
|
+
kind: literal("node-benchmark"),
|
|
25725
|
+
resultId: string(),
|
|
25726
|
+
measuredAtMs: number()
|
|
25727
|
+
})]);
|
|
23644
25728
|
var DeviceModelChoiceSchema = object({
|
|
23645
25729
|
modelId: string(),
|
|
23646
25730
|
p50Ms: number(),
|
|
23647
25731
|
fps: number(),
|
|
23648
25732
|
measured: boolean(),
|
|
25733
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25734
|
+
source: LatencySourceSchema.optional(),
|
|
23649
25735
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23650
25736
|
capacitySessions: number(),
|
|
23651
25737
|
personRecall: number()
|
|
@@ -23656,6 +25742,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23656
25742
|
enabled: boolean(),
|
|
23657
25743
|
available: boolean(),
|
|
23658
25744
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25745
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25746
|
+
kept: KeptReasonSchema.optional(),
|
|
23659
25747
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23660
25748
|
});
|
|
23661
25749
|
var NodeRecommendationSchema = object({
|
|
@@ -23709,6 +25797,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
23709
25797
|
kind: literal("coral-enabled"),
|
|
23710
25798
|
nodeId: string(),
|
|
23711
25799
|
deviceKey: string()
|
|
25800
|
+
}),
|
|
25801
|
+
object({
|
|
25802
|
+
kind: literal("custom-pin-kept"),
|
|
25803
|
+
nodeId: string(),
|
|
25804
|
+
deviceKey: string().nullable(),
|
|
25805
|
+
deviceId: number().nullable(),
|
|
25806
|
+
modelId: string()
|
|
25807
|
+
}),
|
|
25808
|
+
object({
|
|
25809
|
+
kind: literal("custom-registry-unreadable"),
|
|
25810
|
+
error: string()
|
|
23712
25811
|
})
|
|
23713
25812
|
]);
|
|
23714
25813
|
var AutoTuneOptionsSchema = object({
|
|
@@ -23887,13 +25986,14 @@ var SuggestSharesResultSchema = object({
|
|
|
23887
25986
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
23888
25987
|
});
|
|
23889
25988
|
/**
|
|
23890
|
-
* Where the node and device shares come from (D750, D755).
|
|
23891
|
-
* - `
|
|
23892
|
-
*
|
|
23893
|
-
*
|
|
23894
|
-
*
|
|
23895
|
-
*
|
|
23896
|
-
*
|
|
25989
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25990
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25991
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25992
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25993
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25994
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25995
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25996
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
23897
25997
|
* - `manual` — the operator's stored sliders.
|
|
23898
25998
|
* Either way a node or device that cannot take sessions gives its share to
|
|
23899
25999
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -23942,6 +26042,362 @@ var EffectiveSharesSchema = object({
|
|
|
23942
26042
|
nodeWeights: record(string(), number()),
|
|
23943
26043
|
deviceWeights: record(string(), record(string(), number()))
|
|
23944
26044
|
});
|
|
26045
|
+
/**
|
|
26046
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26047
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26048
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26049
|
+
* shares read.
|
|
26050
|
+
*
|
|
26051
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26052
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26053
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26054
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26055
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26056
|
+
*
|
|
26057
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26058
|
+
* cross a process at frame rate, D9):
|
|
26059
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26060
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26061
|
+
* interval;
|
|
26062
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26063
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26064
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26065
|
+
* CPU, RAM or the event loop give out.
|
|
26066
|
+
*/
|
|
26067
|
+
/** Defaults and bounds, one place. */
|
|
26068
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26069
|
+
fpsPerStream: 10,
|
|
26070
|
+
budgetMinutes: 45,
|
|
26071
|
+
minBudgetMinutes: 10,
|
|
26072
|
+
maxBudgetMinutes: 120,
|
|
26073
|
+
/** A result older than this no longer beats the table. */
|
|
26074
|
+
staleAfterDays: 30,
|
|
26075
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26076
|
+
settleSec: 5,
|
|
26077
|
+
/** Accounted window per ramp step. */
|
|
26078
|
+
measureSec: 20,
|
|
26079
|
+
/** Longest the drain may take before the run is refused. */
|
|
26080
|
+
drainTimeoutSec: 120,
|
|
26081
|
+
/** Candidate models per device in one run. */
|
|
26082
|
+
maxModelsPerDevice: 6
|
|
26083
|
+
};
|
|
26084
|
+
/** The two measurements a run can make. */
|
|
26085
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26086
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26087
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26088
|
+
deviceKey: string().min(1),
|
|
26089
|
+
/**
|
|
26090
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26091
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26092
|
+
*/
|
|
26093
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26094
|
+
});
|
|
26095
|
+
/** What the operator confirmed. */
|
|
26096
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26097
|
+
nodeId: string().min(1),
|
|
26098
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26099
|
+
/** Which measurements run. At least one. */
|
|
26100
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26101
|
+
/**
|
|
26102
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26103
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26104
|
+
* detector always runs.
|
|
26105
|
+
*/
|
|
26106
|
+
steps: array(string().min(1)).default([]),
|
|
26107
|
+
/** Offered rate of one stream / session. */
|
|
26108
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26109
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26110
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26111
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26112
|
+
keepDownloadedModels: boolean().default(false),
|
|
26113
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26114
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26115
|
+
});
|
|
26116
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26117
|
+
kind: _enum([
|
|
26118
|
+
"benchmark-active",
|
|
26119
|
+
"node-offline",
|
|
26120
|
+
"unknown-device",
|
|
26121
|
+
"no-phase",
|
|
26122
|
+
"insufficient-headroom"
|
|
26123
|
+
]),
|
|
26124
|
+
detail: string(),
|
|
26125
|
+
overridable: boolean()
|
|
26126
|
+
});
|
|
26127
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26128
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26129
|
+
deviceId: number(),
|
|
26130
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26131
|
+
placedOnNode: boolean(),
|
|
26132
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26133
|
+
pinnedToNode: boolean()
|
|
26134
|
+
});
|
|
26135
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26136
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26137
|
+
deviceId: number(),
|
|
26138
|
+
reason: literal("only-frame-source")
|
|
26139
|
+
});
|
|
26140
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26141
|
+
nodeId: string(),
|
|
26142
|
+
online: boolean(),
|
|
26143
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26144
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26145
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26146
|
+
estimatedDurationMs: number(),
|
|
26147
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26148
|
+
budgetMs: number(),
|
|
26149
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26150
|
+
steps: array(string()).readonly(),
|
|
26151
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26152
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26153
|
+
headroom: object({
|
|
26154
|
+
sessionsNow: number(),
|
|
26155
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26156
|
+
}),
|
|
26157
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26158
|
+
canStart: boolean()
|
|
26159
|
+
});
|
|
26160
|
+
/** Where the measuring runner is. */
|
|
26161
|
+
var NodeBenchProgressSchema = object({
|
|
26162
|
+
phase: _enum([
|
|
26163
|
+
"preparing",
|
|
26164
|
+
"device",
|
|
26165
|
+
"pipeline",
|
|
26166
|
+
"cleanup"
|
|
26167
|
+
]),
|
|
26168
|
+
deviceKey: string().nullable(),
|
|
26169
|
+
modelId: string().nullable(),
|
|
26170
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26171
|
+
load: number().nullable(),
|
|
26172
|
+
cellsDone: number(),
|
|
26173
|
+
cellsTotal: number(),
|
|
26174
|
+
message: string()
|
|
26175
|
+
});
|
|
26176
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26177
|
+
var NodeBenchLimitSchema = _enum([
|
|
26178
|
+
"p95",
|
|
26179
|
+
"drops",
|
|
26180
|
+
"errors",
|
|
26181
|
+
"stall",
|
|
26182
|
+
"cpu",
|
|
26183
|
+
"ram",
|
|
26184
|
+
"none"
|
|
26185
|
+
]);
|
|
26186
|
+
var NodeBenchRampStepSchema = object({
|
|
26187
|
+
load: number(),
|
|
26188
|
+
pass: boolean(),
|
|
26189
|
+
p95Ms: number(),
|
|
26190
|
+
dropRatio: number(),
|
|
26191
|
+
/** Completed frames per second over the accounted window. */
|
|
26192
|
+
fps: number(),
|
|
26193
|
+
cpuPct: number().nullable(),
|
|
26194
|
+
ramFreePct: number().nullable(),
|
|
26195
|
+
failReasons: array(string()).readonly()
|
|
26196
|
+
});
|
|
26197
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26198
|
+
phase: literal("device"),
|
|
26199
|
+
deviceKey: string(),
|
|
26200
|
+
modelId: string(),
|
|
26201
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26202
|
+
p50Ms: number(),
|
|
26203
|
+
p95Ms: number(),
|
|
26204
|
+
p99Ms: number(),
|
|
26205
|
+
/** Frames per second sustained at the last passing step. */
|
|
26206
|
+
fps: number(),
|
|
26207
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26208
|
+
kMax: number(),
|
|
26209
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26210
|
+
/** First call (model load + warm-up). */
|
|
26211
|
+
warmupMs: number(),
|
|
26212
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26213
|
+
}), object({
|
|
26214
|
+
phase: literal("pipeline"),
|
|
26215
|
+
deviceKey: string(),
|
|
26216
|
+
modelId: string(),
|
|
26217
|
+
steps: array(string()).readonly(),
|
|
26218
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26219
|
+
maxSessions: number(),
|
|
26220
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26221
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26222
|
+
stepsFired: array(string()).readonly(),
|
|
26223
|
+
warmupMs: number(),
|
|
26224
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26225
|
+
})]);
|
|
26226
|
+
/**
|
|
26227
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26228
|
+
* the node no longer beats the table.
|
|
26229
|
+
*/
|
|
26230
|
+
var NodeBenchFingerprintSchema = object({
|
|
26231
|
+
pipelineVersion: string().nullable(),
|
|
26232
|
+
cpuModel: string().nullable(),
|
|
26233
|
+
ramGb: number().nullable(),
|
|
26234
|
+
os: string().nullable(),
|
|
26235
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26236
|
+
pools: record(string(), object({
|
|
26237
|
+
runtime: string(),
|
|
26238
|
+
numWorkers: number(),
|
|
26239
|
+
concurrency: number(),
|
|
26240
|
+
batchMode: string()
|
|
26241
|
+
})).default({})
|
|
26242
|
+
});
|
|
26243
|
+
/** The frames the run used. */
|
|
26244
|
+
var NodeBenchClipSchema = object({
|
|
26245
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26246
|
+
id: string(),
|
|
26247
|
+
revision: string().nullable(),
|
|
26248
|
+
frames: number(),
|
|
26249
|
+
width: number(),
|
|
26250
|
+
height: number()
|
|
26251
|
+
});
|
|
26252
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26253
|
+
runId: string().min(1),
|
|
26254
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26255
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26256
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26257
|
+
steps: array(string()).default([]),
|
|
26258
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26259
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26260
|
+
deadlineAtMs: number(),
|
|
26261
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26262
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26263
|
+
keepDownloadedModels: boolean().default(false)
|
|
26264
|
+
});
|
|
26265
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26266
|
+
"running",
|
|
26267
|
+
"done",
|
|
26268
|
+
"failed",
|
|
26269
|
+
"aborted"
|
|
26270
|
+
]);
|
|
26271
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26272
|
+
runId: string(),
|
|
26273
|
+
nodeId: string(),
|
|
26274
|
+
state: NodeBenchRunnerStateSchema,
|
|
26275
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26276
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26277
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26278
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26279
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26280
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26281
|
+
activeCameraIds: array(number()).readonly(),
|
|
26282
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26283
|
+
deletedModels: array(string()).readonly(),
|
|
26284
|
+
error: string().nullable(),
|
|
26285
|
+
startedAtMs: number(),
|
|
26286
|
+
finishedAtMs: number().nullable()
|
|
26287
|
+
});
|
|
26288
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26289
|
+
"draining",
|
|
26290
|
+
"measuring",
|
|
26291
|
+
"restoring",
|
|
26292
|
+
"done",
|
|
26293
|
+
"failed",
|
|
26294
|
+
"aborted"
|
|
26295
|
+
]);
|
|
26296
|
+
/** Why a run ended. */
|
|
26297
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26298
|
+
"completed",
|
|
26299
|
+
"operator-abort",
|
|
26300
|
+
"deadline",
|
|
26301
|
+
"node-lost",
|
|
26302
|
+
"runner-lost",
|
|
26303
|
+
"hub-restart",
|
|
26304
|
+
"drain-timeout",
|
|
26305
|
+
"failed"
|
|
26306
|
+
]);
|
|
26307
|
+
var NodeBenchmarkRunSchema = object({
|
|
26308
|
+
runId: string(),
|
|
26309
|
+
nodeId: string(),
|
|
26310
|
+
state: NodeBenchmarkStateSchema,
|
|
26311
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26312
|
+
startedAtMs: number(),
|
|
26313
|
+
deadlineAtMs: number(),
|
|
26314
|
+
finishedAtMs: number().nullable(),
|
|
26315
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26316
|
+
error: string().nullable(),
|
|
26317
|
+
/** Cameras moved off the node for the run. */
|
|
26318
|
+
moved: array(number()).readonly(),
|
|
26319
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26320
|
+
staying: array(number()).readonly(),
|
|
26321
|
+
/** Something else ran on the node's pools during the run. */
|
|
26322
|
+
contaminated: boolean(),
|
|
26323
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26324
|
+
resultIds: array(string()).readonly()
|
|
26325
|
+
});
|
|
26326
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26327
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26328
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26329
|
+
modeNodeId: string().nullable(),
|
|
26330
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26331
|
+
});
|
|
26332
|
+
/**
|
|
26333
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26334
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26335
|
+
* ends, never by anyone else.
|
|
26336
|
+
*/
|
|
26337
|
+
var NodeBenchmarkResultSchema = object({
|
|
26338
|
+
id: string(),
|
|
26339
|
+
runId: string(),
|
|
26340
|
+
nodeId: string(),
|
|
26341
|
+
cell: NodeBenchCellSchema,
|
|
26342
|
+
fpsPerStream: number(),
|
|
26343
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26344
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26345
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26346
|
+
contaminated: boolean(),
|
|
26347
|
+
stayingCameras: array(number()).readonly(),
|
|
26348
|
+
/** The run ended early; the cell itself completed. */
|
|
26349
|
+
partialRun: boolean(),
|
|
26350
|
+
measuredAtMs: number()
|
|
26351
|
+
});
|
|
26352
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26353
|
+
nodeId: string().optional(),
|
|
26354
|
+
deviceKey: string().optional()
|
|
26355
|
+
});
|
|
26356
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26357
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26358
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26359
|
+
standing: _enum([
|
|
26360
|
+
"fresh",
|
|
26361
|
+
"stale",
|
|
26362
|
+
"superseded"
|
|
26363
|
+
]),
|
|
26364
|
+
staleWhy: _enum([
|
|
26365
|
+
"age",
|
|
26366
|
+
"runtime",
|
|
26367
|
+
"pool-tuning"
|
|
26368
|
+
]).nullable()
|
|
26369
|
+
});
|
|
26370
|
+
object({
|
|
26371
|
+
runId: string(),
|
|
26372
|
+
nodeId: string(),
|
|
26373
|
+
startedAtMs: number(),
|
|
26374
|
+
deadlineAtMs: number(),
|
|
26375
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26376
|
+
moved: array(number()).readonly(),
|
|
26377
|
+
staying: array(number()).readonly()
|
|
26378
|
+
});
|
|
26379
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26380
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26381
|
+
nodeId: string(),
|
|
26382
|
+
reachable: boolean(),
|
|
26383
|
+
devices: array(object({
|
|
26384
|
+
deviceKey: string(),
|
|
26385
|
+
enabled: boolean(),
|
|
26386
|
+
available: boolean(),
|
|
26387
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26388
|
+
suggested: array(string()).readonly(),
|
|
26389
|
+
/** Every root detector the device has a build for. */
|
|
26390
|
+
all: array(string()).readonly(),
|
|
26391
|
+
/** The model the device runs now, when pinned. */
|
|
26392
|
+
currentModelId: string().nullable()
|
|
26393
|
+
})).readonly(),
|
|
26394
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26395
|
+
steps: array(object({
|
|
26396
|
+
id: string(),
|
|
26397
|
+
name: string(),
|
|
26398
|
+
slot: string()
|
|
26399
|
+
})).readonly()
|
|
26400
|
+
});
|
|
23945
26401
|
object({
|
|
23946
26402
|
activeCameras: number(),
|
|
23947
26403
|
throttledCameras: number(),
|
|
@@ -25030,7 +27486,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25030
27486
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25031
27487
|
deviceId: number(),
|
|
25032
27488
|
trackId: string()
|
|
25033
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27489
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27490
|
+
accepted: literal(true),
|
|
27491
|
+
runId: string()
|
|
27492
|
+
}), {
|
|
27493
|
+
kind: "mutation",
|
|
27494
|
+
auth: "admin"
|
|
27495
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27496
|
+
kind: "mutation",
|
|
27497
|
+
auth: "admin"
|
|
27498
|
+
});
|
|
25034
27499
|
var CameraPipelineConfigSchema = object({
|
|
25035
27500
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25036
27501
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -25669,6 +28134,21 @@ method(object({
|
|
|
25669
28134
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
25670
28135
|
kind: "mutation",
|
|
25671
28136
|
auth: "admin"
|
|
28137
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28138
|
+
kind: literal("started"),
|
|
28139
|
+
runId: string()
|
|
28140
|
+
}), object({
|
|
28141
|
+
kind: literal("refused"),
|
|
28142
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28143
|
+
})]), {
|
|
28144
|
+
kind: "mutation",
|
|
28145
|
+
auth: "admin"
|
|
28146
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28147
|
+
kind: "mutation",
|
|
28148
|
+
auth: "admin"
|
|
28149
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28150
|
+
kind: "mutation",
|
|
28151
|
+
auth: "admin"
|
|
25672
28152
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25673
28153
|
deviceId: number(),
|
|
25674
28154
|
addonId: string(),
|
|
@@ -26074,8 +28554,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
26074
28554
|
* `smtp-provider` — pluggable email delivery surface.
|
|
26075
28555
|
*
|
|
26076
28556
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
26077
|
-
* one for transactional / one for notifications). Consumers (
|
|
26078
|
-
*
|
|
28557
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
28558
|
+
* addons, …) walk the collection and pick the first
|
|
26079
28559
|
* ready provider OR target a specific addonId.
|
|
26080
28560
|
*
|
|
26081
28561
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -26254,7 +28734,7 @@ targets: array(object({
|
|
|
26254
28734
|
})));
|
|
26255
28735
|
/**
|
|
26256
28736
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
26257
|
-
* providers (OIDC, SAML,
|
|
28737
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
26258
28738
|
* carrying the post-callback claims before redirecting back to
|
|
26259
28739
|
* `/api/auth/sso/finish`.
|
|
26260
28740
|
*
|
|
@@ -26317,7 +28797,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26317
28797
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
26318
28798
|
* subject is unique only per issuer, so a link is bound to it.
|
|
26319
28799
|
*/
|
|
26320
|
-
issuer: string().optional()
|
|
28800
|
+
issuer: string().optional(),
|
|
28801
|
+
/**
|
|
28802
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
28803
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
28804
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
28805
|
+
* any other browser.
|
|
28806
|
+
*/
|
|
28807
|
+
browserBinding: string().optional()
|
|
26321
28808
|
});
|
|
26322
28809
|
method(object({
|
|
26323
28810
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -30750,6 +33237,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
30750
33237
|
enabled: boolean().optional(),
|
|
30751
33238
|
info: record(string(), unknown()).optional(),
|
|
30752
33239
|
settings: record(string(), unknown()).optional(),
|
|
33240
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33241
|
+
* the keychain, not the table (D787). */
|
|
33242
|
+
secretKeys: array(string()).optional(),
|
|
30753
33243
|
skipRestart: boolean().optional()
|
|
30754
33244
|
});
|
|
30755
33245
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -30773,7 +33263,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
30773
33263
|
auth: "admin"
|
|
30774
33264
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
30775
33265
|
id: string(),
|
|
30776
|
-
settings: record(string(), unknown())
|
|
33266
|
+
settings: record(string(), unknown()),
|
|
33267
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33268
|
+
secretKeys: array(string()).optional()
|
|
30777
33269
|
}), object({ success: boolean() }), {
|
|
30778
33270
|
kind: "mutation",
|
|
30779
33271
|
auth: "admin"
|
|
@@ -36293,16 +38785,6 @@ var ApiKeySummarySchema = object({
|
|
|
36293
38785
|
createdAt: number(),
|
|
36294
38786
|
lastUsedAt: number().optional()
|
|
36295
38787
|
});
|
|
36296
|
-
var CreateApiKeyInputSchema = object({
|
|
36297
|
-
label: string(),
|
|
36298
|
-
isAdmin: boolean().default(false),
|
|
36299
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
36300
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
36301
|
-
});
|
|
36302
|
-
var CreateApiKeyResultSchema = object({
|
|
36303
|
-
token: string(),
|
|
36304
|
-
record: ApiKeySummarySchema
|
|
36305
|
-
});
|
|
36306
38788
|
var ScopedTokenSummarySchema = object({
|
|
36307
38789
|
id: string(),
|
|
36308
38790
|
userId: string(),
|
|
@@ -36401,17 +38883,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
36401
38883
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
36402
38884
|
kind: "mutation",
|
|
36403
38885
|
access: "view"
|
|
36404
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
36405
|
-
kind: "mutation",
|
|
36406
|
-
auth: "admin",
|
|
36407
|
-
access: "create"
|
|
36408
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
38886
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
36409
38887
|
kind: "mutation",
|
|
36410
38888
|
auth: "admin",
|
|
36411
38889
|
access: "delete"
|
|
36412
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
36413
|
-
kind: "mutation",
|
|
36414
|
-
access: "view"
|
|
36415
38890
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
36416
38891
|
kind: "mutation",
|
|
36417
38892
|
auth: "admin",
|
|
@@ -36485,15 +38960,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
36485
38960
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
36486
38961
|
userId: string(),
|
|
36487
38962
|
issuer: string()
|
|
36488
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
36489
|
-
userId: string(),
|
|
36490
|
-
issuer: string().min(1),
|
|
36491
|
-
label: string().optional()
|
|
36492
|
-
}), object({ success: literal(true) }), {
|
|
36493
|
-
kind: "mutation",
|
|
36494
|
-
auth: "admin",
|
|
36495
|
-
access: "create"
|
|
36496
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38963
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
36497
38964
|
kind: "mutation",
|
|
36498
38965
|
auth: "admin",
|
|
36499
38966
|
access: "delete"
|
|
@@ -36888,6 +39355,451 @@ DeviceType.Camera, method(object({
|
|
|
36888
39355
|
detection: array(ZoneRuleSchema).readonly(),
|
|
36889
39356
|
package: array(ZoneRuleSchema).readonly()
|
|
36890
39357
|
});
|
|
39358
|
+
/**
|
|
39359
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
39360
|
+
*
|
|
39361
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
39362
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
39363
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
39364
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
39365
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
39366
|
+
* manifest entry and nothing else.
|
|
39367
|
+
*
|
|
39368
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
39369
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
39370
|
+
* Every method is `admin`: these spend money.
|
|
39371
|
+
*
|
|
39372
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
39373
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
39374
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
39375
|
+
*
|
|
39376
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
39377
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
39378
|
+
* ticket the provider mints (D613).
|
|
39379
|
+
*/
|
|
39380
|
+
var TrainingGpuOptionSchema = object({
|
|
39381
|
+
id: string(),
|
|
39382
|
+
label: string(),
|
|
39383
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
39384
|
+
usdPerHour: number().nonnegative(),
|
|
39385
|
+
vramGb: number().nonnegative()
|
|
39386
|
+
});
|
|
39387
|
+
var TrainingRegionOptionSchema = object({
|
|
39388
|
+
/** `''` = any region (the provider's choice). */
|
|
39389
|
+
id: string(),
|
|
39390
|
+
label: string(),
|
|
39391
|
+
priceMultiplier: number().positive()
|
|
39392
|
+
});
|
|
39393
|
+
/**
|
|
39394
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
39395
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
39396
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
39397
|
+
*/
|
|
39398
|
+
var TrainingProviderDefaultsSchema = object({
|
|
39399
|
+
gpuType: string(),
|
|
39400
|
+
region: string(),
|
|
39401
|
+
costCapUsd: number().nonnegative(),
|
|
39402
|
+
maxRuntimeSec: number().int().positive(),
|
|
39403
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
39404
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
39405
|
+
});
|
|
39406
|
+
var TrainingProviderDescriptorSchema = object({
|
|
39407
|
+
addonId: string(),
|
|
39408
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
39409
|
+
kind: string(),
|
|
39410
|
+
label: string(),
|
|
39411
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
39412
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
39413
|
+
maxDatasetBytes: number().int().positive(),
|
|
39414
|
+
maxRuntimeSec: number().int().positive(),
|
|
39415
|
+
freeTierNote: string().optional(),
|
|
39416
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
39417
|
+
dataResidencyNote: string(),
|
|
39418
|
+
/** Credentials are present — never the values. */
|
|
39419
|
+
configured: boolean(),
|
|
39420
|
+
defaults: TrainingProviderDefaultsSchema
|
|
39421
|
+
});
|
|
39422
|
+
var TrainingCredentialCheckSchema = object({
|
|
39423
|
+
ok: boolean(),
|
|
39424
|
+
/** Workspace / account name, when the provider says. */
|
|
39425
|
+
account: string().optional(),
|
|
39426
|
+
reason: _enum([
|
|
39427
|
+
"missing",
|
|
39428
|
+
"invalid",
|
|
39429
|
+
"forbidden",
|
|
39430
|
+
"network",
|
|
39431
|
+
"quota"
|
|
39432
|
+
]).optional(),
|
|
39433
|
+
detail: string().optional()
|
|
39434
|
+
});
|
|
39435
|
+
var ProviderJobStateSchema = _enum([
|
|
39436
|
+
"pending",
|
|
39437
|
+
"starting",
|
|
39438
|
+
"running",
|
|
39439
|
+
"succeeded",
|
|
39440
|
+
"failed",
|
|
39441
|
+
"cancelled",
|
|
39442
|
+
"lost"
|
|
39443
|
+
]);
|
|
39444
|
+
var ProviderJobStatusSchema = object({
|
|
39445
|
+
jobKey: string(),
|
|
39446
|
+
providerJobId: string().optional(),
|
|
39447
|
+
state: ProviderJobStateSchema,
|
|
39448
|
+
startedAt: number().optional(),
|
|
39449
|
+
endedAt: number().optional(),
|
|
39450
|
+
exitCode: number().int().optional(),
|
|
39451
|
+
failureReason: string().optional(),
|
|
39452
|
+
gpuType: string(),
|
|
39453
|
+
region: string().optional(),
|
|
39454
|
+
billedSeconds: number().nonnegative(),
|
|
39455
|
+
costUsd: number().nonnegative(),
|
|
39456
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
39457
|
+
costIsEstimate: boolean(),
|
|
39458
|
+
lastFetchedAt: number()
|
|
39459
|
+
});
|
|
39460
|
+
/**
|
|
39461
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
39462
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
39463
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
39464
|
+
* in `result.json`.
|
|
39465
|
+
*/
|
|
39466
|
+
var TrainerSourceRefSchema = object({
|
|
39467
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
39468
|
+
repo: string().min(1),
|
|
39469
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
39470
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
39471
|
+
});
|
|
39472
|
+
var JobRef = {
|
|
39473
|
+
addonId: string(),
|
|
39474
|
+
jobKey: string().uuid()
|
|
39475
|
+
};
|
|
39476
|
+
var TrainingLogLineSchema = object({
|
|
39477
|
+
ts: number(),
|
|
39478
|
+
text: string()
|
|
39479
|
+
});
|
|
39480
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
39481
|
+
kind: "mutation",
|
|
39482
|
+
auth: "admin",
|
|
39483
|
+
timeoutMs: 3e4
|
|
39484
|
+
}), method(object({
|
|
39485
|
+
addonId: string(),
|
|
39486
|
+
gpuType: string(),
|
|
39487
|
+
region: string(),
|
|
39488
|
+
datasetBytes: number().int().nonnegative(),
|
|
39489
|
+
gpuSecondsLow: number().nonnegative(),
|
|
39490
|
+
gpuSecondsHigh: number().nonnegative()
|
|
39491
|
+
}), object({
|
|
39492
|
+
usdLow: number().nonnegative(),
|
|
39493
|
+
usdHigh: number().nonnegative(),
|
|
39494
|
+
notes: array(string()).readonly()
|
|
39495
|
+
}), { auth: "admin" }), method(object({
|
|
39496
|
+
...JobRef,
|
|
39497
|
+
ticket: PeerBytesTicketSchema
|
|
39498
|
+
}), object({
|
|
39499
|
+
bytes: number().int().nonnegative(),
|
|
39500
|
+
sha256: string()
|
|
39501
|
+
}), {
|
|
39502
|
+
kind: "mutation",
|
|
39503
|
+
auth: "admin",
|
|
39504
|
+
timeoutMs: 120 * 6e4
|
|
39505
|
+
}), method(object({
|
|
39506
|
+
...JobRef,
|
|
39507
|
+
trainer: TrainerSourceRefSchema,
|
|
39508
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
39509
|
+
gpuType: string(),
|
|
39510
|
+
region: string(),
|
|
39511
|
+
maxRuntimeSec: number().int().positive()
|
|
39512
|
+
}), ProviderJobStatusSchema, {
|
|
39513
|
+
kind: "mutation",
|
|
39514
|
+
auth: "admin",
|
|
39515
|
+
timeoutMs: 30 * 6e4
|
|
39516
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
39517
|
+
auth: "admin",
|
|
39518
|
+
timeoutMs: 6e4
|
|
39519
|
+
}), method(object({
|
|
39520
|
+
...JobRef,
|
|
39521
|
+
cursor: string().optional(),
|
|
39522
|
+
max: number().int().min(1).max(500)
|
|
39523
|
+
}), object({
|
|
39524
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
39525
|
+
cursor: string()
|
|
39526
|
+
}), {
|
|
39527
|
+
auth: "admin",
|
|
39528
|
+
timeoutMs: 6e4
|
|
39529
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
39530
|
+
kind: "mutation",
|
|
39531
|
+
auth: "admin",
|
|
39532
|
+
timeoutMs: 6e4
|
|
39533
|
+
}), method(object(JobRef), object({
|
|
39534
|
+
found: boolean(),
|
|
39535
|
+
text: string().optional()
|
|
39536
|
+
}), {
|
|
39537
|
+
kind: "mutation",
|
|
39538
|
+
auth: "admin",
|
|
39539
|
+
timeoutMs: 5 * 6e4
|
|
39540
|
+
}), method(object({
|
|
39541
|
+
...JobRef,
|
|
39542
|
+
path: _enum(["bundle.tar"])
|
|
39543
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
39544
|
+
kind: "mutation",
|
|
39545
|
+
auth: "admin",
|
|
39546
|
+
timeoutMs: 5 * 6e4
|
|
39547
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
39548
|
+
kind: "mutation",
|
|
39549
|
+
auth: "admin",
|
|
39550
|
+
timeoutMs: 5 * 6e4
|
|
39551
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
39552
|
+
auth: "admin",
|
|
39553
|
+
timeoutMs: 2 * 6e4
|
|
39554
|
+
});
|
|
39555
|
+
/**
|
|
39556
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
39557
|
+
* provided by `addon-training`.
|
|
39558
|
+
*
|
|
39559
|
+
* It owns what every provider must agree on, written once:
|
|
39560
|
+
*
|
|
39561
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
39562
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
39563
|
+
* the export plan) and reaches this store through the five row methods
|
|
39564
|
+
* below, so the Retrain page and the export did not change.
|
|
39565
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
39566
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
39567
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
39568
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
39569
|
+
* rollback. Nothing is ever registered automatically.
|
|
39570
|
+
*
|
|
39571
|
+
* Every method is `admin`.
|
|
39572
|
+
*/
|
|
39573
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
39574
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
39575
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
39576
|
+
var TrainingBaseModelSchema = object({
|
|
39577
|
+
modelId: string(),
|
|
39578
|
+
label: string(),
|
|
39579
|
+
weights: string(),
|
|
39580
|
+
imgsz: number().int(),
|
|
39581
|
+
baselineOnnxUrl: string(),
|
|
39582
|
+
baselineFloors: record(string(), number()),
|
|
39583
|
+
/** The base the fleet runs most — the UI's default. */
|
|
39584
|
+
recommended: boolean()
|
|
39585
|
+
});
|
|
39586
|
+
var TrainingPresetSchema = _enum([
|
|
39587
|
+
"quick",
|
|
39588
|
+
"standard",
|
|
39589
|
+
"thorough"
|
|
39590
|
+
]);
|
|
39591
|
+
var TrainingJobRequestSchema = object({
|
|
39592
|
+
datasetVersionId: string().min(1),
|
|
39593
|
+
/** The `training-provider` addon that runs it. */
|
|
39594
|
+
addonId: string().min(1),
|
|
39595
|
+
gpuType: string().min(1),
|
|
39596
|
+
region: string(),
|
|
39597
|
+
baseModelId: string().min(1),
|
|
39598
|
+
preset: TrainingPresetSchema,
|
|
39599
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
39600
|
+
freeze: number().int().nonnegative().nullable(),
|
|
39601
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
39602
|
+
holdoutCameras: array(number().int()).nullable()
|
|
39603
|
+
});
|
|
39604
|
+
var TrainingSplitPlanSchema = object({
|
|
39605
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
39606
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
39607
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
39608
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
39609
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
39610
|
+
trainSubjects: number().int()
|
|
39611
|
+
});
|
|
39612
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
39613
|
+
"unknown-dataset",
|
|
39614
|
+
"unknown-provider",
|
|
39615
|
+
"provider-not-configured",
|
|
39616
|
+
"unknown-base-model",
|
|
39617
|
+
"unknown-gpu",
|
|
39618
|
+
"dataset-too-large",
|
|
39619
|
+
"no-training-subjects",
|
|
39620
|
+
"job-already-running"
|
|
39621
|
+
]);
|
|
39622
|
+
var TrainingJobPlanSchema = object({
|
|
39623
|
+
refusal: object({
|
|
39624
|
+
reason: TrainingRefusalReasonSchema,
|
|
39625
|
+
detail: string()
|
|
39626
|
+
}).nullable(),
|
|
39627
|
+
warnings: array(string()).readonly(),
|
|
39628
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
39629
|
+
estimate: object({
|
|
39630
|
+
datasetBytes: number().int(),
|
|
39631
|
+
uploadMinutesAt20Mbps: number(),
|
|
39632
|
+
gpuSecondsLow: number(),
|
|
39633
|
+
gpuSecondsHigh: number(),
|
|
39634
|
+
usdLow: number(),
|
|
39635
|
+
usdHigh: number(),
|
|
39636
|
+
notes: array(string()).readonly()
|
|
39637
|
+
}).nullable(),
|
|
39638
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
39639
|
+
defaults: object({
|
|
39640
|
+
maxCostUsd: number(),
|
|
39641
|
+
maxRuntimeSec: number().int()
|
|
39642
|
+
}).nullable(),
|
|
39643
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
39644
|
+
dataNotice: string()
|
|
39645
|
+
});
|
|
39646
|
+
/**
|
|
39647
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
39648
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
39649
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
39650
|
+
* result lives after the operator acted on it.
|
|
39651
|
+
*/
|
|
39652
|
+
var TrainingJobStateSchema = _enum([
|
|
39653
|
+
"uploading",
|
|
39654
|
+
"submitted",
|
|
39655
|
+
"starting",
|
|
39656
|
+
"running",
|
|
39657
|
+
"collecting",
|
|
39658
|
+
"ready",
|
|
39659
|
+
"registered",
|
|
39660
|
+
"canary",
|
|
39661
|
+
"failed",
|
|
39662
|
+
"cancelling",
|
|
39663
|
+
"cancelled",
|
|
39664
|
+
"lost",
|
|
39665
|
+
"expired",
|
|
39666
|
+
"discarded"
|
|
39667
|
+
]);
|
|
39668
|
+
var TrainingFailureReasonSchema = _enum([
|
|
39669
|
+
"cost-cap",
|
|
39670
|
+
"runtime-cap",
|
|
39671
|
+
"upload-failed",
|
|
39672
|
+
"submit-failed",
|
|
39673
|
+
"trainer-failed",
|
|
39674
|
+
"result-invalid",
|
|
39675
|
+
"checksum-mismatch",
|
|
39676
|
+
"fetch-failed",
|
|
39677
|
+
"provider-error",
|
|
39678
|
+
"hub-restart-during-upload"
|
|
39679
|
+
]);
|
|
39680
|
+
var TrainingProgressPointSchema = object({
|
|
39681
|
+
epoch: number().int(),
|
|
39682
|
+
map50: number().nullable(),
|
|
39683
|
+
map50_95: number().nullable()
|
|
39684
|
+
});
|
|
39685
|
+
var TrainingCanarySchema = object({
|
|
39686
|
+
deviceIds: array(number().int()).readonly(),
|
|
39687
|
+
since: number(),
|
|
39688
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
39689
|
+
previous: array(object({
|
|
39690
|
+
deviceId: number().int(),
|
|
39691
|
+
nodeId: string(),
|
|
39692
|
+
deviceKey: string(),
|
|
39693
|
+
patch: object({
|
|
39694
|
+
modelId: string().optional(),
|
|
39695
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
39696
|
+
}).nullable()
|
|
39697
|
+
})).readonly()
|
|
39698
|
+
});
|
|
39699
|
+
var TrainingJobSchema = object({
|
|
39700
|
+
id: string(),
|
|
39701
|
+
idempotencyKey: string(),
|
|
39702
|
+
name: string(),
|
|
39703
|
+
createdAt: number(),
|
|
39704
|
+
updatedAt: number(),
|
|
39705
|
+
state: TrainingJobStateSchema,
|
|
39706
|
+
stage: TrainingStageSchema.nullable(),
|
|
39707
|
+
failure: object({
|
|
39708
|
+
reason: TrainingFailureReasonSchema,
|
|
39709
|
+
stage: string().nullable(),
|
|
39710
|
+
detail: string()
|
|
39711
|
+
}).nullable(),
|
|
39712
|
+
request: TrainingJobRequestSchema,
|
|
39713
|
+
maxCostUsd: number().nonnegative(),
|
|
39714
|
+
maxRuntimeSec: number().int().positive(),
|
|
39715
|
+
trainer: TrainerSourceRefSchema,
|
|
39716
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
39717
|
+
dataset: object({
|
|
39718
|
+
bytes: number().int(),
|
|
39719
|
+
sha256: string(),
|
|
39720
|
+
uploadedAt: number()
|
|
39721
|
+
}).nullable(),
|
|
39722
|
+
split: TrainingSplitPlanSchema,
|
|
39723
|
+
provider: object({
|
|
39724
|
+
state: ProviderJobStateSchema.nullable(),
|
|
39725
|
+
providerJobId: string().nullable(),
|
|
39726
|
+
startedAt: number().nullable(),
|
|
39727
|
+
endedAt: number().nullable(),
|
|
39728
|
+
billedSeconds: number(),
|
|
39729
|
+
costUsd: number(),
|
|
39730
|
+
costIsEstimate: boolean(),
|
|
39731
|
+
lastPolledAt: number().nullable()
|
|
39732
|
+
}),
|
|
39733
|
+
progress: object({
|
|
39734
|
+
epoch: number().int().nullable(),
|
|
39735
|
+
epochs: number().int().nullable(),
|
|
39736
|
+
etaSec: number().nullable(),
|
|
39737
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
39738
|
+
}),
|
|
39739
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
39740
|
+
logTail: array(string()).readonly(),
|
|
39741
|
+
logCursor: string().nullable(),
|
|
39742
|
+
artifacts: object({
|
|
39743
|
+
bundleBytes: number().int(),
|
|
39744
|
+
bundleSha256: string(),
|
|
39745
|
+
fetchedAt: number(),
|
|
39746
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
39747
|
+
expiresAt: number()
|
|
39748
|
+
}).nullable(),
|
|
39749
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
39750
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
39751
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
39752
|
+
cloudCleanupDueAt: number().nullable(),
|
|
39753
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
39754
|
+
registeredModelIds: array(string()).readonly(),
|
|
39755
|
+
canary: TrainingCanarySchema.nullable()
|
|
39756
|
+
});
|
|
39757
|
+
var IdInput = object({ id: string().min(1) });
|
|
39758
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
39759
|
+
kind: "mutation",
|
|
39760
|
+
auth: "admin"
|
|
39761
|
+
}), 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() }), {
|
|
39762
|
+
kind: "mutation",
|
|
39763
|
+
auth: "admin"
|
|
39764
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
39765
|
+
auth: "admin",
|
|
39766
|
+
timeoutMs: 6e4
|
|
39767
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
39768
|
+
name: string().min(1).max(120),
|
|
39769
|
+
maxCostUsd: number().positive(),
|
|
39770
|
+
maxRuntimeSec: number().int().positive(),
|
|
39771
|
+
idempotencyKey: string().min(8).max(80)
|
|
39772
|
+
}), discriminatedUnion("kind", [object({
|
|
39773
|
+
kind: literal("started"),
|
|
39774
|
+
job: TrainingJobSchema
|
|
39775
|
+
}), object({
|
|
39776
|
+
kind: literal("refused"),
|
|
39777
|
+
reason: TrainingRefusalReasonSchema,
|
|
39778
|
+
detail: string()
|
|
39779
|
+
})]), {
|
|
39780
|
+
kind: "mutation",
|
|
39781
|
+
auth: "admin",
|
|
39782
|
+
timeoutMs: 12e4
|
|
39783
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
39784
|
+
kind: "mutation",
|
|
39785
|
+
auth: "admin",
|
|
39786
|
+
timeoutMs: 12e4
|
|
39787
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
39788
|
+
kind: "mutation",
|
|
39789
|
+
auth: "admin",
|
|
39790
|
+
timeoutMs: 30 * 6e4
|
|
39791
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
39792
|
+
kind: "mutation",
|
|
39793
|
+
auth: "admin",
|
|
39794
|
+
timeoutMs: 12e4
|
|
39795
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39796
|
+
kind: "mutation",
|
|
39797
|
+
auth: "admin",
|
|
39798
|
+
timeoutMs: 12e4
|
|
39799
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
39800
|
+
kind: "mutation",
|
|
39801
|
+
auth: "admin"
|
|
39802
|
+
});
|
|
36891
39803
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
36892
39804
|
Object.freeze({
|
|
36893
39805
|
person: .5,
|
|
@@ -37511,6 +40423,12 @@ Object.freeze({
|
|
|
37511
40423
|
addonId: null,
|
|
37512
40424
|
access: "create"
|
|
37513
40425
|
},
|
|
40426
|
+
"backup.checkBackupKey": {
|
|
40427
|
+
capName: "backup",
|
|
40428
|
+
capScope: "system",
|
|
40429
|
+
addonId: null,
|
|
40430
|
+
access: "create"
|
|
40431
|
+
},
|
|
37514
40432
|
"backup.delete": {
|
|
37515
40433
|
capName: "backup",
|
|
37516
40434
|
capScope: "system",
|
|
@@ -37523,6 +40441,18 @@ Object.freeze({
|
|
|
37523
40441
|
addonId: null,
|
|
37524
40442
|
access: "delete"
|
|
37525
40443
|
},
|
|
40444
|
+
"backup.disableEncryption": {
|
|
40445
|
+
capName: "backup",
|
|
40446
|
+
capScope: "system",
|
|
40447
|
+
addonId: null,
|
|
40448
|
+
access: "create"
|
|
40449
|
+
},
|
|
40450
|
+
"backup.getEncryption": {
|
|
40451
|
+
capName: "backup",
|
|
40452
|
+
capScope: "system",
|
|
40453
|
+
addonId: null,
|
|
40454
|
+
access: "view"
|
|
40455
|
+
},
|
|
37526
40456
|
"backup.getEntries": {
|
|
37527
40457
|
capName: "backup",
|
|
37528
40458
|
capScope: "system",
|
|
@@ -37577,6 +40507,12 @@ Object.freeze({
|
|
|
37577
40507
|
addonId: null,
|
|
37578
40508
|
access: "create"
|
|
37579
40509
|
},
|
|
40510
|
+
"backup.setupEncryption": {
|
|
40511
|
+
capName: "backup",
|
|
40512
|
+
capScope: "system",
|
|
40513
|
+
addonId: null,
|
|
40514
|
+
access: "create"
|
|
40515
|
+
},
|
|
37580
40516
|
"backup.trigger": {
|
|
37581
40517
|
capName: "backup",
|
|
37582
40518
|
capScope: "system",
|
|
@@ -38129,6 +41065,12 @@ Object.freeze({
|
|
|
38129
41065
|
addonId: null,
|
|
38130
41066
|
access: "create"
|
|
38131
41067
|
},
|
|
41068
|
+
"customModelRegistry.importModelBundle": {
|
|
41069
|
+
capName: "custom-model-registry",
|
|
41070
|
+
capScope: "system",
|
|
41071
|
+
addonId: null,
|
|
41072
|
+
access: "create"
|
|
41073
|
+
},
|
|
38132
41074
|
"customModelRegistry.listModels": {
|
|
38133
41075
|
capName: "custom-model-registry",
|
|
38134
41076
|
capScope: "system",
|
|
@@ -39539,6 +42481,108 @@ Object.freeze({
|
|
|
39539
42481
|
addonId: null,
|
|
39540
42482
|
access: "create"
|
|
39541
42483
|
},
|
|
42484
|
+
"keychain.delete": {
|
|
42485
|
+
capName: "keychain",
|
|
42486
|
+
capScope: "system",
|
|
42487
|
+
addonId: null,
|
|
42488
|
+
access: "delete"
|
|
42489
|
+
},
|
|
42490
|
+
"keychain.getState": {
|
|
42491
|
+
capName: "keychain",
|
|
42492
|
+
capScope: "system",
|
|
42493
|
+
addonId: null,
|
|
42494
|
+
access: "view"
|
|
42495
|
+
},
|
|
42496
|
+
"keychain.listMeta": {
|
|
42497
|
+
capName: "keychain",
|
|
42498
|
+
capScope: "system",
|
|
42499
|
+
addonId: null,
|
|
42500
|
+
access: "view"
|
|
42501
|
+
},
|
|
42502
|
+
"keychain.put": {
|
|
42503
|
+
capName: "keychain",
|
|
42504
|
+
capScope: "system",
|
|
42505
|
+
addonId: null,
|
|
42506
|
+
access: "create"
|
|
42507
|
+
},
|
|
42508
|
+
"keychain.resolve": {
|
|
42509
|
+
capName: "keychain",
|
|
42510
|
+
capScope: "system",
|
|
42511
|
+
addonId: null,
|
|
42512
|
+
access: "view"
|
|
42513
|
+
},
|
|
42514
|
+
"keychainAdmin.acknowledgeReset": {
|
|
42515
|
+
capName: "keychain-admin",
|
|
42516
|
+
capScope: "system",
|
|
42517
|
+
addonId: null,
|
|
42518
|
+
access: "create"
|
|
42519
|
+
},
|
|
42520
|
+
"keychainAdmin.deleteOrphans": {
|
|
42521
|
+
capName: "keychain-admin",
|
|
42522
|
+
capScope: "system",
|
|
42523
|
+
addonId: null,
|
|
42524
|
+
access: "delete"
|
|
42525
|
+
},
|
|
42526
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
42527
|
+
capName: "keychain-admin",
|
|
42528
|
+
capScope: "system",
|
|
42529
|
+
addonId: null,
|
|
42530
|
+
access: "create"
|
|
42531
|
+
},
|
|
42532
|
+
"keychainAdmin.listAudit": {
|
|
42533
|
+
capName: "keychain-admin",
|
|
42534
|
+
capScope: "system",
|
|
42535
|
+
addonId: null,
|
|
42536
|
+
access: "view"
|
|
42537
|
+
},
|
|
42538
|
+
"keychainAdmin.listSecrets": {
|
|
42539
|
+
capName: "keychain-admin",
|
|
42540
|
+
capScope: "system",
|
|
42541
|
+
addonId: null,
|
|
42542
|
+
access: "view"
|
|
42543
|
+
},
|
|
42544
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
42545
|
+
capName: "keychain-admin",
|
|
42546
|
+
capScope: "system",
|
|
42547
|
+
addonId: null,
|
|
42548
|
+
access: "delete"
|
|
42549
|
+
},
|
|
42550
|
+
"keychainAdmin.resetKeychain": {
|
|
42551
|
+
capName: "keychain-admin",
|
|
42552
|
+
capScope: "system",
|
|
42553
|
+
addonId: null,
|
|
42554
|
+
access: "delete"
|
|
42555
|
+
},
|
|
42556
|
+
"keychainAdmin.resetReport": {
|
|
42557
|
+
capName: "keychain-admin",
|
|
42558
|
+
capScope: "system",
|
|
42559
|
+
addonId: null,
|
|
42560
|
+
access: "delete"
|
|
42561
|
+
},
|
|
42562
|
+
"keychainAdmin.reveal": {
|
|
42563
|
+
capName: "keychain-admin",
|
|
42564
|
+
capScope: "system",
|
|
42565
|
+
addonId: null,
|
|
42566
|
+
access: "create"
|
|
42567
|
+
},
|
|
42568
|
+
"keychainAdmin.rotateMasterKey": {
|
|
42569
|
+
capName: "keychain-admin",
|
|
42570
|
+
capScope: "system",
|
|
42571
|
+
addonId: null,
|
|
42572
|
+
access: "create"
|
|
42573
|
+
},
|
|
42574
|
+
"keychainAdmin.setSystemSecret": {
|
|
42575
|
+
capName: "keychain-admin",
|
|
42576
|
+
capScope: "system",
|
|
42577
|
+
addonId: null,
|
|
42578
|
+
access: "create"
|
|
42579
|
+
},
|
|
42580
|
+
"keychainAdmin.status": {
|
|
42581
|
+
capName: "keychain-admin",
|
|
42582
|
+
capScope: "system",
|
|
42583
|
+
addonId: null,
|
|
42584
|
+
access: "view"
|
|
42585
|
+
},
|
|
39542
42586
|
"lawnMowerControl.dock": {
|
|
39543
42587
|
capName: "lawn-mower-control",
|
|
39544
42588
|
capScope: "device",
|
|
@@ -40913,6 +43957,18 @@ Object.freeze({
|
|
|
40913
43957
|
addonId: null,
|
|
40914
43958
|
access: "create"
|
|
40915
43959
|
},
|
|
43960
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
43961
|
+
capName: "pipeline-analytics",
|
|
43962
|
+
capScope: "device",
|
|
43963
|
+
addonId: null,
|
|
43964
|
+
access: "create"
|
|
43965
|
+
},
|
|
43966
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
43967
|
+
capName: "pipeline-analytics",
|
|
43968
|
+
capScope: "device",
|
|
43969
|
+
addonId: null,
|
|
43970
|
+
access: "create"
|
|
43971
|
+
},
|
|
40916
43972
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
40917
43973
|
capName: "pipeline-analytics",
|
|
40918
43974
|
capScope: "device",
|
|
@@ -40961,12 +44017,36 @@ Object.freeze({
|
|
|
40961
44017
|
addonId: null,
|
|
40962
44018
|
access: "view"
|
|
40963
44019
|
},
|
|
44020
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
44021
|
+
capName: "pipeline-analytics",
|
|
44022
|
+
capScope: "device",
|
|
44023
|
+
addonId: null,
|
|
44024
|
+
access: "create"
|
|
44025
|
+
},
|
|
44026
|
+
"pipelineAnalytics.createRetrainDatasetVersion": {
|
|
44027
|
+
capName: "pipeline-analytics",
|
|
44028
|
+
capScope: "device",
|
|
44029
|
+
addonId: null,
|
|
44030
|
+
access: "create"
|
|
44031
|
+
},
|
|
40964
44032
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
40965
44033
|
capName: "pipeline-analytics",
|
|
40966
44034
|
capScope: "device",
|
|
40967
44035
|
addonId: null,
|
|
40968
44036
|
access: "delete"
|
|
40969
44037
|
},
|
|
44038
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
44039
|
+
capName: "pipeline-analytics",
|
|
44040
|
+
capScope: "device",
|
|
44041
|
+
addonId: null,
|
|
44042
|
+
access: "delete"
|
|
44043
|
+
},
|
|
44044
|
+
"pipelineAnalytics.deleteRetrainDatasetVersion": {
|
|
44045
|
+
capName: "pipeline-analytics",
|
|
44046
|
+
capScope: "device",
|
|
44047
|
+
addonId: null,
|
|
44048
|
+
access: "delete"
|
|
44049
|
+
},
|
|
40970
44050
|
"pipelineAnalytics.deleteTracks": {
|
|
40971
44051
|
capName: "pipeline-analytics",
|
|
40972
44052
|
capScope: "device",
|
|
@@ -41171,6 +44251,30 @@ Object.freeze({
|
|
|
41171
44251
|
addonId: null,
|
|
41172
44252
|
access: "view"
|
|
41173
44253
|
},
|
|
44254
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
44255
|
+
capName: "pipeline-analytics",
|
|
44256
|
+
capScope: "device",
|
|
44257
|
+
addonId: null,
|
|
44258
|
+
access: "view"
|
|
44259
|
+
},
|
|
44260
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
44261
|
+
capName: "pipeline-analytics",
|
|
44262
|
+
capScope: "device",
|
|
44263
|
+
addonId: null,
|
|
44264
|
+
access: "view"
|
|
44265
|
+
},
|
|
44266
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
44267
|
+
capName: "pipeline-analytics",
|
|
44268
|
+
capScope: "device",
|
|
44269
|
+
addonId: null,
|
|
44270
|
+
access: "view"
|
|
44271
|
+
},
|
|
44272
|
+
"pipelineAnalytics.listRetrainDatasetVersions": {
|
|
44273
|
+
capName: "pipeline-analytics",
|
|
44274
|
+
capScope: "device",
|
|
44275
|
+
addonId: null,
|
|
44276
|
+
access: "view"
|
|
44277
|
+
},
|
|
41174
44278
|
"pipelineAnalytics.listRetrainFrames": {
|
|
41175
44279
|
capName: "pipeline-analytics",
|
|
41176
44280
|
capScope: "device",
|
|
@@ -41201,6 +44305,12 @@ Object.freeze({
|
|
|
41201
44305
|
addonId: null,
|
|
41202
44306
|
access: "view"
|
|
41203
44307
|
},
|
|
44308
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
44309
|
+
capName: "pipeline-analytics",
|
|
44310
|
+
capScope: "device",
|
|
44311
|
+
addonId: null,
|
|
44312
|
+
access: "create"
|
|
44313
|
+
},
|
|
41204
44314
|
"pipelineAnalytics.ownersWithMedia": {
|
|
41205
44315
|
capName: "pipeline-analytics",
|
|
41206
44316
|
capScope: "device",
|
|
@@ -41213,12 +44323,24 @@ Object.freeze({
|
|
|
41213
44323
|
addonId: null,
|
|
41214
44324
|
access: "create"
|
|
41215
44325
|
},
|
|
44326
|
+
"pipelineAnalytics.previewRetrainDataset": {
|
|
44327
|
+
capName: "pipeline-analytics",
|
|
44328
|
+
capScope: "device",
|
|
44329
|
+
addonId: null,
|
|
44330
|
+
access: "view"
|
|
44331
|
+
},
|
|
41216
44332
|
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
41217
44333
|
capName: "pipeline-analytics",
|
|
41218
44334
|
capScope: "device",
|
|
41219
44335
|
addonId: null,
|
|
41220
44336
|
access: "create"
|
|
41221
44337
|
},
|
|
44338
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
44339
|
+
capName: "pipeline-analytics",
|
|
44340
|
+
capScope: "device",
|
|
44341
|
+
addonId: null,
|
|
44342
|
+
access: "create"
|
|
44343
|
+
},
|
|
41222
44344
|
"pipelineAnalytics.pruneEvents": {
|
|
41223
44345
|
capName: "pipeline-analytics",
|
|
41224
44346
|
capScope: "device",
|
|
@@ -41273,6 +44395,18 @@ Object.freeze({
|
|
|
41273
44395
|
addonId: null,
|
|
41274
44396
|
access: "create"
|
|
41275
44397
|
},
|
|
44398
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
44399
|
+
capName: "pipeline-analytics",
|
|
44400
|
+
capScope: "device",
|
|
44401
|
+
addonId: null,
|
|
44402
|
+
access: "delete"
|
|
44403
|
+
},
|
|
44404
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
44405
|
+
capName: "pipeline-analytics",
|
|
44406
|
+
capScope: "device",
|
|
44407
|
+
addonId: null,
|
|
44408
|
+
access: "create"
|
|
44409
|
+
},
|
|
41276
44410
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
41277
44411
|
capName: "pipeline-analytics",
|
|
41278
44412
|
capScope: "device",
|
|
@@ -41333,6 +44467,12 @@ Object.freeze({
|
|
|
41333
44467
|
addonId: null,
|
|
41334
44468
|
access: "create"
|
|
41335
44469
|
},
|
|
44470
|
+
"pipelineAnalytics.verifyRetrainDatasetVersion": {
|
|
44471
|
+
capName: "pipeline-analytics",
|
|
44472
|
+
capScope: "device",
|
|
44473
|
+
addonId: null,
|
|
44474
|
+
access: "view"
|
|
44475
|
+
},
|
|
41336
44476
|
"pipelineAnalytics.wipeAllAnalytics": {
|
|
41337
44477
|
capName: "pipeline-analytics",
|
|
41338
44478
|
capScope: "device",
|
|
@@ -41561,6 +44701,12 @@ Object.freeze({
|
|
|
41561
44701
|
addonId: null,
|
|
41562
44702
|
access: "view"
|
|
41563
44703
|
},
|
|
44704
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
44705
|
+
capName: "pipeline-orchestrator",
|
|
44706
|
+
capScope: "system",
|
|
44707
|
+
addonId: null,
|
|
44708
|
+
access: "create"
|
|
44709
|
+
},
|
|
41564
44710
|
"pipelineOrchestrator.applyAutoTune": {
|
|
41565
44711
|
capName: "pipeline-orchestrator",
|
|
41566
44712
|
capScope: "system",
|
|
@@ -41585,6 +44731,12 @@ Object.freeze({
|
|
|
41585
44731
|
addonId: null,
|
|
41586
44732
|
access: "create"
|
|
41587
44733
|
},
|
|
44734
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
44735
|
+
capName: "pipeline-orchestrator",
|
|
44736
|
+
capScope: "system",
|
|
44737
|
+
addonId: null,
|
|
44738
|
+
access: "delete"
|
|
44739
|
+
},
|
|
41588
44740
|
"pipelineOrchestrator.getAgentLoad": {
|
|
41589
44741
|
capName: "pipeline-orchestrator",
|
|
41590
44742
|
capScope: "system",
|
|
@@ -41693,6 +44845,24 @@ Object.freeze({
|
|
|
41693
44845
|
addonId: null,
|
|
41694
44846
|
access: "view"
|
|
41695
44847
|
},
|
|
44848
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
44849
|
+
capName: "pipeline-orchestrator",
|
|
44850
|
+
capScope: "system",
|
|
44851
|
+
addonId: null,
|
|
44852
|
+
access: "view"
|
|
44853
|
+
},
|
|
44854
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
44855
|
+
capName: "pipeline-orchestrator",
|
|
44856
|
+
capScope: "system",
|
|
44857
|
+
addonId: null,
|
|
44858
|
+
access: "view"
|
|
44859
|
+
},
|
|
44860
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
44861
|
+
capName: "pipeline-orchestrator",
|
|
44862
|
+
capScope: "system",
|
|
44863
|
+
addonId: null,
|
|
44864
|
+
access: "view"
|
|
44865
|
+
},
|
|
41696
44866
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
41697
44867
|
capName: "pipeline-orchestrator",
|
|
41698
44868
|
capScope: "system",
|
|
@@ -41735,6 +44905,12 @@ Object.freeze({
|
|
|
41735
44905
|
addonId: null,
|
|
41736
44906
|
access: "view"
|
|
41737
44907
|
},
|
|
44908
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
44909
|
+
capName: "pipeline-orchestrator",
|
|
44910
|
+
capScope: "system",
|
|
44911
|
+
addonId: null,
|
|
44912
|
+
access: "view"
|
|
44913
|
+
},
|
|
41738
44914
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
41739
44915
|
capName: "pipeline-orchestrator",
|
|
41740
44916
|
capScope: "system",
|
|
@@ -41879,6 +45055,12 @@ Object.freeze({
|
|
|
41879
45055
|
addonId: null,
|
|
41880
45056
|
access: "create"
|
|
41881
45057
|
},
|
|
45058
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
45059
|
+
capName: "pipeline-orchestrator",
|
|
45060
|
+
capScope: "system",
|
|
45061
|
+
addonId: null,
|
|
45062
|
+
access: "create"
|
|
45063
|
+
},
|
|
41882
45064
|
"pipelineOrchestrator.suggestShares": {
|
|
41883
45065
|
capName: "pipeline-orchestrator",
|
|
41884
45066
|
capScope: "system",
|
|
@@ -41897,6 +45079,12 @@ Object.freeze({
|
|
|
41897
45079
|
addonId: null,
|
|
41898
45080
|
access: "create"
|
|
41899
45081
|
},
|
|
45082
|
+
"pipelineRunner.abortNodeBench": {
|
|
45083
|
+
capName: "pipeline-runner",
|
|
45084
|
+
capScope: "system",
|
|
45085
|
+
addonId: null,
|
|
45086
|
+
access: "create"
|
|
45087
|
+
},
|
|
41900
45088
|
"pipelineRunner.attachCamera": {
|
|
41901
45089
|
capName: "pipeline-runner",
|
|
41902
45090
|
capScope: "system",
|
|
@@ -41945,6 +45133,12 @@ Object.freeze({
|
|
|
41945
45133
|
addonId: null,
|
|
41946
45134
|
access: "view"
|
|
41947
45135
|
},
|
|
45136
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
45137
|
+
capName: "pipeline-runner",
|
|
45138
|
+
capScope: "system",
|
|
45139
|
+
addonId: null,
|
|
45140
|
+
access: "view"
|
|
45141
|
+
},
|
|
41948
45142
|
"pipelineRunner.getParkedTrackFrame": {
|
|
41949
45143
|
capName: "pipeline-runner",
|
|
41950
45144
|
capScope: "system",
|
|
@@ -41987,6 +45181,12 @@ Object.freeze({
|
|
|
41987
45181
|
addonId: null,
|
|
41988
45182
|
access: "create"
|
|
41989
45183
|
},
|
|
45184
|
+
"pipelineRunner.startNodeBench": {
|
|
45185
|
+
capName: "pipeline-runner",
|
|
45186
|
+
capScope: "system",
|
|
45187
|
+
addonId: null,
|
|
45188
|
+
access: "create"
|
|
45189
|
+
},
|
|
41990
45190
|
"plateGallery.assignPlate": {
|
|
41991
45191
|
capName: "plate-gallery",
|
|
41992
45192
|
capScope: "system",
|
|
@@ -43649,6 +46849,174 @@ Object.freeze({
|
|
|
43649
46849
|
addonId: null,
|
|
43650
46850
|
access: "view"
|
|
43651
46851
|
},
|
|
46852
|
+
"training.canaryResult": {
|
|
46853
|
+
capName: "training",
|
|
46854
|
+
capScope: "system",
|
|
46855
|
+
addonId: null,
|
|
46856
|
+
access: "create"
|
|
46857
|
+
},
|
|
46858
|
+
"training.cancelJob": {
|
|
46859
|
+
capName: "training",
|
|
46860
|
+
capScope: "system",
|
|
46861
|
+
addonId: null,
|
|
46862
|
+
access: "create"
|
|
46863
|
+
},
|
|
46864
|
+
"training.discardResult": {
|
|
46865
|
+
capName: "training",
|
|
46866
|
+
capScope: "system",
|
|
46867
|
+
addonId: null,
|
|
46868
|
+
access: "create"
|
|
46869
|
+
},
|
|
46870
|
+
"training.findDatasetVersionIdByName": {
|
|
46871
|
+
capName: "training",
|
|
46872
|
+
capScope: "system",
|
|
46873
|
+
addonId: null,
|
|
46874
|
+
access: "view"
|
|
46875
|
+
},
|
|
46876
|
+
"training.getDatasetVersion": {
|
|
46877
|
+
capName: "training",
|
|
46878
|
+
capScope: "system",
|
|
46879
|
+
addonId: null,
|
|
46880
|
+
access: "view"
|
|
46881
|
+
},
|
|
46882
|
+
"training.getJob": {
|
|
46883
|
+
capName: "training",
|
|
46884
|
+
capScope: "system",
|
|
46885
|
+
addonId: null,
|
|
46886
|
+
access: "view"
|
|
46887
|
+
},
|
|
46888
|
+
"training.getJobResult": {
|
|
46889
|
+
capName: "training",
|
|
46890
|
+
capScope: "system",
|
|
46891
|
+
addonId: null,
|
|
46892
|
+
access: "view"
|
|
46893
|
+
},
|
|
46894
|
+
"training.listBaseModels": {
|
|
46895
|
+
capName: "training",
|
|
46896
|
+
capScope: "system",
|
|
46897
|
+
addonId: null,
|
|
46898
|
+
access: "view"
|
|
46899
|
+
},
|
|
46900
|
+
"training.listDatasetVersions": {
|
|
46901
|
+
capName: "training",
|
|
46902
|
+
capScope: "system",
|
|
46903
|
+
addonId: null,
|
|
46904
|
+
access: "view"
|
|
46905
|
+
},
|
|
46906
|
+
"training.listJobs": {
|
|
46907
|
+
capName: "training",
|
|
46908
|
+
capScope: "system",
|
|
46909
|
+
addonId: null,
|
|
46910
|
+
access: "view"
|
|
46911
|
+
},
|
|
46912
|
+
"training.planJob": {
|
|
46913
|
+
capName: "training",
|
|
46914
|
+
capScope: "system",
|
|
46915
|
+
addonId: null,
|
|
46916
|
+
access: "view"
|
|
46917
|
+
},
|
|
46918
|
+
"training.putDatasetVersion": {
|
|
46919
|
+
capName: "training",
|
|
46920
|
+
capScope: "system",
|
|
46921
|
+
addonId: null,
|
|
46922
|
+
access: "create"
|
|
46923
|
+
},
|
|
46924
|
+
"training.registerResult": {
|
|
46925
|
+
capName: "training",
|
|
46926
|
+
capScope: "system",
|
|
46927
|
+
addonId: null,
|
|
46928
|
+
access: "create"
|
|
46929
|
+
},
|
|
46930
|
+
"training.removeDatasetVersion": {
|
|
46931
|
+
capName: "training",
|
|
46932
|
+
capScope: "system",
|
|
46933
|
+
addonId: null,
|
|
46934
|
+
access: "delete"
|
|
46935
|
+
},
|
|
46936
|
+
"training.rollbackCanary": {
|
|
46937
|
+
capName: "training",
|
|
46938
|
+
capScope: "system",
|
|
46939
|
+
addonId: null,
|
|
46940
|
+
access: "create"
|
|
46941
|
+
},
|
|
46942
|
+
"training.startJob": {
|
|
46943
|
+
capName: "training",
|
|
46944
|
+
capScope: "system",
|
|
46945
|
+
addonId: null,
|
|
46946
|
+
access: "create"
|
|
46947
|
+
},
|
|
46948
|
+
"trainingProvider.cancelJob": {
|
|
46949
|
+
capName: "training-provider",
|
|
46950
|
+
capScope: "system",
|
|
46951
|
+
addonId: null,
|
|
46952
|
+
access: "create"
|
|
46953
|
+
},
|
|
46954
|
+
"trainingProvider.cleanupJob": {
|
|
46955
|
+
capName: "training-provider",
|
|
46956
|
+
capScope: "system",
|
|
46957
|
+
addonId: null,
|
|
46958
|
+
access: "create"
|
|
46959
|
+
},
|
|
46960
|
+
"trainingProvider.describe": {
|
|
46961
|
+
capName: "training-provider",
|
|
46962
|
+
capScope: "system",
|
|
46963
|
+
addonId: null,
|
|
46964
|
+
access: "view"
|
|
46965
|
+
},
|
|
46966
|
+
"trainingProvider.estimateJob": {
|
|
46967
|
+
capName: "training-provider",
|
|
46968
|
+
capScope: "system",
|
|
46969
|
+
addonId: null,
|
|
46970
|
+
access: "view"
|
|
46971
|
+
},
|
|
46972
|
+
"trainingProvider.getJob": {
|
|
46973
|
+
capName: "training-provider",
|
|
46974
|
+
capScope: "system",
|
|
46975
|
+
addonId: null,
|
|
46976
|
+
access: "view"
|
|
46977
|
+
},
|
|
46978
|
+
"trainingProvider.listJobEvents": {
|
|
46979
|
+
capName: "training-provider",
|
|
46980
|
+
capScope: "system",
|
|
46981
|
+
addonId: null,
|
|
46982
|
+
access: "view"
|
|
46983
|
+
},
|
|
46984
|
+
"trainingProvider.listJobs": {
|
|
46985
|
+
capName: "training-provider",
|
|
46986
|
+
capScope: "system",
|
|
46987
|
+
addonId: null,
|
|
46988
|
+
access: "view"
|
|
46989
|
+
},
|
|
46990
|
+
"trainingProvider.offerArtifact": {
|
|
46991
|
+
capName: "training-provider",
|
|
46992
|
+
capScope: "system",
|
|
46993
|
+
addonId: null,
|
|
46994
|
+
access: "create"
|
|
46995
|
+
},
|
|
46996
|
+
"trainingProvider.readResult": {
|
|
46997
|
+
capName: "training-provider",
|
|
46998
|
+
capScope: "system",
|
|
46999
|
+
addonId: null,
|
|
47000
|
+
access: "create"
|
|
47001
|
+
},
|
|
47002
|
+
"trainingProvider.submitJob": {
|
|
47003
|
+
capName: "training-provider",
|
|
47004
|
+
capScope: "system",
|
|
47005
|
+
addonId: null,
|
|
47006
|
+
access: "create"
|
|
47007
|
+
},
|
|
47008
|
+
"trainingProvider.uploadDataset": {
|
|
47009
|
+
capName: "training-provider",
|
|
47010
|
+
capScope: "system",
|
|
47011
|
+
addonId: null,
|
|
47012
|
+
access: "create"
|
|
47013
|
+
},
|
|
47014
|
+
"trainingProvider.validateCredentials": {
|
|
47015
|
+
capName: "training-provider",
|
|
47016
|
+
capScope: "system",
|
|
47017
|
+
addonId: null,
|
|
47018
|
+
access: "create"
|
|
47019
|
+
},
|
|
43652
47020
|
"turnProvider.getTurnServers": {
|
|
43653
47021
|
capName: "turn-provider",
|
|
43654
47022
|
capScope: "system",
|
|
@@ -43673,12 +47041,6 @@ Object.freeze({
|
|
|
43673
47041
|
addonId: null,
|
|
43674
47042
|
access: "create"
|
|
43675
47043
|
},
|
|
43676
|
-
"userManagement.createApiKey": {
|
|
43677
|
-
capName: "user-management",
|
|
43678
|
-
capScope: "system",
|
|
43679
|
-
addonId: null,
|
|
43680
|
-
access: "create"
|
|
43681
|
-
},
|
|
43682
47044
|
"userManagement.createScopedToken": {
|
|
43683
47045
|
capName: "user-management",
|
|
43684
47046
|
capScope: "system",
|
|
@@ -43715,12 +47077,6 @@ Object.freeze({
|
|
|
43715
47077
|
addonId: null,
|
|
43716
47078
|
access: "view"
|
|
43717
47079
|
},
|
|
43718
|
-
"userManagement.linkExternalIdentity": {
|
|
43719
|
-
capName: "user-management",
|
|
43720
|
-
capScope: "system",
|
|
43721
|
-
addonId: null,
|
|
43722
|
-
access: "create"
|
|
43723
|
-
},
|
|
43724
47080
|
"userManagement.listApiKeys": {
|
|
43725
47081
|
capName: "user-management",
|
|
43726
47082
|
capScope: "system",
|
|
@@ -43823,12 +47179,6 @@ Object.freeze({
|
|
|
43823
47179
|
addonId: null,
|
|
43824
47180
|
access: "create"
|
|
43825
47181
|
},
|
|
43826
|
-
"userManagement.validateApiKey": {
|
|
43827
|
-
capName: "user-management",
|
|
43828
|
-
capScope: "system",
|
|
43829
|
-
addonId: null,
|
|
43830
|
-
access: "view"
|
|
43831
|
-
},
|
|
43832
47182
|
"userManagement.validateCredentials": {
|
|
43833
47183
|
capName: "user-management",
|
|
43834
47184
|
capScope: "system",
|
|
@@ -46916,6 +50266,11 @@ Object.freeze({
|
|
|
46916
50266
|
form: "single",
|
|
46917
50267
|
optional: false
|
|
46918
50268
|
}],
|
|
50269
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
50270
|
+
name: "deviceId",
|
|
50271
|
+
form: "single",
|
|
50272
|
+
optional: false
|
|
50273
|
+
}],
|
|
46919
50274
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
46920
50275
|
name: "deviceId",
|
|
46921
50276
|
form: "single",
|
|
@@ -47106,6 +50461,11 @@ Object.freeze({
|
|
|
47106
50461
|
form: "single",
|
|
47107
50462
|
optional: false
|
|
47108
50463
|
}],
|
|
50464
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
50465
|
+
name: "deviceId",
|
|
50466
|
+
form: "single",
|
|
50467
|
+
optional: false
|
|
50468
|
+
}],
|
|
47109
50469
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
47110
50470
|
name: "deviceId",
|
|
47111
50471
|
form: "single",
|
|
@@ -47932,6 +51292,11 @@ Object.freeze({
|
|
|
47932
51292
|
form: "single",
|
|
47933
51293
|
optional: false
|
|
47934
51294
|
}],
|
|
51295
|
+
"training.canaryResult": [{
|
|
51296
|
+
name: "deviceIds",
|
|
51297
|
+
form: "array",
|
|
51298
|
+
optional: false
|
|
51299
|
+
}],
|
|
47935
51300
|
"update.getStatus": [{
|
|
47936
51301
|
name: "deviceId",
|
|
47937
51302
|
form: "single",
|