@camstack/system 1.2.375 → 1.2.377
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-runner.js +9 -4
- package/dist/addon-runner.mjs +10 -5
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/auth/external-identity-manager.d.ts +43 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-config-secrets.d.ts +21 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts +2 -0
- package/dist/builtins/device-manager/device-manager.addon.js +119 -6
- package/dist/builtins/device-manager/device-manager.addon.mjs +119 -6
- package/dist/builtins/device-manager/device-projection.d.ts +2 -1
- package/dist/builtins/device-manager/device-provider-context.d.ts +3 -0
- package/dist/builtins/device-manager/secret-config-paths.d.ts +24 -0
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.d.ts +1 -0
- package/dist/builtins/keychain/index.js +1416 -0
- package/dist/builtins/keychain/index.mjs +1409 -0
- package/dist/builtins/keychain/key-sources.d.ts +37 -0
- package/dist/builtins/keychain/keychain-crypto.d.ts +28 -0
- package/dist/builtins/keychain/keychain-service.d.ts +103 -0
- package/dist/builtins/keychain/keychain-store.d.ts +82 -0
- package/dist/builtins/keychain/keychain-usage.d.ts +6 -0
- package/dist/builtins/keychain/keychain.addon.d.ts +11 -0
- package/dist/builtins/keychain/platform-key-source.d.ts +24 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +14 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts +1 -0
- package/dist/builtins/local-auth/local-auth.addon.js +1358 -1129
- package/dist/builtins/local-auth/local-auth.addon.mjs +1358 -1129
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/location-store.d.ts +6 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +15 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +74 -14
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +74 -14
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{child-cap-dispatch-B9kziY4L.mjs → child-cap-dispatch-CgmOo0yl.mjs} +184 -29
- package/dist/{child-cap-dispatch-Bfdgkbq3.js → child-cap-dispatch-DlDSoqm1.js} +212 -27
- package/dist/{composition-sources-DYlXX2qW.js → composition-sources-BNyXPSs_.js} +1 -1
- package/dist/{composition-sources-BfZgiTYD.mjs → composition-sources-D39bl0nP.mjs} +1 -1
- package/dist/{dist-ZdSg09GJ.mjs → dist-BWNoS-1S.mjs} +2454 -108
- package/dist/{dist-CNbnikIh.js → dist-D_a9mUiM.js} +2525 -107
- package/dist/{event-loop-stall-monitor-DKcYBHdH.mjs → event-loop-stall-monitor-ClPhfx7Y.mjs} +1 -1
- package/dist/{event-loop-stall-monitor-CpEH3CoV.js → event-loop-stall-monitor-DuOn8H1n.js} +1 -1
- package/dist/{hub-cap-forward-BdT320dq.mjs → hub-cap-forward-CH6_VWVO.mjs} +13 -4
- package/dist/{hub-cap-forward-DmHNjbB0.js → hub-cap-forward-COCmYaup.js} +13 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -6
- package/dist/index.mjs +13 -7
- package/dist/kernel/config-schema.d.ts +4 -0
- package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +6 -0
- package/dist/kernel/transport/cap-route-resolver.d.ts +19 -0
- package/dist/kernel/transport/hub-cap-forward.d.ts +22 -1
- package/dist/kernel/transport/index.d.ts +2 -2
- package/dist/kernel/transport/local-child-registry.d.ts +4 -3
- package/dist/logging/log-redactor.d.ts +9 -0
- package/dist/platform-key-source-BWlq0jjn.mjs +23 -0
- package/dist/platform-key-source-Di7HrlGR.js +40 -0
- package/dist/{retired-settings-keys-CcWvdy6u.js → retired-settings-keys-CDyOGAje.js} +1 -1
- package/dist/{retired-settings-keys-B4ZeKrbR.mjs → retired-settings-keys-iGcmzwLV.mjs} +1 -1
- package/package.json +17 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import "node:crypto";
|
|
3
|
-
//#region ../types/dist/event-category-
|
|
3
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
4
4
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
5
5
|
EventCategory["SystemBoot"] = "system.boot";
|
|
6
6
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -79,6 +79,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
79
79
|
*/
|
|
80
80
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
81
81
|
/**
|
|
82
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
83
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
84
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
85
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
86
|
+
*/
|
|
87
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
88
|
+
/**
|
|
82
89
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
83
90
|
* transitions from `failed` back to `healthy` (typically via the
|
|
84
91
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -701,7 +708,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
701
708
|
return EventCategory;
|
|
702
709
|
}({});
|
|
703
710
|
//#endregion
|
|
704
|
-
//#region ../types/dist/sleep-
|
|
711
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
705
712
|
/**
|
|
706
713
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
707
714
|
* window to float samples (D455).
|
|
@@ -780,6 +787,144 @@ function buildAlawTable() {
|
|
|
780
787
|
}
|
|
781
788
|
buildUlawTable();
|
|
782
789
|
buildAlawTable();
|
|
790
|
+
/**
|
|
791
|
+
* The value a redacted secret is replaced with on every read surface.
|
|
792
|
+
*
|
|
793
|
+
* It is also the WRITE-BACK token: an `upsertLocation` that sends this value
|
|
794
|
+
* back for a key means "keep what is stored", which is what lets an operator
|
|
795
|
+
* rename a location without retyping its password. A literal an operator could
|
|
796
|
+
* plausibly choose as a real password would turn that convenience into a way
|
|
797
|
+
* to lock yourself out, hence the sentinel shape.
|
|
798
|
+
*/
|
|
799
|
+
var REDACTED_SECRET = "__camstack_redacted__";
|
|
800
|
+
/** Is this field's stored value a credential? */
|
|
801
|
+
function isSecretConfigField(field) {
|
|
802
|
+
if (field.type === "password") return true;
|
|
803
|
+
return "secret" in field && field.secret === true;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
807
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
808
|
+
*/
|
|
809
|
+
function isKeychainStoredField(field) {
|
|
810
|
+
if (!isSecretConfigField(field)) return false;
|
|
811
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
812
|
+
return !("storage" in field && field.storage === "inline");
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Every config key in `schema` whose value is a secret, including keys nested
|
|
816
|
+
* inside `group` / `sub-tabs` containers.
|
|
817
|
+
*/
|
|
818
|
+
function collectSecretConfigKeys(schema) {
|
|
819
|
+
const keys = /* @__PURE__ */ new Set();
|
|
820
|
+
for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkField(field, keys);
|
|
821
|
+
return keys;
|
|
822
|
+
}
|
|
823
|
+
function isRecord$2(value) {
|
|
824
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
825
|
+
}
|
|
826
|
+
function sectionsOf(schema) {
|
|
827
|
+
if (!isRecord$2(schema)) return [];
|
|
828
|
+
const sections = schema["sections"];
|
|
829
|
+
return Array.isArray(sections) ? sections : [];
|
|
830
|
+
}
|
|
831
|
+
function fieldsOf(node) {
|
|
832
|
+
if (!isRecord$2(node)) return [];
|
|
833
|
+
const fields = node["fields"];
|
|
834
|
+
return Array.isArray(fields) ? fields : [];
|
|
835
|
+
}
|
|
836
|
+
function walkField(field, out) {
|
|
837
|
+
if (!isRecord$2(field)) return;
|
|
838
|
+
const type = field["type"];
|
|
839
|
+
const key = field["key"];
|
|
840
|
+
if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
|
|
841
|
+
if (type === "group") {
|
|
842
|
+
for (const child of fieldsOf(field)) walkField(child, out);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (type === "sub-tabs") {
|
|
846
|
+
const tabs = field["tabs"];
|
|
847
|
+
if (!Array.isArray(tabs)) return;
|
|
848
|
+
for (const tab of tabs) for (const child of fieldsOf(tab)) walkField(child, out);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* What a settings blob holds where a secret used to be.
|
|
853
|
+
*
|
|
854
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
855
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
856
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
857
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
858
|
+
*
|
|
859
|
+
* The same shapes travel to and from the admin UI:
|
|
860
|
+
*
|
|
861
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
862
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
863
|
+
* value is set, never the value.
|
|
864
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
865
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
866
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
867
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
868
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
869
|
+
*
|
|
870
|
+
* Pure and browser-safe.
|
|
871
|
+
*/
|
|
872
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
873
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
874
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
875
|
+
function isRecord$1(value) {
|
|
876
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
877
|
+
}
|
|
878
|
+
function makeSecretMarker(ref) {
|
|
879
|
+
return {
|
|
880
|
+
$secret: ref,
|
|
881
|
+
v: 1
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
885
|
+
function isSecretMarker(value) {
|
|
886
|
+
if (!isRecord$1(value)) return false;
|
|
887
|
+
const ref = value["$secret"];
|
|
888
|
+
return typeof ref === "string" && ref.length > 0;
|
|
889
|
+
}
|
|
890
|
+
function isSecretClear(value) {
|
|
891
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
895
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
896
|
+
* survives this function.
|
|
897
|
+
*/
|
|
898
|
+
function toSecretFieldView(stored) {
|
|
899
|
+
if (isSecretMarker(stored)) return {
|
|
900
|
+
$secret: stored.$secret,
|
|
901
|
+
v: 1,
|
|
902
|
+
set: true
|
|
903
|
+
};
|
|
904
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
905
|
+
$secret: null,
|
|
906
|
+
v: 1,
|
|
907
|
+
set: true,
|
|
908
|
+
inline: true
|
|
909
|
+
};
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
914
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
915
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
916
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
917
|
+
*/
|
|
918
|
+
function classifySecretWrite(incoming) {
|
|
919
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
920
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
921
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
922
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
923
|
+
return {
|
|
924
|
+
kind: "set",
|
|
925
|
+
value: incoming
|
|
926
|
+
};
|
|
927
|
+
}
|
|
783
928
|
/** Lookup map for well-known tabs by ID. */
|
|
784
929
|
var WELL_KNOWN_TAB_MAP = Object.fromEntries([
|
|
785
930
|
{
|
|
@@ -952,33 +1097,19 @@ var WELL_KNOWN_TAB_MAP = Object.fromEntries([
|
|
|
952
1097
|
function isValuelessField(field) {
|
|
953
1098
|
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";
|
|
954
1099
|
}
|
|
955
|
-
|
|
956
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
957
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
958
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
959
|
-
*
|
|
960
|
-
* For each leaf field:
|
|
961
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
962
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
963
|
-
*
|
|
964
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
965
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
966
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
967
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
968
|
-
*/
|
|
969
|
-
function hydrateSchema(schema, values) {
|
|
1100
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
970
1101
|
return {
|
|
971
1102
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
972
1103
|
sections: schema.sections.map((section) => ({
|
|
973
1104
|
...section,
|
|
974
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
1105
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
975
1106
|
}))
|
|
976
1107
|
};
|
|
977
1108
|
}
|
|
978
|
-
function hydrateField(field, values) {
|
|
1109
|
+
function hydrateField(field, values, options) {
|
|
979
1110
|
if (isValuelessField(field)) return field;
|
|
980
1111
|
if (field.type === "group") {
|
|
981
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
1112
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
982
1113
|
return {
|
|
983
1114
|
...field,
|
|
984
1115
|
fields: hydratedChildren
|
|
@@ -987,7 +1118,7 @@ function hydrateField(field, values) {
|
|
|
987
1118
|
if (field.type === "sub-tabs") {
|
|
988
1119
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
989
1120
|
...tab,
|
|
990
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
1121
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
991
1122
|
}));
|
|
992
1123
|
return {
|
|
993
1124
|
...field,
|
|
@@ -997,6 +1128,33 @@ function hydrateField(field, values) {
|
|
|
997
1128
|
const key = field.key;
|
|
998
1129
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
999
1130
|
const defaultValue = field.default;
|
|
1131
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
1132
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
1133
|
+
...field,
|
|
1134
|
+
value: toSecretFieldView(storedValue)
|
|
1135
|
+
};
|
|
1136
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
1137
|
+
...field,
|
|
1138
|
+
value: null
|
|
1139
|
+
};
|
|
1140
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
1141
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
1142
|
+
if (secretItemKeys.length > 0) {
|
|
1143
|
+
const rows = storedValue.map((row) => {
|
|
1144
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
1145
|
+
const out = { ...row };
|
|
1146
|
+
for (const k of secretItemKeys) {
|
|
1147
|
+
const v = Reflect.get(row, k);
|
|
1148
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
1149
|
+
}
|
|
1150
|
+
return out;
|
|
1151
|
+
});
|
|
1152
|
+
return {
|
|
1153
|
+
...field,
|
|
1154
|
+
value: rows
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1000
1158
|
if (field.multiple) {
|
|
1001
1159
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
1002
1160
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -1255,6 +1413,538 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
1255
1413
|
}
|
|
1256
1414
|
return out;
|
|
1257
1415
|
}
|
|
1416
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
1417
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
1418
|
+
function globalSecretScope() {
|
|
1419
|
+
return GLOBAL_SCOPE;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* An addon id as a ref owner. A hub in-process builtin's context id is
|
|
1423
|
+
* `addon:<id>`; the owner of its secrets is `<id>`, exactly as for the same
|
|
1424
|
+
* addon running forked.
|
|
1425
|
+
*/
|
|
1426
|
+
function normalizeSecretOwner(addonId) {
|
|
1427
|
+
return addonId.startsWith("addon:") ? addonId.slice(6) : addonId;
|
|
1428
|
+
}
|
|
1429
|
+
function encodeSegment(value) {
|
|
1430
|
+
return encodeURIComponent(value);
|
|
1431
|
+
}
|
|
1432
|
+
function decodeSegment(value) {
|
|
1433
|
+
try {
|
|
1434
|
+
return decodeURIComponent(value);
|
|
1435
|
+
} catch {
|
|
1436
|
+
return null;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
/** The scope as it appears inside a ref (`global`, `node/<id>`, …). */
|
|
1440
|
+
function formatSecretScope(scope) {
|
|
1441
|
+
switch (scope.kind) {
|
|
1442
|
+
case "global": return "global";
|
|
1443
|
+
case "node": return `node/${encodeSegment(scope.nodeId)}`;
|
|
1444
|
+
case "device": return `device/${scope.deviceId}`;
|
|
1445
|
+
case "integration": return `integration/${encodeSegment(scope.integrationId)}`;
|
|
1446
|
+
case "row": return `row/${encodeSegment(scope.collection)}/${encodeSegment(scope.rowId)}`;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
1451
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
1452
|
+
* `providers[authentik].clientSecret`.
|
|
1453
|
+
*/
|
|
1454
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
1455
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
1456
|
+
}
|
|
1457
|
+
function parseScope(segments) {
|
|
1458
|
+
switch (segments[0]) {
|
|
1459
|
+
case "global": return {
|
|
1460
|
+
scope: GLOBAL_SCOPE,
|
|
1461
|
+
used: 1
|
|
1462
|
+
};
|
|
1463
|
+
case "node": {
|
|
1464
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
1465
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
1466
|
+
scope: {
|
|
1467
|
+
kind: "node",
|
|
1468
|
+
nodeId
|
|
1469
|
+
},
|
|
1470
|
+
used: 2
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
case "device": {
|
|
1474
|
+
const raw = segments[1];
|
|
1475
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
1476
|
+
return {
|
|
1477
|
+
scope: {
|
|
1478
|
+
kind: "device",
|
|
1479
|
+
deviceId: Number(raw)
|
|
1480
|
+
},
|
|
1481
|
+
used: 2
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
case "integration": {
|
|
1485
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
1486
|
+
return id === null || id.length === 0 ? null : {
|
|
1487
|
+
scope: {
|
|
1488
|
+
kind: "integration",
|
|
1489
|
+
integrationId: id
|
|
1490
|
+
},
|
|
1491
|
+
used: 2
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
case "row": {
|
|
1495
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
1496
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
1497
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
1498
|
+
return {
|
|
1499
|
+
scope: {
|
|
1500
|
+
kind: "row",
|
|
1501
|
+
collection,
|
|
1502
|
+
rowId
|
|
1503
|
+
},
|
|
1504
|
+
used: 3
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
default: return null;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
1511
|
+
function parseSecretRef(ref) {
|
|
1512
|
+
if (!ref.startsWith("secret://")) return null;
|
|
1513
|
+
const segments = ref.slice(9).split("/");
|
|
1514
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
1515
|
+
if (owner === null || owner.length === 0) return null;
|
|
1516
|
+
const parsed = parseScope(segments.slice(1));
|
|
1517
|
+
if (parsed === null) return null;
|
|
1518
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
1519
|
+
if (fieldPath.length === 0) return null;
|
|
1520
|
+
return {
|
|
1521
|
+
owner,
|
|
1522
|
+
scope: parsed.scope,
|
|
1523
|
+
fieldPath
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
1527
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
1528
|
+
fieldPath;
|
|
1529
|
+
constructor(fieldPath, cause) {
|
|
1530
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
1531
|
+
this.fieldPath = fieldPath;
|
|
1532
|
+
this.name = "KeychainWriteRefusedError";
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
var KEEP = { kind: "keep" };
|
|
1536
|
+
function isRecord(value) {
|
|
1537
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1538
|
+
}
|
|
1539
|
+
function defaultMintId() {
|
|
1540
|
+
return globalThis.crypto.randomUUID();
|
|
1541
|
+
}
|
|
1542
|
+
/** Every marker ref anywhere under `value`. */
|
|
1543
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
1544
|
+
if (isSecretMarker(value)) {
|
|
1545
|
+
out.push(value.$secret);
|
|
1546
|
+
return out;
|
|
1547
|
+
}
|
|
1548
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
1549
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
1550
|
+
return out;
|
|
1551
|
+
}
|
|
1552
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
1553
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
1554
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
1555
|
+
}
|
|
1556
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
1557
|
+
const intent = classifySecretWrite(incoming);
|
|
1558
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
1559
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
1560
|
+
if (intent.kind === "keep") return KEEP;
|
|
1561
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
1562
|
+
if (intent.kind === "clear") {
|
|
1563
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
1564
|
+
return {
|
|
1565
|
+
kind: "value",
|
|
1566
|
+
value: null
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
1570
|
+
kind: "value",
|
|
1571
|
+
value: stored
|
|
1572
|
+
};
|
|
1573
|
+
try {
|
|
1574
|
+
await ctx.secrets.put(ref, intent.value);
|
|
1575
|
+
} catch (err) {
|
|
1576
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
1577
|
+
}
|
|
1578
|
+
return {
|
|
1579
|
+
kind: "value",
|
|
1580
|
+
value: makeSecretMarker(ref)
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
1584
|
+
function applyMember(out, key, result, storedParent) {
|
|
1585
|
+
if (result.kind === "value") {
|
|
1586
|
+
out[key] = result.value;
|
|
1587
|
+
return;
|
|
1588
|
+
}
|
|
1589
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
1590
|
+
else delete out[key];
|
|
1591
|
+
}
|
|
1592
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
1593
|
+
const out = { ...incoming };
|
|
1594
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
1595
|
+
return out;
|
|
1596
|
+
}
|
|
1597
|
+
function rowId(row, idKey) {
|
|
1598
|
+
const raw = row[idKey];
|
|
1599
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
1600
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
1601
|
+
return null;
|
|
1602
|
+
}
|
|
1603
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
1604
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
1605
|
+
if (!Array.isArray(incoming)) {
|
|
1606
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
1607
|
+
return {
|
|
1608
|
+
kind: "value",
|
|
1609
|
+
value: incoming
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
1613
|
+
for (const row of storedRows) {
|
|
1614
|
+
const id = rowId(row, node.idKey);
|
|
1615
|
+
if (id !== null) storedById.set(id, row);
|
|
1616
|
+
}
|
|
1617
|
+
const kept = /* @__PURE__ */ new Set();
|
|
1618
|
+
const rows = [];
|
|
1619
|
+
for (const row of incoming) {
|
|
1620
|
+
if (!isRecord(row)) {
|
|
1621
|
+
rows.push(row);
|
|
1622
|
+
continue;
|
|
1623
|
+
}
|
|
1624
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
1625
|
+
kept.add(id);
|
|
1626
|
+
const withId = {
|
|
1627
|
+
...row,
|
|
1628
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
1629
|
+
};
|
|
1630
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
1631
|
+
const storedRow = storedById.get(id) ?? {};
|
|
1632
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
1633
|
+
}
|
|
1634
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
1635
|
+
return {
|
|
1636
|
+
kind: "value",
|
|
1637
|
+
value: rows
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1640
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
1641
|
+
switch (node.kind) {
|
|
1642
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
1643
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
1644
|
+
case "object": {
|
|
1645
|
+
if (!isRecord(incoming)) {
|
|
1646
|
+
if (incoming === void 0) return KEEP;
|
|
1647
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
1648
|
+
return {
|
|
1649
|
+
kind: "value",
|
|
1650
|
+
value: incoming
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
1654
|
+
return {
|
|
1655
|
+
kind: "value",
|
|
1656
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
1662
|
+
function splitNodeKey(key) {
|
|
1663
|
+
const at = key.indexOf("@");
|
|
1664
|
+
return at <= 0 ? {
|
|
1665
|
+
base: key,
|
|
1666
|
+
nodeId: null
|
|
1667
|
+
} : {
|
|
1668
|
+
base: key.slice(0, at),
|
|
1669
|
+
nodeId: key.slice(at + 1)
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
1673
|
+
async function transformSecretWrite(input) {
|
|
1674
|
+
const deletes = [];
|
|
1675
|
+
const base = {
|
|
1676
|
+
secrets: input.secrets,
|
|
1677
|
+
mintId: input.mintId ?? defaultMintId,
|
|
1678
|
+
deletes,
|
|
1679
|
+
operatorWrite: input.operatorWrite === true
|
|
1680
|
+
};
|
|
1681
|
+
const out = {};
|
|
1682
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
1683
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
1684
|
+
const node = input.tree.get(baseKey);
|
|
1685
|
+
if (node === void 0) {
|
|
1686
|
+
out[key] = incoming;
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
1690
|
+
kind: "node",
|
|
1691
|
+
nodeId
|
|
1692
|
+
} : input.scope ?? globalSecretScope();
|
|
1693
|
+
const result = await writeNode({
|
|
1694
|
+
...base,
|
|
1695
|
+
scope
|
|
1696
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
1697
|
+
if (result.kind === "value") out[key] = result.value;
|
|
1698
|
+
}
|
|
1699
|
+
return {
|
|
1700
|
+
patch: out,
|
|
1701
|
+
afterWrite: async () => {
|
|
1702
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
1703
|
+
try {
|
|
1704
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
1705
|
+
return { orphaned: [] };
|
|
1706
|
+
} catch {
|
|
1707
|
+
return { orphaned: [...new Set(deletes)] };
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
1714
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
1715
|
+
*/
|
|
1716
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
1717
|
+
const refs = collectSecretMarkerRefs(value);
|
|
1718
|
+
if (refs.length === 0) return {
|
|
1719
|
+
value,
|
|
1720
|
+
unresolved: []
|
|
1721
|
+
};
|
|
1722
|
+
const answers = await secrets.resolve(refs);
|
|
1723
|
+
const unresolved = [];
|
|
1724
|
+
for (const ref of new Set(refs)) {
|
|
1725
|
+
const answer = answers[ref];
|
|
1726
|
+
if (answer === void 0) unresolved.push({
|
|
1727
|
+
ref,
|
|
1728
|
+
reason: "not-initialized"
|
|
1729
|
+
});
|
|
1730
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
1731
|
+
ref,
|
|
1732
|
+
reason: answer.reason
|
|
1733
|
+
});
|
|
1734
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
1735
|
+
ref,
|
|
1736
|
+
reason: answer.kind
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
const substitute = (v) => {
|
|
1740
|
+
if (isSecretMarker(v)) {
|
|
1741
|
+
const answer = answers[v.$secret];
|
|
1742
|
+
return answer?.kind === "value" ? {
|
|
1743
|
+
keep: true,
|
|
1744
|
+
value: answer.value
|
|
1745
|
+
} : {
|
|
1746
|
+
keep: false,
|
|
1747
|
+
value: void 0
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
if (Array.isArray(v)) {
|
|
1751
|
+
const items = [];
|
|
1752
|
+
for (const item of v) {
|
|
1753
|
+
const s = substitute(item);
|
|
1754
|
+
if (s.keep) items.push(s.value);
|
|
1755
|
+
}
|
|
1756
|
+
return {
|
|
1757
|
+
keep: true,
|
|
1758
|
+
value: items
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
if (isRecord(v)) {
|
|
1762
|
+
const out = {};
|
|
1763
|
+
for (const [k, child] of Object.entries(v)) {
|
|
1764
|
+
const s = substitute(child);
|
|
1765
|
+
if (s.keep) out[k] = s.value;
|
|
1766
|
+
}
|
|
1767
|
+
return {
|
|
1768
|
+
keep: true,
|
|
1769
|
+
value: out
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
return {
|
|
1773
|
+
keep: true,
|
|
1774
|
+
value: v
|
|
1775
|
+
};
|
|
1776
|
+
};
|
|
1777
|
+
return {
|
|
1778
|
+
value: substitute(value).value,
|
|
1779
|
+
unresolved
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
function touchesTree(tree, patch) {
|
|
1783
|
+
if (tree.size === 0) return false;
|
|
1784
|
+
for (const key of Object.keys(patch)) {
|
|
1785
|
+
const at = key.indexOf("@");
|
|
1786
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
1787
|
+
}
|
|
1788
|
+
return false;
|
|
1789
|
+
}
|
|
1790
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
1791
|
+
async function readStoredAddonBlob(raw) {
|
|
1792
|
+
const threeWay = raw.readAddonStoreResult;
|
|
1793
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
1794
|
+
const result = await threeWay.call(raw);
|
|
1795
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
1796
|
+
return result.kind === "missing" ? {} : result.value;
|
|
1797
|
+
}
|
|
1798
|
+
function createSecretAwareSettings(raw, opts) {
|
|
1799
|
+
const chains = /* @__PURE__ */ new Map();
|
|
1800
|
+
const serialize = (key, fn) => {
|
|
1801
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
1802
|
+
const tail = next.catch(() => void 0);
|
|
1803
|
+
chains.set(key, tail);
|
|
1804
|
+
tail.then(() => {
|
|
1805
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
1806
|
+
});
|
|
1807
|
+
return next;
|
|
1808
|
+
};
|
|
1809
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
1810
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
1811
|
+
return serialize(chainKey, async () => {
|
|
1812
|
+
const stored = await readStored();
|
|
1813
|
+
const result = await transformSecretWrite({
|
|
1814
|
+
tree,
|
|
1815
|
+
secrets: opts.secrets,
|
|
1816
|
+
patch,
|
|
1817
|
+
stored,
|
|
1818
|
+
...scope !== void 0 ? { scope } : {},
|
|
1819
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
1820
|
+
});
|
|
1821
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
1822
|
+
const { orphaned } = await result.afterWrite();
|
|
1823
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
1824
|
+
});
|
|
1825
|
+
};
|
|
1826
|
+
const wrapped = {
|
|
1827
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
1828
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
1829
|
+
kind: "device",
|
|
1830
|
+
deviceId
|
|
1831
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
1832
|
+
};
|
|
1833
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
1834
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
1835
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
1836
|
+
const value = Reflect.get(target, prop, receiver);
|
|
1837
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
1838
|
+
} });
|
|
1839
|
+
}
|
|
1840
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
1841
|
+
function withSecretAwareSettings(context, opts) {
|
|
1842
|
+
const raw = context.settings;
|
|
1843
|
+
if (raw === void 0) return context;
|
|
1844
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
1845
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
1846
|
+
if (prop === "settings") return settings;
|
|
1847
|
+
return Reflect.get(target, prop, receiver);
|
|
1848
|
+
} });
|
|
1849
|
+
}
|
|
1850
|
+
var LEAF = { kind: "leaf" };
|
|
1851
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
1852
|
+
function collectFields(fields, out) {
|
|
1853
|
+
for (const field of fields) {
|
|
1854
|
+
if (field.type === "group") {
|
|
1855
|
+
collectFields(field.fields, out);
|
|
1856
|
+
continue;
|
|
1857
|
+
}
|
|
1858
|
+
if (field.type === "sub-tabs") {
|
|
1859
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
1860
|
+
continue;
|
|
1861
|
+
}
|
|
1862
|
+
if (field.type === "editable-array") {
|
|
1863
|
+
const item = /* @__PURE__ */ new Map();
|
|
1864
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
1865
|
+
if (item.size > 0) out.set(field.key, {
|
|
1866
|
+
kind: "array",
|
|
1867
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
1868
|
+
item
|
|
1869
|
+
});
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1872
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
1873
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
/** The secret tree a settings schema declares. */
|
|
1877
|
+
function secretTreeFromSchema(schema) {
|
|
1878
|
+
const out = /* @__PURE__ */ new Map();
|
|
1879
|
+
if (schema === null) return out;
|
|
1880
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
1881
|
+
return out;
|
|
1882
|
+
}
|
|
1883
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
1884
|
+
function parseSecretStatePath(path) {
|
|
1885
|
+
const segments = [];
|
|
1886
|
+
for (const raw of path.split(".")) {
|
|
1887
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
1888
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
1889
|
+
segments.push(m[2] !== void 0 ? {
|
|
1890
|
+
key: m[1],
|
|
1891
|
+
idKey: m[2]
|
|
1892
|
+
} : { key: m[1] });
|
|
1893
|
+
}
|
|
1894
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
1895
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
1896
|
+
return segments;
|
|
1897
|
+
}
|
|
1898
|
+
function insert(into, segments) {
|
|
1899
|
+
const [head, ...rest] = segments;
|
|
1900
|
+
if (head === void 0) return;
|
|
1901
|
+
if (rest.length === 0) {
|
|
1902
|
+
into.set(head.key, LEAF);
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
const existing = into.get(head.key);
|
|
1906
|
+
if (head.idKey !== void 0) {
|
|
1907
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
1908
|
+
insert(item, rest);
|
|
1909
|
+
into.set(head.key, {
|
|
1910
|
+
kind: "array",
|
|
1911
|
+
idKey: head.idKey,
|
|
1912
|
+
item
|
|
1913
|
+
});
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
1917
|
+
insert(children, rest);
|
|
1918
|
+
into.set(head.key, {
|
|
1919
|
+
kind: "object",
|
|
1920
|
+
children
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
1924
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
1925
|
+
if (paths.length === 0) return tree;
|
|
1926
|
+
const out = new Map(tree);
|
|
1927
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
1928
|
+
return out;
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* The tree of a DECLARED path list — a device's `secretConfigPaths`
|
|
1932
|
+
* (`collectZodSecretPaths`: dotted, `[]` for array items). An array segment
|
|
1933
|
+
* without a named id field is addressed by the item's `id`.
|
|
1934
|
+
*/
|
|
1935
|
+
function secretTreeFromPaths(paths) {
|
|
1936
|
+
const out = /* @__PURE__ */ new Map();
|
|
1937
|
+
for (const path of paths) {
|
|
1938
|
+
if (path.length === 0) continue;
|
|
1939
|
+
insert(out, parseSecretStatePath(path.replace(/\[\]/g, `[${DEFAULT_ITEM_ID_KEY}]`)));
|
|
1940
|
+
}
|
|
1941
|
+
return out;
|
|
1942
|
+
}
|
|
1943
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
1944
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
1945
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
1946
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
1947
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
1258
1948
|
/**
|
|
1259
1949
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
1260
1950
|
*
|
|
@@ -1324,6 +2014,25 @@ var BaseAddon = class {
|
|
|
1324
2014
|
settingsStoreReady = false;
|
|
1325
2015
|
/** Default config values. Provided via constructor. */
|
|
1326
2016
|
defaults;
|
|
2017
|
+
/**
|
|
2018
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
2019
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
2020
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
2021
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
2022
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
2023
|
+
*/
|
|
2024
|
+
secretStatePaths = [];
|
|
2025
|
+
_addonSecretTree = null;
|
|
2026
|
+
_deviceSecretTree = null;
|
|
2027
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
2028
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
2029
|
+
_unresolvedSecrets = [];
|
|
2030
|
+
_secretRetryTimer = null;
|
|
2031
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
2032
|
+
_secretChangeTimer = null;
|
|
2033
|
+
_secretChangeUnsub = null;
|
|
2034
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
2035
|
+
_operatorWriteDepth = 0;
|
|
1327
2036
|
constructor(defaults) {
|
|
1328
2037
|
this.defaults = defaults;
|
|
1329
2038
|
this._config = { ...defaults };
|
|
@@ -1359,8 +2068,18 @@ var BaseAddon = class {
|
|
|
1359
2068
|
return this._config;
|
|
1360
2069
|
}
|
|
1361
2070
|
async initialize(context) {
|
|
1362
|
-
|
|
2071
|
+
const secrets = context.secrets;
|
|
2072
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
2073
|
+
secrets,
|
|
2074
|
+
addonTree: () => this.addonSecretTree(),
|
|
2075
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
2076
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
2077
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
2078
|
+
}) : context;
|
|
1363
2079
|
await this.resolveConfig();
|
|
2080
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
2081
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
2082
|
+
});
|
|
1364
2083
|
const result = await this.onInitialize();
|
|
1365
2084
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
1366
2085
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -1393,6 +2112,12 @@ var BaseAddon = class {
|
|
|
1393
2112
|
*/
|
|
1394
2113
|
async onHubReachable() {}
|
|
1395
2114
|
async shutdown() {
|
|
2115
|
+
this._secretChangeUnsub?.();
|
|
2116
|
+
this._secretChangeUnsub = null;
|
|
2117
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
2118
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
2119
|
+
this._secretRetryTimer = null;
|
|
2120
|
+
this._secretChangeTimer = null;
|
|
1396
2121
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
1397
2122
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
1398
2123
|
await this.onShutdown();
|
|
@@ -1471,7 +2196,7 @@ var BaseAddon = class {
|
|
|
1471
2196
|
return hydrateSchema(schema, overlay ? {
|
|
1472
2197
|
...projected,
|
|
1473
2198
|
...overlay
|
|
1474
|
-
} : projected);
|
|
2199
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
1475
2200
|
}
|
|
1476
2201
|
/**
|
|
1477
2202
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -1520,7 +2245,7 @@ var BaseAddon = class {
|
|
|
1520
2245
|
return hydrateSchema({
|
|
1521
2246
|
...schema,
|
|
1522
2247
|
sections
|
|
1523
|
-
}, projected);
|
|
2248
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
1524
2249
|
}
|
|
1525
2250
|
/**
|
|
1526
2251
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -1574,18 +2299,50 @@ var BaseAddon = class {
|
|
|
1574
2299
|
value: result.value[key]
|
|
1575
2300
|
};
|
|
1576
2301
|
}
|
|
2302
|
+
/**
|
|
2303
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
2304
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
2305
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
2306
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
2307
|
+
* writing back what it read is not (D787).
|
|
2308
|
+
*/
|
|
2309
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
2310
|
+
this._operatorWriteDepth++;
|
|
2311
|
+
try {
|
|
2312
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
2313
|
+
} finally {
|
|
2314
|
+
this._operatorWriteDepth--;
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
1577
2317
|
async updateGlobalSettings(patch, nodeId) {
|
|
2318
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
2322
|
+
*
|
|
2323
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
2324
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
2325
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
2326
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
2327
|
+
*/
|
|
2328
|
+
async clearSecrets(keys, nodeId) {
|
|
2329
|
+
const tree = this.addonSecretTree();
|
|
2330
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
2331
|
+
const patch = {};
|
|
2332
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
2333
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
2334
|
+
}
|
|
2335
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
1578
2336
|
const keys = this.perNodeKeys();
|
|
1579
2337
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
1580
2338
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
1581
|
-
const barePatch = patch;
|
|
1582
2339
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
1583
2340
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
1584
2341
|
if (target !== localNode) return;
|
|
1585
2342
|
await this.resolveConfig();
|
|
1586
2343
|
await this.onConfigChanged();
|
|
1587
2344
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
1588
|
-
this.maybeAutoRestart(
|
|
2345
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
1589
2346
|
}
|
|
1590
2347
|
/**
|
|
1591
2348
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -1610,7 +2367,7 @@ var BaseAddon = class {
|
|
|
1610
2367
|
* time to return its response before the addon is torn down and
|
|
1611
2368
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
1612
2369
|
*/
|
|
1613
|
-
maybeAutoRestart(
|
|
2370
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
1614
2371
|
if (!schema) return;
|
|
1615
2372
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
1616
2373
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -1618,13 +2375,13 @@ var BaseAddon = class {
|
|
|
1618
2375
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
1619
2376
|
}
|
|
1620
2377
|
if (restartKeys.size === 0) return;
|
|
1621
|
-
if (!
|
|
2378
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
1622
2379
|
const ctx = this._ctx;
|
|
1623
2380
|
if (!ctx) return;
|
|
1624
2381
|
const addonId = ctx.id;
|
|
1625
2382
|
setImmediate(() => {
|
|
1626
2383
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
1627
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
2384
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
1628
2385
|
}).catch((err) => {
|
|
1629
2386
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1630
2387
|
});
|
|
@@ -1633,7 +2390,7 @@ var BaseAddon = class {
|
|
|
1633
2390
|
async getDeviceSettings(deviceId) {
|
|
1634
2391
|
const schema = this.deviceSettingsSchema();
|
|
1635
2392
|
if (!schema) return { sections: [] };
|
|
1636
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
2393
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
1637
2394
|
}
|
|
1638
2395
|
async updateDeviceSettings(deviceId, patch) {
|
|
1639
2396
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -1763,7 +2520,7 @@ var BaseAddon = class {
|
|
|
1763
2520
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
1764
2521
|
*/
|
|
1765
2522
|
async resolveConfig() {
|
|
1766
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
2523
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
1767
2524
|
const perNode = this.perNodeKeys();
|
|
1768
2525
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
1769
2526
|
const resolved = { ...this.defaults };
|
|
@@ -1788,7 +2545,7 @@ var BaseAddon = class {
|
|
|
1788
2545
|
key,
|
|
1789
2546
|
schema,
|
|
1790
2547
|
fallback,
|
|
1791
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
2548
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
1792
2549
|
write: async (patch) => {
|
|
1793
2550
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
1794
2551
|
},
|
|
@@ -1805,7 +2562,7 @@ var BaseAddon = class {
|
|
|
1805
2562
|
key,
|
|
1806
2563
|
schema,
|
|
1807
2564
|
fallback,
|
|
1808
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
2565
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
1809
2566
|
write: async (patch) => {
|
|
1810
2567
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
1811
2568
|
},
|
|
@@ -1817,6 +2574,70 @@ var BaseAddon = class {
|
|
|
1817
2574
|
} })
|
|
1818
2575
|
});
|
|
1819
2576
|
}
|
|
2577
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
2578
|
+
addonSecretTree() {
|
|
2579
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
2580
|
+
return this._addonSecretTree;
|
|
2581
|
+
}
|
|
2582
|
+
deviceSecretTree() {
|
|
2583
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
2584
|
+
return this._deviceSecretTree;
|
|
2585
|
+
}
|
|
2586
|
+
/**
|
|
2587
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
2588
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
2589
|
+
* an addon whose function needs one should report itself degraded rather
|
|
2590
|
+
* than start on an empty credential.
|
|
2591
|
+
*/
|
|
2592
|
+
get unresolvedSecrets() {
|
|
2593
|
+
return this._unresolvedSecrets;
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
2597
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
2598
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
2599
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
2600
|
+
* ever written back from here.
|
|
2601
|
+
*/
|
|
2602
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
2603
|
+
const secrets = this._ctx?.secrets;
|
|
2604
|
+
if (secrets === void 0) return blob;
|
|
2605
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
2606
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
2607
|
+
if (refs.length === 0) {
|
|
2608
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
2609
|
+
return blob;
|
|
2610
|
+
}
|
|
2611
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
2612
|
+
if (trackForConfig) {
|
|
2613
|
+
this._unresolvedSecrets = unresolved;
|
|
2614
|
+
if (unresolved.length > 0) {
|
|
2615
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
2616
|
+
ref: u.ref,
|
|
2617
|
+
reason: u.reason
|
|
2618
|
+
})) } });
|
|
2619
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
2620
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
2621
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
2622
|
+
}
|
|
2623
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
2624
|
+
}
|
|
2625
|
+
return value;
|
|
2626
|
+
}
|
|
2627
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
2628
|
+
scheduleSecretReresolve(delayMs) {
|
|
2629
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
2630
|
+
if (this[timerOf] !== null) return;
|
|
2631
|
+
const timer = setTimeout(() => {
|
|
2632
|
+
this[timerOf] = null;
|
|
2633
|
+
if (this._ctx === null) return;
|
|
2634
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
2635
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
2636
|
+
});
|
|
2637
|
+
}, delayMs);
|
|
2638
|
+
timer.unref?.();
|
|
2639
|
+
this[timerOf] = timer;
|
|
2640
|
+
}
|
|
1820
2641
|
/**
|
|
1821
2642
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
1822
2643
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -1950,6 +2771,31 @@ var PeerBytesTicketSchema = z.object({
|
|
|
1950
2771
|
*/
|
|
1951
2772
|
declaredBytes: z.number().int().nonnegative().nullable()
|
|
1952
2773
|
});
|
|
2774
|
+
/**
|
|
2775
|
+
* One store per PROCESS, even when two copies of this module are loaded (an
|
|
2776
|
+
* addon bundle next to the framework's): keyed on a registered symbol.
|
|
2777
|
+
*/
|
|
2778
|
+
var STORE_KEY = Symbol.for("camstack.keychain.known-secrets");
|
|
2779
|
+
function store() {
|
|
2780
|
+
const existing = Reflect.get(globalThis, STORE_KEY);
|
|
2781
|
+
if (existing !== void 0 && existing !== null) return existing;
|
|
2782
|
+
const created = {
|
|
2783
|
+
values: /* @__PURE__ */ new Map(),
|
|
2784
|
+
compiled: null
|
|
2785
|
+
};
|
|
2786
|
+
Reflect.set(globalThis, STORE_KEY, created);
|
|
2787
|
+
return created;
|
|
2788
|
+
}
|
|
2789
|
+
/** Replace every registered value inside `text` with its label. */
|
|
2790
|
+
function scrubKnownSecrets(text) {
|
|
2791
|
+
const s = store();
|
|
2792
|
+
const re = s.compiled;
|
|
2793
|
+
if (re === null || text.length < 8) return text;
|
|
2794
|
+
re.lastIndex = 0;
|
|
2795
|
+
if (!re.test(text)) return text;
|
|
2796
|
+
re.lastIndex = 0;
|
|
2797
|
+
return text.replace(re, (match) => s.values.get(match) ?? "‹secret›");
|
|
2798
|
+
}
|
|
1953
2799
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
1954
2800
|
var CamProfileSchema = z.enum([
|
|
1955
2801
|
"high",
|
|
@@ -3078,6 +3924,69 @@ var deviceOpsCapability = {
|
|
|
3078
3924
|
getRawState: method(z.object({ deviceId: z.number() }), RawStateResultSchema.nullable(), { auth: "protected" })
|
|
3079
3925
|
}
|
|
3080
3926
|
};
|
|
3927
|
+
function defOf(schema) {
|
|
3928
|
+
return schema._zod?.def ?? {};
|
|
3929
|
+
}
|
|
3930
|
+
function declaredHere(schema) {
|
|
3931
|
+
return z.globalRegistry.get(schema)?.secret === true;
|
|
3932
|
+
}
|
|
3933
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
3934
|
+
var WRAPPERS = new Set([
|
|
3935
|
+
"optional",
|
|
3936
|
+
"nullable",
|
|
3937
|
+
"default",
|
|
3938
|
+
"prefault",
|
|
3939
|
+
"catch",
|
|
3940
|
+
"readonly",
|
|
3941
|
+
"nonoptional"
|
|
3942
|
+
]);
|
|
3943
|
+
/**
|
|
3944
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
3945
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
3946
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
3947
|
+
* `.transform` on `in`).
|
|
3948
|
+
*/
|
|
3949
|
+
function layersOf(schema) {
|
|
3950
|
+
const out = [];
|
|
3951
|
+
const queue = [schema];
|
|
3952
|
+
while (queue.length > 0) {
|
|
3953
|
+
const s = queue.shift();
|
|
3954
|
+
if (!s || out.includes(s)) continue;
|
|
3955
|
+
out.push(s);
|
|
3956
|
+
const def = defOf(s);
|
|
3957
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
3958
|
+
if (def.type === "pipe") {
|
|
3959
|
+
if (def.in) queue.push(def.in);
|
|
3960
|
+
if (def.out) queue.push(def.out);
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
return out;
|
|
3964
|
+
}
|
|
3965
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
3966
|
+
function isZodSecret(schema) {
|
|
3967
|
+
return layersOf(schema).some(declaredHere);
|
|
3968
|
+
}
|
|
3969
|
+
/**
|
|
3970
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
3971
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
3972
|
+
* object or array is reported as one path and not descended into — everything
|
|
3973
|
+
* under it is secret.
|
|
3974
|
+
*/
|
|
3975
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
3976
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
3977
|
+
const paths = [];
|
|
3978
|
+
for (const layer of layersOf(schema)) {
|
|
3979
|
+
const def = defOf(layer);
|
|
3980
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
3981
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
3982
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
3983
|
+
else if (def.type === "intersection") {
|
|
3984
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
3985
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
return [...new Set(paths)];
|
|
3989
|
+
}
|
|
3081
3990
|
/**
|
|
3082
3991
|
* Type-safe JSON parsing helpers.
|
|
3083
3992
|
*
|
|
@@ -5715,53 +6624,6 @@ var DERIVED_CAMERA_SILENCED_CAP_NAMES = [
|
|
|
5715
6624
|
"scene-monitor"
|
|
5716
6625
|
];
|
|
5717
6626
|
/**
|
|
5718
|
-
* The value a redacted secret is replaced with on every read surface.
|
|
5719
|
-
*
|
|
5720
|
-
* It is also the WRITE-BACK token: an `upsertLocation` that sends this value
|
|
5721
|
-
* back for a key means "keep what is stored", which is what lets an operator
|
|
5722
|
-
* rename a location without retyping its password. A literal an operator could
|
|
5723
|
-
* plausibly choose as a real password would turn that convenience into a way
|
|
5724
|
-
* to lock yourself out, hence the sentinel shape.
|
|
5725
|
-
*/
|
|
5726
|
-
var REDACTED_SECRET = "__camstack_redacted__";
|
|
5727
|
-
/**
|
|
5728
|
-
* Every config key in `schema` whose value is a secret, including keys nested
|
|
5729
|
-
* inside `group` / `sub-tabs` containers.
|
|
5730
|
-
*/
|
|
5731
|
-
function collectSecretConfigKeys(schema) {
|
|
5732
|
-
const keys = /* @__PURE__ */ new Set();
|
|
5733
|
-
for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkField(field, keys);
|
|
5734
|
-
return keys;
|
|
5735
|
-
}
|
|
5736
|
-
function isRecord$3(value) {
|
|
5737
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5738
|
-
}
|
|
5739
|
-
function sectionsOf(schema) {
|
|
5740
|
-
if (!isRecord$3(schema)) return [];
|
|
5741
|
-
const sections = schema["sections"];
|
|
5742
|
-
return Array.isArray(sections) ? sections : [];
|
|
5743
|
-
}
|
|
5744
|
-
function fieldsOf(node) {
|
|
5745
|
-
if (!isRecord$3(node)) return [];
|
|
5746
|
-
const fields = node["fields"];
|
|
5747
|
-
return Array.isArray(fields) ? fields : [];
|
|
5748
|
-
}
|
|
5749
|
-
function walkField(field, out) {
|
|
5750
|
-
if (!isRecord$3(field)) return;
|
|
5751
|
-
const type = field["type"];
|
|
5752
|
-
const key = field["key"];
|
|
5753
|
-
if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
|
|
5754
|
-
if (type === "group") {
|
|
5755
|
-
for (const child of fieldsOf(field)) walkField(child, out);
|
|
5756
|
-
return;
|
|
5757
|
-
}
|
|
5758
|
-
if (type === "sub-tabs") {
|
|
5759
|
-
const tabs = field["tabs"];
|
|
5760
|
-
if (!Array.isArray(tabs)) return;
|
|
5761
|
-
for (const tab of tabs) for (const child of fieldsOf(tab)) walkField(child, out);
|
|
5762
|
-
}
|
|
5763
|
-
}
|
|
5764
|
-
/**
|
|
5765
6627
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
5766
6628
|
*
|
|
5767
6629
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -13962,6 +14824,270 @@ id: z.union([z.string(), z.number()]) }), {
|
|
|
13962
14824
|
})
|
|
13963
14825
|
}
|
|
13964
14826
|
};
|
|
14827
|
+
/**
|
|
14828
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14829
|
+
*
|
|
14830
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14831
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14832
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14833
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14834
|
+
* against the CALLER, never against anything the caller claims.
|
|
14835
|
+
*
|
|
14836
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14837
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14838
|
+
* connection, the agent from its child's connection carried in
|
|
14839
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14840
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14841
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14842
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14843
|
+
* runner is the same OS user): see the threat model in
|
|
14844
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14845
|
+
*
|
|
14846
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14847
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14848
|
+
* floors every method to admin anyway (D240).
|
|
14849
|
+
*
|
|
14850
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14851
|
+
*/
|
|
14852
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14853
|
+
var KeychainUnavailableReasonSchema = z.enum([
|
|
14854
|
+
"key-missing",
|
|
14855
|
+
"wrong-key",
|
|
14856
|
+
"key-file-unreadable",
|
|
14857
|
+
"store-unavailable",
|
|
14858
|
+
"not-initialized",
|
|
14859
|
+
"decrypt-failed"
|
|
14860
|
+
]);
|
|
14861
|
+
var KeychainStateSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("ready") }), z.object({
|
|
14862
|
+
state: z.literal("locked"),
|
|
14863
|
+
reason: KeychainUnavailableReasonSchema
|
|
14864
|
+
})]);
|
|
14865
|
+
var KeychainResolveEntrySchema = z.discriminatedUnion("kind", [
|
|
14866
|
+
z.object({
|
|
14867
|
+
kind: z.literal("value"),
|
|
14868
|
+
value: z.string(),
|
|
14869
|
+
version: z.number().int()
|
|
14870
|
+
}),
|
|
14871
|
+
z.object({ kind: z.literal("missing") }),
|
|
14872
|
+
z.object({
|
|
14873
|
+
kind: z.literal("unavailable"),
|
|
14874
|
+
reason: KeychainUnavailableReasonSchema
|
|
14875
|
+
}),
|
|
14876
|
+
z.object({ kind: z.literal("forbidden") })
|
|
14877
|
+
]);
|
|
14878
|
+
var KeychainResolveResultSchema = z.record(z.string(), KeychainResolveEntrySchema);
|
|
14879
|
+
/** Metadata of one stored value — never the value. */
|
|
14880
|
+
var KeychainSecretMetaSchema = z.object({
|
|
14881
|
+
ref: z.string(),
|
|
14882
|
+
owner: z.string(),
|
|
14883
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14884
|
+
scope: z.string(),
|
|
14885
|
+
fieldPath: z.string(),
|
|
14886
|
+
version: z.number().int(),
|
|
14887
|
+
createdAt: z.number(),
|
|
14888
|
+
updatedAt: z.number(),
|
|
14889
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14890
|
+
updatedBy: z.string(),
|
|
14891
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14892
|
+
lastReadAt: z.number().nullable()
|
|
14893
|
+
});
|
|
14894
|
+
var RefListSchema = z.array(z.string().min(1)).max(512);
|
|
14895
|
+
var keychainCapability = {
|
|
14896
|
+
name: "keychain",
|
|
14897
|
+
scope: "system",
|
|
14898
|
+
mode: "singleton",
|
|
14899
|
+
internal: true,
|
|
14900
|
+
methods: {
|
|
14901
|
+
/** Store (or replace) the caller's value at `ref`. Refused while locked. */
|
|
14902
|
+
put: method(z.object({
|
|
14903
|
+
ref: z.string().min(1),
|
|
14904
|
+
value: z.string().min(1)
|
|
14905
|
+
}), z.object({
|
|
14906
|
+
ref: z.string(),
|
|
14907
|
+
version: z.number().int()
|
|
14908
|
+
}), {
|
|
14909
|
+
kind: "mutation",
|
|
14910
|
+
auth: "admin"
|
|
14911
|
+
}),
|
|
14912
|
+
/**
|
|
14913
|
+
* Resolve the caller's refs in one round-trip. A locked keychain answers
|
|
14914
|
+
* `unavailable` per ref — never `missing`, never an empty value.
|
|
14915
|
+
*/
|
|
14916
|
+
resolve: method(z.object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }),
|
|
14917
|
+
/** Remove the caller's refs. Unknown refs are ignored. */
|
|
14918
|
+
delete: method(z.object({ refs: RefListSchema }), z.object({ deleted: z.number().int() }), {
|
|
14919
|
+
kind: "mutation",
|
|
14920
|
+
auth: "admin"
|
|
14921
|
+
}),
|
|
14922
|
+
/** The caller's own refs, metadata only. */
|
|
14923
|
+
listMeta: method(z.object({}), z.array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }),
|
|
14924
|
+
/** Whether values can be served — the save path refuses a write while locked. */
|
|
14925
|
+
getState: method(z.object({}), KeychainStateSchema, { auth: "admin" })
|
|
14926
|
+
}
|
|
14927
|
+
};
|
|
14928
|
+
/**
|
|
14929
|
+
* `keychain-admin` — the operator's view of the keychain (System → Secrets).
|
|
14930
|
+
*
|
|
14931
|
+
* Every method is `admin`. Two methods hand out material, each audited and
|
|
14932
|
+
* each named for exactly that: {@link keychainAdminCapability.methods.reveal}
|
|
14933
|
+
* (one value, shown briefly by the UI) and `downloadRecoveryKey` (the master
|
|
14934
|
+
* key itself, so the operator can keep a copy off the hub). Nothing else
|
|
14935
|
+
* returns a value.
|
|
14936
|
+
*
|
|
14937
|
+
* The master key's LOCATION is configuration, never an env var (D788):
|
|
14938
|
+
* `keychain.keyFile` in `config.yaml`, the OS keychain on a desktop hub, else
|
|
14939
|
+
* `<dataDir>/.keychain/master.key` — which sits beside the database in every
|
|
14940
|
+
* whole-volume backup, and the status says so.
|
|
14941
|
+
*/
|
|
14942
|
+
/** Where the master key in use came from. */
|
|
14943
|
+
var KeychainKeySourceKindSchema = z.enum([
|
|
14944
|
+
"config-file",
|
|
14945
|
+
"previous-config-file",
|
|
14946
|
+
"platform",
|
|
14947
|
+
"default-file"
|
|
14948
|
+
]);
|
|
14949
|
+
var KeychainKeySourceSchema = z.object({
|
|
14950
|
+
kind: KeychainKeySourceKindSchema,
|
|
14951
|
+
/** File sources only — a path is not a secret. */
|
|
14952
|
+
path: z.string().optional(),
|
|
14953
|
+
/**
|
|
14954
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14955
|
+
* next to the database it protects (the default file). The page warns.
|
|
14956
|
+
*/
|
|
14957
|
+
sharesBackupWithDatabase: z.boolean()
|
|
14958
|
+
});
|
|
14959
|
+
var KeychainStatusSchema = z.object({
|
|
14960
|
+
keychain: KeychainStateSchema,
|
|
14961
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14962
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14963
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14964
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14965
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14966
|
+
fingerprint: z.string().nullable(),
|
|
14967
|
+
activeKeyId: z.string().nullable(),
|
|
14968
|
+
/**
|
|
14969
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14970
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14971
|
+
*/
|
|
14972
|
+
rotationPending: z.boolean(),
|
|
14973
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14974
|
+
retiredWraps: z.number().int(),
|
|
14975
|
+
recoveryKeyDownloadedAt: z.number().nullable(),
|
|
14976
|
+
secretCount: z.number().int()
|
|
14977
|
+
});
|
|
14978
|
+
/**
|
|
14979
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14980
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14981
|
+
* never reported as an orphan (and never deleted as one).
|
|
14982
|
+
*/
|
|
14983
|
+
var KeychainSecretUsageSchema = z.enum([
|
|
14984
|
+
"in-use",
|
|
14985
|
+
"orphan",
|
|
14986
|
+
"unknown"
|
|
14987
|
+
]);
|
|
14988
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14989
|
+
var KeychainAuditActionSchema = z.enum([
|
|
14990
|
+
"put",
|
|
14991
|
+
"delete",
|
|
14992
|
+
"reveal",
|
|
14993
|
+
"rotate-master-key",
|
|
14994
|
+
"purge-retired-keys",
|
|
14995
|
+
"download-recovery-key",
|
|
14996
|
+
"delete-orphans",
|
|
14997
|
+
"reset",
|
|
14998
|
+
"initialize"
|
|
14999
|
+
]);
|
|
15000
|
+
var KeychainAuditEntrySchema = z.object({
|
|
15001
|
+
id: z.string(),
|
|
15002
|
+
at: z.number(),
|
|
15003
|
+
action: KeychainAuditActionSchema,
|
|
15004
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15005
|
+
actor: z.string(),
|
|
15006
|
+
ref: z.string().nullable(),
|
|
15007
|
+
detail: z.string().nullable()
|
|
15008
|
+
});
|
|
15009
|
+
var keychainAdminCapability = {
|
|
15010
|
+
name: "keychain-admin",
|
|
15011
|
+
scope: "system",
|
|
15012
|
+
mode: "singleton",
|
|
15013
|
+
methods: {
|
|
15014
|
+
status: method(z.object({}), KeychainStatusSchema, { auth: "admin" }),
|
|
15015
|
+
listSecrets: method(z.object({}), z.array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }),
|
|
15016
|
+
listAudit: method(z.object({ limit: z.number().int().min(1).max(500).optional() }), z.array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }),
|
|
15017
|
+
/**
|
|
15018
|
+
* Show one value to the operator. Audited. The UI hides it again after a
|
|
15019
|
+
* few seconds; nothing caches it.
|
|
15020
|
+
*/
|
|
15021
|
+
reveal: method(z.object({ ref: z.string().min(1) }), z.object({
|
|
15022
|
+
value: z.string(),
|
|
15023
|
+
version: z.number().int()
|
|
15024
|
+
}), {
|
|
15025
|
+
kind: "mutation",
|
|
15026
|
+
auth: "admin",
|
|
15027
|
+
caller: "required"
|
|
15028
|
+
}),
|
|
15029
|
+
/** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
|
|
15030
|
+
deleteOrphans: method(z.object({ refs: z.array(z.string().min(1)).max(1e3) }), z.object({
|
|
15031
|
+
deleted: z.array(z.string()).readonly(),
|
|
15032
|
+
kept: z.array(z.object({
|
|
15033
|
+
ref: z.string(),
|
|
15034
|
+
usage: KeychainSecretUsageSchema
|
|
15035
|
+
})).readonly()
|
|
15036
|
+
}), {
|
|
15037
|
+
kind: "mutation",
|
|
15038
|
+
auth: "admin",
|
|
15039
|
+
caller: "required"
|
|
15040
|
+
}),
|
|
15041
|
+
/**
|
|
15042
|
+
* Wrap the data key under the configured primary master key.
|
|
15043
|
+
*
|
|
15044
|
+
* Pending rotation (the keychain unlocked with a previous source): re-wrap
|
|
15045
|
+
* under the primary. Otherwise, with the default file as primary: generate
|
|
15046
|
+
* a new master key, write it there, re-wrap. A file or OS-keychain primary
|
|
15047
|
+
* that is already in use cannot be replaced from here — put the new key at
|
|
15048
|
+
* the source, keep the old one as `keychain.previousKeyFile`, restart, and
|
|
15049
|
+
* rotate. No value is re-encrypted either way; the previous wrap is kept
|
|
15050
|
+
* (retired) until purged.
|
|
15051
|
+
*/
|
|
15052
|
+
rotateMasterKey: method(z.object({}), z.object({
|
|
15053
|
+
fingerprint: z.string(),
|
|
15054
|
+
keySource: KeychainKeySourceSchema
|
|
15055
|
+
}), {
|
|
15056
|
+
kind: "mutation",
|
|
15057
|
+
auth: "admin",
|
|
15058
|
+
caller: "required"
|
|
15059
|
+
}),
|
|
15060
|
+
purgeRetiredKeys: method(z.object({}), z.object({ purged: z.number().int() }), {
|
|
15061
|
+
kind: "mutation",
|
|
15062
|
+
auth: "admin",
|
|
15063
|
+
caller: "required"
|
|
15064
|
+
}),
|
|
15065
|
+
/** The master key, base64. Audited; marks the recovery copy as taken. */
|
|
15066
|
+
downloadRecoveryKey: method(z.object({}), z.object({
|
|
15067
|
+
key: z.string(),
|
|
15068
|
+
fingerprint: z.string(),
|
|
15069
|
+
keySource: KeychainKeySourceSchema
|
|
15070
|
+
}), {
|
|
15071
|
+
kind: "mutation",
|
|
15072
|
+
auth: "admin",
|
|
15073
|
+
caller: "required"
|
|
15074
|
+
}),
|
|
15075
|
+
/**
|
|
15076
|
+
* Lost-key recovery: archive every stored value into a
|
|
15077
|
+
* `keychain:secrets-orphaned-<ts>` table and start over with a new data
|
|
15078
|
+
* key. Every secret field then reads "not set". Requires the typed
|
|
15079
|
+
* confirmation {@link KEYCHAIN_RESET_CONFIRMATION}.
|
|
15080
|
+
*/
|
|
15081
|
+
resetKeychain: method(z.object({ confirm: z.literal("RESET KEYCHAIN") }), z.object({
|
|
15082
|
+
archivedCollection: z.string().nullable(),
|
|
15083
|
+
archived: z.number().int()
|
|
15084
|
+
}), {
|
|
15085
|
+
kind: "mutation",
|
|
15086
|
+
auth: "admin",
|
|
15087
|
+
caller: "required"
|
|
15088
|
+
})
|
|
15089
|
+
}
|
|
15090
|
+
};
|
|
13965
15091
|
var decoderCapability = {
|
|
13966
15092
|
name: "decoder",
|
|
13967
15093
|
scope: "system",
|
|
@@ -15146,6 +16272,10 @@ var DeviceInfoSchema = z.object({
|
|
|
15146
16272
|
isCamera: z.boolean(),
|
|
15147
16273
|
/** Current config values — serializable snapshot */
|
|
15148
16274
|
config: z.record(z.string(), z.unknown()),
|
|
16275
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16276
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16277
|
+
* when the owning runner has not reported them. */
|
|
16278
|
+
secretConfigPaths: z.array(z.string()).optional(),
|
|
15149
16279
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15150
16280
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15151
16281
|
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
@@ -15366,12 +16496,22 @@ var DeviceRegisterPayloadSchema = z.object({
|
|
|
15366
16496
|
* call (workers re-register on init), so probe-driven updates
|
|
15367
16497
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15368
16498
|
features: z.array(z.string()).optional(),
|
|
15369
|
-
config: z.record(z.string(), z.unknown())
|
|
16499
|
+
config: z.record(z.string(), z.unknown()),
|
|
16500
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16501
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16502
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16503
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16504
|
+
* omits it and the keyword backstop applies. */
|
|
16505
|
+
secretConfigPaths: z.array(z.string()).optional()
|
|
15370
16506
|
});
|
|
15371
16507
|
var DeviceRemovePayloadSchema = z.object({ deviceId: z.number() });
|
|
15372
16508
|
var DevicePersistConfigPayloadSchema = z.object({
|
|
15373
16509
|
deviceId: z.number(),
|
|
15374
|
-
data: z.record(z.string(), z.unknown())
|
|
16510
|
+
data: z.record(z.string(), z.unknown()),
|
|
16511
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16512
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16513
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16514
|
+
secretConfigPaths: z.array(z.string()).optional()
|
|
15375
16515
|
});
|
|
15376
16516
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15377
16517
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -18285,7 +19425,14 @@ var RedirectLoginMethodSchema = z.object({
|
|
|
18285
19425
|
icon: z.string().optional(),
|
|
18286
19426
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
18287
19427
|
startUrl: z.string(),
|
|
18288
|
-
stage: LoginStageEnum
|
|
19428
|
+
stage: LoginStageEnum,
|
|
19429
|
+
/**
|
|
19430
|
+
* The provider names an external identity a signed-in user can link to
|
|
19431
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
19432
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
19433
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
19434
|
+
*/
|
|
19435
|
+
linkable: z.boolean().optional()
|
|
18289
19436
|
});
|
|
18290
19437
|
/**
|
|
18291
19438
|
* A Module-Federation widget the login page mounts for an in-page
|
|
@@ -24082,8 +25229,23 @@ var RetrainMacroClassSchema = z.enum([
|
|
|
24082
25229
|
]);
|
|
24083
25230
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
24084
25231
|
var RetrainAnnotationKindSchema = z.enum(["subject", "model_error"]);
|
|
24085
|
-
/**
|
|
24086
|
-
|
|
25232
|
+
/**
|
|
25233
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
25234
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
25235
|
+
*
|
|
25236
|
+
* - `operator` — drawn by hand.
|
|
25237
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
25238
|
+
* model, or a larger teacher model).
|
|
25239
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
25240
|
+
* back from the track store (never a re-run).
|
|
25241
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
25242
|
+
*/
|
|
25243
|
+
var RetrainAnnotationSourceSchema = z.enum([
|
|
25244
|
+
"operator",
|
|
25245
|
+
"assist",
|
|
25246
|
+
"pipeline",
|
|
25247
|
+
"llm"
|
|
25248
|
+
]);
|
|
24087
25249
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
24088
25250
|
var RetrainBboxSchema = z.object({
|
|
24089
25251
|
x: z.number(),
|
|
@@ -24101,7 +25263,8 @@ var RetrainBboxSchema = z.object({
|
|
|
24101
25263
|
*/
|
|
24102
25264
|
var RetrainAnnotationSchema = z.object({
|
|
24103
25265
|
id: z.string(),
|
|
24104
|
-
|
|
25266
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
25267
|
+
trackId: z.string().optional(),
|
|
24105
25268
|
deviceId: z.number(),
|
|
24106
25269
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
24107
25270
|
mediaKey: z.string(),
|
|
@@ -24150,18 +25313,63 @@ var RetrainFrameCandidateSchema = z.object({
|
|
|
24150
25313
|
* fail, whatever became of the original. */
|
|
24151
25314
|
copied: z.boolean()
|
|
24152
25315
|
});
|
|
25316
|
+
/**
|
|
25317
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
25318
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
25319
|
+
* box recorded on the source media row when there is one, else the track
|
|
25320
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
25321
|
+
* until the operator confirms it.
|
|
25322
|
+
*/
|
|
25323
|
+
var RetrainPipelineBoxSchema = z.object({
|
|
25324
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
25325
|
+
bbox: RetrainBboxSchema,
|
|
25326
|
+
macroClass: RetrainMacroClassSchema,
|
|
25327
|
+
label: z.string().optional(),
|
|
25328
|
+
subLabel: z.string().optional(),
|
|
25329
|
+
/** The detection score of the position used, when it was recorded. */
|
|
25330
|
+
score: z.number().optional(),
|
|
25331
|
+
/** The root model that produced the track, when it was recorded. */
|
|
25332
|
+
modelId: z.string().optional(),
|
|
25333
|
+
trackId: z.string(),
|
|
25334
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
25335
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
25336
|
+
basis: z.enum(["subject-box", "position"]),
|
|
25337
|
+
deltaMs: z.number()
|
|
25338
|
+
});
|
|
25339
|
+
/**
|
|
25340
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
25341
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
25342
|
+
* track at all.
|
|
25343
|
+
*/
|
|
25344
|
+
var RetrainFrameOriginSchema = z.enum(["track", "recording"]);
|
|
24153
25345
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
24154
25346
|
var RetrainFrameSchema = z.object({
|
|
24155
25347
|
frameId: z.string(),
|
|
24156
25348
|
deviceId: z.number(),
|
|
24157
|
-
|
|
24158
|
-
/**
|
|
24159
|
-
|
|
25349
|
+
origin: RetrainFrameOriginSchema,
|
|
25350
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
25351
|
+
trackId: z.string().optional(),
|
|
25352
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
25353
|
+
* Absent on a recording still. */
|
|
25354
|
+
sourceMediaId: z.number().int().optional(),
|
|
25355
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
25356
|
+
epochMs: z.number().optional(),
|
|
24160
25357
|
sourceKind: MediaFileKindEnum,
|
|
24161
25358
|
sizeBytes: z.number().int(),
|
|
24162
25359
|
width: z.number().int(),
|
|
24163
25360
|
height: z.number().int(),
|
|
24164
|
-
copiedAt: z.number()
|
|
25361
|
+
copiedAt: z.number(),
|
|
25362
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
25363
|
+
capturedAt: z.number().optional(),
|
|
25364
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
25365
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
25366
|
+
* a false positive. */
|
|
25367
|
+
complete: z.boolean(),
|
|
25368
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
25369
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
25370
|
+
pipelineBoxes: z.array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
25371
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
25372
|
+
collectionIds: z.array(z.string()).readonly().optional()
|
|
24165
25373
|
});
|
|
24166
25374
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
24167
25375
|
var RetrainCopyRefusalSchema = z.enum([
|
|
@@ -24182,6 +25390,53 @@ var RetrainFrameListSchema = z.object({
|
|
|
24182
25390
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
24183
25391
|
autoPickMediaId: z.number().int().optional()
|
|
24184
25392
|
});
|
|
25393
|
+
/**
|
|
25394
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
25395
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
25396
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
25397
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
25398
|
+
* export carried (`exportedInBatch`).
|
|
25399
|
+
*/
|
|
25400
|
+
var RetrainExportFilterSchema = z.object({
|
|
25401
|
+
deviceIds: z.array(z.number()).optional(),
|
|
25402
|
+
frameIds: z.array(z.string()).max(2e4).optional(),
|
|
25403
|
+
/** Only frames in at least one of these named collections. */
|
|
25404
|
+
collectionIds: z.array(z.string()).max(200).optional(),
|
|
25405
|
+
batchId: z.string().optional(),
|
|
25406
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
25407
|
+
completeOnly: z.boolean().optional()
|
|
25408
|
+
});
|
|
25409
|
+
/**
|
|
25410
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
25411
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
25412
|
+
* convention — the classifier layout.
|
|
25413
|
+
*/
|
|
25414
|
+
var RetrainExportLayoutSchema = z.enum(["frames", "crops"]);
|
|
25415
|
+
/**
|
|
25416
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
25417
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
25418
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
25419
|
+
* logged.
|
|
25420
|
+
*/
|
|
25421
|
+
var RetrainArchiveTargetSchema = z.object({
|
|
25422
|
+
kind: z.literal("http"),
|
|
25423
|
+
method: z.enum(["PUT", "POST"]),
|
|
25424
|
+
url: z.string().url(),
|
|
25425
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
25426
|
+
});
|
|
25427
|
+
var RetrainArchiveResultSchema = z.object({
|
|
25428
|
+
batchId: z.string(),
|
|
25429
|
+
frames: z.number().int(),
|
|
25430
|
+
crops: z.number().int(),
|
|
25431
|
+
annotations: z.number().int(),
|
|
25432
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
25433
|
+
missing: z.number().int(),
|
|
25434
|
+
bytes: z.number().int(),
|
|
25435
|
+
/** sha256 of the exact bytes sent. */
|
|
25436
|
+
sha256: z.string(),
|
|
25437
|
+
/** The target's HTTP status. */
|
|
25438
|
+
status: z.number().int()
|
|
25439
|
+
});
|
|
24185
25440
|
/** What the operator asked the assist to look for. */
|
|
24186
25441
|
var RetrainAssistSubjectSchema = z.discriminatedUnion("kind", [z.object({
|
|
24187
25442
|
kind: z.literal("package"),
|
|
@@ -24211,6 +25466,109 @@ var RetrainAssistResultSchema = z.discriminatedUnion("kind", [z.object({
|
|
|
24211
25466
|
reason: z.string(),
|
|
24212
25467
|
detail: z.string().optional()
|
|
24213
25468
|
})]);
|
|
25469
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
25470
|
+
var RetrainCollectionSchema = z.object({
|
|
25471
|
+
id: z.string(),
|
|
25472
|
+
name: z.string(),
|
|
25473
|
+
createdAt: z.number(),
|
|
25474
|
+
frameCount: z.number().int()
|
|
25475
|
+
});
|
|
25476
|
+
var RetrainCollectionCreateResultSchema = z.discriminatedUnion("kind", [z.object({
|
|
25477
|
+
kind: z.literal("created"),
|
|
25478
|
+
collection: RetrainCollectionSchema
|
|
25479
|
+
}), z.object({
|
|
25480
|
+
kind: z.literal("refused"),
|
|
25481
|
+
reason: z.enum(["empty-name", "duplicate-name"])
|
|
25482
|
+
})]);
|
|
25483
|
+
var RetrainCollectionRenameResultSchema = z.discriminatedUnion("kind", [z.object({
|
|
25484
|
+
kind: z.literal("renamed"),
|
|
25485
|
+
collection: RetrainCollectionSchema
|
|
25486
|
+
}), z.object({
|
|
25487
|
+
kind: z.literal("refused"),
|
|
25488
|
+
reason: z.enum([
|
|
25489
|
+
"empty-name",
|
|
25490
|
+
"duplicate-name",
|
|
25491
|
+
"unknown-collection"
|
|
25492
|
+
])
|
|
25493
|
+
})]);
|
|
25494
|
+
/**
|
|
25495
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
25496
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
25497
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
25498
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
25499
|
+
*/
|
|
25500
|
+
var AddRetrainFrameFromRecordingResultSchema = z.discriminatedUnion("kind", [z.object({
|
|
25501
|
+
kind: z.literal("added"),
|
|
25502
|
+
collectionId: z.string(),
|
|
25503
|
+
frame: RetrainFrameSchema,
|
|
25504
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
25505
|
+
reused: z.boolean()
|
|
25506
|
+
}), z.object({
|
|
25507
|
+
kind: z.literal("refused"),
|
|
25508
|
+
reason: z.enum([
|
|
25509
|
+
"unknown-collection",
|
|
25510
|
+
"still-unavailable",
|
|
25511
|
+
"still-busy",
|
|
25512
|
+
"unreadable-image",
|
|
25513
|
+
"write-failed"
|
|
25514
|
+
]),
|
|
25515
|
+
detail: z.string().optional()
|
|
25516
|
+
})]);
|
|
25517
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
25518
|
+
var RetrainAssistProfileSchema = z.object({
|
|
25519
|
+
id: z.string(),
|
|
25520
|
+
name: z.string(),
|
|
25521
|
+
model: z.string(),
|
|
25522
|
+
kind: z.string(),
|
|
25523
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
25524
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
25525
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
25526
|
+
leavesHouse: z.boolean()
|
|
25527
|
+
});
|
|
25528
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
25529
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: z.string() });
|
|
25530
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
25531
|
+
var RetrainLlmReviewSchema = z.object({
|
|
25532
|
+
/** The `ref` the page sent the box under. */
|
|
25533
|
+
ref: z.string(),
|
|
25534
|
+
verdict: z.enum([
|
|
25535
|
+
"confirmed",
|
|
25536
|
+
"wrong-class",
|
|
25537
|
+
"not-an-object",
|
|
25538
|
+
"uncertain"
|
|
25539
|
+
]),
|
|
25540
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
25541
|
+
reason: z.string()
|
|
25542
|
+
});
|
|
25543
|
+
/**
|
|
25544
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
25545
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
25546
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
25547
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
25548
|
+
*/
|
|
25549
|
+
var RetrainLlmAssistResultSchema = z.discriminatedUnion("kind", [z.object({
|
|
25550
|
+
kind: z.literal("proposed"),
|
|
25551
|
+
profileId: z.string(),
|
|
25552
|
+
model: z.string(),
|
|
25553
|
+
/** The frame was sent outside the house for this answer. */
|
|
25554
|
+
leftHouse: z.boolean(),
|
|
25555
|
+
proposals: z.array(RetrainLlmProposalSchema).readonly(),
|
|
25556
|
+
reviews: z.array(RetrainLlmReviewSchema).readonly(),
|
|
25557
|
+
rejected: z.number().int()
|
|
25558
|
+
}), z.object({
|
|
25559
|
+
kind: z.literal("refused"),
|
|
25560
|
+
reason: z.enum([
|
|
25561
|
+
"unknown-frame",
|
|
25562
|
+
"unreadable-frame",
|
|
25563
|
+
"unknown-profile",
|
|
25564
|
+
"profile-disabled",
|
|
25565
|
+
"no-vision",
|
|
25566
|
+
"cloud-not-confirmed",
|
|
25567
|
+
"llm-error",
|
|
25568
|
+
"malformed-answer"
|
|
25569
|
+
]),
|
|
25570
|
+
detail: z.string().optional()
|
|
25571
|
+
})]);
|
|
24214
25572
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
24215
25573
|
var RetrainTransitionResultSchema = z.object({
|
|
24216
25574
|
trackId: z.string(),
|
|
@@ -25397,7 +26755,7 @@ var pipelineAnalyticsCapability = {
|
|
|
25397
26755
|
* a frame leaves the dataset before export. */
|
|
25398
26756
|
deselectRetrainFrame: method(z.object({
|
|
25399
26757
|
deviceId: z.number(),
|
|
25400
|
-
trackId: z.string(),
|
|
26758
|
+
trackId: z.string().optional(),
|
|
25401
26759
|
frameId: z.string()
|
|
25402
26760
|
}), z.object({
|
|
25403
26761
|
removed: z.boolean(),
|
|
@@ -25440,7 +26798,8 @@ var pipelineAnalyticsCapability = {
|
|
|
25440
26798
|
*/
|
|
25441
26799
|
proposeRetrainAnnotations: method(z.object({
|
|
25442
26800
|
deviceId: z.number(),
|
|
25443
|
-
|
|
26801
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26802
|
+
trackId: z.string().optional(),
|
|
25444
26803
|
frameId: z.string(),
|
|
25445
26804
|
subject: RetrainAssistSubjectSchema,
|
|
25446
26805
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -25449,8 +26808,12 @@ var pipelineAnalyticsCapability = {
|
|
|
25449
26808
|
kind: "mutation",
|
|
25450
26809
|
auth: "admin"
|
|
25451
26810
|
}),
|
|
25452
|
-
/** Every annotation on a track,
|
|
25453
|
-
|
|
26811
|
+
/** Every annotation on a track, or on named frames (a recording still has
|
|
26812
|
+
* no track), oldest first. One of the two is required. */
|
|
26813
|
+
listRetrainAnnotations: method(z.object({
|
|
26814
|
+
trackId: z.string().optional(),
|
|
26815
|
+
frameIds: z.array(z.string()).max(2e3).optional()
|
|
26816
|
+
}), z.array(RetrainAnnotationSchema).readonly(), {
|
|
25454
26817
|
kind: "query",
|
|
25455
26818
|
auth: "admin"
|
|
25456
26819
|
}),
|
|
@@ -25469,7 +26832,8 @@ var pipelineAnalyticsCapability = {
|
|
|
25469
26832
|
*/
|
|
25470
26833
|
saveRetrainAnnotations: method(z.object({
|
|
25471
26834
|
deviceId: z.number(),
|
|
25472
|
-
|
|
26835
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
26836
|
+
trackId: z.string().optional(),
|
|
25473
26837
|
frameId: z.string(),
|
|
25474
26838
|
annotations: z.array(RetrainAnnotationDraftSchema)
|
|
25475
26839
|
}), z.array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -25521,7 +26885,146 @@ var pipelineAnalyticsCapability = {
|
|
|
25521
26885
|
* out, so two crops of the same subject can never end up in one feature
|
|
25522
26886
|
* space (D52).
|
|
25523
26887
|
*/
|
|
25524
|
-
getRetrainExportUrl: method(
|
|
26888
|
+
getRetrainExportUrl: method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), z.object({ url: z.string() }), {
|
|
26889
|
+
kind: "query",
|
|
26890
|
+
auth: "admin"
|
|
26891
|
+
}),
|
|
26892
|
+
/**
|
|
26893
|
+
* The operator's "every subject in this frame is boxed" — set and cleared
|
|
26894
|
+
* by hand, never derived: a frame with no box may be a complete hard
|
|
26895
|
+
* negative, and a frame with three boxes may still miss a fourth person.
|
|
26896
|
+
*/
|
|
26897
|
+
setRetrainFrameComplete: method(z.object({
|
|
26898
|
+
deviceId: z.number(),
|
|
26899
|
+
trackId: z.string().optional(),
|
|
26900
|
+
frameId: z.string(),
|
|
26901
|
+
complete: z.boolean()
|
|
26902
|
+
}), RetrainFrameSchema, {
|
|
26903
|
+
kind: "mutation",
|
|
26904
|
+
auth: "admin"
|
|
26905
|
+
}),
|
|
26906
|
+
/**
|
|
26907
|
+
* Stream the annotated archive to a TARGET instead of a browser — the
|
|
26908
|
+
* same tar `getRetrainExportUrl` serves (manifest first, one JPEG in
|
|
26909
|
+
* memory at a time, paced), written chunk by chunk into one HTTP request.
|
|
26910
|
+
* The bytes never cross this cap and never land on the hub's disk; the
|
|
26911
|
+
* answer is what was sent, with its sha256.
|
|
26912
|
+
*/
|
|
26913
|
+
writeRetrainArchive: method(z.object({
|
|
26914
|
+
filter: RetrainExportFilterSchema,
|
|
26915
|
+
layout: RetrainExportLayoutSchema,
|
|
26916
|
+
target: RetrainArchiveTargetSchema
|
|
26917
|
+
}), RetrainArchiveResultSchema, {
|
|
26918
|
+
kind: "mutation",
|
|
26919
|
+
auth: "admin",
|
|
26920
|
+
timeoutMs: 60 * 6e4
|
|
26921
|
+
}),
|
|
26922
|
+
/** The enabled, vision-capable LLM profiles, each saying whether a frame
|
|
26923
|
+
* sent to it leaves the house. */
|
|
26924
|
+
listRetrainAssistProfiles: method(z.object({}), z.array(RetrainAssistProfileSchema).readonly(), {
|
|
26925
|
+
kind: "query",
|
|
26926
|
+
auth: "admin"
|
|
26927
|
+
}),
|
|
26928
|
+
/**
|
|
26929
|
+
* Ask a vision LLM (the `llm` capability) about ONE copied frame: list the
|
|
26930
|
+
* objects of `classes` with boxes, and review the boxes already on the
|
|
26931
|
+
* canvas (sent by `ref`). Answers drafts (`source: 'llm'`) and reviews —
|
|
26932
|
+
* nothing is stored, nothing is accepted. A profile that sends the frame
|
|
26933
|
+
* outside the house is refused unless `allowCloud` says the operator
|
|
26934
|
+
* confirmed this run.
|
|
26935
|
+
*/
|
|
26936
|
+
proposeRetrainAnnotationsWithLlm: method(z.object({
|
|
26937
|
+
deviceId: z.number(),
|
|
26938
|
+
trackId: z.string().optional(),
|
|
26939
|
+
frameId: z.string(),
|
|
26940
|
+
profileId: z.string(),
|
|
26941
|
+
classes: z.array(RetrainMacroClassSchema).min(1),
|
|
26942
|
+
boxes: z.array(z.object({
|
|
26943
|
+
ref: z.string(),
|
|
26944
|
+
bbox: RetrainBboxSchema,
|
|
26945
|
+
macroClass: RetrainMacroClassSchema,
|
|
26946
|
+
label: z.string().optional()
|
|
26947
|
+
})).max(50),
|
|
26948
|
+
allowCloud: z.boolean()
|
|
26949
|
+
}), RetrainLlmAssistResultSchema, {
|
|
26950
|
+
kind: "mutation",
|
|
26951
|
+
auth: "admin",
|
|
26952
|
+
timeoutMs: 18e4
|
|
26953
|
+
}),
|
|
26954
|
+
/**
|
|
26955
|
+
* Create a named collection — a set over the retrain corpus ("packages
|
|
26956
|
+
* porch night"). Names are unique case-insensitively and never empty;
|
|
26957
|
+
* both refusals are named.
|
|
26958
|
+
*/
|
|
26959
|
+
createRetrainCollection: method(z.object({ name: z.string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
26960
|
+
kind: "mutation",
|
|
26961
|
+
auth: "admin"
|
|
26962
|
+
}),
|
|
26963
|
+
/** Every collection, newest first, with its frame count. */
|
|
26964
|
+
listRetrainCollections: method(z.object({}), z.array(RetrainCollectionSchema).readonly(), {
|
|
26965
|
+
kind: "query",
|
|
26966
|
+
auth: "admin"
|
|
26967
|
+
}),
|
|
26968
|
+
renameRetrainCollection: method(z.object({
|
|
26969
|
+
id: z.string(),
|
|
26970
|
+
name: z.string().max(120)
|
|
26971
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
26972
|
+
kind: "mutation",
|
|
26973
|
+
auth: "admin"
|
|
26974
|
+
}),
|
|
26975
|
+
/**
|
|
26976
|
+
* Delete a collection. Its recording stills that no other collection
|
|
26977
|
+
* holds are deleted with their annotations (nothing else reaches them);
|
|
26978
|
+
* frames copied from tracks always stay in the dataset.
|
|
26979
|
+
*/
|
|
26980
|
+
deleteRetrainCollection: method(z.object({ id: z.string() }), z.object({
|
|
26981
|
+
deleted: z.boolean(),
|
|
26982
|
+
removedFrames: z.number().int()
|
|
26983
|
+
}), {
|
|
26984
|
+
kind: "mutation",
|
|
26985
|
+
auth: "admin"
|
|
26986
|
+
}),
|
|
26987
|
+
/**
|
|
26988
|
+
* Add the frame at a recording instant to a collection — the frame the
|
|
26989
|
+
* model may have seen NOTHING in. The recorder re-decodes the native
|
|
26990
|
+
* frame at `epochMs`; the dataset copies it (trackless, durable). The same
|
|
26991
|
+
* moment twice is one copy. Every refusal is named.
|
|
26992
|
+
*/
|
|
26993
|
+
addRetrainFrameFromRecording: method(z.object({
|
|
26994
|
+
collectionId: z.string(),
|
|
26995
|
+
deviceId: z.number(),
|
|
26996
|
+
epochMs: z.number()
|
|
26997
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
26998
|
+
kind: "mutation",
|
|
26999
|
+
auth: "admin",
|
|
27000
|
+
timeoutMs: 6e4
|
|
27001
|
+
}),
|
|
27002
|
+
/** Add frames already in the dataset to a collection. */
|
|
27003
|
+
addRetrainFramesToCollection: method(z.object({
|
|
27004
|
+
collectionId: z.string(),
|
|
27005
|
+
frameIds: z.array(z.string()).min(1).max(500)
|
|
27006
|
+
}), z.object({
|
|
27007
|
+
added: z.number().int(),
|
|
27008
|
+
alreadyMember: z.number().int(),
|
|
27009
|
+
unknownFrameIds: z.array(z.string()).readonly()
|
|
27010
|
+
}), {
|
|
27011
|
+
kind: "mutation",
|
|
27012
|
+
auth: "admin"
|
|
27013
|
+
}),
|
|
27014
|
+
/** Remove a frame from a collection. A recording still left in no
|
|
27015
|
+
* collection is deleted with its annotations (`deletedFrame`). */
|
|
27016
|
+
removeRetrainFrameFromCollection: method(z.object({
|
|
27017
|
+
collectionId: z.string(),
|
|
27018
|
+
frameId: z.string()
|
|
27019
|
+
}), z.object({
|
|
27020
|
+
removed: z.boolean(),
|
|
27021
|
+
deletedFrame: z.boolean()
|
|
27022
|
+
}), {
|
|
27023
|
+
kind: "mutation",
|
|
27024
|
+
auth: "admin"
|
|
27025
|
+
}),
|
|
27026
|
+
/** The frames of a collection, with their pipeline boxes. */
|
|
27027
|
+
listRetrainCollectionFrames: method(z.object({ collectionId: z.string() }), z.array(RetrainFrameSchema).readonly(), {
|
|
25525
27028
|
kind: "query",
|
|
25526
27029
|
auth: "admin"
|
|
25527
27030
|
}),
|
|
@@ -26465,13 +27968,31 @@ var RecommendationReasonSchema = z.discriminatedUnion("kind", [
|
|
|
26465
27968
|
z.object({
|
|
26466
27969
|
kind: z.literal("no-family-build"),
|
|
26467
27970
|
format: ModelFormatSchema$1
|
|
27971
|
+
}),
|
|
27972
|
+
z.object({
|
|
27973
|
+
kind: z.literal("kept-custom-pin"),
|
|
27974
|
+
modelId: z.string(),
|
|
27975
|
+
deviceKey: z.string()
|
|
26468
27976
|
})
|
|
26469
27977
|
]);
|
|
27978
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
27979
|
+
var KeptReasonSchema = z.enum(["custom-pin"]);
|
|
27980
|
+
/**
|
|
27981
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
27982
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
27983
|
+
*/
|
|
27984
|
+
var LatencySourceSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("table") }), z.object({
|
|
27985
|
+
kind: z.literal("node-benchmark"),
|
|
27986
|
+
resultId: z.string(),
|
|
27987
|
+
measuredAtMs: z.number()
|
|
27988
|
+
})]);
|
|
26470
27989
|
var DeviceModelChoiceSchema = z.object({
|
|
26471
27990
|
modelId: z.string(),
|
|
26472
27991
|
p50Ms: z.number(),
|
|
26473
27992
|
fps: z.number(),
|
|
26474
27993
|
measured: z.boolean(),
|
|
27994
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
27995
|
+
source: LatencySourceSchema.optional(),
|
|
26475
27996
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
26476
27997
|
capacitySessions: z.number(),
|
|
26477
27998
|
personRecall: z.number()
|
|
@@ -26482,6 +28003,8 @@ var DeviceRecommendationSchema = z.object({
|
|
|
26482
28003
|
enabled: z.boolean(),
|
|
26483
28004
|
available: z.boolean(),
|
|
26484
28005
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
28006
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
28007
|
+
kept: KeptReasonSchema.optional(),
|
|
26485
28008
|
reasons: z.array(RecommendationReasonSchema).readonly()
|
|
26486
28009
|
});
|
|
26487
28010
|
var NodeRecommendationSchema = z.object({
|
|
@@ -26535,6 +28058,17 @@ var AutoTuneWarningSchema = z.discriminatedUnion("kind", [
|
|
|
26535
28058
|
kind: z.literal("coral-enabled"),
|
|
26536
28059
|
nodeId: z.string(),
|
|
26537
28060
|
deviceKey: z.string()
|
|
28061
|
+
}),
|
|
28062
|
+
z.object({
|
|
28063
|
+
kind: z.literal("custom-pin-kept"),
|
|
28064
|
+
nodeId: z.string(),
|
|
28065
|
+
deviceKey: z.string().nullable(),
|
|
28066
|
+
deviceId: z.number().nullable(),
|
|
28067
|
+
modelId: z.string()
|
|
28068
|
+
}),
|
|
28069
|
+
z.object({
|
|
28070
|
+
kind: z.literal("custom-registry-unreadable"),
|
|
28071
|
+
error: z.string()
|
|
26538
28072
|
})
|
|
26539
28073
|
]);
|
|
26540
28074
|
var AutoTuneOptionsSchema = z.object({
|
|
@@ -26713,13 +28247,14 @@ var SuggestSharesResultSchema = z.object({
|
|
|
26713
28247
|
nodes: z.array(SuggestedNodeShareSchema).readonly()
|
|
26714
28248
|
});
|
|
26715
28249
|
/**
|
|
26716
|
-
* Where the node and device shares come from (D750, D755).
|
|
26717
|
-
* - `
|
|
26718
|
-
*
|
|
26719
|
-
*
|
|
26720
|
-
*
|
|
26721
|
-
*
|
|
26722
|
-
*
|
|
28250
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
28251
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
28252
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
28253
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
28254
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
28255
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
28256
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
28257
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
26723
28258
|
* - `manual` — the operator's stored sliders.
|
|
26724
28259
|
* Either way a node or device that cannot take sessions gives its share to
|
|
26725
28260
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -26768,6 +28303,368 @@ var EffectiveSharesSchema = z.object({
|
|
|
26768
28303
|
nodeWeights: z.record(z.string(), z.number()),
|
|
26769
28304
|
deviceWeights: z.record(z.string(), z.record(z.string(), z.number()))
|
|
26770
28305
|
});
|
|
28306
|
+
/**
|
|
28307
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
28308
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
28309
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
28310
|
+
* shares read.
|
|
28311
|
+
*
|
|
28312
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
28313
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
28314
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
28315
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
28316
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
28317
|
+
*
|
|
28318
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
28319
|
+
* cross a process at frame rate, D9):
|
|
28320
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
28321
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
28322
|
+
* interval;
|
|
28323
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
28324
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
28325
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
28326
|
+
* CPU, RAM or the event loop give out.
|
|
28327
|
+
*/
|
|
28328
|
+
/** Defaults and bounds, one place. */
|
|
28329
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
28330
|
+
fpsPerStream: 10,
|
|
28331
|
+
budgetMinutes: 45,
|
|
28332
|
+
minBudgetMinutes: 10,
|
|
28333
|
+
maxBudgetMinutes: 120,
|
|
28334
|
+
/** A result older than this no longer beats the table. */
|
|
28335
|
+
staleAfterDays: 30,
|
|
28336
|
+
/** Warm-in per ramp step (not accounted). */
|
|
28337
|
+
settleSec: 5,
|
|
28338
|
+
/** Accounted window per ramp step. */
|
|
28339
|
+
measureSec: 20,
|
|
28340
|
+
/** Longest the drain may take before the run is refused. */
|
|
28341
|
+
drainTimeoutSec: 120,
|
|
28342
|
+
/** Candidate models per device in one run. */
|
|
28343
|
+
maxModelsPerDevice: 6
|
|
28344
|
+
};
|
|
28345
|
+
/** The two measurements a run can make. */
|
|
28346
|
+
var NodeBenchmarkPhaseSchema = z.enum(["device", "pipeline"]);
|
|
28347
|
+
var NodeBenchmarkDevicePlanSchema = z.object({
|
|
28348
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
28349
|
+
deviceKey: z.string().min(1),
|
|
28350
|
+
/**
|
|
28351
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
28352
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
28353
|
+
*/
|
|
28354
|
+
modelIds: z.array(z.string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
28355
|
+
});
|
|
28356
|
+
/** What the operator confirmed. */
|
|
28357
|
+
var NodeBenchmarkPlanSchema = z.object({
|
|
28358
|
+
nodeId: z.string().min(1),
|
|
28359
|
+
devices: z.array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
28360
|
+
/** Which measurements run. At least one. */
|
|
28361
|
+
phases: z.array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
28362
|
+
/**
|
|
28363
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
28364
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
28365
|
+
* detector always runs.
|
|
28366
|
+
*/
|
|
28367
|
+
steps: z.array(z.string().min(1)).default([]),
|
|
28368
|
+
/** Offered rate of one stream / session. */
|
|
28369
|
+
fpsPerStream: z.number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
28370
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
28371
|
+
budgetMinutes: z.number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
28372
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
28373
|
+
keepDownloadedModels: z.boolean().default(false),
|
|
28374
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
28375
|
+
acceptInsufficientHeadroom: z.boolean().default(false)
|
|
28376
|
+
});
|
|
28377
|
+
/** Why a run cannot start. `overridable` ones are lifted by a plan flag. */
|
|
28378
|
+
var NodeBenchmarkRefusalKindSchema = z.enum([
|
|
28379
|
+
"benchmark-active",
|
|
28380
|
+
"node-offline",
|
|
28381
|
+
"unknown-device",
|
|
28382
|
+
"no-phase",
|
|
28383
|
+
"insufficient-headroom"
|
|
28384
|
+
]);
|
|
28385
|
+
var NodeBenchmarkRefusalSchema = z.object({
|
|
28386
|
+
kind: NodeBenchmarkRefusalKindSchema,
|
|
28387
|
+
detail: z.string(),
|
|
28388
|
+
overridable: z.boolean()
|
|
28389
|
+
});
|
|
28390
|
+
/** A camera whose detection leaves the node for the run. */
|
|
28391
|
+
var NodeBenchmarkMovingCameraSchema = z.object({
|
|
28392
|
+
deviceId: z.number(),
|
|
28393
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
28394
|
+
placedOnNode: z.boolean(),
|
|
28395
|
+
/** A node pin naming this node, ignored for the run. */
|
|
28396
|
+
pinnedToNode: z.boolean()
|
|
28397
|
+
});
|
|
28398
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
28399
|
+
var NodeBenchmarkStayingCameraSchema = z.object({
|
|
28400
|
+
deviceId: z.number(),
|
|
28401
|
+
reason: z.literal("only-frame-source")
|
|
28402
|
+
});
|
|
28403
|
+
var NodeBenchmarkPreflightSchema = z.object({
|
|
28404
|
+
nodeId: z.string(),
|
|
28405
|
+
online: z.boolean(),
|
|
28406
|
+
moving: z.array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
28407
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
28408
|
+
staying: z.array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
28409
|
+
estimatedDurationMs: z.number(),
|
|
28410
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
28411
|
+
budgetMs: z.number(),
|
|
28412
|
+
phases: z.array(NodeBenchmarkPhaseSchema).readonly(),
|
|
28413
|
+
steps: z.array(z.string()).readonly(),
|
|
28414
|
+
devices: z.array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
28415
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
28416
|
+
headroom: z.object({
|
|
28417
|
+
sessionsNow: z.number(),
|
|
28418
|
+
otherNodesCapacitySessions: z.number().nullable()
|
|
28419
|
+
}),
|
|
28420
|
+
refusals: z.array(NodeBenchmarkRefusalSchema).readonly(),
|
|
28421
|
+
canStart: z.boolean()
|
|
28422
|
+
});
|
|
28423
|
+
/** Where the measuring runner is. */
|
|
28424
|
+
var NodeBenchProgressSchema = z.object({
|
|
28425
|
+
phase: z.enum([
|
|
28426
|
+
"preparing",
|
|
28427
|
+
"device",
|
|
28428
|
+
"pipeline",
|
|
28429
|
+
"cleanup"
|
|
28430
|
+
]),
|
|
28431
|
+
deviceKey: z.string().nullable(),
|
|
28432
|
+
modelId: z.string().nullable(),
|
|
28433
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
28434
|
+
load: z.number().nullable(),
|
|
28435
|
+
cellsDone: z.number(),
|
|
28436
|
+
cellsTotal: z.number(),
|
|
28437
|
+
message: z.string()
|
|
28438
|
+
});
|
|
28439
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
28440
|
+
var NodeBenchLimitSchema = z.enum([
|
|
28441
|
+
"p95",
|
|
28442
|
+
"drops",
|
|
28443
|
+
"errors",
|
|
28444
|
+
"stall",
|
|
28445
|
+
"cpu",
|
|
28446
|
+
"ram",
|
|
28447
|
+
"none"
|
|
28448
|
+
]);
|
|
28449
|
+
var NodeBenchRampStepSchema = z.object({
|
|
28450
|
+
load: z.number(),
|
|
28451
|
+
pass: z.boolean(),
|
|
28452
|
+
p95Ms: z.number(),
|
|
28453
|
+
dropRatio: z.number(),
|
|
28454
|
+
/** Completed frames per second over the accounted window. */
|
|
28455
|
+
fps: z.number(),
|
|
28456
|
+
cpuPct: z.number().nullable(),
|
|
28457
|
+
ramFreePct: z.number().nullable(),
|
|
28458
|
+
failReasons: z.array(z.string()).readonly()
|
|
28459
|
+
});
|
|
28460
|
+
/** One measured device × detector (the `device` measurement). */
|
|
28461
|
+
var NodeBenchDeviceCellSchema = z.object({
|
|
28462
|
+
phase: z.literal("device"),
|
|
28463
|
+
deviceKey: z.string(),
|
|
28464
|
+
modelId: z.string(),
|
|
28465
|
+
/** Single-stream latency (the K = 1 step). */
|
|
28466
|
+
p50Ms: z.number(),
|
|
28467
|
+
p95Ms: z.number(),
|
|
28468
|
+
p99Ms: z.number(),
|
|
28469
|
+
/** Frames per second sustained at the last passing step. */
|
|
28470
|
+
fps: z.number(),
|
|
28471
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
28472
|
+
kMax: z.number(),
|
|
28473
|
+
limitedBy: NodeBenchLimitSchema,
|
|
28474
|
+
/** First call (model load + warm-up). */
|
|
28475
|
+
warmupMs: z.number(),
|
|
28476
|
+
ramp: z.array(NodeBenchRampStepSchema).readonly()
|
|
28477
|
+
});
|
|
28478
|
+
/** One measured pipeline (the `pipeline` measurement) on a device. */
|
|
28479
|
+
var NodeBenchPipelineCellSchema = z.object({
|
|
28480
|
+
phase: z.literal("pipeline"),
|
|
28481
|
+
deviceKey: z.string(),
|
|
28482
|
+
modelId: z.string(),
|
|
28483
|
+
steps: z.array(z.string()).readonly(),
|
|
28484
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
28485
|
+
maxSessions: z.number(),
|
|
28486
|
+
limitedBy: NodeBenchLimitSchema,
|
|
28487
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
28488
|
+
stepsFired: z.array(z.string()).readonly(),
|
|
28489
|
+
warmupMs: z.number(),
|
|
28490
|
+
ramp: z.array(NodeBenchRampStepSchema).readonly()
|
|
28491
|
+
});
|
|
28492
|
+
var NodeBenchCellSchema = z.discriminatedUnion("phase", [NodeBenchDeviceCellSchema, NodeBenchPipelineCellSchema]);
|
|
28493
|
+
/**
|
|
28494
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
28495
|
+
* the node no longer beats the table.
|
|
28496
|
+
*/
|
|
28497
|
+
var NodeBenchFingerprintSchema = z.object({
|
|
28498
|
+
pipelineVersion: z.string().nullable(),
|
|
28499
|
+
cpuModel: z.string().nullable(),
|
|
28500
|
+
ramGb: z.number().nullable(),
|
|
28501
|
+
os: z.string().nullable(),
|
|
28502
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
28503
|
+
pools: z.record(z.string(), z.object({
|
|
28504
|
+
runtime: z.string(),
|
|
28505
|
+
numWorkers: z.number(),
|
|
28506
|
+
concurrency: z.number(),
|
|
28507
|
+
batchMode: z.string()
|
|
28508
|
+
})).default({})
|
|
28509
|
+
});
|
|
28510
|
+
/** The frames the run used. */
|
|
28511
|
+
var NodeBenchClipSchema = z.object({
|
|
28512
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
28513
|
+
id: z.string(),
|
|
28514
|
+
revision: z.string().nullable(),
|
|
28515
|
+
frames: z.number(),
|
|
28516
|
+
width: z.number(),
|
|
28517
|
+
height: z.number()
|
|
28518
|
+
});
|
|
28519
|
+
var NodeBenchRunnerInputSchema = z.object({
|
|
28520
|
+
runId: z.string().min(1),
|
|
28521
|
+
devices: z.array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
28522
|
+
phases: z.array(NodeBenchmarkPhaseSchema).min(1),
|
|
28523
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
28524
|
+
steps: z.array(z.string()).default([]),
|
|
28525
|
+
fpsPerStream: z.number().int().min(1).max(30),
|
|
28526
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
28527
|
+
deadlineAtMs: z.number(),
|
|
28528
|
+
settleSec: z.number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
28529
|
+
measureSec: z.number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
28530
|
+
keepDownloadedModels: z.boolean().default(false)
|
|
28531
|
+
});
|
|
28532
|
+
var NodeBenchRunnerStateSchema = z.enum([
|
|
28533
|
+
"running",
|
|
28534
|
+
"done",
|
|
28535
|
+
"failed",
|
|
28536
|
+
"aborted"
|
|
28537
|
+
]);
|
|
28538
|
+
var NodeBenchRunnerStatusSchema = z.object({
|
|
28539
|
+
runId: z.string(),
|
|
28540
|
+
nodeId: z.string(),
|
|
28541
|
+
state: NodeBenchRunnerStateSchema,
|
|
28542
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
28543
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
28544
|
+
cells: z.array(NodeBenchCellSchema).readonly(),
|
|
28545
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
28546
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
28547
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
28548
|
+
activeCameraIds: z.array(z.number()).readonly(),
|
|
28549
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
28550
|
+
deletedModels: z.array(z.string()).readonly(),
|
|
28551
|
+
error: z.string().nullable(),
|
|
28552
|
+
startedAtMs: z.number(),
|
|
28553
|
+
finishedAtMs: z.number().nullable()
|
|
28554
|
+
});
|
|
28555
|
+
var NodeBenchmarkStateSchema = z.enum([
|
|
28556
|
+
"draining",
|
|
28557
|
+
"measuring",
|
|
28558
|
+
"restoring",
|
|
28559
|
+
"done",
|
|
28560
|
+
"failed",
|
|
28561
|
+
"aborted"
|
|
28562
|
+
]);
|
|
28563
|
+
/** Why a run ended. */
|
|
28564
|
+
var NodeBenchmarkEndReasonSchema = z.enum([
|
|
28565
|
+
"completed",
|
|
28566
|
+
"operator-abort",
|
|
28567
|
+
"deadline",
|
|
28568
|
+
"node-lost",
|
|
28569
|
+
"runner-lost",
|
|
28570
|
+
"hub-restart",
|
|
28571
|
+
"drain-timeout",
|
|
28572
|
+
"failed"
|
|
28573
|
+
]);
|
|
28574
|
+
var NodeBenchmarkRunSchema = z.object({
|
|
28575
|
+
runId: z.string(),
|
|
28576
|
+
nodeId: z.string(),
|
|
28577
|
+
state: NodeBenchmarkStateSchema,
|
|
28578
|
+
plan: NodeBenchmarkPlanSchema,
|
|
28579
|
+
startedAtMs: z.number(),
|
|
28580
|
+
deadlineAtMs: z.number(),
|
|
28581
|
+
finishedAtMs: z.number().nullable(),
|
|
28582
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
28583
|
+
error: z.string().nullable(),
|
|
28584
|
+
/** Cameras moved off the node for the run. */
|
|
28585
|
+
moved: z.array(z.number()).readonly(),
|
|
28586
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
28587
|
+
staying: z.array(z.number()).readonly(),
|
|
28588
|
+
/** Something else ran on the node's pools during the run. */
|
|
28589
|
+
contaminated: z.boolean(),
|
|
28590
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
28591
|
+
resultIds: z.array(z.string()).readonly()
|
|
28592
|
+
});
|
|
28593
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
28594
|
+
var NodeBenchmarkStatusSchema = z.object({
|
|
28595
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
28596
|
+
modeNodeId: z.string().nullable(),
|
|
28597
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
28598
|
+
});
|
|
28599
|
+
/**
|
|
28600
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
28601
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
28602
|
+
* ends, never by anyone else.
|
|
28603
|
+
*/
|
|
28604
|
+
var NodeBenchmarkResultSchema = z.object({
|
|
28605
|
+
id: z.string(),
|
|
28606
|
+
runId: z.string(),
|
|
28607
|
+
nodeId: z.string(),
|
|
28608
|
+
cell: NodeBenchCellSchema,
|
|
28609
|
+
fpsPerStream: z.number(),
|
|
28610
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
28611
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
28612
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
28613
|
+
contaminated: z.boolean(),
|
|
28614
|
+
stayingCameras: z.array(z.number()).readonly(),
|
|
28615
|
+
/** The run ended early; the cell itself completed. */
|
|
28616
|
+
partialRun: z.boolean(),
|
|
28617
|
+
measuredAtMs: z.number()
|
|
28618
|
+
});
|
|
28619
|
+
var ListNodeBenchmarkResultsInputSchema = z.object({
|
|
28620
|
+
nodeId: z.string().optional(),
|
|
28621
|
+
deviceKey: z.string().optional()
|
|
28622
|
+
});
|
|
28623
|
+
/** A result with its standing today: does it still beat the table? */
|
|
28624
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
28625
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
28626
|
+
standing: z.enum([
|
|
28627
|
+
"fresh",
|
|
28628
|
+
"stale",
|
|
28629
|
+
"superseded"
|
|
28630
|
+
]),
|
|
28631
|
+
staleWhy: z.enum([
|
|
28632
|
+
"age",
|
|
28633
|
+
"runtime",
|
|
28634
|
+
"pool-tuning"
|
|
28635
|
+
]).nullable()
|
|
28636
|
+
});
|
|
28637
|
+
z.object({
|
|
28638
|
+
runId: z.string(),
|
|
28639
|
+
nodeId: z.string(),
|
|
28640
|
+
startedAtMs: z.number(),
|
|
28641
|
+
deadlineAtMs: z.number(),
|
|
28642
|
+
plan: NodeBenchmarkPlanSchema,
|
|
28643
|
+
moved: z.array(z.number()).readonly(),
|
|
28644
|
+
staying: z.array(z.number()).readonly()
|
|
28645
|
+
});
|
|
28646
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
28647
|
+
var NodeBenchmarkCandidatesSchema = z.object({
|
|
28648
|
+
nodeId: z.string(),
|
|
28649
|
+
reachable: z.boolean(),
|
|
28650
|
+
devices: z.array(z.object({
|
|
28651
|
+
deviceKey: z.string(),
|
|
28652
|
+
enabled: z.boolean(),
|
|
28653
|
+
available: z.boolean(),
|
|
28654
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
28655
|
+
suggested: z.array(z.string()).readonly(),
|
|
28656
|
+
/** Every root detector the device has a build for. */
|
|
28657
|
+
all: z.array(z.string()).readonly(),
|
|
28658
|
+
/** The model the device runs now, when pinned. */
|
|
28659
|
+
currentModelId: z.string().nullable()
|
|
28660
|
+
})).readonly(),
|
|
28661
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
28662
|
+
steps: z.array(z.object({
|
|
28663
|
+
id: z.string(),
|
|
28664
|
+
name: z.string(),
|
|
28665
|
+
slot: z.string()
|
|
28666
|
+
})).readonly()
|
|
28667
|
+
});
|
|
26771
28668
|
z.object({
|
|
26772
28669
|
activeCameras: z.number(),
|
|
26773
28670
|
throttledCameras: z.number(),
|
|
@@ -28086,7 +29983,30 @@ var pipelineRunnerCapability = {
|
|
|
28086
29983
|
releaseParkedTrackFrames: method(z.object({
|
|
28087
29984
|
deviceId: z.number(),
|
|
28088
29985
|
trackId: z.string()
|
|
28089
|
-
}), z.object({ released: z.number().int().nonnegative() }), { kind: "mutation" })
|
|
29986
|
+
}), z.object({ released: z.number().int().nonnegative() }), { kind: "mutation" }),
|
|
29987
|
+
/**
|
|
29988
|
+
* Start measuring THIS node for the orchestrator's node benchmark: the
|
|
29989
|
+
* bench clip decoded once into RAM, each device × candidate detector on an
|
|
29990
|
+
* open-loop ramp (`device`), then the chosen pipeline with the requested
|
|
29991
|
+
* detail steps (`pipeline`). Everything runs in-process with the executor
|
|
29992
|
+
* — no frame crosses a node (D9) — and writes nothing: no track, event,
|
|
29993
|
+
* media or notification. Reached by `nodePin(nodeId)`. Answers at once;
|
|
29994
|
+
* one run per node; the run stops itself at `deadlineAtMs`.
|
|
29995
|
+
*/
|
|
29996
|
+
startNodeBench: method(NodeBenchRunnerInputSchema, z.object({
|
|
29997
|
+
accepted: z.literal(true),
|
|
29998
|
+
runId: z.string()
|
|
29999
|
+
}), {
|
|
30000
|
+
kind: "mutation",
|
|
30001
|
+
auth: "admin"
|
|
30002
|
+
}),
|
|
30003
|
+
/** The run's progress and every finished cell; null when this runner does not know `runId`. */
|
|
30004
|
+
getNodeBenchStatus: method(z.object({ runId: z.string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }),
|
|
30005
|
+
/** Stop the run; what it finished is kept. */
|
|
30006
|
+
abortNodeBench: method(z.object({ runId: z.string() }), z.object({ aborted: z.boolean() }), {
|
|
30007
|
+
kind: "mutation",
|
|
30008
|
+
auth: "admin"
|
|
30009
|
+
})
|
|
28090
30010
|
}
|
|
28091
30011
|
};
|
|
28092
30012
|
var CameraPipelineConfigSchema = z.object({
|
|
@@ -29044,6 +30964,51 @@ var pipelineOrchestratorCapability = {
|
|
|
29044
30964
|
kind: "mutation",
|
|
29045
30965
|
auth: "admin"
|
|
29046
30966
|
}),
|
|
30967
|
+
/**
|
|
30968
|
+
* Node benchmark — what a run of this plan would do, without doing it:
|
|
30969
|
+
* the cameras that leave the node, those that cannot (the node is their
|
|
30970
|
+
* only frame source; they stay and flag the run), the estimated duration
|
|
30971
|
+
* and every reason it may not start. The confirmation shows this.
|
|
30972
|
+
*/
|
|
30973
|
+
getNodeBenchmarkPreflight: method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }),
|
|
30974
|
+
/**
|
|
30975
|
+
* Node benchmark — start ONE run (cluster-wide lock). The orchestrator
|
|
30976
|
+
* persists a restore manifest, enters benchmark mode for the node (out of
|
|
30977
|
+
* placement, its camera pins ignored, nothing rewritten), drains it, drives
|
|
30978
|
+
* the node's own runner, then restores — always, including after an
|
|
30979
|
+
* abort, a lost node or a hub restart. Answers at once; poll
|
|
30980
|
+
* `getNodeBenchmarkStatus`. Refused runs carry the preflight.
|
|
30981
|
+
*/
|
|
30982
|
+
startNodeBenchmark: method(NodeBenchmarkPlanSchema, z.discriminatedUnion("kind", [z.object({
|
|
30983
|
+
kind: z.literal("started"),
|
|
30984
|
+
runId: z.string()
|
|
30985
|
+
}), z.object({
|
|
30986
|
+
kind: z.literal("refused"),
|
|
30987
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
30988
|
+
})]), {
|
|
30989
|
+
kind: "mutation",
|
|
30990
|
+
auth: "admin"
|
|
30991
|
+
}),
|
|
30992
|
+
/** Node benchmark — the active run (or the last one) and the node in benchmark mode. */
|
|
30993
|
+
getNodeBenchmarkStatus: method(z.void(), NodeBenchmarkStatusSchema, { auth: "admin" }),
|
|
30994
|
+
/** Node benchmark — stop the active run; the cluster is restored as it was. */
|
|
30995
|
+
abortNodeBenchmark: method(z.object({ runId: z.string() }), z.object({ aborted: z.boolean() }), {
|
|
30996
|
+
kind: "mutation",
|
|
30997
|
+
auth: "admin"
|
|
30998
|
+
}),
|
|
30999
|
+
/**
|
|
31000
|
+
* Node benchmark — root detector candidates per device (what Auto tune
|
|
31001
|
+
* would pick first, then the family) and the detail steps the node's
|
|
31002
|
+
* catalog offers, for the plan editor.
|
|
31003
|
+
*/
|
|
31004
|
+
getNodeBenchmarkCandidates: method(z.object({ nodeId: z.string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }),
|
|
31005
|
+
/** Node benchmark — stored results, newest first, each with its standing today. */
|
|
31006
|
+
listNodeBenchmarkResults: method(ListNodeBenchmarkResultsInputSchema, z.array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }),
|
|
31007
|
+
/** Node benchmark — delete one result; Auto tune and the shares stop reading it. */
|
|
31008
|
+
deleteNodeBenchmarkResult: method(z.object({ id: z.string() }), z.object({ deleted: z.boolean() }), {
|
|
31009
|
+
kind: "mutation",
|
|
31010
|
+
auth: "admin"
|
|
31011
|
+
}),
|
|
29047
31012
|
/** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
|
|
29048
31013
|
getCameraSettings: method(z.object({ deviceId: z.number() }), CameraPipelineSettingsSchema.nullable()),
|
|
29049
31014
|
/** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
|
|
@@ -30001,7 +31966,19 @@ var SsoBridgeClaimsSchema = z.object({
|
|
|
30001
31966
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
30002
31967
|
* operator already consented to.
|
|
30003
31968
|
*/
|
|
30004
|
-
refreshTtl: z.union([z.number().int().positive(), z.literal("never")]).optional()
|
|
31969
|
+
refreshTtl: z.union([z.number().int().positive(), z.literal("never")]).optional(),
|
|
31970
|
+
/**
|
|
31971
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
31972
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
31973
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
31974
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
31975
|
+
*/
|
|
31976
|
+
linkIntent: z.string().optional(),
|
|
31977
|
+
/**
|
|
31978
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
31979
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
31980
|
+
*/
|
|
31981
|
+
issuer: z.string().optional()
|
|
30005
31982
|
});
|
|
30006
31983
|
var ssoBridgeCapability = {
|
|
30007
31984
|
name: "sso-bridge",
|
|
@@ -36591,6 +38568,9 @@ var CreateIntegrationInputSchema = z.object({
|
|
|
36591
38568
|
enabled: z.boolean().optional(),
|
|
36592
38569
|
info: z.record(z.string(), z.unknown()).optional(),
|
|
36593
38570
|
settings: z.record(z.string(), z.unknown()).optional(),
|
|
38571
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
38572
|
+
* the keychain, not the table (D787). */
|
|
38573
|
+
secretKeys: z.array(z.string()).optional(),
|
|
36594
38574
|
skipRestart: z.boolean().optional()
|
|
36595
38575
|
});
|
|
36596
38576
|
var UpdateIntegrationInputSchema = z.object({
|
|
@@ -36626,7 +38606,9 @@ var integrationsCapability = {
|
|
|
36626
38606
|
getSettings: method(z.object({ id: z.string() }), z.record(z.string(), z.unknown()), { auth: "admin" }),
|
|
36627
38607
|
setSettings: method(z.object({
|
|
36628
38608
|
id: z.string(),
|
|
36629
|
-
settings: z.record(z.string(), z.unknown())
|
|
38609
|
+
settings: z.record(z.string(), z.unknown()),
|
|
38610
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
38611
|
+
secretKeys: z.array(z.string()).optional()
|
|
36630
38612
|
}), z.object({ success: z.boolean() }), {
|
|
36631
38613
|
kind: "mutation",
|
|
36632
38614
|
auth: "admin"
|
|
@@ -44870,6 +46852,22 @@ var TotpStatusSchema = z.object({
|
|
|
44870
46852
|
* delegation, structural caller-scope subset check goes inside the
|
|
44871
46853
|
* provider.
|
|
44872
46854
|
*/
|
|
46855
|
+
var ExternalIdentitySchema = z.object({
|
|
46856
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
46857
|
+
provider: z.string(),
|
|
46858
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
46859
|
+
subject: z.string(),
|
|
46860
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
46861
|
+
issuer: z.string(),
|
|
46862
|
+
userId: z.string(),
|
|
46863
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
46864
|
+
label: z.string().optional(),
|
|
46865
|
+
linkedAt: z.number()
|
|
46866
|
+
});
|
|
46867
|
+
var ExternalIdentityKeySchema = z.object({
|
|
46868
|
+
provider: z.string().min(1),
|
|
46869
|
+
subject: z.string().min(1)
|
|
46870
|
+
});
|
|
44873
46871
|
var userManagementCapability = {
|
|
44874
46872
|
name: "user-management",
|
|
44875
46873
|
scope: "system",
|
|
@@ -45012,6 +47010,32 @@ var userManagementCapability = {
|
|
|
45012
47010
|
username: z.string(),
|
|
45013
47011
|
scopes: z.array(TokenScopeSchema)
|
|
45014
47012
|
}).nullable(), { access: "view" }),
|
|
47013
|
+
listExternalIdentities: method(z.object({ userId: z.string() }), z.array(ExternalIdentitySchema), { auth: "admin" }),
|
|
47014
|
+
/** The user an identity is linked to, or `null`. */
|
|
47015
|
+
findUserByExternalIdentity: method(ExternalIdentityKeySchema, z.object({
|
|
47016
|
+
userId: z.string(),
|
|
47017
|
+
issuer: z.string()
|
|
47018
|
+
}).nullable(), { auth: "admin" }),
|
|
47019
|
+
/**
|
|
47020
|
+
* Link `(provider, subject)` to `userId`. Idempotent for the same user;
|
|
47021
|
+
* REFUSES (throws) an identity already linked to another user, and a
|
|
47022
|
+
* user that does not exist.
|
|
47023
|
+
*/
|
|
47024
|
+
linkExternalIdentity: method(ExternalIdentityKeySchema.extend({
|
|
47025
|
+
userId: z.string(),
|
|
47026
|
+
issuer: z.string().min(1),
|
|
47027
|
+
label: z.string().optional()
|
|
47028
|
+
}), z.object({ success: z.literal(true) }), {
|
|
47029
|
+
kind: "mutation",
|
|
47030
|
+
auth: "admin",
|
|
47031
|
+
access: "create"
|
|
47032
|
+
}),
|
|
47033
|
+
/** Remove one link of `userId`. `success: false` when it was not linked to that user. */
|
|
47034
|
+
unlinkExternalIdentity: method(ExternalIdentityKeySchema.extend({ userId: z.string() }), z.object({ success: z.boolean() }), {
|
|
47035
|
+
kind: "mutation",
|
|
47036
|
+
auth: "admin",
|
|
47037
|
+
access: "delete"
|
|
47038
|
+
}),
|
|
45015
47039
|
listOauthSessions: method(z.void(), z.array(OauthSessionSummarySchema), { auth: "admin" }),
|
|
45016
47040
|
revokeOauthSession: method(z.object({ id: z.string() }), z.object({ success: z.boolean() }), {
|
|
45017
47041
|
kind: "mutation",
|
|
@@ -46737,7 +48761,8 @@ var BaseDevice = class {
|
|
|
46737
48761
|
this.role = options.role;
|
|
46738
48762
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
46739
48763
|
const seedData = ctx.persistedConfig ?? {};
|
|
46740
|
-
|
|
48764
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
48765
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
46741
48766
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
46742
48767
|
tags: {
|
|
46743
48768
|
deviceId: ctx.id,
|
|
@@ -50209,6 +52234,90 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
50209
52234
|
addonId: null,
|
|
50210
52235
|
access: "create"
|
|
50211
52236
|
},
|
|
52237
|
+
"keychain.delete": {
|
|
52238
|
+
capName: "keychain",
|
|
52239
|
+
capScope: "system",
|
|
52240
|
+
addonId: null,
|
|
52241
|
+
access: "delete"
|
|
52242
|
+
},
|
|
52243
|
+
"keychain.getState": {
|
|
52244
|
+
capName: "keychain",
|
|
52245
|
+
capScope: "system",
|
|
52246
|
+
addonId: null,
|
|
52247
|
+
access: "view"
|
|
52248
|
+
},
|
|
52249
|
+
"keychain.listMeta": {
|
|
52250
|
+
capName: "keychain",
|
|
52251
|
+
capScope: "system",
|
|
52252
|
+
addonId: null,
|
|
52253
|
+
access: "view"
|
|
52254
|
+
},
|
|
52255
|
+
"keychain.put": {
|
|
52256
|
+
capName: "keychain",
|
|
52257
|
+
capScope: "system",
|
|
52258
|
+
addonId: null,
|
|
52259
|
+
access: "create"
|
|
52260
|
+
},
|
|
52261
|
+
"keychain.resolve": {
|
|
52262
|
+
capName: "keychain",
|
|
52263
|
+
capScope: "system",
|
|
52264
|
+
addonId: null,
|
|
52265
|
+
access: "view"
|
|
52266
|
+
},
|
|
52267
|
+
"keychainAdmin.deleteOrphans": {
|
|
52268
|
+
capName: "keychain-admin",
|
|
52269
|
+
capScope: "system",
|
|
52270
|
+
addonId: null,
|
|
52271
|
+
access: "delete"
|
|
52272
|
+
},
|
|
52273
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
52274
|
+
capName: "keychain-admin",
|
|
52275
|
+
capScope: "system",
|
|
52276
|
+
addonId: null,
|
|
52277
|
+
access: "create"
|
|
52278
|
+
},
|
|
52279
|
+
"keychainAdmin.listAudit": {
|
|
52280
|
+
capName: "keychain-admin",
|
|
52281
|
+
capScope: "system",
|
|
52282
|
+
addonId: null,
|
|
52283
|
+
access: "view"
|
|
52284
|
+
},
|
|
52285
|
+
"keychainAdmin.listSecrets": {
|
|
52286
|
+
capName: "keychain-admin",
|
|
52287
|
+
capScope: "system",
|
|
52288
|
+
addonId: null,
|
|
52289
|
+
access: "view"
|
|
52290
|
+
},
|
|
52291
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
52292
|
+
capName: "keychain-admin",
|
|
52293
|
+
capScope: "system",
|
|
52294
|
+
addonId: null,
|
|
52295
|
+
access: "delete"
|
|
52296
|
+
},
|
|
52297
|
+
"keychainAdmin.resetKeychain": {
|
|
52298
|
+
capName: "keychain-admin",
|
|
52299
|
+
capScope: "system",
|
|
52300
|
+
addonId: null,
|
|
52301
|
+
access: "delete"
|
|
52302
|
+
},
|
|
52303
|
+
"keychainAdmin.reveal": {
|
|
52304
|
+
capName: "keychain-admin",
|
|
52305
|
+
capScope: "system",
|
|
52306
|
+
addonId: null,
|
|
52307
|
+
access: "create"
|
|
52308
|
+
},
|
|
52309
|
+
"keychainAdmin.rotateMasterKey": {
|
|
52310
|
+
capName: "keychain-admin",
|
|
52311
|
+
capScope: "system",
|
|
52312
|
+
addonId: null,
|
|
52313
|
+
access: "create"
|
|
52314
|
+
},
|
|
52315
|
+
"keychainAdmin.status": {
|
|
52316
|
+
capName: "keychain-admin",
|
|
52317
|
+
capScope: "system",
|
|
52318
|
+
addonId: null,
|
|
52319
|
+
access: "view"
|
|
52320
|
+
},
|
|
50212
52321
|
"lawnMowerControl.dock": {
|
|
50213
52322
|
capName: "lawn-mower-control",
|
|
50214
52323
|
capScope: "device",
|
|
@@ -51583,6 +53692,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51583
53692
|
addonId: null,
|
|
51584
53693
|
access: "create"
|
|
51585
53694
|
},
|
|
53695
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
53696
|
+
capName: "pipeline-analytics",
|
|
53697
|
+
capScope: "device",
|
|
53698
|
+
addonId: null,
|
|
53699
|
+
access: "create"
|
|
53700
|
+
},
|
|
53701
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
53702
|
+
capName: "pipeline-analytics",
|
|
53703
|
+
capScope: "device",
|
|
53704
|
+
addonId: null,
|
|
53705
|
+
access: "create"
|
|
53706
|
+
},
|
|
51586
53707
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
51587
53708
|
capName: "pipeline-analytics",
|
|
51588
53709
|
capScope: "device",
|
|
@@ -51631,12 +53752,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51631
53752
|
addonId: null,
|
|
51632
53753
|
access: "view"
|
|
51633
53754
|
},
|
|
53755
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
53756
|
+
capName: "pipeline-analytics",
|
|
53757
|
+
capScope: "device",
|
|
53758
|
+
addonId: null,
|
|
53759
|
+
access: "create"
|
|
53760
|
+
},
|
|
51634
53761
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
51635
53762
|
capName: "pipeline-analytics",
|
|
51636
53763
|
capScope: "device",
|
|
51637
53764
|
addonId: null,
|
|
51638
53765
|
access: "delete"
|
|
51639
53766
|
},
|
|
53767
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
53768
|
+
capName: "pipeline-analytics",
|
|
53769
|
+
capScope: "device",
|
|
53770
|
+
addonId: null,
|
|
53771
|
+
access: "delete"
|
|
53772
|
+
},
|
|
51640
53773
|
"pipelineAnalytics.deleteTracks": {
|
|
51641
53774
|
capName: "pipeline-analytics",
|
|
51642
53775
|
capScope: "device",
|
|
@@ -51841,6 +53974,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51841
53974
|
addonId: null,
|
|
51842
53975
|
access: "view"
|
|
51843
53976
|
},
|
|
53977
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
53978
|
+
capName: "pipeline-analytics",
|
|
53979
|
+
capScope: "device",
|
|
53980
|
+
addonId: null,
|
|
53981
|
+
access: "view"
|
|
53982
|
+
},
|
|
53983
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
53984
|
+
capName: "pipeline-analytics",
|
|
53985
|
+
capScope: "device",
|
|
53986
|
+
addonId: null,
|
|
53987
|
+
access: "view"
|
|
53988
|
+
},
|
|
53989
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
53990
|
+
capName: "pipeline-analytics",
|
|
53991
|
+
capScope: "device",
|
|
53992
|
+
addonId: null,
|
|
53993
|
+
access: "view"
|
|
53994
|
+
},
|
|
51844
53995
|
"pipelineAnalytics.listRetrainFrames": {
|
|
51845
53996
|
capName: "pipeline-analytics",
|
|
51846
53997
|
capScope: "device",
|
|
@@ -51889,6 +54040,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51889
54040
|
addonId: null,
|
|
51890
54041
|
access: "create"
|
|
51891
54042
|
},
|
|
54043
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
54044
|
+
capName: "pipeline-analytics",
|
|
54045
|
+
capScope: "device",
|
|
54046
|
+
addonId: null,
|
|
54047
|
+
access: "create"
|
|
54048
|
+
},
|
|
51892
54049
|
"pipelineAnalytics.pruneEvents": {
|
|
51893
54050
|
capName: "pipeline-analytics",
|
|
51894
54051
|
capScope: "device",
|
|
@@ -51943,6 +54100,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51943
54100
|
addonId: null,
|
|
51944
54101
|
access: "create"
|
|
51945
54102
|
},
|
|
54103
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
54104
|
+
capName: "pipeline-analytics",
|
|
54105
|
+
capScope: "device",
|
|
54106
|
+
addonId: null,
|
|
54107
|
+
access: "delete"
|
|
54108
|
+
},
|
|
54109
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
54110
|
+
capName: "pipeline-analytics",
|
|
54111
|
+
capScope: "device",
|
|
54112
|
+
addonId: null,
|
|
54113
|
+
access: "create"
|
|
54114
|
+
},
|
|
51946
54115
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
51947
54116
|
capName: "pipeline-analytics",
|
|
51948
54117
|
capScope: "device",
|
|
@@ -51973,6 +54142,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
51973
54142
|
addonId: null,
|
|
51974
54143
|
access: "create"
|
|
51975
54144
|
},
|
|
54145
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
54146
|
+
capName: "pipeline-analytics",
|
|
54147
|
+
capScope: "device",
|
|
54148
|
+
addonId: null,
|
|
54149
|
+
access: "create"
|
|
54150
|
+
},
|
|
51976
54151
|
"pipelineAnalytics.setTrackFlags": {
|
|
51977
54152
|
capName: "pipeline-analytics",
|
|
51978
54153
|
capScope: "device",
|
|
@@ -52009,6 +54184,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52009
54184
|
addonId: null,
|
|
52010
54185
|
access: "delete"
|
|
52011
54186
|
},
|
|
54187
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
54188
|
+
capName: "pipeline-analytics",
|
|
54189
|
+
capScope: "device",
|
|
54190
|
+
addonId: null,
|
|
54191
|
+
access: "create"
|
|
54192
|
+
},
|
|
52012
54193
|
"pipelineExecutor.cacheFrameInPool": {
|
|
52013
54194
|
capName: "pipeline-executor",
|
|
52014
54195
|
capScope: "system",
|
|
@@ -52219,6 +54400,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52219
54400
|
addonId: null,
|
|
52220
54401
|
access: "view"
|
|
52221
54402
|
},
|
|
54403
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
54404
|
+
capName: "pipeline-orchestrator",
|
|
54405
|
+
capScope: "system",
|
|
54406
|
+
addonId: null,
|
|
54407
|
+
access: "create"
|
|
54408
|
+
},
|
|
52222
54409
|
"pipelineOrchestrator.applyAutoTune": {
|
|
52223
54410
|
capName: "pipeline-orchestrator",
|
|
52224
54411
|
capScope: "system",
|
|
@@ -52243,6 +54430,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52243
54430
|
addonId: null,
|
|
52244
54431
|
access: "create"
|
|
52245
54432
|
},
|
|
54433
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
54434
|
+
capName: "pipeline-orchestrator",
|
|
54435
|
+
capScope: "system",
|
|
54436
|
+
addonId: null,
|
|
54437
|
+
access: "delete"
|
|
54438
|
+
},
|
|
52246
54439
|
"pipelineOrchestrator.getAgentLoad": {
|
|
52247
54440
|
capName: "pipeline-orchestrator",
|
|
52248
54441
|
capScope: "system",
|
|
@@ -52351,6 +54544,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52351
54544
|
addonId: null,
|
|
52352
54545
|
access: "view"
|
|
52353
54546
|
},
|
|
54547
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
54548
|
+
capName: "pipeline-orchestrator",
|
|
54549
|
+
capScope: "system",
|
|
54550
|
+
addonId: null,
|
|
54551
|
+
access: "view"
|
|
54552
|
+
},
|
|
54553
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
54554
|
+
capName: "pipeline-orchestrator",
|
|
54555
|
+
capScope: "system",
|
|
54556
|
+
addonId: null,
|
|
54557
|
+
access: "view"
|
|
54558
|
+
},
|
|
54559
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
54560
|
+
capName: "pipeline-orchestrator",
|
|
54561
|
+
capScope: "system",
|
|
54562
|
+
addonId: null,
|
|
54563
|
+
access: "view"
|
|
54564
|
+
},
|
|
52354
54565
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
52355
54566
|
capName: "pipeline-orchestrator",
|
|
52356
54567
|
capScope: "system",
|
|
@@ -52393,6 +54604,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52393
54604
|
addonId: null,
|
|
52394
54605
|
access: "view"
|
|
52395
54606
|
},
|
|
54607
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
54608
|
+
capName: "pipeline-orchestrator",
|
|
54609
|
+
capScope: "system",
|
|
54610
|
+
addonId: null,
|
|
54611
|
+
access: "view"
|
|
54612
|
+
},
|
|
52396
54613
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
52397
54614
|
capName: "pipeline-orchestrator",
|
|
52398
54615
|
capScope: "system",
|
|
@@ -52537,6 +54754,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52537
54754
|
addonId: null,
|
|
52538
54755
|
access: "create"
|
|
52539
54756
|
},
|
|
54757
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
54758
|
+
capName: "pipeline-orchestrator",
|
|
54759
|
+
capScope: "system",
|
|
54760
|
+
addonId: null,
|
|
54761
|
+
access: "create"
|
|
54762
|
+
},
|
|
52540
54763
|
"pipelineOrchestrator.suggestShares": {
|
|
52541
54764
|
capName: "pipeline-orchestrator",
|
|
52542
54765
|
capScope: "system",
|
|
@@ -52555,6 +54778,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52555
54778
|
addonId: null,
|
|
52556
54779
|
access: "create"
|
|
52557
54780
|
},
|
|
54781
|
+
"pipelineRunner.abortNodeBench": {
|
|
54782
|
+
capName: "pipeline-runner",
|
|
54783
|
+
capScope: "system",
|
|
54784
|
+
addonId: null,
|
|
54785
|
+
access: "create"
|
|
54786
|
+
},
|
|
52558
54787
|
"pipelineRunner.attachCamera": {
|
|
52559
54788
|
capName: "pipeline-runner",
|
|
52560
54789
|
capScope: "system",
|
|
@@ -52603,6 +54832,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52603
54832
|
addonId: null,
|
|
52604
54833
|
access: "view"
|
|
52605
54834
|
},
|
|
54835
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
54836
|
+
capName: "pipeline-runner",
|
|
54837
|
+
capScope: "system",
|
|
54838
|
+
addonId: null,
|
|
54839
|
+
access: "view"
|
|
54840
|
+
},
|
|
52606
54841
|
"pipelineRunner.getParkedTrackFrame": {
|
|
52607
54842
|
capName: "pipeline-runner",
|
|
52608
54843
|
capScope: "system",
|
|
@@ -52645,6 +54880,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52645
54880
|
addonId: null,
|
|
52646
54881
|
access: "create"
|
|
52647
54882
|
},
|
|
54883
|
+
"pipelineRunner.startNodeBench": {
|
|
54884
|
+
capName: "pipeline-runner",
|
|
54885
|
+
capScope: "system",
|
|
54886
|
+
addonId: null,
|
|
54887
|
+
access: "create"
|
|
54888
|
+
},
|
|
52648
54889
|
"plateGallery.assignPlate": {
|
|
52649
54890
|
capName: "plate-gallery",
|
|
52650
54891
|
capScope: "system",
|
|
@@ -54361,18 +56602,36 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
54361
56602
|
addonId: null,
|
|
54362
56603
|
access: "delete"
|
|
54363
56604
|
},
|
|
56605
|
+
"userManagement.findUserByExternalIdentity": {
|
|
56606
|
+
capName: "user-management",
|
|
56607
|
+
capScope: "system",
|
|
56608
|
+
addonId: null,
|
|
56609
|
+
access: "view"
|
|
56610
|
+
},
|
|
54364
56611
|
"userManagement.getTotpStatus": {
|
|
54365
56612
|
capName: "user-management",
|
|
54366
56613
|
capScope: "system",
|
|
54367
56614
|
addonId: null,
|
|
54368
56615
|
access: "view"
|
|
54369
56616
|
},
|
|
56617
|
+
"userManagement.linkExternalIdentity": {
|
|
56618
|
+
capName: "user-management",
|
|
56619
|
+
capScope: "system",
|
|
56620
|
+
addonId: null,
|
|
56621
|
+
access: "create"
|
|
56622
|
+
},
|
|
54370
56623
|
"userManagement.listApiKeys": {
|
|
54371
56624
|
capName: "user-management",
|
|
54372
56625
|
capScope: "system",
|
|
54373
56626
|
addonId: null,
|
|
54374
56627
|
access: "view"
|
|
54375
56628
|
},
|
|
56629
|
+
"userManagement.listExternalIdentities": {
|
|
56630
|
+
capName: "user-management",
|
|
56631
|
+
capScope: "system",
|
|
56632
|
+
addonId: null,
|
|
56633
|
+
access: "view"
|
|
56634
|
+
},
|
|
54376
56635
|
"userManagement.listOauthSessions": {
|
|
54377
56636
|
capName: "user-management",
|
|
54378
56637
|
capScope: "system",
|
|
@@ -54451,6 +56710,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
54451
56710
|
addonId: null,
|
|
54452
56711
|
access: "create"
|
|
54453
56712
|
},
|
|
56713
|
+
"userManagement.unlinkExternalIdentity": {
|
|
56714
|
+
capName: "user-management",
|
|
56715
|
+
capScope: "system",
|
|
56716
|
+
addonId: null,
|
|
56717
|
+
access: "delete"
|
|
56718
|
+
},
|
|
54454
56719
|
"userManagement.updateUser": {
|
|
54455
56720
|
capName: "user-management",
|
|
54456
56721
|
capScope: "system",
|
|
@@ -56379,6 +58644,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
56379
58644
|
imageSettingsCapability,
|
|
56380
58645
|
integrationsCapability,
|
|
56381
58646
|
intercomCapability,
|
|
58647
|
+
keychainCapability,
|
|
58648
|
+
keychainAdminCapability,
|
|
56382
58649
|
lawnMowerControlCapability,
|
|
56383
58650
|
llmCapability,
|
|
56384
58651
|
llmRuntimeCapability,
|
|
@@ -57805,6 +60072,11 @@ Object.freeze({
|
|
|
57805
60072
|
form: "single",
|
|
57806
60073
|
optional: false
|
|
57807
60074
|
}],
|
|
60075
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
60076
|
+
name: "deviceId",
|
|
60077
|
+
form: "single",
|
|
60078
|
+
optional: false
|
|
60079
|
+
}],
|
|
57808
60080
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
57809
60081
|
name: "deviceId",
|
|
57810
60082
|
form: "single",
|
|
@@ -57995,6 +60267,11 @@ Object.freeze({
|
|
|
57995
60267
|
form: "single",
|
|
57996
60268
|
optional: false
|
|
57997
60269
|
}],
|
|
60270
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
60271
|
+
name: "deviceId",
|
|
60272
|
+
form: "single",
|
|
60273
|
+
optional: false
|
|
60274
|
+
}],
|
|
57998
60275
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
57999
60276
|
name: "deviceId",
|
|
58000
60277
|
form: "single",
|
|
@@ -58045,6 +60322,11 @@ Object.freeze({
|
|
|
58045
60322
|
form: "single",
|
|
58046
60323
|
optional: false
|
|
58047
60324
|
}],
|
|
60325
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
60326
|
+
name: "deviceId",
|
|
60327
|
+
form: "single",
|
|
60328
|
+
optional: false
|
|
60329
|
+
}],
|
|
58048
60330
|
"pipelineAnalytics.setTrackFlags": [{
|
|
58049
60331
|
name: "deviceId",
|
|
58050
60332
|
form: "single",
|
|
@@ -60428,6 +62710,70 @@ function bareAddonId(id) {
|
|
|
60428
62710
|
function hfModelUrl(repo, path) {
|
|
60429
62711
|
return `https://huggingface.co/${repo}/resolve/main/${path}`;
|
|
60430
62712
|
}
|
|
62713
|
+
/**
|
|
62714
|
+
* Names that, when used as URL query parameters, almost certainly carry
|
|
62715
|
+
* a secret. Matching is case-insensitive and anchored to the full param
|
|
62716
|
+
* name to avoid false positives like `user_id` (an entity reference, not
|
|
62717
|
+
* a credential) or `topic=password-reset` (a value happens to contain
|
|
62718
|
+
* the substring "password" but the param name is unrelated).
|
|
62719
|
+
*
|
|
62720
|
+
* Add new patterns here as we encounter cameras/APIs that leak through
|
|
62721
|
+
* the existing list.
|
|
62722
|
+
*/
|
|
62723
|
+
var CREDENTIAL_PARAM_PATTERNS = [
|
|
62724
|
+
/^user$/i,
|
|
62725
|
+
/^usr$/i,
|
|
62726
|
+
/^username$/i,
|
|
62727
|
+
/^password$/i,
|
|
62728
|
+
/^pwd$/i,
|
|
62729
|
+
/^pass$/i,
|
|
62730
|
+
/^passwd$/i,
|
|
62731
|
+
/^secret$/i,
|
|
62732
|
+
/^token$/i,
|
|
62733
|
+
/^auth$/i,
|
|
62734
|
+
/^auth[_-]?token$/i,
|
|
62735
|
+
/^bearer$/i,
|
|
62736
|
+
/^api[_-]?key$/i,
|
|
62737
|
+
/^access[_-]?token$/i,
|
|
62738
|
+
/^refresh[_-]?token$/i
|
|
62739
|
+
];
|
|
62740
|
+
function isCredentialParam(name) {
|
|
62741
|
+
return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
|
|
62742
|
+
}
|
|
62743
|
+
/**
|
|
62744
|
+
* Redact secrets we may surface in logs or telemetry:
|
|
62745
|
+
* 1. `userinfo` (`user:password@host`) — the classic RTSP shape.
|
|
62746
|
+
* 2. Query-string credential params (`?user=...&password=...`) — the
|
|
62747
|
+
* Reolink RTMP shape and several HTTP-pushed-stream APIs.
|
|
62748
|
+
*
|
|
62749
|
+
* Returns the original string verbatim when the input is not a parseable
|
|
62750
|
+
* URL — a log helper must never throw. Param values are replaced with
|
|
62751
|
+
* `***` so an operator reading logs still sees WHICH credential was
|
|
62752
|
+
* present (useful for debugging "wrong password" issues) without
|
|
62753
|
+
* exposing the value.
|
|
62754
|
+
*
|
|
62755
|
+
* The credential-name match is case-insensitive but anchored to the
|
|
62756
|
+
* whole param name; values like `user_id=42` or `topic=password-reset`
|
|
62757
|
+
* are NOT masked (those are entity references, not credentials).
|
|
62758
|
+
*/
|
|
62759
|
+
function maskUrlCredentials(rawUrl) {
|
|
62760
|
+
try {
|
|
62761
|
+
const u = new URL(rawUrl);
|
|
62762
|
+
let touched = false;
|
|
62763
|
+
if (u.username || u.password) {
|
|
62764
|
+
u.username = "";
|
|
62765
|
+
u.password = "";
|
|
62766
|
+
touched = true;
|
|
62767
|
+
}
|
|
62768
|
+
for (const key of Array.from(u.searchParams.keys())) if (isCredentialParam(key)) {
|
|
62769
|
+
u.searchParams.set(key, "***");
|
|
62770
|
+
touched = true;
|
|
62771
|
+
}
|
|
62772
|
+
return touched ? u.toString() : rawUrl;
|
|
62773
|
+
} catch {
|
|
62774
|
+
return rawUrl;
|
|
62775
|
+
}
|
|
62776
|
+
}
|
|
60431
62777
|
var MB = 1024 * 1024;
|
|
60432
62778
|
1024 * MB, 3072 * MB;
|
|
60433
62779
|
/**
|
|
@@ -60562,4 +62908,4 @@ function enumerateInferenceDevices(hw) {
|
|
|
60562
62908
|
return out;
|
|
60563
62909
|
}
|
|
60564
62910
|
//#endregion
|
|
60565
|
-
export {
|
|
62911
|
+
export { buildStreamParamsConfigSchema as $, compositionItemFieldPath as $n, looseSchema as $t, MINUTES_PER_DAY as A, scoreRuntimes as An, isSecretMarker as Ar, extractNestedAddonId as At, StorageLocationModeSchema as B, userManagementCapability as Bn, scrubKnownSecrets as Br, isLocationEnabled as Bt, FieldClaimModeSchema as C, resolveHubAddressRoles as Cn, emitDownForOwnedCaps as Cr, enumerateInferenceDevices as Ct, LegacyStorageLocationDefaultSchema as D, runtimeStatePolicyFor as Dn, hydrateSchema as Dr, evictionPolicyOfLocation as Dt, LOG_LEVEL_RANK as E, resolveNotificationTapAddress as En, formatSecretScope as Er, evaluateCompositionField as Et, RecordingStatusSchema as F, storageMigrationCapability as Fn, parseSecretRef as Fr, hfModelUrl as Ft, addonSettingsCapability as G, vectorStoreCapability as Gn, EventCategory as Gr, keychainCapability as Gt, StorageMigrationJobSchema as H, validateCustomAddress as Hn, sleep as Hr, isVoidInput as Ht, STORAGE_ACCESS_FALLBACK as I, storageOccupancyCapability as In, readinessKey as Ir, isAppLinkBase as It, authProviderCapability as J, buildFfmpegArgs as Jn, lifecycleJobSchema as Jt, addonWidgetsCapability as K, withLocationMode as Kn, legacyAutoLinkIds as Kt, STREAM_PROFILE_META as L, storageProviderCapability as Ln, resolveCapMount as Lr, isArrayOutputSchema as Lt, MOTION_CLOSE_AFTER_MS as M, siteZoneKey as Mn, normalizeSecretOwner as Mr, foldSnapshotByFunction as Mt, RECORDING_SOURCE_CAMSTACK_ADDON as N, snapshotCapability as Nn, parseJsonObject as Nr, formatMinutes as Nt, LocationIconIdSchema as O, scopesAllowAddon as On, isDeviceConfigCap as Or, expandContainer as Ot, RUNTIME_DEFAULTS as P, storageCapability as Pn, parseJsonUnknown as Pr, gbToBytes as Pt, buildCapabilityLookup as Q, compositionFeatureEnabled as Qn, logLevelAtMost as Qt, ScopedTokenSchema as R, streamCatalogCapability as Rn, resolveSecretMarkers as Rr, isCollectionArrayMethod as Rt, FIRST_LEVEL_MACRO_CLASSES as S, resolveCoreBlockFiles as Sn, createEvent as Sr, deviceStatusCapability as St, HF_REPO as T, resolveMethodAuth as Tn, expandCapMethods as Tr, enumerateSchemaFields as Tt, UserRecordSchema as U, vectorDimFromBase64 as Un, toNodeId as Ur, kebabToCamel as Ut, StorageLocationTypeSchema as V, validateComposition as Vn, secretTreeFromPaths as Vr, isObjectInput as Vt, addonPagesCapability as W, vectorIndexDimConflictError as Wn, transformSecretWrite as Wr, keychainAdminCapability as Wt, bareAddonId as X, composedDeviceRef as Xn, locationIconKey as Xt, backupCapability as Y, cloneStatefulExpressionMemory as Yn, localNetworkCapability as Yt, batteryCapability as Z, composedDeviceStableId as Zn, logDestinationCapability as Zt, DATABASE_SNAPSHOT_TIMEOUT_MS as _, reducePoints as _n, asJsonObject as _r, deriveBatteryPresence as _t, BatteryStatusSchema as a, modeMayWrite as an, DeviceFeature as ar, compositionSourceRefs as at, DeclaredDevices as b, resolveBucketMs as bn, collectSecretConfigKeys as br, deviceManagerCapability as bt, CAP_NAMES_WITH_STATUS as c, normalizeUnit as cn, errMsg as cr, coreBlockIdFromAddonId as ct, CORE_BLOCKS_ADDON_ID as d, parseStreamParamsFormPatch as dn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as dr, createDeviceExtensionProvider as dt, maskUrlCredentials as en, compositionSliceKey as er, calendarsCapability as et, CORE_BLOCK_ADDON_PREFIX as f, pickAppLinkHub as fn, DEVICE_STATUS_METHOD as fr, dataStoreProviderCapability as ft, DATABASE_SNAPSHOT_SUFFIX as g, ptzAutotrackCapability as gn, WELL_KNOWN_TAB_MAP as gr, defineExtensionSlotProvider as gt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as h, procedureAuthKey as hn, ReadinessTimeoutError as hr, decodeVectorBase64 as ht, BaseDevice as i, metricsProviderCapability as in, toExpressionValue as ir, compositionFieldKey as it, MODEL_FORMATS as j, settingsStoreCapability as jn, nodePin as jr, filesystemBrowseCapability as jt, METHOD_ACCESS_MAP as k, scopesAllowDeviceCap as kn, isEvent as kr, expressionContainsBuiltinCall as kt, COMPOSED_ITEM_FIXED_FIELDS as l, objectInputDeclaresAddonId as ln, BaseAddon as lr, coreBlockSourceKind as lt, CoreBlockSchema as m, platformProbeCapability as mn, ReadinessRegistry as mr, declarationOwnerNodeId as mt, AlertSchema as n, mayWriteToLocation as nn, createStatefulExpressionMemory as nr, checkRoleAddress as nt, CAMERA_SWITCH_ORDER as o, motionCapability as on, DeviceRole as or, coreBlockAddonId as ot, CalendarPreferencesSchema as p, planComposition as pn, REDACTED_SECRET as pr, databaseSnapshotCapability as pt, alertsCapability as q, COMPOSER_ADDON_ID as qn, legacyModeOf as qt, ApiKeyRecordSchema as r, memoizePinnedFfmpeg as rn, disarmRoseMemory as rr, composerCapability as rt, CAMSTACK_APP_LINK_ORIGIN as s, normalizeCoreBlockWrite as sn, DeviceType as sr, coreBlockComposition as st, ALL_CAPABILITY_DEFINITIONS as t, mayReadLocation as tn, compositionSourceKey as tr, cameraGridLayoutCapability as tt, COMPOSER_RUNNER_ID as u, objectInputDeclaresRequiredDeviceId as un, DATAPLANE_SECRET_HEADER as ur, coreBlocksCapability as ut, DAY_NAMES as v, replacedFieldKeys as vn, asNumber as vr, describeComposableCaps as vt, FieldClaimSchema as w, resolveLocationMode as wn, emitReadiness as wr, enumerateItemArrayFields as wt, DeviceStatusSchema as x, resolveCoreBlockEntry as xn, collectZodSecretPaths as xr, deviceStateCapability as xt, DERIVED_CAMERA_SILENCED_CAP_NAMES as y, resolveAppConnections as yn, asString$1 as yr, deviceExtensionCapability as yt, StorageCleanupJobSchema as z, streamQualityLabel as zn, scopeKey as zr, isDefaultAppConnectionEndpoint as zt };
|